import * as React from 'react'; import { FieldDescriptors, ClientError, FieldState } from './types'; import { List, Nested } from './components'; interface RemoteError { field: string[] | null; message: string; } export declare type FormError = RemoteError | ClientError; export declare type FieldStates = { [FieldPath in keyof Fields]: FieldState; }; declare type MaybeArray = T | T[]; declare type MaybePromise = T | Promise; interface SubmitHandler { (fields: FieldStates): MaybePromise | MaybePromise; } export declare type ValidatorDictionary = { [FieldPath in keyof Fields]: MaybeArray>; }; interface ValidationFunction { (value: Value, fields: FieldStates): any; } export interface FormDetails { fields: FieldDescriptors; dirty: boolean; valid: boolean; submitting: boolean; errors: ClientError[]; reset(): void; submit(): void; } interface Props { initialValues: Fields; validators?: Partial>; onSubmit?: SubmitHandler; children(form: FormDetails): React.ReactNode; } interface State { submitting: boolean; errors: ClientError[]; dirtyFields: (keyof Fields)[]; fields: FieldStates; } export default class FormState extends React.PureComponent, State> { static List: typeof List; static Nested: typeof Nested; static getDerivedStateFromProps(newProps: Props, oldState?: State): State | null; state: State; private mounted; componentDidMount(): void; componentWillUnmount(): void; render(): React.ReactNode; private readonly dirty; private readonly valid; private readonly fields; private readonly allErrors; private submit; private reset; private fieldWithHandlers; private updateField; private getUpdatedDirtyFields; private getUpdatedField; private blurField; private validateFieldValue; private updateErrors; } export {};