From a51ecb2b8f50c1c7e389cab45155841592a5b3be Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 23 Sep 2024 18:39:07 +0100 Subject: [PATCH 1/2] Fix `Tabs` signatures --- .../components/src/components/hds/tabs/panel.ts | 14 +++++++------- packages/components/src/components/hds/tabs/tab.ts | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/components/src/components/hds/tabs/panel.ts b/packages/components/src/components/hds/tabs/panel.ts index d316278ef6..b0fa93ab76 100644 --- a/packages/components/src/components/hds/tabs/panel.ts +++ b/packages/components/src/components/hds/tabs/panel.ts @@ -11,16 +11,16 @@ import type { HdsTabsPanelIds, HdsTabsTabIds } from './types'; export interface HdsTabsPanelSignature { Args: { - tabIds: HdsTabsTabIds; - panelIds: HdsTabsPanelIds; - selectedTabIndex: HdsTabsTabSignature['Args']['selectedTabIndex']; - didInsertNode: (element: HTMLElement, elementId: string) => void; - willDestroyNode: (element: HTMLElement) => void; + tabIds?: HdsTabsTabIds; + panelIds?: HdsTabsPanelIds; + selectedTabIndex?: HdsTabsTabSignature['Args']['selectedTabIndex']; + didInsertNode?: (element: HTMLElement, elementId: string) => void; + willDestroyNode?: (element: HTMLElement) => void; }; Blocks: { default: [ { - isVisible: boolean; + isVisible?: boolean; }, ]; }; @@ -56,7 +56,7 @@ export default class HdsTabsPanel extends Component { */ get coupledTabId(): string | undefined { return this.nodeIndex !== undefined - ? this.args.tabIds[this.nodeIndex] + ? this.args.tabIds?.[this.nodeIndex] : undefined; } diff --git a/packages/components/src/components/hds/tabs/tab.ts b/packages/components/src/components/hds/tabs/tab.ts index 3a0d6ab7d2..7ab197076c 100644 --- a/packages/components/src/components/hds/tabs/tab.ts +++ b/packages/components/src/components/hds/tabs/tab.ts @@ -11,16 +11,16 @@ import type { HdsTabsTabIds } from './types'; export interface HdsTabsTabSignature { Args: { - tabIds: HdsTabsTabIds; - selectedTabIndex: number; + tabIds?: HdsTabsTabIds; + selectedTabIndex?: number; icon?: IconName; count?: string; isSelected?: boolean; - didInsertNode: (element: HTMLButtonElement, isSelected?: boolean) => void; - didUpdateNode: (nodeIndex: number, isSelected?: boolean) => void; - willDestroyNode: (element: HTMLButtonElement) => void; - onClick: (event: MouseEvent, tabIndex: number) => void; - onKeyUp: (nodeIndex: number, event: KeyboardEvent) => void; + didInsertNode?: (element: HTMLButtonElement, isSelected?: boolean) => void; + didUpdateNode?: (nodeIndex: number, isSelected?: boolean) => void; + willDestroyNode?: (element: HTMLButtonElement) => void; + onClick?: (event: MouseEvent, tabIndex: number) => void; + onKeyUp?: (nodeIndex: number, event: KeyboardEvent) => void; }; Blocks: { default: []; From 41f879da388eba27f183639669441b28362fc8d8 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 24 Sep 2024 09:38:56 +0100 Subject: [PATCH 2/2] Add changelog entry --- .changeset/sharp-taxis-juggle.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sharp-taxis-juggle.md diff --git a/.changeset/sharp-taxis-juggle.md b/.changeset/sharp-taxis-juggle.md new file mode 100644 index 0000000000..50d4944f56 --- /dev/null +++ b/.changeset/sharp-taxis-juggle.md @@ -0,0 +1,5 @@ +--- +"@hashicorp/design-system-components": patch +--- + +`Tabs` - fixed signatures for subcomponents