1 | /*
|
---|
2 | * check usage examples in ./example/typescript-example.tsx
|
---|
3 | */
|
---|
4 |
|
---|
5 | import * as React from 'react';
|
---|
6 |
|
---|
7 | interface PropConstraints<T> {
|
---|
8 | readonly value?: string | number;
|
---|
9 | readonly onChange: React.ChangeEventHandler<T>;
|
---|
10 | }
|
---|
11 |
|
---|
12 | export type DebounceInputProps<WrappedComponent, WrappedComponentProps> = WrappedComponentProps & {
|
---|
13 | readonly element?: string | React.ComponentType<PropConstraints<WrappedComponent>>;
|
---|
14 | readonly type?: string;
|
---|
15 | readonly onChange: React.ChangeEventHandler<WrappedComponent>;
|
---|
16 | readonly onKeyDown?: React.KeyboardEventHandler<WrappedComponent>;
|
---|
17 | readonly onBlur?: React.FocusEventHandler<WrappedComponent>;
|
---|
18 | readonly value?: string | number;
|
---|
19 | readonly placeholder?: string | number;
|
---|
20 | readonly minLength?: number;
|
---|
21 | readonly debounceTimeout?: number;
|
---|
22 | readonly forceNotifyByEnter?: boolean;
|
---|
23 | readonly forceNotifyOnBlur?: boolean;
|
---|
24 | readonly inputRef?: React.Ref<WrappedComponent>;
|
---|
25 | };
|
---|
26 |
|
---|
27 | export declare class DebounceInput<
|
---|
28 | WrappedComponent = HTMLInputElement,
|
---|
29 | WrappedComponentProps = React.InputHTMLAttributes<HTMLInputElement>
|
---|
30 | > extends React.PureComponent<DebounceInputProps<WrappedComponent, WrappedComponentProps>> {
|
---|
31 |
|
---|
32 | }
|
---|
33 |
|
---|
34 | export type Debounced<
|
---|
35 | WrappedComponent,
|
---|
36 | WrappedComponentProps
|
---|
37 | > = React.ComponentType<DebounceInputProps<WrappedComponent, WrappedComponentProps>>;
|
---|
38 |
|
---|
39 | export type DebounceTextArea = Debounced<
|
---|
40 | HTMLTextAreaElement,
|
---|
41 | React.TextareaHTMLAttributes<HTMLTextAreaElement>
|
---|
42 | >;
|
---|