import { type TFormField } from 'feature-form'; import { type ChangeEventHandler, type FocusEventHandler } from 'react'; import { type TIsWideString } from './types'; /** * Returns `name`, `defaultValue`/`value`, `onChange`, and `onBlur` props for binding * a native input, textarea, or select to a form field. * * Uncontrolled by default: `onChange` sets the field value with `background: true` so React * does not re-render on every keystroke. Set `controlled: true` for a controlled input. * Non-string fields require `format` (field value to display string) and `parse` (string to field value). */ export declare function getFieldInputProps(formField: TFormField, ...[options]: TFieldInputOptionsArgs): TFieldInputProps; export interface TFieldInputProps { defaultValue?: string; value?: string; name: GKey; onChange: ChangeEventHandler; onBlur: FocusEventHandler; } /** Requires `format` and `parse` for non-string field values. */ export type TFieldInputOptionsArgs = TIsWideString extends true ? [options?: TFieldInputOptions] : [options: TParsedFieldInputOptions]; export interface TFieldInputOptions { /** Use a controlled input. Defaults to `false`. */ controlled?: boolean; /** Converts the field value to a display string. */ format?: (value: GValue) => string | undefined; /** Converts the input string back to the field value type. */ parse?: (value: string) => GValue; } export interface TParsedFieldInputOptions { /** Use a controlled input. Defaults to `false`. */ controlled?: boolean; /** Converts the field value to a display string. */ format: (value: GValue) => string | undefined; /** Converts the input string back to the field value type. */ parse: (value: string) => GValue; } type TFieldInputElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement; export {};