import { UseFormReturn, SubmitHandler, FieldValues, UseFormProps } from 'react-hook-form'; import { ZodType } from 'zod'; import * as React from 'react'; type FormSchema = ZodType; /** * Form component props extending React Hook Form's UseFormProps * * @example * ```tsx * import { z } from 'zod'; * * const schema = z.object({ * email: z.string().email(), * password: z.string().min(8), * }); * * function LoginForm() { * const handleSubmit = (data: z.infer) => { * console.log(data); * }; * * return ( *
* {(form) => ( * <> * * * * * )} * * ); * } * ``` */ export interface FormProps extends Omit, 'onSubmit' | 'children'> { /** Zod schema for validation */ schema?: FormSchema; /** Form submission handler */ onSubmit: SubmitHandler; /** React Hook Form configuration */ formOptions?: Omit, 'resolver'>; /** Render prop with form instance */ children: (form: UseFormReturn) => React.ReactNode; } /** * Form wrapper component with React Hook Form integration * * Provides FormProvider context and handles form submission with validation. * Integrates with Zod for schema validation via @hookform/resolvers. * * @example * ```tsx * const schema = z.object({ * name: z.string().min(2), * email: z.string().email(), * }); * *
console.log(data)} * formOptions={{ defaultValues: { name: '', email: '' } }} * > * {(form) => ( *
* * *
* )} *
* ``` */ export declare function Form({ schema, onSubmit, formOptions, children, className, ...props }: FormProps): import("react/jsx-runtime").JSX.Element; /** * Hook to access form context * * Re-exports useFormContext from react-hook-form for convenience * * @example * ```tsx * function CustomFormField() { * const form = useFormContext(); * return ; * } * ``` */ export { useFormContext } from 'react-hook-form'; export { FormProvider } from 'react-hook-form'; /** * Hook to create a standalone form instance * * Use this when you want to manage form state without the Form component wrapper. * * @example * ```tsx * const schema = z.object({ name: z.string() }); * * function MyForm() { * const form = useForm({ schema }); * * return ( * * * * ); * } * ``` */ export declare function useForm(options: { schema?: FormSchema; } & Omit, 'resolver'>): UseFormReturn; //# sourceMappingURL=Form.d.ts.map