import { type ComponentProps, type KeyboardEvent, type ReactNode } from 'react'; /** * Unstyled Carbon `ContentSwitcher`, the behaviour of the styled ContentSwitcher without a single * class (the rules of ``, core/roving): a `tablist` where exactly one item is * selected, one Tab stop (the selected item, else the first enabled one). A click, or ← / → (wrapping, * skipping disabled items, mirrored right-to-left) select at once; `selectionMode="manual"` moves * focus only and Enter / Space selects; Home / End jump to the ends. * * Each direct child of `Root` is one item, by position: `Root` reads its `disabled` and `name` props * (`name` is reported in `onChange`), so a wrapper component around an `Item` takes those two props too. * * State shows as data attributes to style on: `data-selected` and `data-disabled` on an `Item`. * * ```tsx * …}> * All * Mine * * ``` */ export type SelectionMode = 'automatic' | 'manual'; export interface Change { index: number; name: string; } export interface RootProps extends Omit, 'onChange' | 'children'> { /** The selected item's index (controlled). */ selectedIndex?: number; defaultSelectedIndex?: number; /** After the user selects another item. */ onChange?: (change: Change) => void; selectionMode?: SelectionMode; /** The items, one per direct child. */ children: ReactNode; } interface ContentSwitcherContextValue { /** The selected item's index. */ selected: number; /** The single Tab stop: the selected item, or the first enabled one (-1 when every item is disabled). */ focusable: number; count: number; selectionMode: SelectionMode; /** Selects the item at `index` (not a disabled one) and reports it. */ select: (index: number) => void; onItemKeyDown: (index: number, event: KeyboardEvent) => void; onItemClick: (index: number, element: HTMLElement) => void; } /** The state of the enclosing `ContentSwitcher.Root` (selected index, Tab stop, item count …). */ export declare function useContentSwitcherContext(part?: string): ContentSwitcherContextValue; /** The position of the enclosing item among the `Root`'s children. */ export declare function useItemIndex(): number; export declare function Root({ selectedIndex, defaultSelectedIndex, onChange, selectionMode, children, ref, ...rest }: Readonly): import("react").JSX.Element; export interface ItemProps extends Omit, 'role'> { /** Identifies the item in `onChange` (Carbon `name`; read by `Root` from its child). */ name?: string; /** Stays visible and announced, but can't be selected or focused with the arrows. */ disabled?: boolean; } /** One item (`role="tab"`): selects on a click, the arrows and Enter / Space as `Root` says. */ export declare function Item({ disabled, name: _name, ...rest }: Readonly): import("react").JSX.Element; export {};