import { Validator, ValidatorOutput, AsyncValidator } from '../Validator'; interface UseValidationCommonProps { name: string; onValidChange?(name: string, valid: boolean): void; validators: Validator[]; validationKey?: string | number | boolean; asyncValidator?: AsyncValidator; /** defaults to onError from ItiReactCoreContext */ onAsyncError?(e: unknown): void; formLevelValidatorOutput?: ValidatorOutput; } /** * Input components that call [[`useValidation`]] should generally have their * Props interface extend this. */ export interface UseValidationProps extends UseValidationCommonProps { value?: TValue; defaultValue?: TValue; onChange?(value: TValue): void; showValidation: boolean; } export interface UseValidationOptions extends UseValidationCommonProps { value: TValue; } /** * A hook that allows implementing validation in any input component. * * Internally, `useValidation` calls `useMemo` on `validators` and `asyncValidator` * since those props won't have stable identities if defined during the render * as is typical. If `useValidation` did not do this, every component that rendered * a validated component would have to call `useMemo` on `validators` and * `asyncValidator` (or move the definitions outside of the component) to prevent * infinite `useEffect` loops. * * If and when your `validators` or `asyncValidator` do change, you **must** pass a * different `validationKey` for `useValidation` to pick up the changes. * * @typeParam TValue the type of the input's value */ export declare function useValidation({ value, name, validationKey, onAsyncError, formLevelValidatorOutput, ...otherProps }: UseValidationOptions): ValidatorOutput; export {};