import { type Readable } from '@vielzeug/ripple'; import { type FieldHandle, type FieldOptions } from './field-base'; export type ChoiceChangeDetail = { labels: string[]; originalEvent?: Event; values: string[]; }; export type ChoiceFieldOptions = FieldOptions & { multiple?: Readable; /** Marks an empty selection invalid — feeds `validity`/`validationMessage` (see below). */ required?: Readable; /** Message for the empty-selection+required case. Defaults to `'Please make a selection.'`. */ requiredMessage?: Readable; /** `AbortSignal` from the component lifecycle. All internal subscriptions are disposed on abort. */ signal: AbortSignal; /** * Current selection value(s). Accepts a comma-separated string * (legacy/single-select form serialisation) or a `string[]` array. * The field normalises both formats internally via `parseChoiceValues`. */ value: Readable; }; export type ChoiceFieldHandle = FieldHandle & { clear: () => void; formValue: Readable; removeValue: (value: string) => void; /** * Restores the selection to its native "default". See `DirtyTracker` for the two-state * rationale. */ reset: () => void; selectedValue: Readable; selectedValues: Readable; selectValue: (value: string) => void; setValues: (values: string[]) => void; /** * Toggles `value` in the selection. * - **Multiple mode**: adds if absent, removes if present. * - **Single mode**: always selects `value` (acts like `selectValue` — cannot * deselect; use `clear()` to reset a single-select field). */ toggleValue: (value: string) => void; /** Reactive validation message paired with `validity`. Empty string when valid. */ validationMessage: Readable; /** * Reactive `ValidityStateFlags` — `{ valueMissing: true }` while `required` and no option is * selected, `null` (valid) otherwise. Pass straight to `useField({ validity: choice.validity })`. */ validity: Readable; }; export declare const createChoiceField: (options: ChoiceFieldOptions) => ChoiceFieldHandle; //# sourceMappingURL=choice-field.d.ts.map