import * as React from 'react'; import * as objectManager from './src/utils/object-manager'; import {FunctionComponent} from 'react'; import {ComponentClass} from 'react'; export interface IFieldMeta { focused: boolean; active: boolean; blurred: boolean; changed: boolean; warning: string; error: string; } export type MetaState = { [key in keyof Values]?: Values[key] extends object ? MetaState : IFieldMeta; }; export type MapMessages = { [key in keyof Values]?: Values[key] extends object ? MapMessages : string | null; }; export interface IFormState { submitted: boolean; focused: boolean; blurred: boolean; changed: boolean; errorsMap: MapMessages; hasErrors: boolean; warningsMap: MapMessages; hasWarnings: boolean; activeField: string; } export interface IReduxFormState { form: IFormState; meta: MetaState; values: Values; } export type ValidateMethod = (value?: any) => string | undefined | null; export type ValidateProps = Array | ValidateMethod; export interface IFullReduxFormState { [key: string]: IReduxFormState | IReduxFormWizard | undefined; } export interface IMapValidate { [key: string]: ValidateProps; } export interface IMapErrorsAndWarningsMessages { errors?: MapMessages; warnings?: MapMessages; } export interface IReduxFormSubmitEvent { values: Values; actions: IReduxFormActions; state: IReduxFormState; wizard?: IReduxFormWizard; } export interface IReduxFormActions { registerForm(form: string, wizard?: string): any; registerField(form: string, field: string, value: any, wizard?: string): any; change(form: string, field: string, value: any, wizard?: string): any; focus(form: string, field: string): any; blur(form: string, field: string): any; updateValidateMessage(form: string, field: string, value: any, wizard?: string): any; updateValidateMessages(form: string, errorsMap: MapMessages, submitted?: boolean, wizard?: string): any; updateWarningMessage(form: string, field: string, value?: string, wizard?: string): any; updateWarningMessages(form: string, warningMap: MapMessages, submitted?: string, wizard?: string): any; updateValidateAndWarningMessages( form: string, map: IMapErrorsAndWarningsMessages, submitted?: boolean, wizard?: string, ): any; changeSubmitted(form: string, value: boolean): any; updateFormState( form: string, state: IReduxFormState, wizard?: string, wizardState?: IReduxFormWizard, ): any; removeField(form: string, field: string): any; removeForm(form: string): any; setInitialValues(form: string, initialValues: any, wizard?: string): any; resetForm(form: string, wizard?: string); arrayPush(form: string, field: string, value: any): any; } export type SubmitValidate = (values: Values) => MapMessages; export interface IReduxFormParams { form: string; wizard?: string; destroyOnUnmount?: boolean; validate?: SubmitValidate; warn?: SubmitValidate; initialValues?: Values; } export interface IWizardState { errorsMap: MapMessages; hasErrors: boolean; warningsMap: MapMessages; hasWarnings: boolean; } export interface IReduxFormWizard { wizard: IWizardState; values: Values; } export interface IReduxFormInjected { handleSubmit(): void; formParams: IReduxFormParams; formActions: IReduxFormActions; formState: IReduxFormState; } declare const reducer: () => IFullReduxFormState; /// interface IPropsInjectedForm { [key: string]: any; formParams: IReduxFormParams; formActions: IReduxFormActions; formState: IReduxFormState; handleSubmit(arg: React.SyntheticEvent | ((submitEvent?: IReduxFormSubmitEvent) => void)): () => void; } interface IReduxFormReturnedMethod { (component: React.ComponentType): React.ElementType; } export interface IReduxForm { (params: IReduxFormParams): IReduxFormReturnedMethod, } declare const reduxForm: IReduxForm; export interface IPropInput { value: any; onChange(event: React.ChangeEvent): void; onBlur(event: React.SyntheticEvent): void; onFocus(event: React.SyntheticEvent): void; } export interface IPropsCustomField { input: IPropInput; meta: IFieldMeta; } interface IPropsField extends Partial> { name: string; component: FunctionComponent | ComponentClass | string; warn?: ValidateProps; validate?: ValidateProps; [key: string]: any; } declare const Field: React.ComponentType; interface IPropsFieldArray { component: React.ComponentType; name: string; keyOfId?: string; [key: string]: any; } export interface IFields { length: number; map(callback: (name: string, index: number, fieldArray: Array) => any): Array; push(value: any): void; remove(id: string | number): void; } export interface IPropsInjectedFieldArray { keyOfId: string; fields: IFields; fieldArray: Array; dispatch(actions: any): any; } declare const FieldArray: React.ComponentType; interface IPropsFormSection { name: string; children: React.ReactNode; } declare const FormSection: React.ComponentType; declare const setIn: typeof objectManager.setIn; declare const getIn: typeof objectManager.getIn;