import { RefObject } from 'react'; import { Observer } from '@jalik/observer'; import { FieldPath, Values } from './useFormState'; export type FieldStatus = { /** * Tells if the field was modified. */ modified: boolean; /** * The field name. */ name: string; /** * The previous field value. */ previousValue: T | null | undefined; /** * Tells if the field was touched. */ touched: boolean; /** * The current field value. */ value: T | null | undefined; }; export type UseFormWatchHook = { /** * Notifies all watchers that a field changed. * @param path * @param status */ notifyWatchers(path: FieldPath, status: FieldStatus): void; /** * Adds a watcher that is notified when the field changed. * @param path * @param callback */ watch(path: FieldPath, callback: (status: FieldStatus) => void): void; /** * Registered watchers. */ watchers: RefObject>; }; export declare function inputChangeEvent(name: string): string; declare function useFormWatch(): UseFormWatchHook; export default useFormWatch; //# sourceMappingURL=useFormWatch.d.ts.map