import { TextAreaProps, TextInputProps } from '@patternfly/react-core'; import * as React from 'react'; import * as yup from 'yup'; import { ValidateOptions } from 'yup/lib/types'; export interface IFormField { value: T; setValue: React.Dispatch>; defaultValue: T; cleanValue: T; reinitialize: (value: T) => void; prefill: (value: T) => void; markSaved: () => void; clear: () => void; revert: () => void; isDirty: boolean; isTouched: boolean; setIsTouched: (isTouched: boolean) => void; schema: yup.AnySchema; } export interface IValidatedFormField extends IFormField { error: yup.ValidationError | null; isValid: boolean; shouldShowError: boolean; } type FormFields = { [key in keyof TFieldValues]: IFormField; }; type ValidatedFormFields = { [key in keyof TFieldValues]: IValidatedFormField; }; export interface IFormState { fields: ValidatedFormFields; values: TFieldValues; isDirty: boolean; isTouched: boolean; isValid: boolean; setValues: (newValues: Partial) => void; reinitialize: (newValues: Partial) => void; prefill: (newValues: Partial) => void; markSaved: () => void; clear: () => void; revert: () => void; } export declare const useFormField: (initialValue: T, schema: yup.AnySchema, options?: { initialTouched?: boolean | undefined; onChange?: ((newValue: T) => void) | undefined; }) => IFormField; export declare const useFormState: (fields: FormFields, options?: { revalidateOnChange?: unknown[] | undefined; yupOptions?: ValidateOptions<{}> | undefined; }) => IFormState; export interface FormGroupOptions { greenWhenValid?: boolean; } export interface TextFieldOptions { greenWhenValid?: boolean; onBlur?: () => void; onChange?: (value: string) => void; } export declare const getTextFieldProps: (field: IValidatedFormField | IValidatedFormField, options?: TextFieldOptions) => Pick; export declare const getTextInputProps: (field: IValidatedFormField | IValidatedFormField, options?: TextFieldOptions) => Partial; export declare const getTextAreaProps: (field: IValidatedFormField | IValidatedFormField, options?: TextFieldOptions) => Partial; export {};