UNPKG

@hashicorp/design-system-components

Version:
58 lines (57 loc) 2.32 kB
/** * Copyright IBM Corp. 2021, 2025 * SPDX-License-Identifier: MPL-2.0 */ import Component from '@glimmer/component'; import type { WithBoundArgs } from '@glint/template'; import type Owner from '@ember/owner'; import HdsTabsTab from './tab'; import HdsTabsPanel from './panel'; import type { HdsTabsTabSignature } from './tab'; import type { HdsTabsSizes } from './types.ts'; export declare const DEFAULT_SIZE: HdsTabsSizes; export declare const SIZES: HdsTabsSizes[]; export interface HdsTabsSignature { Args: { size?: HdsTabsSizes; onClickTab?: (event: MouseEvent, tabIndex: number) => void; selectedTabIndex?: HdsTabsTabSignature['Args']['selectedTabIndex']; isParentVisible?: boolean; }; Blocks: { default: [ { Tab?: WithBoundArgs<typeof HdsTabsTab, 'selectedTabIndex' | 'tabIds' | 'panelIds' | 'onClick' | 'onKeyUp' | 'didInsertNode' | 'didUpdateNode' | 'willDestroyNode'>; Panel?: WithBoundArgs<typeof HdsTabsPanel, 'selectedTabIndex' | 'tabIds' | 'panelIds' | 'didInsertNode' | 'willDestroyNode'>; } ]; }; Element: HTMLDivElement; } export default class HdsTabs extends Component<HdsTabsSignature> { private _tabNodes; private _tabIds; private _panelNodes; private _panelIds; private _selectedTabIndex; private _selectedTabId?; private _isControlled; get size(): HdsTabsSizes; constructor(owner: Owner, args: HdsTabsSignature['Args']); get selectedTabIndex(): number; set selectedTabIndex(value: number); get classNames(): string; didInsert: () => void; didUpdateSelectedTabIndex: () => void; didUpdateSelectedTabId: () => void; didUpdateParentVisibility: () => void; didInsertTab: (element: HTMLButtonElement, isSelected?: boolean) => void; didUpdateTab: (tabIndex: number, isSelected?: boolean) => void; willDestroyTab: (element: HTMLButtonElement) => void; didInsertPanel: (element: HTMLElement, panelId: string) => void; willDestroyPanel: (element: HTMLElement) => void; onClick: (event: MouseEvent, tabIndex: number) => void; onKeyUp: (tabIndex: number, event: KeyboardEvent) => void; focusTab: (tabIndex: number, event: KeyboardEvent) => void; setTabIndicator: () => void; }