import * as React from 'react'; import { PathMatchingValue } from './helpers/path-helpers'; import { FormikProps, GenericFieldHTMLAttributes, FieldMetaProps, FieldInputProps, FieldValidator, SingleValue, ParseFn, FormatFn } from './types'; export declare type FieldHookConfig = { as?: any; } & FieldPassThroughConfig; export declare type FieldConfig = FieldAsStringConfig | FieldAsComponentConfig | FieldStringComponentConfig | FieldComponentConfig | FieldRenderConfig | FieldChildrenConfig | FieldDefaultConfig; /** * CustomField, AsField, ComponentField definitions */ export declare type CustomField = (props: FieldConfig) => React.ReactElement | null; export declare type TypedField = (props: FieldConfig) => React.ReactElement | null; export declare type FieldByValue = (props: FieldConfig) => React.ReactElement | null; /** * AsField */ export declare type FieldAsProps = FieldPassThroughConfig & FieldInputProps; export declare type TypedAsField = (props: React.PropsWithChildren>) => React.ReactElement | null; export declare abstract class FieldAsClass extends React.Component> { } /** * ComponentField */ export declare type FieldComponentProps = FieldPassThroughConfig & LegacyBag; export declare abstract class FieldComponentClass extends React.Component> { } /** * @deprecated use `FieldConfig` */ export declare type FieldAttributes = FieldConfig; /** * These props are passed from FieldConfig to FieldProps. * * @private */ export declare type FieldPassThroughConfig = { /** * Validate a single field value independently */ validate?: FieldValidator>; /** * Function to parse raw input value before setting it to state */ parse?: ParseFn>; /** * Function to transform value passed to input */ format?: FormatFn>; /** * Wait until blur event before formatting input value? * @default false */ formatOnBlur?: boolean; /** * HTML multiple attribute */ multiple?: boolean; /** * Field name */ name: PathMatchingValue; /** HTML input type */ type?: string; /** checkbox value to match against current value */ value?: SingleValue; /** Inner ref */ innerRef?: (instance: any) => void; }; export declare type FieldAsComponent = any extends Values ? React.ComponentType : React.ComponentType>; declare type FieldComponentComponent = any extends Values ? React.ComponentType : React.ComponentType>; declare type GenericFieldHTMLConfig = Omit>; /** * Passed to ``. */ declare type LegacyBag = { field: FieldInputProps; form: FormikProps; }; /** * Passed to `render={Function}` or `children={Function}`. */ export declare type FieldRenderProps = LegacyBag & { meta: FieldMetaProps; }; export declare type FieldRenderFunction = (props: FieldRenderProps) => React.ReactElement | null; /** * @deprecated Field types do not share common props. Please choose: * * FieldComponentProps: `field.component = Component`, * FieldAsProps: `field.as = Component`, * FieldRenderProps: `field.render, field.children = Function` */ export declare type FieldProps = FieldRenderProps; export declare type TypedComponentField = (props: FieldComponentProps) => React.ReactElement | null; /** * `field.as = string` * * @private */ export declare type FieldAsStringConfig = React.PropsWithChildren<{ as: string; component?: undefined; render?: undefined; }> & FieldPassThroughConfig & GenericFieldHTMLConfig; /** * `field.as = Component` * * @private */ export declare type FieldAsComponentConfig = React.PropsWithChildren<{ as: TypedAsField | FieldAsComponent; component?: undefined; render?: undefined; }> & FieldPassThroughConfig; /** * `field.component = string` * * @private */ export declare type FieldStringComponentConfig = React.PropsWithChildren<{ component: string; as?: undefined; render?: undefined; }> & FieldPassThroughConfig & GenericFieldHTMLConfig; /** * `field.component = Component` * * @private */ export declare type FieldComponentConfig = React.PropsWithChildren<{ component: FieldComponentComponent; as?: undefined; render?: undefined; }> & FieldPassThroughConfig; /** * `field.render = Function` * * @private */ export declare type FieldRenderConfig = { render: FieldRenderFunction; as?: undefined; component?: undefined; children?: undefined; } & FieldPassThroughConfig; /** * `field.children = Function` * * @private */ export declare type FieldChildrenConfig = { children: FieldRenderFunction; as?: undefined; component?: undefined; render?: undefined; } & FieldPassThroughConfig; /** * no config, `` * * @private */ export declare type FieldDefaultConfig = { as?: undefined; component?: undefined; render?: undefined; children?: undefined; } & FieldPassThroughConfig & GenericFieldHTMLConfig; export {};