import type { AriaRole, ReactNode } from 'react'; import type { Placement } from '@floating-ui/dom'; import type { Dimensions } from '../../types'; export declare enum TabsVariant { AI = "AI", Default = "Default" } export declare enum TabsType { /** * Render tabs as ReactRouter links with a `to` prop and active states derived via route matching */ Links = "Links", /** * Render tabs as buttons with `aria-selected`. `onClick` and `isActive` tab configuration drives active states */ Buttons = "Buttons", /** * Render tabs as buttons, with radio semantic attributes. `onClick` and `isActive` tab configuration drives active states */ Filters = "Filters" } export type TabPadding = 'default' | 'tight'; export type TabClickHandler = ({ id, event }: { id: string; event: React.MouseEvent; }) => void; export interface CommonTabFields { /** * Optional, if provided a badge with the corresponding count will be rendered within the tab */ badgeCount?: number | string; /** * Optional, applied to the tab button */ className?: string; /** * Is this tab disabled? Will prevent pointer events and change the UI to appear disabled */ disabled?: boolean; /** * Optional, provide an ExpressIcon at a 16 base size to render to the left of the tab's label */ icon?: ReactNode; /** * Required, unique ID for the tab. Included as an argument to the onClick handler if provided */ id: string; /** * Optional for TabsType.Links, required for TabsType.Buttons and TabsType.Filters * Forces the active/selected state for this tab */ isActive?: boolean; /** * Not applicable for individual non-dropdown tabs but included in the type to allow for * a consistent interface across all tab configurations. * If you need to render a dropdown tab, create an entry matching `TabDropdownConfig` instead. */ dropdownItems?: never; /** * Required, the display label for the tab */ label: string; /** * Optional Pendo tag for tracking purposes, applied as the `data-pendo` attribute */ pendoTag?: string; /** * Optional, RTL testId property */ testId?: string; /** * Optional, determines visual styling variant */ variant?: TabsVariant; } type SpecificTabFields = T extends TabsType.Links ? { to: string; onClick?: TabClickHandler; isActive?: boolean; } : { onClick: TabClickHandler; to?: never; isActive: boolean; }; export type TabItemConfig = CommonTabFields & SpecificTabFields; export type TabDropdownConfig = Pick & { /** * Items to render in the dropdown menu. Each item must have a unique ID */ dropdownItems: Omit, 'variant'>[]; /** * Optional, the placement of the dropdown relative to the tab button * Defaults to 'bottom-end' * @see https://floating-ui.com/docs/placements */ dropdownPlacement?: Placement; /** * Optional, the click handler for the dropdown tab button * This will be called with the tab ID and the click event when the tab is clicked * It does not impact the toggling of the dropdown menu */ onClick?: TabClickHandler; /** * Optional, determines if the dropdown tab button is active */ isActive?: boolean; }; export interface TabsListProps { /** * Optional, the aria role of the tab container. The component will infer the correct role based on `tabsType` if not provided */ role?: AriaRole; /** * Required, determines if the tabs are links, buttons, or filters */ tabsType: T; /** * Required, the configuration for each tab. Each tab must have a unique ID * Tabs can be a mix of `TabItemConfig` and `TabDropdownConfig`, but all must match the `tabsType` * provided in `tabsType`. Dropdown configured tabs will include `dropdownItems` which is an array of `TabItemConfig` * for the dropdown items. */ tabsConfig: (TabItemConfig | TabDropdownConfig)[]; /** * Optional, determines the horizontal padding amount for all tabs */ tabsPadding?: TabPadding; /** * Optional, the width of the TabsList container. Defaults to 'auto' */ width?: Dimensions; } export declare const getTabConfigIsForDropdown: (tabConfig: TabsListProps['tabsConfig'][number]) => tabConfig is TabDropdownConfig; export {};