import { ReactNode } from 'react'; import { AnyObject } from '../common-types/any-object'; import messages from '../validators/messages'; export type DataTypeValidators = 'string' | 'integer' | 'boolean' | 'number' | 'float'; export type ValidatorFunction = Record, TMeta extends Record = Record> = (value: TValue, allValues?: TFormValues, meta?: TMeta) => Promise | ReactNode | { type: 'warning'; error: any; } | undefined; export interface ValidatorConfiguration extends AnyObject { type: string; message?: string | ((value: TValue) => string); msg?: string | ((value: TValue) => string); warning?: boolean; } export type Validator = Record, TMeta extends Record = Record> = ValidatorConfiguration | ValidatorFunction; export interface LengthOptions extends ValidatorConfiguration { '='?: string | number; is?: number; max?: number; maximum?: number; min?: number; minimum?: number; } export interface LenghtOptions extends LengthOptions { } export interface PatternOptions extends ValidatorConfiguration { pattern?: string | RegExp; flags?: string; } export interface NumericalityOptions extends ValidatorConfiguration { even?: boolean; odd?: boolean; equalTo?: number; otherThan?: number; greaterThan?: number; lessThan?: number; greaterThanOrEqualTo?: number; lessThanOrEqualTo?: number; '='?: string | number; '!='?: string | number; '>'?: string | number; '<'?: string | number; '>='?: string | number; '<='?: string | number; } interface ValidatorsType { messages: typeof messages; urlProtocols: string[]; } declare const Validators: ValidatorsType; export default Validators;