| 49658 | var TextFieldBase = /** @class */ function(_super) { |
| 49659 | (0, _tslib.__extends)(TextFieldBase1, _super); |
| 49660 | function TextFieldBase1(props1) { |
| 49661 | var _this = _super.call(this, props1) || this; |
| 49662 | _this._textElement = _react.createRef(); |
| 49663 | _this._onFocus = function(ev) { |
| 49664 | if (_this.props.onFocus) _this.props.onFocus(ev); |
| 49665 | _this.setState({ |
| 49666 | isFocused: true |
| 49667 | }, function() { |
| 49668 | if (_this.props.validateOnFocusIn) _this._validate(_this.value); |
| 49669 | }); |
| 49670 | }; |
| 49671 | _this._onBlur = function(ev) { |
| 49672 | if (_this.props.onBlur) _this.props.onBlur(ev); |
| 49673 | _this.setState({ |
| 49674 | isFocused: false |
| 49675 | }, function() { |
| 49676 | if (_this.props.validateOnFocusOut) _this._validate(_this.value); |
| 49677 | }); |
| 49678 | }; |
| 49679 | _this._onRenderLabel = function(props) { |
| 49680 | var label = props.label, required = props.required; |
| 49681 | // IProcessedStyleSet definition requires casting for what Label expects as its styles prop |
| 49682 | var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined; |
| 49683 | if (label) return _react.createElement((0, _label.Label), { |
| 49684 | required: required, |
| 49685 | htmlFor: _this._id, |
| 49686 | styles: labelStyles, |
| 49687 | disabled: props.disabled, |
| 49688 | id: _this._labelId |
| 49689 | }, props.label); |
| 49690 | return null; |
| 49691 | }; |
| 49692 | _this._onRenderDescription = function(props) { |
| 49693 | if (props.description) return _react.createElement("span", { |
| 49694 | className: _this._classNames.description |
| 49695 | }, props.description); |
| 49696 | return null; |
| 49697 | }; |
| 49698 | _this._onRevealButtonClick = function(event) { |
| 49699 | _this.setState(function(prevState) { |
| 49700 | return { |
| 49701 | isRevealingPassword: !prevState.isRevealingPassword |
| 49702 | }; |
| 49703 | }); |
| 49704 | }; |
| 49705 | _this._onInputChange = function(event) { |
| 49706 | // Previously, we needed to call both onInput and onChange due to some weird IE/React issues, |
| 49707 | // which have *probably* been fixed now: |
| 49708 | // - https://github.com/microsoft/fluentui/issues/744 (likely fixed) |
| 49709 | // - https://github.com/microsoft/fluentui/issues/824 (confirmed fixed) |
| 49710 | // TODO (Fabric 8?) - Switch to calling only onChange. This switch is pretty disruptive for |
| 49711 | // tests (ours and maybe consumers' too), so it seemed best to do the switch in a major bump. |
| 49712 | var element = event.target; |
| 49713 | var value = element.value; |
| 49714 | // Ignore this event if the value is undefined (in case one of the IE bugs comes back) |
| 49715 | if (value === undefined || value === _this._lastChangeValue) return; |
| 49716 | _this._lastChangeValue = value; |
| 49717 | // This is so developers can access the event properties in asynchronous callbacks |