import type { MouseEvent, ReactNode } from "react"; import type { LocationSensorState } from "react-use/lib/useLocation"; import type { ColorVariant } from "../../types"; export interface BaseTab { id?: string; label: ReactNode; variant?: ColorVariant; disabled?: boolean; value?: string; /** @ignore */ className?: string; } export type UrlMatcher = (tab: LinkTab, location: LocationSensorState) => boolean; export interface LinkTab extends BaseTab { to: string; } export interface LinkTabsProps { /** @ignore */ className?: string; /** * The tabs to display. */ tabs: LinkTab[]; /** * The function to call when a tab is clicked. */ onTabClick?(event: MouseEvent, tab: LinkTab): void; /** * The function to use to determine if a tab is selected. */ urlMatcher?: UrlMatcher; } export interface ContentTab extends BaseTab { content: ReactNode; } export interface ContentTabsProps { /** @ignore */ className?: string; /** * The tabs to display. */ tabs: ContentTab[]; /** * The current tab index. */ tabIndex?: number; /** * The index of the tab to display by default. */ defaultIndex?: number; /** * The function to call when the tab changes. */ onChange?: (tabIndex: number) => void; }