@zag-js/form-utils
Version:
## Installation
27 lines (24 loc) • 1.3 kB
TypeScript
interface DescriptorOptions {
type?: "HTMLInputElement" | "HTMLTextAreaElement" | "HTMLSelectElement" | undefined;
property?: "value" | "checked" | undefined;
}
declare function setElementValue(el: HTMLElement, value: string, option?: DescriptorOptions): void;
declare function setElementChecked(el: HTMLElement, checked: boolean): void;
type InputEventOptions = {
value: string | number;
bubbles?: boolean;
};
declare function dispatchInputValueEvent(el: HTMLElement | null, options: InputEventOptions): void;
type CheckedEventOptions = {
checked: boolean;
bubbles?: boolean;
};
declare function dispatchInputCheckedEvent(el: HTMLElement | null, options: CheckedEventOptions): void;
declare function getClosestForm(el: HTMLElement): HTMLFormElement | null;
declare function isNativeDisabled(el: HTMLElement): boolean;
type FormControlOptions = {
onFieldsetDisabledChange: (disabled: boolean) => void;
onFormReset: () => void;
};
declare function trackFormControl(el: HTMLElement | null, options: FormControlOptions): (() => void) | undefined;
export { type CheckedEventOptions, type FormControlOptions, type InputEventOptions, dispatchInputCheckedEvent, dispatchInputValueEvent, getClosestForm, isNativeDisabled, setElementChecked, setElementValue, trackFormControl };