Skip to content

Commit

Permalink
Merge pull request #2448 from hashicorp/alex-ju/fix-tabs-signature
Browse files Browse the repository at this point in the history
Fix `Tabs` signatures
  • Loading branch information
alex-ju authored Sep 24, 2024
2 parents 577ff39 + 41f879d commit 82a86eb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-taxis-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hashicorp/design-system-components": patch
---

`Tabs` - fixed signatures for subcomponents
14 changes: 7 additions & 7 deletions packages/components/src/components/hds/tabs/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
];
};
Expand Down Expand Up @@ -56,7 +56,7 @@ export default class HdsTabsPanel extends Component<HdsTabsPanelSignature> {
*/
get coupledTabId(): string | undefined {
return this.nodeIndex !== undefined
? this.args.tabIds[this.nodeIndex]
? this.args.tabIds?.[this.nodeIndex]
: undefined;
}

Expand Down
14 changes: 7 additions & 7 deletions packages/components/src/components/hds/tabs/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [];
Expand Down

0 comments on commit 82a86eb

Please sign in to comment.