/**
 * Copyright 2023 Kapeta Inc.
 * SPDX-License-Identifier: MIT
 */
import React from 'react';
import './FormContainer.less';
import { FormContextType } from './FormContext';
import { ValidatorList } from '../validation/Validators';
export type FormChangeHandler = (formState: FormStateChangeEvent) => void;
export interface FormStateChangeEvent {
    type: string;
    value: any;
}
export type FormData = {
    [key: string]: any;
};
export interface FormContainerProps<TData> {
    onSubmit?: () => void | Promise<void>;
    onReset?: () => void;
    validators?: ValidatorList;
    initialValue?: TData;
    onSubmitData?: (data: TData) => void | Promise<void>;
    onChange?: (data: TData) => void;
    children: any;
}
interface State<TData> {
    formData: TData;
    readyStates: {
        [key: string]: boolean;
    };
    valid: boolean;
    processing: boolean;
    isDirty: boolean;
}
export declare class FormContainer<TData extends FormData = any> extends React.Component<FormContainerProps<TData>, State<TData>> {
    static contextType: FormContextType;
    context: React.ContextType<FormContextType>;
    container: HTMLDivElement | null;
    private readonly submitClickHandler;
    private readonly resetClickHandler;
    private readonly changeHandlers;
    private readonly resetListeners;
    constructor(props: FormContainerProps<TData>);
    getValue(name: string): any;
    private onValueChanged;
    private onReadyStateChanged;
    private isValid;
    private emitFormStateChange;
    onFormStateChanged(handler: FormChangeHandler): () => void;
    private addResetListener;
    private renderFormContainer;
    private processingWhile;
    private shouldSubmitForm;
    submit(): Promise<void>;
    private emitChange;
    reset(): void;
    private handleResetClick;
    private handleSubmitClick;
    private handleKeyPress;
    private bindButtons;
    private hasParentContainer;
    private focusFirstUnready;
    componentDidMount(): void;
    componentDidUpdate(prevProps: FormContainerProps<TData>): void;
    render(): React.JSX.Element;
}
export {};
