import type { Readable, Signal } from '@vielzeug/ripple'; export type FormFieldOptions = { disabled?: Readable; /** * The host element to attach `ElementInternals` to. * Defaults to the element currently being set up via `getHost()`. * Pass this explicitly when calling `useField` from a composable that is * not called directly during `setup()` (e.g. a helper factory function). */ el?: HTMLElement; /** * When `true`, a `null` or `undefined` value is submitted as an empty string * (`''`) instead of `null`. This keeps the field's key present in `FormData` * even when the value is absent — useful when the server expects the field to * always be included. * * @default false */ emptyStringForNull?: boolean; /** * Called when the ancestor `
` is reset (see `onFormReset`). Use to restore * whatever local state backs `value` — `useField` itself owns no field state to reset. */ onReset?: () => void; toFormValue?: (value: T) => File | FormData | string | null; /** * Recomputed reactively and passed straight to `internals.setValidity()` — `null` * (or omitting `validity` entirely) means always valid. Pair with `validationMessage`. * * @example * ```ts * validity: computed(() => (required.value && isBlank(value.value)) ? { valueMissing: true } : null), * validationMessage: computed(() => (required.value && isBlank(value.value)) ? 'Required.' : ''), * ``` */ validationMessage?: Readable; validity?: Readable; value: Signal | Readable; }; export type FormFieldHandle = { checkValidity: () => boolean; readonly internals: ElementInternals; reportValidity: () => boolean; /** * Set (non-empty message) or clear (empty string) a custom validity error. * Guards the platform's throw-on-empty-message contract — prefer this over * calling `internals.setValidity` directly. */ setCustomValidity: (message: string) => void; }; export declare const useField: (options: FormFieldOptions) => FormFieldHandle; //# sourceMappingURL=field.d.ts.map