import "./index.css"; import React, { type SelectHTMLAttributes } from "react"; export type SelectSize = "lg" | "md"; /** * String-labelled option variant. Valid in both native (`complex={false}`) * and complex (`complex={true}`) modes. The `label` doubles as the type-ahead * search target. */ export interface SelectOptionWithTextLabel { /** Arbitrary `data-*` attributes are forwarded to the rendered option. */ [key: `data-${string}`]: boolean | number | string | undefined; /** Whether this option is non-interactive. */ disabled?: boolean; divider?: never; /** Displayed as the option content and used for type-ahead matching. */ label: string; textValue?: never; /** Unique identifier for the option. */ value: string; } /** * Rich-content option variant. The popover (`complex={true}`) renders the * `label` node directly; the native ``'s visible option text when * `label` is a React node. */ textValue: string; /** Unique identifier for the option. */ value: string; } /** * Visual-separator option variant. Renders a divider line between options * (or between groups of options). Carries no value of its own. */ export interface SelectOptionDivider { disabled?: never; /** Renders a visual separator between options. */ divider: true; label?: never; textValue?: never; value?: never; } export type SelectOption = SelectOptionDivider | SelectOptionWithNodeLabel | SelectOptionWithTextLabel; /** * A group entry in `Select`'s `options` array. Renders a heading above its * `options` and nests them visually beneath it. */ export interface SelectOptionsGroup { /** * Whether all options in this group are non-interactive. Disables every * nested option regardless of its own `disabled` flag. */ disabled?: boolean; /** Visible heading displayed above the group's options. */ label: string; /** The selectable options nested under this group. */ options: SelectOption[]; } export type SelectItem = SelectOption | SelectOptionsGroup; interface SelectBaseProps { /** * When true, renders as a popover listbox instead of a native `