import type React from "react"; import type { ClassName } from "@reshaped/utilities"; import type { ActionableProps } from "../../components/Actionable"; import type { IconProps } from "../../components/Icon"; import type { Attributes } from "../../types/global"; export type SelectionState = { left: number; top: number; scaleX: number; scaleY: number; status: "idle" | "prepared" | "animated"; }; export type ItemProps = { /** Value of the item used for the active item selection */ value: string; /** Node for inserting children */ children?: React.ReactNode; /** Icon of the item at the start position */ icon?: IconProps["svg"]; /** Link of the item, renders as an anchor element */ href?: string; /** Disable the item user interaction */ disabled?: boolean; /** Additional attributes for the item element */ attributes?: ActionableProps["attributes"]; }; export type ListProps = { /** Node for inserting children */ children?: React.ReactNode; /** Additional classname for the list element */ className?: ClassName; /** Additional attributes for the list element */ attributes?: Attributes<"div">; }; export type PanelProps = { /** Value of the panel used for the active panel selection */ value: string; /** Node for inserting children */ children?: React.ReactNode; /** Additional classname for the panel element */ className?: ClassName; /** Additional attributes for the panel element */ attributes?: Attributes<"div">; }; export type BaseProps = { /** Node for inserting children */ children?: React.ReactNode; /** Direction of the tab buttons */ direction?: "column" | "row"; /** Equal width for the tab buttons */ itemWidth?: "equal"; /** Render variant for component */ variant?: "bordered" | "borderless" | "pills" | "pills-raised"; /** Component size */ size?: "small" | "medium" | "large"; /** Name of the tab buttons group when used as a form control */ name?: string; /** Disable the animation of the tab button selection */ disableSelectionAnimation?: boolean; /** Callback when the active tab value changes */ onChange?: (args: { value: string; name?: string; }) => void; }; export type ControlledProps = BaseProps & { /** Value of the active tab, enables controlled mode */ value: string; /** Default value of the active tab, enables uncontrolled mode */ defaultValue?: never; }; export type UncontrolledProps = BaseProps & { /** Value of the active tab, enables controlled mode */ value?: never; /** Default value of the active tab, enables uncontrolled mode */ defaultValue: string; }; export type Props = ControlledProps | UncontrolledProps; export type Context = Pick & { size: NonNullable; value?: string; id: string; registerPanel: (value: string) => void; unregisterPanel: (value: string) => void; hasPanel: (value: string) => boolean; elActiveRef: React.RefObject; elPrevActiveRef: React.RefObject; elScrollableRef: React.RefObject; selection: SelectionState; setSelection: React.Dispatch>; };