1 | import * as React from "react";
|
2 | export interface IAsyncControllableInputProps extends React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
3 | inputRef?: React.LegacyRef<HTMLInputElement>;
|
4 | }
|
5 | declare type InputValue = IAsyncControllableInputProps["value"];
|
6 | export interface IAsyncControllableInputState {
|
7 | /**
|
8 | * Whether we are in the middle of a composition event.
|
9 | *
|
10 | * @default false
|
11 | */
|
12 | isComposing: boolean;
|
13 | /**
|
14 | * The source of truth for the input value. This is not updated during IME composition.
|
15 | * It may be updated by a parent component.
|
16 | *
|
17 | * @default ""
|
18 | */
|
19 | value: InputValue;
|
20 | /**
|
21 | * The latest input value, which updates during IME composition. Defaults to props.value.
|
22 | */
|
23 | nextValue: InputValue;
|
24 | /**
|
25 | * Whether there is a pending update we are expecting from a parent component.
|
26 | *
|
27 | * @default false
|
28 | */
|
29 | hasPendingUpdate: boolean;
|
30 | }
|
31 | /**
|
32 | * A stateful wrapper around the low-level <input> component which works around a
|
33 | * [React bug](https://github.com/facebook/react/issues/3926). This bug is reproduced when an input
|
34 | * receives CompositionEvents (for example, through IME composition) and has its value prop updated
|
35 | * asychronously. This might happen if a component chooses to do async validation of a value
|
36 | * returned by the input's `onChange` callback.
|
37 | *
|
38 | * Note: this component does not apply any Blueprint-specific styling.
|
39 | */
|
40 | export declare class AsyncControllableInput extends React.PureComponent<IAsyncControllableInputProps, IAsyncControllableInputState> {
|
41 | static displayName: string;
|
42 | state: IAsyncControllableInputState;
|
43 | static getDerivedStateFromProps(nextProps: IAsyncControllableInputProps, nextState: IAsyncControllableInputState): Partial<IAsyncControllableInputState> | null;
|
44 | render(): JSX.Element;
|
45 | private handleCompositionStart;
|
46 | private handleCompositionEnd;
|
47 | private handleChange;
|
48 | }
|
49 | export {};
|