import React, { Component } from 'react'; import { FormFieldProps } from './formField'; type Props = { /** Form content */ children: any; ignoreValidation?: boolean; /** * @param {Object} values Values of form fields * @param {Object} validation Validation errors and messages of form fields */ onSubmit: (values: { [key: string]: any; }, validation: { [key: string]: {}; }) => void; /** * @param {Object} values Values of form fields * @param {Object} validation Validation errors and messages of form fields */ onInvalidSubmit?: (values: { [key: string]: any; }, validation: { [key: string]: {}; }) => void; /** Initial validation errors and messages of form fields */ validation?: { [key: string]: {}; }; /** Initial values of form fields _(will be overwritten by an individually set value on a form field)_ */ values?: { [key: string]: any; }; /** Position labels above form fields (inline by default) */ vertical?: boolean; }; type State = { isSubmitted: boolean; validation: { [key: string]: {} | undefined; }; values: { [key: string]: any; }; }; export type FieldValidation = { maxLength?: number; messageId: string; type: 'danger'; }; type FormContextType = { formSubmitted: boolean; updateField: (target: FormFieldProps, value: any, validationRules?: (target: FormFieldProps, value: any) => FieldValidation | undefined) => void; validation: { [key: string]: FieldValidation | undefined; }; values: { [key: string]: any; }; vertical?: boolean; }; export declare const FormContext: React.Context; /** __WIP__ Custom form solution */ export declare class Form extends Component { static defaultProps: { ignoreValidation: boolean; validation: {}; values: {}; vertical: boolean; }; state: { isSubmitted: boolean; validation: {}; values: { [key: string]: any; }; }; submitForm: (event: React.FormEvent) => { isFormValid: boolean; } | undefined; validateFormFields: () => { isFormValid: boolean; } | undefined; scrollToFirstInvalidField: (firstInvalidField: HTMLInputElement) => void; triggerFieldInvalidState: (invalidField: HTMLInputElement) => void; submitInvalidForm: () => void; updateValidation: (name: string, validation?: {}) => void; updateValue: (name: string, value: any) => void; render(): import("react/jsx-runtime").JSX.Element; } export {};