1 | import * as React from 'react';
|
2 | import { FormikConfig, FormikErrors, FormikState, FormikTouched, FormikValues, FieldMetaProps, FieldHelperProps, FieldInputProps } from './types';
|
3 | export declare function useFormik<Values extends FormikValues = FormikValues>({ validateOnChange, validateOnBlur, validateOnMount, isInitialValid, enableReinitialize, onSubmit, ...rest }: FormikConfig<Values>): {
|
4 | initialValues: Values;
|
5 | initialErrors: FormikErrors<unknown>;
|
6 | initialTouched: FormikTouched<unknown>;
|
7 | initialStatus: any;
|
8 | handleBlur: {
|
9 | (e: React.FocusEvent<any>): void;
|
10 | <T = any>(fieldOrEvent: T): T extends string ? (e: any) => void : void;
|
11 | };
|
12 | handleChange: {
|
13 | (e: React.ChangeEvent<any>): void;
|
14 | <T_1 = string | React.ChangeEvent<any>>(field: T_1): T_1 extends React.ChangeEvent<any> ? void : (e: string | React.ChangeEvent<any>) => void;
|
15 | };
|
16 | handleReset: (e: any) => void;
|
17 | handleSubmit: (e?: React.FormEvent<HTMLFormElement> | undefined) => void;
|
18 | resetForm: (nextState?: Partial<FormikState<Values>> | undefined) => void;
|
19 | setErrors: (errors: FormikErrors<Values>) => void;
|
20 | setFormikState: (stateOrCb: FormikState<Values> | ((state: FormikState<Values>) => FormikState<Values>)) => void;
|
21 | setFieldTouched: (field: string, touched?: boolean, shouldValidate?: boolean | undefined) => Promise<FormikErrors<Values>> | Promise<void>;
|
22 | setFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => Promise<FormikErrors<Values>> | Promise<void>;
|
23 | setFieldError: (field: string, value: string | undefined) => void;
|
24 | setStatus: (status: any) => void;
|
25 | setSubmitting: (isSubmitting: boolean) => void;
|
26 | setTouched: (touched: FormikTouched<Values>, shouldValidate?: boolean | undefined) => Promise<FormikErrors<Values>> | Promise<void>;
|
27 | setValues: (values: React.SetStateAction<Values>, shouldValidate?: boolean | undefined) => Promise<FormikErrors<Values>> | Promise<void>;
|
28 | submitForm: () => Promise<any>;
|
29 | validateForm: (values?: Values) => Promise<FormikErrors<Values>>;
|
30 | validateField: (name: string) => Promise<void> | Promise<string | undefined>;
|
31 | isValid: boolean;
|
32 | dirty: boolean;
|
33 | unregisterField: (name: string) => void;
|
34 | registerField: (name: string, { validate }: any) => void;
|
35 | getFieldProps: (nameOrOptions: any) => FieldInputProps<any>;
|
36 | getFieldMeta: (name: string) => FieldMetaProps<any>;
|
37 | getFieldHelpers: (name: string) => FieldHelperProps<any>;
|
38 | validateOnBlur: boolean;
|
39 | validateOnChange: boolean;
|
40 | validateOnMount: boolean;
|
41 | values: Values;
|
42 | errors: FormikErrors<Values>;
|
43 | touched: FormikTouched<Values>;
|
44 | isSubmitting: boolean;
|
45 | isValidating: boolean;
|
46 | status?: any;
|
47 | submitCount: number;
|
48 | };
|
49 | export declare function Formik<Values extends FormikValues = FormikValues, ExtraProps = {}>(props: FormikConfig<Values> & ExtraProps): JSX.Element;
|
50 |
|
51 |
|
52 |
|
53 | export declare function yupToFormErrors<Values>(yupError: any): FormikErrors<Values>;
|
54 |
|
55 |
|
56 |
|
57 | export declare function validateYupSchema<T extends FormikValues>(values: T, schema: any, sync?: boolean, context?: any): Promise<Partial<T>>;
|
58 |
|
59 |
|
60 |
|
61 | export declare function prepareDataForValidation<T extends FormikValues>(values: T): FormikValues;
|