/** * Form field state management * @module form/state */ /** * Form field state interface */ export interface FormFieldState { value: T; error: string | undefined; touched: boolean; dirty: boolean; } /** * Create a reactive form field state * @param initialValue - Initial value for the field * @returns Form field state object * * @example * ```svelte * * * email.touched = true} * /> * * {#if email.error && email.touched} *

{email.error}

* {/if} * ``` */ export declare function createFormField(initialValue: T): FormFieldState; /** * Form state manager for multiple fields */ export interface FormState> { values: T; errors: Record; touched: Record; dirty: Record; } /** * Create a form state manager * @param initialValues - Initial values for all fields * @returns Form state object * * @example * ```svelte * * * * * ``` */ export declare function createFormState>(initialValues: T): FormState; /** * Check if form has any errors * @param form - Form state object * @returns Whether any field has an error */ export declare function hasFormErrors>(form: FormState): boolean; /** * Check if form is valid (no errors and all required fields touched) * @param form - Form state object * @returns Whether form is valid */ export declare function isFormValid>(form: FormState): boolean; /** * Reset form to initial state * @param form - Form state object * @param initialValues - Initial values to reset to */ export declare function resetForm>(form: FormState, initialValues: T): void;