import { Ref } from 'vue'; import { FieldRules } from './useFormValidation'; export type { FieldRules, ValidationRule } from './useFormValidation'; /** * Field validation rules configuration. */ export interface FieldState { value: unknown; error: string | null; touched: boolean; dirty: boolean; } /** * Form state and methods. */ export interface UseFormReturn> { data: T; errors: Record; touched: Record; dirty: Record; isValid: Ref; isDirty: Ref; isSubmitting: Ref; setFieldValue: (field: K, value: T[K]) => void; setFieldError: (field: string, error: string | null) => void; setFieldTouched: (field: string, touched?: boolean) => void; validateField: (field: string) => boolean; validate: () => boolean; reset: (values?: Partial) => void; /** Replace the full form state and treat the provided values as the new clean baseline. */ replaceState: (values: T) => void; handleSubmit: (onSubmit: (data: T) => Promise | void) => (e?: Event) => Promise; getFieldProps: (field: K) => { modelValue: T[K]; 'onUpdate:modelValue': (value: T[K]) => void; onBlur: () => void; error: string | null; }; } /** * Form state management composable with validation. * * @param initialValues - Initial form values * @param rules - Validation rules for each field * * @example * ```typescript * const { data, errors, isValid, handleSubmit, getFieldProps } = useForm( * { email: '', password: '' }, * { * email: { required: true, email: true }, * password: { required: true, minLength: 8 }, * } * ) * * // In template * * * Submit * ``` */ /** Reactive form state with field-level validation, dirty tracking, and submit handling. */ export declare function useForm>(initialValues: T, rules?: Partial>): UseFormReturn;