UNPKG

ai-native-form

Version:

AI-powered React form assistant with GPT-4, speech input, and schema auto-generation.

63 lines (62 loc) 2.5 kB
import { UseFormReturn, FieldValues, Path } from "react-hook-form"; export interface JSONSchema { type: "object"; properties: Record<string, { type: string; pattern?: string; enum?: any[]; items?: { type: string; enum?: any[]; }; minimum?: number; maximum?: number; format?: string; }>; required: string[]; } export declare function useAIForm<T extends FieldValues = any>(form?: UseFormReturn<T>, apiKeyOverride?: string): { register: (name: Path<T>, options?: { required?: boolean; fillRequired?: boolean; type?: "string" | "number" | "boolean" | "array" | "radio" | "select"; pattern?: RegExp; enum?: any[]; min?: number; max?: number; format?: string; itemType?: string; }) => import("react-hook-form").UseFormRegisterReturn<Path<T>> | import("react-hook-form").ControllerRenderProps<T, Path<T>> | { checked: any; onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; onBlur: import("react-hook-form").ChangeHandler; ref: import("react-hook-form").RefCallBack; name: Path<T>; min?: string | number; max?: string | number; maxLength?: number; minLength?: number; pattern?: string; required?: boolean; disabled?: boolean; }; handleSubmit: import("react-hook-form").UseFormHandleSubmit<T, T>; getSchema: () => JSONSchema; fillFromPrompt: (promptArg?: string, schema?: JSONSchema) => Promise<void>; isLoading: boolean; hasSchema: boolean; watch: import("react-hook-form").UseFormWatch<T>; getValues: import("react-hook-form").UseFormGetValues<T>; getFieldState: import("react-hook-form").UseFormGetFieldState<T>; setError: import("react-hook-form").UseFormSetError<T>; clearErrors: import("react-hook-form").UseFormClearErrors<T>; setValue: import("react-hook-form").UseFormSetValue<T>; trigger: import("react-hook-form").UseFormTrigger<T>; formState: import("react-hook-form").FormState<T>; resetField: import("react-hook-form").UseFormResetField<T>; reset: import("react-hook-form").UseFormReset<T>; unregister: import("react-hook-form").UseFormUnregister<T>; control: import("react-hook-form").Control<T, any, T>; setFocus: import("react-hook-form").UseFormSetFocus<T>; subscribe: import("react-hook-form").UseFromSubscribe<T>; };