import { z } from 'zod'; import { ContextValue, Mode } from './Context'; export interface OnChangeParams { /** The values in the form AFTER the change. */ values: z.infer; /** The path that was changed. */ path: string; /** The previous value at the path. */ prev: unknown; /** Whether validation succeeded. */ valid: boolean; } /** Params for {@link use}. */ export interface UseParams { /** The starting values. They are copied, not held. */ values: z.infer; mode?: Mode; /** Whether to reset the form whenever `values` changes identity. */ sync?: boolean; onChange?: (props: OnChangeParams) => void; /** Called when the form goes from untouched to touched, and back. */ onHasTouched?: (value: boolean) => void; /** Zod schema the values validate against on every write. */ schema?: Z; scope?: string; } export interface UseReturn extends ContextValue { } /** * Creates a form over the given values, validated by the given Zod schema. The returned * value is stable, so a field hook re-renders only when its own path changes. * * @example * const form = Form.use({ values: initial, schema: rangeZ, onChange: save }); * return ; */ export declare const use: ({ values: initialValues, sync, schema, mode, onChange, onHasTouched, }: UseParams) => UseReturn; //# sourceMappingURL=use.d.ts.map