import * as React from 'react'; import { ValidatorData, ValueMap } from '../../types'; import { BoundComponent } from '../bind'; export declare const FormContext: React.Context; export interface FormApi { clear: Form['clear']; reset: Form['reset']; validate: Form['validate']; isValid: Form['isValid']; isPristine: Form['isPristine']; getValidatorData: Form['getValidatorData']; getValue: Form['getValue']; getValues: Form['getValues']; setValidatorData: Form['setValidatorData']; setValue: Form['setValue']; setValues: Form['setValues']; onComponentMount: Form['handleComponentMount']; onComponentUnmount: Form['handleComponentUnmount']; onComponentUpdate: Form['handleComponentUpdate']; onComponentBlur: Form['handleComponentBlur']; onComponentFocus: Form['handleComponentFocus']; registerMirror: Form['registerMirror']; unregisterMirror: Form['unregisterMirror']; initialValues: FormProps['initialValues']; debug?: FormProps['debug']; } export interface FormProps { /** * Called when the value of a bound form component has been changed. * @param {string} componentName name of the component * @param {object} value new value */ onChange?: (componentName: keyof FormFields, value: any) => void; /** * Called when a bound form component has been blurred. * @param {string} componentName name of the component * @param {object} value current value */ onBlur?: (componentName: keyof FormFields, value: any, event: any) => void; /** * Called when a bound form component has been focused. * @param {string} componentName name of the component * @param {object} value current value */ onFocus?: (componentName: keyof FormFields, value: any, event: any) => void; /** * Called when a component updates * @param {string} componentName name of the component */ onUpdate?: (componentName: keyof FormFields) => void; /** * Called when the form is programmatically submitted, or a button with type="submit" is clicked. * @param {object} values name/value pairs for all bound form components. */ onSubmit?: (values: FormFields) => void; /** * Called after onSubmit if all bound form components are valid. * @param {object} values name/value pairs for all bound form components. */ onValidSubmit?: (values: FormFields) => void; /** * Called after onSubmit at least 1 bound form component is invalid.x * @param {object} values name/value pairs for all bound form components. */ onInvalidSubmit?: (values: FormFields) => void; /** * A transformer func which allows the final form value to be manipulated. * The calculated value that `getValue` would normally return is provided * as an argument to this transformer. * * The returned value will take precedence over the value normally returned * by `getValue`. It will also be use for form validation and provided to * bound components. If it is not necessary to modify the value, simply * return the provided value and `getValue` will behave as normal. */ valueTransformer?: (componentName: keyof FormFields, value: any) => any; /** * If you don't want to modify the values, simply return the provided values. * * A transformer func which is used to manipulate the entire form values to * be manipulated. It is calculated after any individual `valueTransformer`'s * have been applied. * * The returned value will take precedence over the value normally returned by * `getValues`. If it is not necessary to modify the value, simply return the * provided value and `getValue` will behave as normal * */ valuesTransformer?: (values: FormFields) => FormFields; /** * Whether a hidden submit should be rendered within the form. The existence of a * `