import * as React from "react"; import { FormexController } from "./types"; export interface FieldInputProps { /** Value of the field */ value: Value; /** Name of the field */ name: string; /** Multiple select? */ multiple?: boolean; /** Is the field checked? */ checked?: boolean; /** Change event handler */ onChange: (event: React.SyntheticEvent) => void; /** Blur event handler */ onBlur: (event: React.FocusEvent) => void; } export interface FormexFieldProps { field: FieldInputProps; form: FormexController; } export interface FieldConfig { /** * Component to render. Can either be a string e.g. 'select', 'input', or 'textarea', or a component. */ as?: C | string | React.ForwardRefExoticComponent>; /** * Children render function {props => ...}) */ children?: ((props: FormexFieldProps) => React.ReactNode) | React.ReactNode; /** * Validate a single field value independently */ /** * Used for 'select' and related input types. */ multiple?: boolean; /** * Field name */ name: string; /** HTML input type */ type?: string; /** Field value */ value?: unknown; /** Inner ref */ innerRef?: (instance: unknown) => void; } export type FieldProps = { as?: C; } & (C extends React.ElementType ? (React.ComponentProps & FieldConfig) : FieldConfig); export declare function Field({ validate, name, children, as: is, // `as` is reserved in typescript lol className, ...props }: FieldProps): any;