/** * Shared atomic prop types used across multiple components. * @see docs/PROPS-VOCABULARY.md */ import type * as React from "react"; /** Extra CSS class names on a component root. */ export type ClassNameProp = string; /** Child nodes slot. */ export type ChildrenProp = React.ReactNode; /** Stable DOM / form identifier. */ export type IdProp = string; /** Controlled open state for panels (Dialog, Sheet, Popover). */ export type OpenProp = boolean; /** Uncontrolled initial open state for panels (Dialog, Sheet, Popover). */ export type DefaultOpenProp = boolean; /** Callback when open state changes. */ export type OnOpenChangeProp = (open: boolean) => void; /** Async or sync handler — no return value expected. */ export type HandlerProp = () => void | Promise; /** Loading / pending state — disables actions and shows spinners. */ export type PendingProp = boolean; /** Field or control is required. */ export type RequiredProp = boolean; /** Disable user interaction. */ export type DisabledProp = boolean; /** Generic label text (filters, form fields, nav groups). */ export type LabelProp = React.ReactNode; /** Helper / hint text below inputs. */ export type HelperProp = React.ReactNode; /** Validation error message. */ export type ErrorProp = React.ReactNode; /** * Server validation error bag, keyed by field name — the shape Laravel hands Inertia * (`errors: { field: "message" }`) or a JSON API returns (`{ field: ["m1", "m2"] }`). */ export type ErrorBagProp = Partial>; /** Placeholder text for inputs. */ export type PlaceholderProp = string; /** HTML input `name` attribute. */ export type NameProp = string; /** Abstract controlled value. */ export type ValueProp = T; /** Abstract uncontrolled initial value. */ export type DefaultValueProp = T; /** Callback when an abstract value changes. */ export type OnValueChangeProp = (value: T) => void; /** Change handler for text inputs. */ export type OnChangeProp = React.ChangeEventHandler; /** Click handler for buttons and interactive elements. */ export type OnClickProp = React.MouseEventHandler; /** Radix/shadcn `asChild` polymorphism — render as child element. */ export type AsChildProp = boolean; /** * The slot's CONTENT owns its own inset: the container drops its padding so the child reaches the * frame edge — a full-bleed table inside a Card, an expanded detail panel inside a table cell, a * Command list inside a Popover. It is the sanctioned replacement for the `p-0` utility a consumer * would otherwise write at the call site. */ export type FlushProp = boolean; /** * An explicit layout dimension (NOT the `SizeProp` control-height tier). A `number` is treated as * px; a `string` is any CSS length (`"32rem"`, `"90vw"`, `"50%"`). */ export type WidthProp = number | string; /** * How a control sizes on the inline axis: fill its column, hug its label, or sit at a bounded * width the theme owns. * * `bounded` exists because neither of the other two is right for a control whose VALUE varies in * length — an organization switcher in a shell top bar is the canonical case. `full` swallows the * bar; `auto` makes the bar reflow every time the selected value changes length. `bounded` reads * `--control-bounded-width`, so the width is a knob rather than geometry hand-written at the call * site (gh#375). */ export type ControlWidthProp = "full" | "auto" | "bounded"; /** * antd `allowClear`: `true`/`false`, or the object form carrying a replacement icon and the * accessible label for the clear control (antd 6.6.2, `BaseSelectProps.allowClear`). */ export type AllowClearProp = boolean | { clearIcon?: React.ReactNode; label?: string; }; /** * antd `maxTagCount` — how many selected values stay visible before the rest collapse into the * overflow node. `"responsive"` is NOT supported here (see the PR that introduced this type): it * needs a per-frame width measurement of the value row, which this library resolves through * container queries instead. */ export type MaxTagCountProp = number; /** * antd `maxTagPlaceholder` — the node standing in for the values `maxTagCount` hid. A function * receives the omitted values so a consumer can render "+3 件" or a tooltip listing them. */ export type MaxTagPlaceholderProp = React.ReactNode | ((omitted: { value: string; label: React.ReactNode; }[]) => React.ReactNode); /** * antd `notFoundContent` — the node shown when a popup has nothing to list. Supersedes the * string-only `emptyMessage`, which stays for the common case. */ export type NotFoundContentProp = React.ReactNode; /** * antd `popupMatchSelectWidth`: `true` (default) locks the popup to the trigger's width, `false` * lets it size to its content, and a number pins it to that many pixels. */ export type PopupMatchWidthProp = boolean | number;