export interface IHandleChangeOptions { regex?: RegExp; errorMessage?: string; required?: boolean; requiredMessage?: string; validate?: (value: string) => boolean; formatter?: (value: string) => string; } export interface IUseFormOptions { debugging?: boolean; } export type TFormKey = string | number; export type TFormValue = any; export type TErrorValue = string; export type TFormState = Record; export type TErrorState = Record; /** * useForm hook is build for basic form management for Intugine Component library. * Easy to manage, provides ready-made reusable functions, and inbuilt validation support * @param initialFormState use it to initialize your form, Optional * @param options form options * @returns object of state and helper functions */ declare const useForm: (initialFormState?: TFormState, options?: IUseFormOptions) => { form: TFormState; initForm: (newInitialState?: TFormState) => TFormState; clearForm: () => void; handleTextbox: (key: TFormKey, options?: IHandleChangeOptions) => (e: React.ChangeEvent) => void; handleToggle: (key: TFormKey) => () => void; handleValue: (key: TFormKey, options?: IHandleChangeOptions) => (value: any) => void; setFields: (value: Partial | React.SetStateAction>) => void; errors: TErrorState; setAllErrors: (errors: TErrorState) => void; setError: (key: TFormKey, error: TErrorValue) => void; }; export default useForm;