import { UiElement } from '../shared/element.js'; import '../tooltip/tooltip.js'; export * from './tab.js'; export * from './tab-panel.js'; /** Carbon VERTICAL_TABS_BREAKPOINT: vertical tabs from just above md (42rem); below, contained tabs in a row. */ export declare const VERTICAL_TABS_QUERY = "(min-width: 42.01rem)"; /** Carbon Tabs `activation`; `auto` is the pre-0.9 spelling, still accepted. */ export type TabsActivation = 'automatic' | 'manual' | 'auto'; /** Carbon tab styles: `line` (default) or `contained` (cds-tabs `type="contained"`, React `contained`). */ export type TabsType = 'line' | 'contained'; /** Carbon tab heights: sm 32px, md 40px (line default), lg 48px (contained default), xl 64px (contained only). */ export type TabsSize = 'sm' | 'md' | 'lg' | 'xl'; /** * Carbon tabs: `line` (default; Carbon's product tabs) or * `type="contained"` — 48px tabs on layer-accent with dividers, the selected one on the layer with a * blue top edge, and panels on the layer padded 16px; `full-width` splits the strip into equal columns. * * Keyboard (WAI-ARIA APG): Left/Right move with wrap, Home/End jump to the first/last tab. * `activation="automatic"` (default; `auto` still works) selects as focus moves; `activation="manual"` only moves * focus and selects on Enter/Space — use it when panels are slow to render. * * When tabs overflow, previous/next buttons scroll the strip for mouse users (keyboard * users have the arrow keys, so the buttons are skipped by Tab and hidden from AT). * * `dismissable` (Carbon `Tabs dismissable`): every tab gets a close button, and Delete closes the * focused tab. The tab fires a cancelable `ui-request-close`; unless prevented it is hidden (still * in the DOM, so a framework can drop it from its own state) and fires `ui-close`. A closed selected * tab passes the selection to the first enabled tab (`ui-tab-change`); focus moves to the tab now in * its place, else the one before it (Carbon). Not with `vertical`. * * @slot nav - `` elements (assigned automatically) * @slot - `` elements * @slot end - Content at the end of the strip, e.g. an action button * @fires ui-tab-before-change - Cancelable; detail: { name, previous }. preventDefault() keeps * the current tab (e.g. unsaved changes). * @fires ui-tab-change - detail: { name } after the user selects a tab * @fires ui-request-close - From a `` of dismissable tabs (close button or Delete); cancelable; * detail: { name }. preventDefault() keeps the tab. * @fires ui-close - From a `` after it closed (hidden); detail: { name } * @csspart base - The strip holding the tab list and scroll buttons * @csspart tablist - The role=tablist container (tabs themselves are light-DOM ``s: style the element) * @csspart scroll-button - The overflow scroll buttons * @csspart end - Wrapper of the `end` slot * @cssprop --ui-tabs-track - `box-shadow` of the tab strip, for one line under every tab (default none; Kanok: a 1px hairline) * @cssprop --ui-tabs-gap - Gap between line tabs (default 1px; Kanok: 4px) * @cssprop --ui-tabs-contained-height - Tab height of `type="contained"` (default 48px; Kanok: 32px) * @cssprop --ui-tabs-contained-track / --ui-tabs-contained-padding / --ui-tabs-contained-radius / --ui-tabs-contained-gap - The track behind contained tabs (default none: Carbon's full-width strip; Kanok: a grey rounded track) * @cssprop --ui-tabs-contained-flex - `flex` of the contained strip (default 1, full width; Kanok: hugs the tabs) * @cssprop --ui-tab-vertical-background - The vertical tab list's fill (default the layer; on `` with the other --ui-tab-vertical-* settings) */ export declare class UiTabs extends UiElement { static readonly styles: import("lit").CSSResult; /** Name of the active panel. Defaults to the first enabled tab. */ value: string; /** Accessible name for the tab strip, e.g. "Product details". */ label: string; /** `automatic` (Carbon's name; `auto` is still accepted) or `manual`. */ activation: TabsActivation; /** `line` (default) or `contained` (Carbon cds-tabs `type="contained"`). */ type: TabsType; /** Tab height (Carbon `size`): sm 32px, md 40px, lg 48px, xl 64px (contained only); unset = md for line, lg for contained. */ size?: TabsSize; /** With `type="contained"`: the tabs share the full width in equal columns (Carbon `full-width` / `fullWidth`). */ fullWidth: boolean; /** Carbon `TabsVertical`: the tabs in a column beside the panels from md up (contained tabs in a row below). */ vertical: boolean; /** A fixed height for vertical tabs (Carbon `height`), e.g. `"400px"`: the tab list and the panels then scroll. */ height: string; /** A close button on every tab, and Delete closes the focused tab (Carbon `dismissable`); not with `vertical`. */ dismissable: boolean; /** Vertical and at least md wide: laid out as a column. */ private wide; private canScrollUp; private canScrollDown; private media?; private readonly onMedia; private canScrollStart; private canScrollEnd; private readonly tablist; private resizeObserver?; /** Created on connect (not at construction, so server rendering has no ResizeObserver to need); re-observed after a move. */ private observeSize; connectedCallback(): void; firstUpdated(): void; disconnectedCallback(): void; private get columnLayout(); private readonly tabs; private readonly panels; protected updated(changed: Map): void; /** The tabs that aren't closed. */ private shownTabs; private enabledTabs; private get closable(); private sync; /** * Carbon dismissable: asks the tab to close (`ui-request-close`); unless prevented it is hidden and * fires `ui-close`, the first enabled tab takes over a closed selection, and focus goes to the tab * now in its place, else the one before (Carbon React; a kept tab keeps focus). */ private closeTab; /** Move focus (and the roving tab stop) without selecting. */ private focusTab; private select; private onClick; private nextTab; private onKeydown; private updateOverflow; private scrollStrip; /** Focus the active tab (the tablist's tab stop). */ focus(options?: FocusOptions): void; private renderTablist; /** Vertical from md up: the tab list beside the panels in a Carbon grid; the panels a layer up for their fields (Carbon update_fields_on_layer). */ private renderColumns; render(): import("lit-html").TemplateResult<1>; } export interface TabChangeDetail { name: string; } export interface TabBeforeChangeDetail { name: string; previous: string; } /** `name` = the closing tab's `panel`. */ export interface TabCloseDetail { name: string; } export interface UiTabsEventMap extends HTMLElementEventMap { 'ui-tab-change': CustomEvent; 'ui-tab-before-change': CustomEvent; /** Bubbles from the `` of dismissable tabs. */ 'ui-request-close': CustomEvent; 'ui-close': CustomEvent; } /** Typed listeners for UiTabs's events (declaration merging with the class). */ export interface UiTabs { addEventListener(type: K, listener: (this: UiTabs, event: UiTabsEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiTabs, event: UiTabsEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-tabs': UiTabs; } }