import React from 'react';

interface FormPropsInterface {
    afterChange?(fields: object, path: string | null, hasErrors: boolean, getErrors: any): any;
    autoCompleteOff?: boolean;
    children: React.ReactElement;
    clearAfterSubmit?: any;
    disabled?: boolean;
    disableIf?(fields: object): boolean;
    disableIfNoUpdates?: boolean;
    disableIfInvalid?: boolean;
    initialValues: object;
    refresh?: boolean;
    onInvalidSubmit?(): any;
    onReset?(fields: object): any;
    onSubmit?(fields: object): any;
    schemaValidation?: object;
    render?: string;
    rest?: any;
}
declare function Form({ afterChange, autoCompleteOff, children, clearAfterSubmit, disabled, disableIf, disableIfNoUpdates, disableIfInvalid, initialValues, refresh, onInvalidSubmit, onReset, onSubmit, schemaValidation, render, // TODO: Check render is a legal value, otherwise replace it with "div"
...rest }: FormPropsInterface): JSX.Element;

interface FieldPropsInterface {
    afterChange?(value?: any, path?: string, error?: boolean): any;
    autoCapitalizeOn?: boolean;
    autoCompleteOff?: boolean;
    autoCorrectOn?: boolean;
    children: React.ReactElement;
    disabled?: boolean;
    path: string;
    getValueFromArgs?(args: any): any;
    isErrorProp?: string;
    onChangeProp?: string;
    spellCheckOn?: boolean;
    trim?: boolean;
    type?: string;
    valueProp?: string;
    rest?: any;
}
declare function Field({ afterChange, autoCapitalizeOn, autoCompleteOff, autoCorrectOn, children, disabled: locallyDisabled, path, getValueFromArgs, isErrorProp, onChangeProp, spellCheckOn, trim, type, valueProp, ...rest }: FieldPropsInterface): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;

interface SubmitInterface {
    children: React.ReactElement;
    disabled?(): boolean;
    rest?: any;
}
declare function Submit({ disabled: locallyDisabled, children, ...rest }: SubmitInterface): React.ReactElement<any, string | React.JSXElementConstructor<any>>;

interface ResetInterface {
    children: React.ReactElement;
    onClick?(): any;
    rest?: any;
}
declare function Reset({ children, onClick, ...rest }: ResetInterface): React.ReactElement<any, string | React.JSXElementConstructor<any>>;

interface childrenInterface {
    path: string;
    items: Array<any>;
    removeItem(index: number): void;
    addItem(): void;
    disabled: boolean;
}
interface FieldArrayPropsInterface {
    children?(object: childrenInterface): React.ReactElement;
    path: string;
    model: any;
    startWithOneMore?: boolean;
}
declare function FieldArray({ children, path, model, startWithOneMore, }: FieldArrayPropsInterface): ((object: childrenInterface) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) | JSX.Element | null;

declare function useField(path: string, config?: {
    native?: boolean;
    trim?: boolean;
    afterChange?(value: any, path: string, error: boolean): any;
    disabled?: boolean;
}): {
    value: any;
    setValue: (next: any) => void;
    error: boolean;
    disabled: boolean | undefined;
    onBlur: () => void;
} | undefined;

declare function useFieldObserver(path: string, userHandler?: (event: any) => any): any;

declare function useSubmitListener(handler?: () => any): void;

declare function useResetListener(handler?: () => any): void;

interface FormContextInterface {
    disabled: boolean;
    formId: string;
    handleSubmit(event: React.ChangeEvent<HTMLInputElement>, updatedKeys: string[]): any;
    getErrors(): any;
    getFields(): object;
    getOneField(path: string): any;
    getOneUpdated(path: string): any;
    getOneError(path: string): boolean;
    getUpdatesList(): string[];
    hasUpdates(): boolean;
    hasErrors(): boolean;
    registerFieldObserver(path: string): void;
    render: string;
    resetForm(): void;
    setOneError(path: string, isError: boolean): void;
    setOneField(path: string, value: any): void;
    setOneUpdated(path: string): void;
    unsetOneField(path: string): void;
    schemaValidation: object;
}
declare const useForm: () => FormContextInterface | null;

export { Field, FieldArray, Form, Reset, Submit, useField, useFieldObserver, useForm, useResetListener, useSubmitListener };
