@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
49 lines • 2.01 kB
TypeScript
/**
* @license
* Copyright 2026 Kai-Orion & Sandlada
* SPDX-License-Identifier: MIT
*
* @fileoverview
* Internal base class for `mdc-tabs`.
*
* The bar owns selection: a single active tab at a time (roving `tabindex`),
* an ARIA `tablist` role, arrow-key navigation and a cancelable `change` event
* that fires before the selection is committed. Each tab is asked to animate
* its indicator (via the {@link ANIMATE_INDICATOR} symbol) from the previous
* tab's position, so the active indicator slides smoothly between tabs.
*/
import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
import { BaseTab } from './base-tab';
import type { ITabs } from '../tabs.interface';
export declare abstract class BaseTabs extends LitElement implements ITabs {
/** The index of the active tab. */
activeTabIndex: number;
/** If `true` (default), arrow keys immediately activate the focused tab. */
autoActivate: boolean;
protected readonly tabsElement: HTMLElement | null;
private readonly assignedTabs;
private tabs;
constructor();
/** The currently selected tab. */
get activeTab(): BaseTab | null;
protected render(): TemplateResult;
protected updated(changedProperties: PropertyValues<this>): void;
private readonly handleTabClick;
private activateTabAfterMicrotask;
private readonly handleKeydown;
private isRtl;
private readonly handleSlotChange;
/**
* Selects `tab`, animating the indicator from the previously active tab.
*
* Dispatches a cancelable `change` event first; if a listener cancels it,
* the previous selection is restored.
*/
activateTab(tab: BaseTab, userInitiated: boolean): Promise<void>;
/**
* Scrolls the given tab (defaults to the active tab) into view within the
* tab bar. Resolves once the native smooth scroll has been requested.
*/
scrollToTab(tabToScrollTo?: BaseTab | null): Promise<void>;
}
//# sourceMappingURL=base-tabs.d.ts.map