UNPKG

1 kBTypeScriptView Raw
1import * as React from "react";
2interface UseAsyncControllableValueProps<E extends HTMLInputElement | HTMLTextAreaElement> {
3 value?: React.InputHTMLAttributes<E>["value"];
4 onChange?: React.ChangeEventHandler<E>;
5 onCompositionStart?: React.CompositionEventHandler<E>;
6 onCompositionEnd?: React.CompositionEventHandler<E>;
7}
8/**
9 * The amount of time (in milliseconds) which the input will wait after a compositionEnd event before
10 * unlocking its state value for external updates via props. See `handleCompositionEnd` for more details.
11 */
12export declare const ASYNC_CONTROLLABLE_VALUE_COMPOSITION_END_DELAY = 10;
13export declare function useAsyncControllableValue<E extends HTMLInputElement | HTMLTextAreaElement>(props: UseAsyncControllableValueProps<E>): {
14 onChange: React.ChangeEventHandler<E>;
15 onCompositionEnd: React.CompositionEventHandler<E>;
16 onCompositionStart: React.CompositionEventHandler<E>;
17 value: string | number | readonly string[] | undefined;
18};
19export {};