import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type CarbonTabsContext = { tabs: import("svelte/store").Writable>; tabsById: import("svelte/store").Readable>; contentById: import("svelte/store").Readable>; /** Reverse lookup so each `Tab` can find its paired panel id by index. */ contentByIndex: import("svelte/store").Readable>; selectedTab: import("svelte/store").Writable; selectedContent: import("svelte/store").Writable; /** Mirror the `iconOnly` prop into the context so each `Tab` reacts to it. */ iconOnly: import("svelte/store").Writable; useFullWidth: import("svelte/store").Writable; useDismissible: import("svelte/store").Writable; useDismissText: import("svelte/store").Writable<(label: string) => string>; useContainer: import("svelte/store").Writable; navigation: import("svelte/store").Writable; secondaryLabelSupported: import("svelte/store").Writable; hasSecondaryLabel: import("svelte/store").Readable; add: (data: { id: string; label: string; disabled: boolean; hasSecondaryLabel: boolean; }) => void; remove: (id: string) => void; addContent: (data: { id: string }) => void; removeContent: (id: string) => void; claimTab: (id: string) => undefined | { panelId: string | undefined }; claimPanel: (id: string, hasOwnId: boolean) => undefined | { id: string; tabId: string | undefined }; update: (id: string) => void; /** * Dispatch `dismiss`. When the handler removes the focused tab, move focus * to the tab that took its place (or the new last tab) instead of ``. */ dismiss: (id: string) => Promise; }; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify the selected tab index. * Prefer `selectedId` when tabs can be added, removed or reordered: an * index then points at a different tab. Ignored when `selectedId` is set. * @default 0 */ selected?: number; /** * Specify the selected tab by id. Prefer it to `selected`. * When set, takes precedence over `selected` and stays on the same logical * tab as tabs are added or removed. Pair with a stable `id` on each `Tab`. */ selectedId?: string | undefined; /** * Choose whether arrow keys change the selection on focus. * Defaults to `"automatic"`. Set to `"manual"` so arrow keys only move * focus; press Enter or Space to select. * Ignored when `navigation` is set. * @default "automatic" */ activation?: "automatic" | "manual"; /** * Specify the type of tabs. * @default "default" */ type?: "default" | "container"; /** * Set to `true` to render the tabs as page navigation: a list of links * where the selected link has `aria-current="page"`, instead of a tab list * that switches panels in place. Links keep the browser's Tab order and * arrow keys do not move between them. Give each `Tab` an `href`, set * `selected` or `selectedId` from the current route, and label the * navigation with `aria-label`. * @default false */ navigation?: boolean; /** * Set to `true` to render a dismiss button for each tab * @default false */ dismissible?: boolean; /** * Specify the accessible name of each tab's dismiss button. * Receives the tab's `label`, which is empty when the tab has none. * @default (label) => label ? `Dismiss ${label}` : "Dismiss tab" */ dismissText?: (label: string) => string; /** * Set to `true` for tabs to span the full width of the container * @default false */ fullWidth?: boolean; /** * Set to `true` to render icon-only tabs. * Each `Tab` displays only its `icon`; the `label` is used as the accessible * name and the tooltip shown on hover and focus. * @default false */ iconOnly?: boolean; /** * Specify the icon size for icon-only tabs. * `"lg"` uses the large scale (48px tabs with a 20px icon); * the default scale is 40px tabs with a 16px icon. * Only applies when `iconOnly` is `true`. * @default "default" */ iconSize?: "default" | "lg"; /** * Specify the size of the tabs. Unset by default, which preserves the * original unsized height. Line tabs (`type="default"`) support up to * `"lg"`; container tabs support the full range up to `"xl"` — an * out-of-range value clamps to the type's max. */ size?: "sm" | "md" | "lg" | "xl" | undefined; content?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type TabsProps = Omit<$RestProps, keyof $Props> & $Props; export default class Tabs extends SvelteComponentTyped< TabsProps, { change: CustomEvent; dismiss: CustomEvent<{ id: string; label: string; disabled: boolean; hasSecondaryLabel: boolean; index: number }>; }, { default: Record; content: Record; } > {}