import type { ControlSize } from "@charcuterie/tokens" import type { ChangeEvent, ComponentPropsWithRef, ReactNode, } from "react" import { CONTROL_SIZE_CLASS } from "../controlStyles.ts" import { DISABLED_CLASS, FOCUS_RING_CLASS, } from "../intentStyles.ts" import { toClassName } from "../toClassName.ts" /** * @deprecated Part of the deprecated native `Select`. The * replacement shape is `PickerOption` / `ListboxItem`, whose * `label` is a `ReactNode` rather than a `string`. */ export type SelectOption = { isDisabled?: boolean label: string value: string } /** * @deprecated Part of the deprecated native `Select`. `Listbox` * has **no `` equivalent**, so a grouped picker is the * one shape this deprecation has no replacement for — an app that * needs one is a change to `Listbox`, not a reason to keep * reaching for the native control. */ export type SelectOptionGroup = { label: string options: readonly SelectOption[] } /** @deprecated Part of the deprecated native `Select`. */ export type SelectItem = SelectOption | SelectOptionGroup /** * @deprecated Part of the deprecated native `Select` — see the * component's docblock. `PickerProps` is the replacement. * * The HTML attributes are passed through, and that is not * convenience — it is what makes the `Field` slot work at all. * * `Field` clones `id`, `aria-describedby`, `aria-invalid` and * `required` onto whatever control it is given. A component with a * closed prop list **silently drops all four**: the field renders, * the label still points at nothing, and every assertion about the * control's own props passes because they never arrived. Found by * the one test that asked the control what it had been handed. * * Same arrangement as `Button`, for the same reason. */ export type SelectProps = Omit< ComponentPropsWithRef<"select">, "disabled" | "onChange" | "size" | "value" > & { /** * Goes on the **wrapper**, which is the box a caller means when * they size a control. See the component docblock — the chevron * is positioned against that wrapper, so a width anywhere else * leaves it behind. */ className?: string /** * The escape hatch for the inner `` with neither a `