import React, { Component, ReactNode } from 'react'; export declare type IFieldValues = { [key: string]: any; }; export declare type IFieldErrors = { [key: string]: string; }; export declare type IFieldTouched = { [key: string]: boolean; }; export declare type IFormState = { values: V; initial: V; errors: IFieldErrors; touched: IFieldTouched; }; export declare type IFormActions = { setAllValues: (values: V) => void; setAllErrors: (errors: IFieldErrors) => void; setAllTouched: (touched: IFieldTouched) => void; setValue: (name: string, value: any) => void; setError: (name: string, error: string) => void; setTouched: (name: string) => void; }; export declare type IFormValidationActions = IFormActions & { validateFields: () => Promise; validateField: (name: string) => Promise; }; export declare type IFormProps = { initial: V; children: ReactNode | ((state: IFormState, actions: IFormActions) => JSX.Element); }; export declare const FormContext: React.Context<[IFormState, IFormActions]>; export declare function useFormContext(): [IFormState, IFormActions]; export declare function useFormValidationContext(): [IFormState, IFormValidationActions]; export declare class FormProvider extends Component & P, IFormState> { constructor(props: IFormProps & P); setAllValues(values: IFormState['values'], cb?: () => void): void; setAllErrors(errors: IFormState['errors'], cb?: () => void): void; setAllTouched(touched: IFormState['touched'], cb?: () => void): void; setValue(name: string, value: any, cb?: () => void): void; setError(name: string, value: string, cb?: () => void): void; setTouched(name: string, cb?: () => void): void; buildActions(): IFormActions; actions: IFormActions; render(): JSX.Element; }