| 1 |
import { Component } from 'react'; |
| 2 |
import { OUIAProps } from '../../helpers'; |
| 3 |
export 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 |
} |
| 16 |
export declare enum TextInputReadOnlyVariant { |
| 17 |
default = "default", |
| 18 |
plain = "plain" |
| 19 |
} |
| 20 |
export interface TextInputExpandedObj { |
| 21 |
/** Flag to apply expanded styling. */ |
| 22 |
isExpanded: boolean; |
| 23 |
/** Id of the element that the text input is controlling expansion of. */ |
| 24 |
ariaControls: string; |
| 25 |
} |
| 26 |
export interface TextInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'>, OUIAProps { |
| 27 |
/** Additional classes added to the text input. */ |
| 28 |
className?: string; |
| 29 |
/** Flag to show if the text input is disabled. */ |
| 30 |
isDisabled?: boolean; |
| 31 |
/** @deprecated Flag to apply expanded styling. expandedProps should now be used instead. */ |
| 32 |
isExpanded?: boolean; |
| 33 |
/** Prop to apply expanded styling to the text input and link it to the element it is controlling. This should be used when the input controls a menu and that menu is expandable. */ |
| 34 |
expandedProps?: TextInputExpandedObj; |
| 35 |
/** Sets the input as readonly and determines the readonly styling. */ |
| 36 |
readOnlyVariant?: 'plain' | 'default'; |
| 37 |
/** Flag indicating whether the input is required */ |
| 38 |
isRequired?: boolean; |
| 39 |
/** Value to indicate if the text input is modified to show that validation state. |
| 40 |
* If set to success, text input will be modified to indicate valid state. |
| 41 |
* If set to error, text input will be modified to indicate error state. |
| 42 |
*/ |
| 43 |
validated?: 'success' | 'warning' | 'error' | 'default'; |
| 44 |
/** A callback for when the text input value changes. */ |
| 45 |
onChange?: (event: React.FormEvent<HTMLInputElement>, value: string) => void; |
| 46 |
/** Type that the text input accepts. */ |
| 47 |
type?: 'text' | 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'time' | 'url'; |
| 48 |
/** Value of the text input. */ |
| 49 |
value?: string | number; |
| 50 |
/** Placeholder of the text input when there is no value */ |
| 51 |
placeholder?: string; |
| 52 |
/** Aria-label. The text input requires an associated id or aria-label. */ |
| 53 |
'aria-label'?: string; |
| 54 |
/** @hide A reference object to attach to the text input box. */ |
| 55 |
innerRef?: React.RefObject<any>; |
| 56 |
/** @deprecated Use isStartTruncated instead. Trim text at start */ |
| 57 |
isLeftTruncated?: boolean; |
| 58 |
/** Trim text at start */ |
| 59 |
isStartTruncated?: boolean; |
| 60 |
/** Callback function when text input is focused */ |
| 61 |
onFocus?: (event?: any) => void; |
| 62 |
/** Callback function when text input is blurred (focus leaves) */ |
| 63 |
onBlur?: (event?: any) => void; |
| 64 |
/** Custom icon to render. If the validated prop is also passed, this will render an icon in addition to a validated icon. */ |
| 65 |
customIcon?: React.ReactNode; |
| 66 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 67 |
ouiaId?: number | string; |
| 68 |
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 69 |
ouiaSafe?: boolean; |
| 70 |
} |
| 71 |
export declare class TextInputBase extends Component<TextInputProps> { |
| 72 |
static displayName: string; |
| 73 |
static defaultProps: TextInputProps; |
| 74 |
inputRef: import("react").RefObject<HTMLInputElement>; |
| 75 |
observer: any; |
| 76 |
constructor(props: TextInputProps); |
| 77 |
handleChange: (event: React.FormEvent<HTMLInputElement>) => void; |
| 78 |
componentDidMount(): void; |
| 79 |
componentWillUnmount(): void; |
| 80 |
handleResize: () => void; |
| 81 |
restoreText: () => void; |
| 82 |
onFocus: (event?: any) => void; |
| 83 |
onBlur: (event?: any) => void; |
| 84 |
render(): import("react/jsx-runtime").JSX.Element; |
| 85 |
private sanitizeInputValue; |
| 86 |
} |
| 87 |
export declare const TextInput: import("react").ForwardRefExoticComponent<TextInputProps & import("react").RefAttributes<HTMLInputElement>>; |
| 88 |
//# sourceMappingURL=TextInput.d.ts.map |