/** * Reactive form creation and management. * * @module bquery/forms */ import type { Form, FormConfig } from './types'; /** * Creates a fully reactive form with field-level validation, * dirty/touched tracking, cross-field validation, and submission handling. * * Each field's `value`, `error`, `isDirty`, `isTouched`, and `isPristine` * are reactive signals/computed values that can be used in effects, computed * values, or directly read/written. * * @template T - Shape of the form values (e.g. `{ name: string; age: number }`) * @param config - Form configuration with field definitions, validators, and submit handler * @returns A reactive {@link Form} instance * * @example * ```ts * import { createForm, required, email, min } from '@bquery/bquery/forms'; * * const form = createForm({ * fields: { * name: { initialValue: '', validators: [required()] }, * email: { initialValue: '', validators: [required(), email()] }, * age: { initialValue: 0, validators: [min(18, 'Must be 18+')] }, * }, * onSubmit: async (values) => { * await fetch('/api/register', { * method: 'POST', * body: JSON.stringify(values), * }); * }, * }); * * // Read reactive state * console.log(form.isValid.value); // true (initially, before validation runs) * console.log(form.fields.name.value.value); // '' * * // Update a field * form.fields.name.value.value = 'Ada'; * * // Validate and submit * await form.handleSubmit(); * ``` */ export declare const createForm: >(config: FormConfig) => Form; //# sourceMappingURL=create-form.d.ts.map