UNPKG

3.11 kBTypeScriptView Raw
1import * as React from 'react';
2import { OUIAProps } from '../../helpers';
3export declare enum TextInputTypes {
4 text = "text",
5 date = "date",
6 datetimeLocal = "datetime-local",
7 email = "email",
8 month = "month",
9 number = "number",
10 password = "password",
11 search = "search",
12 tel = "tel",
13 time = "time",
14 url = "url"
15}
16export interface TextInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'>, OUIAProps {
17 /** Additional classes added to the TextInput. */
18 className?: string;
19 /** Flag to show if the input is disabled. */
20 isDisabled?: boolean;
21 /** Flag to show if the input is read only. */
22 isReadOnly?: boolean;
23 /** Flag to show if the input is required. */
24 isRequired?: boolean;
25 /** Value to indicate if the input is modified to show that validation state.
26 * If set to success, input will be modified to indicate valid state.
27 * If set to error, input will be modified to indicate error state.
28 */
29 validated?: 'success' | 'warning' | 'error' | 'default';
30 /** A callback for when the input value changes. */
31 onChange?: (value: string, event: React.FormEvent<HTMLInputElement>) => void;
32 /** Type that the input accepts. */
33 type?: 'text' | 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'time' | 'url';
34 /** Value of the input. */
35 value?: string | number;
36 /** Aria-label. The input requires an associated id or aria-label. */
37 'aria-label'?: string;
38 /** A reference object to attach to the input box. */
39 innerRef?: React.RefObject<any>;
40 /** Trim text on left */
41 isLeftTruncated?: boolean;
42 /** Callback function when input is focused */
43 onFocus?: (event?: any) => void;
44 /** Callback function when input is blurred (focus leaves) */
45 onBlur?: (event?: any) => void;
46 /** icon variant */
47 iconVariant?: 'calendar' | 'clock' | 'search';
48 /** Use the external file instead of a data URI */
49 isIconSprite?: boolean;
50 /** Custom icon url to set as the input's background-image */
51 customIconUrl?: string;
52 /** Dimensions for the custom icon set as the input's background-size */
53 customIconDimensions?: string;
54}
55interface TextInputState {
56 ouiaStateId: string;
57}
58export declare class TextInputBase extends React.Component<TextInputProps, TextInputState> {
59 static displayName: string;
60 static defaultProps: TextInputProps;
61 inputRef: React.RefObject<HTMLInputElement>;
62 observer: any;
63 constructor(props: TextInputProps);
64 handleChange: (event: React.FormEvent<HTMLInputElement>) => void;
65 componentDidMount(): void;
66 componentWillUnmount(): void;
67 handleResize: () => void;
68 restoreText: () => void;
69 onFocus: (event?: any) => void;
70 onBlur: (event?: any) => void;
71 render(): JSX.Element;
72 private sanitizeInputValue;
73}
74export declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
75export {};
76//# sourceMappingURL=TextInput.d.ts.map
\No newline at end of file