From dfe79a6a92af76df727ff36a4c181e89b1456d0d Mon Sep 17 00:00:00 2001 From: gitstart Date: Thu, 17 Nov 2022 16:25:44 +0000 Subject: [PATCH] exclude disabled controls while counting controls for panel title --- code/addons/controls/src/manager.tsx | 4 +++- code/addons/controls/template/stories/disable.stories.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/code/addons/controls/src/manager.tsx b/code/addons/controls/src/manager.tsx index f76dfaf83e9a..38a3b31314f5 100644 --- a/code/addons/controls/src/manager.tsx +++ b/code/addons/controls/src/manager.tsx @@ -9,7 +9,9 @@ addons.register(ADDON_ID, (api: API) => { addons.addPanel(ADDON_ID, { title() { const rows = useArgTypes(); - const controlsCount = Object.values(rows).filter((argType) => argType?.control).length; + const controlsCount = Object.values(rows).filter( + (argType) => argType?.control && !argType?.table?.disable + ).length; const suffix = controlsCount === 0 ? '' : ` (${controlsCount})`; return `Controls${suffix}`; }, diff --git a/code/addons/controls/template/stories/disable.stories.ts b/code/addons/controls/template/stories/disable.stories.ts index 4c597178fb67..f95160a034c9 100644 --- a/code/addons/controls/template/stories/disable.stories.ts +++ b/code/addons/controls/template/stories/disable.stories.ts @@ -18,5 +18,7 @@ export const DisableTable = { export const DisableControl = { args: { a: 'a', b: 'b' }, - b: { control: { disable: true } }, + argTypes: { + b: { control: { disable: true } }, + }, };