/** * Type definitions for the Tabs component. * * All interfaces use the IPrefix convention. Type aliases do not. * Supports two panel modes: auto-height (animated resize) and layout (motion layout). * * @module @mks2508/mks-ui/react/ui/Tabs/Tabs.types */ import type * as React from 'react'; import type { Tabs as TabsPrimitive } from '@base-ui/react/tabs'; import type { HTMLMotionProps, Transition } from 'motion/react'; import type { VariantProps } from 'class-variance-authority'; import type { SlotOverrides } from '../../../core/types'; import type { IHighlightProps, IHighlightItemProps } from '../../../react-ui/primitives/Highlight'; import type { IAutoHeightProps } from '../../../react-ui/primitives/AutoHeight'; import type { TabsSlot, tabsListVariants, tabsTabVariants } from './Tabs.styles'; /** * Internal context carrying the active tab value and its setter. * * @example * ```typescript * const ctx: TabsContextType = { * value: 'settings', * setValue: (v) => {}, * }; * ``` */ export type TabsContextType = { /** Currently active tab value, or undefined if none. */ value: string | undefined; /** Setter matching base-ui's onValueChange signature. */ setValue: ITabsProps['onValueChange']; }; /** * Props for the root Tabs component. * Extends base-ui Tabs.Root with slot overrides. * * @example * ```tsx * * ... * * ``` */ export interface ITabsProps extends React.ComponentProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for TabsHighlight -- animated background that follows the active tab. * Wraps the Highlight primitive; `controlledItems` and `value` are managed internally. * * @example * ```tsx * * ``` */ export interface ITabsHighlightProps extends Omit { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for TabsHighlightItem -- wraps a tab for highlight position tracking. * Requires a `value` prop matching the corresponding tab value. * * @example * ```tsx * * General * * ``` */ export interface ITabsHighlightItemProps extends IHighlightItemProps { /** Tab value this highlight item corresponds to. */ value: string; /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for TabsList -- the container holding tab triggers. * * @example * ```tsx * * General * Advanced * * ``` */ export interface ITabsListProps extends React.ComponentProps, VariantProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; /** Show the CSS Anchor-based sliding indicator. Defaults to true for default/outline/pill variants. */ indicator?: boolean; } /** * Props for TabsTab -- a single tab trigger button. * * @example * ```tsx * * General * * ``` */ export interface ITabsTabProps extends React.ComponentProps, VariantProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for TabsPanel -- animated content panel with blur transitions. * Combines base-ui Panel with motion HTML props for enter/exit animations. * * @example * ```tsx * * General settings content... * * ``` */ export interface ITabsPanelProps extends Omit, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for TabsPanels in auto-height mode. * Uses the AutoHeight primitive to animate container height changes. * * @example * ```tsx * * Short content * Much longer content... * * ``` */ export interface ITabsPanelsAutoProps extends Omit { /** Panel animation mode (default). */ mode?: 'auto-height'; /** Tab panel children. */ children: React.ReactNode; /** Motion transition for height animation. */ transition?: Transition; /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for TabsPanels in layout mode. * Uses Motion layout animation to transition between panels. * * @example * ```tsx * * Content A * Content B * * ``` */ export interface ITabsPanelsLayoutProps extends Omit, 'children'> { /** Panel animation mode. */ mode: 'layout'; /** Tab panel children. */ children: React.ReactNode; /** Motion transition for layout animation. */ transition?: Transition; /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Discriminated union of TabsPanels props. * Defaults to auto-height mode when `mode` is omitted. * * @example * ```tsx * // Auto-height (default) * ... * * // Layout mode * ... * ``` */ export type ITabsPanelsProps = ITabsPanelsAutoProps | ITabsPanelsLayoutProps; //# sourceMappingURL=Tabs.types.d.ts.map
General settings content...