import { type Readable, type Signal } from '@vielzeug/ripple'; import { type ControlValidationMode, type FieldHandle } from './field-base'; export type CheckableChangePayload = { checked: boolean; originalEvent?: Event; value: string; }; export type CheckableOptions = { checked: Readable; clearIndeterminateFirst?: boolean; disabled?: Readable; error?: Readable; group?: { toggle: (value: string, originalEvent?: Event) => void; }; helper?: Readable; indeterminate?: Readable; onToggle?: (payload: CheckableChangePayload) => void; prefix?: string; /** Marks an unchecked control invalid — feeds `validity`/`validationMessage` (see below). */ required?: Readable; /** Message for the unchecked+required case. Defaults to `'This field is required.'`. */ requiredMessage?: Readable; /** `AbortSignal` from the component lifecycle. All reactive subscriptions are torn down on abort. */ signal: AbortSignal; validateOn?: Readable; value: Readable; }; export type CheckableHandle = FieldHandle & { /** The form submission value: null when unchecked/indeterminate, the value string when checked. */ checkableFormValue: Readable; checked: Signal; handleClick: (event: MouseEvent) => boolean; handleKeydown: (event: KeyboardEvent) => boolean; indeterminate: Signal; /** * Restores `checked`/`indeterminate` to their native "default" value. See `DirtyTracker` * for the two-state rationale. Wire into `useField({ onReset: checkable.reset })`. */ reset: () => void; toggle: (event: Event) => void; /** Reactive validation message paired with `validity`. Empty string when valid. */ validationMessage: Readable; /** * Reactive `ValidityStateFlags` — `{ valueMissing: true }` while `required` and unchecked * (indeterminate counts as unchecked), `null` (valid) otherwise. Pass straight to * `useField({ validity: checkable.validity })`. */ validity: Readable; }; export declare const createCheckable: (options: CheckableOptions) => CheckableHandle; //# sourceMappingURL=checkable.d.ts.map