import type { JSX } from "@solidjs/web"; import { type MaybeAccessor } from "../../internals/maybe-accessor.js"; import { type SelectRootChangeEventDetails, type SelectRootChangeEventReason, type SelectValue } from "../select-root-context.js"; import { type ItemsInput } from "../utils/resolve-value-label.js"; export type { SelectRootChangeEventDetails, SelectRootChangeEventReason }; /** * Imperative actions written into `actionsRef` on ``. Mirrors * React's `SelectRoot.Actions` — only `unmount()` is exposed (close is * reserved via `onOpenChange`). */ export interface SelectRootActions { unmount: () => void; } export interface SelectRootProps { /** The id of the Select. */ id?: string | undefined; /** Field name for form submission. */ name?: string | undefined; /** Form id for the hidden input. */ form?: string | undefined; /** Autocomplete hint. */ autoComplete?: string | undefined; /** Whether the user must choose a value before submitting. */ required?: MaybeAccessor; /** Whether the user can change the selection. */ readOnly?: MaybeAccessor; /** Whether the component ignores interaction. */ disabled?: MaybeAccessor; /** Whether multiple items may be selected. */ multiple?: Multiple | undefined; /** Whether hovering an item highlights it. */ highlightItemOnHover?: boolean | undefined; /** * Controlled open state. When provided (resolved value not * `undefined`), the consumer owns the state — pair with * {@link onOpenChange}. When omitted, the select manages its own open * state (seeded from {@link defaultOpen}). */ open?: MaybeAccessor; /** * Initial open state when uncontrolled. Read once at mount. * @default false */ defaultOpen?: MaybeAccessor; /** * Fires on every open/close request. Calling `eventDetails.cancel()` * keeps the select's own (uncontrolled) state unchanged, mirroring * React Base UI; controlled consumers simply don't update their signal. */ onOpenChange?: ((open: boolean, eventDetails: SelectRootChangeEventDetails) => void) | undefined; /** Called after open/close transitions settle. */ onOpenChangeComplete?: ((open: boolean) => void) | undefined; /** Modal mode — locks outside interaction while open. @default true */ modal?: boolean | undefined; /** * Controlled value (scalar for single; array for multiple). When * provided (resolved value not `undefined` — `null` counts as * controlled), the consumer owns the state — pair with * {@link onValueChange}. When omitted, the select manages its own * value (seeded from {@link defaultValue}). */ value?: MaybeAccessor | null | undefined>; /** * Initial value when uncontrolled. Read once at mount. * @default null (normalized to `[]` when `multiple`) */ defaultValue?: MaybeAccessor | null | undefined>; /** * Fires on every selection request. Calling `eventDetails.cancel()` * keeps the select's own (uncontrolled) value unchanged, mirroring * React Base UI; controlled consumers simply don't update their signal. */ onValueChange?: ((value: SelectValueType | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void) | undefined; /** * Imperative actions — callback-ref shape (React uses RefObject). */ actionsRef?: ((actions: SelectRootActions | null) => void) | { current: SelectRootActions | null; } | undefined; /** Ref to the hidden input. */ inputRef?: ((el: HTMLInputElement | null) => void) | { current: HTMLInputElement | null; } | undefined; /** Items registry — drives trigger label resolution for object values. */ items?: MaybeAccessor>; /** Formatter for object values (trigger display). */ itemToStringLabel?: ((value: Value) => string) | undefined; /** Formatter for object values (form submission). */ itemToStringValue?: ((value: Value) => string) | undefined; /** Custom equality comparer. */ isItemEqualToValue?: ((itemValue: Value, value: Value) => boolean) | undefined; /** Children. */ children?: JSX.Element; } type SelectValueType = Multiple extends true ? Value[] : Value; /** * Groups all parts of the select. Doesn't render its own HTML element — * the root is a pure context provider. */ export declare function SelectRoot(props: SelectRootProps): JSX.Element; //# sourceMappingURL=select-root.d.ts.map