import React from "react"; export interface ApplyValueCb { (value: TValue): void; } /** * This component is used to wrap Input and Textarea components to optimize form re-render. * These 2 are the only components that trigger form model change on each character input. * This means, whenever you type a letter an entire form re-renders. * On complex forms you will feel and see a significant delay if this component is not used. * * The logic behind this component is to serve as a middleware between Form and Input/Textarea, and only notify form of a change when * a user stops typing for given period of time (400ms by default). */ export interface OnChangeCallable { (value: TValue, cb?: ApplyValueCb): void; } interface OnBlurCallable { (ev: React.SyntheticEvent): void; } interface OnKeyDownCallable { (ev: React.KeyboardEvent): void; } interface ChildrenCallableParams { value: TValue; onChange: OnChangeCallable; } interface ChildrenCallable { (params: ChildrenCallableParams): React.ReactElement; } export interface DelayedOnChangeProps { value?: TValue; delay?: number; onChange?: OnChangeCallable; onBlur?: OnBlurCallable; onKeyDown?: OnKeyDownCallable; children: React.ReactNode | ChildrenCallable; } export declare const DelayedOnChange: ({ children, ...other }: DelayedOnChangeProps) => React.ReactElement>; export {};