UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

83 lines (82 loc) 2.78 kB
/// <reference types="react" /> import { ITextField, ITextFieldProps } from './TextField.types'; import { BaseComponent } from '../../Utilities'; export interface ITextFieldState { value: string; /** Is true when the control has focus. */ isFocused: boolean; /** * The validation error message. * * - If there is no validation error or we have not validated the input value, errorMessage is an empty string. * - If we have done the validation and there is validation error, errorMessage is the validation error message. */ errorMessage: string; } export declare class TextFieldBase extends BaseComponent<ITextFieldProps, ITextFieldState> implements ITextField { static defaultProps: ITextFieldProps; private _id; private _descriptionId; private _delayedValidate; private _isMounted; private _lastValidation; private _latestValue; private _latestValidateValue; private _isDescriptionAvailable; private _textElement; private _classNames; constructor(props: ITextFieldProps); /** * Gets the current value of the text field. */ readonly value: string | undefined; componentDidMount(): void; componentWillReceiveProps(newProps: ITextFieldProps): void; componentWillUnmount(): void; render(): JSX.Element; /** * Sets focus on the text field */ focus(): void; /** * Selects the text field */ select(): void; /** * Sets the selection start of the text field to a specified value */ setSelectionStart(value: number): void; /** * Sets the selection end of the text field to a specified value */ setSelectionEnd(value: number): void; /** * Gets the selection start of the text field */ readonly selectionStart: number | null; /** * Gets the selection end of the text field */ readonly selectionEnd: number | null; /** * Sets the start and end positions of a selection in a text field. * @param start Index of the start of the selection. * @param end Index of the end of the selection. */ setSelectionRange(start: number, end: number): void; private _setValue(value?); private _onFocus(ev); private _onBlur(ev); private _onRenderLabel; private _onRenderDescription; private _onRenderAddon(props); private _onRenderPrefix(props); private _onRenderSuffix(props); private readonly _errorMessage; private _renderTextArea(); private _renderInput(); private _onInputChange(event); private _validate(value); private _notifyAfterValidate(value, errorMessage); private _adjustInputHeight(); }