@instructure/ui-text-input 8.33.1 → 8.33.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-text-input
9
+
6
10
  ## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-text-input
@@ -1,8 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["type", "size", "htmlSize", "display", "textAlign", "placeholder", "value", "defaultValue", "isRequired"];
3
-
4
3
  var _dec, _dec2, _dec3, _class, _class2;
5
-
6
4
  /*
7
5
  * The MIT License (MIT)
8
6
  *
@@ -37,6 +35,7 @@ import { withStyle, jsx } from '@instructure/emotion';
37
35
  import generateStyle from './styles';
38
36
  import generateComponentTheme from './theme';
39
37
  import { allowedProps, propTypes } from './props';
38
+
40
39
  /**
41
40
  ---
42
41
  category: components
@@ -44,7 +43,6 @@ tags: form, field
44
43
  ---
45
44
  @tsProps
46
45
  **/
47
-
48
46
  let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TextInput extends Component {
49
47
  constructor(props) {
50
48
  super(props);
@@ -55,22 +53,19 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
55
53
  this._defaultId = void 0;
56
54
  this._messagesId = void 0;
57
55
  this._focusListener = null;
58
-
59
56
  this.handleRef = el => {
60
57
  const elementRef = this.props.elementRef;
61
58
  this.ref = el;
62
-
63
59
  if (typeof elementRef === 'function') {
64
60
  elementRef(el);
65
61
  }
66
62
  };
67
-
68
63
  this.makeStyleProps = () => {
69
64
  const interaction = this.interaction;
70
65
  const _this$state = this.state,
71
- hasFocus = _this$state.hasFocus,
72
- beforeElementHasWidth = _this$state.beforeElementHasWidth,
73
- afterElementHasWidth = _this$state.afterElementHasWidth;
66
+ hasFocus = _this$state.hasFocus,
67
+ beforeElementHasWidth = _this$state.beforeElementHasWidth,
68
+ afterElementHasWidth = _this$state.afterElementHasWidth;
74
69
  return {
75
70
  disabled: interaction === 'disabled',
76
71
  invalid: this.invalid,
@@ -79,41 +74,33 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
79
74
  afterElementHasWidth
80
75
  };
81
76
  };
82
-
83
77
  this.handleInputRef = node => {
84
78
  this._input = node;
85
-
86
79
  if (typeof this.props.inputRef === 'function') {
87
80
  this.props.inputRef(node);
88
81
  }
89
82
  };
90
-
91
83
  this.handleChange = event => {
92
84
  if (typeof this.props.onChange === 'function') {
93
85
  this.props.onChange(event, event.target.value);
94
86
  }
95
87
  };
96
-
97
88
  this.handleBlur = event => {
98
89
  if (typeof this.props.onBlur === 'function') {
99
90
  this.props.onBlur(event);
100
91
  }
101
-
102
92
  this.setState({
103
93
  hasFocus: false
104
94
  });
105
95
  };
106
-
107
96
  this.handleFocus = event => {
108
97
  if (typeof this.props.onFocus === 'function') {
109
98
  this.props.onFocus(event);
110
99
  }
111
-
112
100
  this.setState({
113
101
  hasFocus: true
114
102
  });
115
103
  };
116
-
117
104
  this.state = {
118
105
  hasFocus: false,
119
106
  beforeElementHasWidth: void 0,
@@ -122,10 +109,8 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
122
109
  this._defaultId = props.deterministicId();
123
110
  this._messagesId = props.deterministicId('TextInput-messages');
124
111
  }
125
-
126
112
  componentDidMount() {
127
113
  var _this$props$makeStyle, _this$props;
128
-
129
114
  if (this._input) {
130
115
  this._focusListener = addEventListener(this._input, 'focus', this.handleFocus);
131
116
  this.setState({
@@ -133,31 +118,25 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
133
118
  afterElementHasWidth: this.getElementHasWidth(this._afterElement)
134
119
  });
135
120
  }
136
-
137
121
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
138
122
  }
139
-
140
123
  componentWillUnmount() {
141
124
  if (this._focusListener) {
142
125
  this._focusListener.remove();
143
126
  }
144
127
  }
145
-
146
128
  componentDidUpdate(prevProps) {
147
129
  var _this$props$makeStyle2, _this$props2;
148
-
149
130
  if (prevProps.renderBeforeInput !== this.props.renderBeforeInput) {
150
131
  this.setState({
151
132
  beforeElementHasWidth: this.getElementHasWidth(this._beforeElement)
152
133
  });
153
134
  }
154
-
155
135
  if (prevProps.renderAfterInput !== this.props.renderAfterInput) {
156
136
  this.setState({
157
137
  afterElementHasWidth: this.getElementHasWidth(this._afterElement)
158
138
  });
159
139
  }
160
-
161
140
  if (getInteraction({
162
141
  props: prevProps
163
142
  }) !== 'disabled' && getInteraction({
@@ -167,73 +146,57 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
167
146
  hasFocus: false
168
147
  });
169
148
  }
170
-
171
149
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
172
150
  }
173
-
174
151
  focus() {
175
152
  var _this$_input;
176
-
177
153
  (_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
178
154
  }
179
-
180
155
  get interaction() {
181
156
  return getInteraction({
182
157
  props: this.props
183
158
  });
184
159
  }
185
-
186
160
  get hasMessages() {
187
161
  return !!this.props.messages && this.props.messages.length > 0;
188
162
  }
189
-
190
163
  get invalid() {
191
164
  return !!this.props.messages && this.props.messages.findIndex(message => {
192
165
  return message.type === 'error';
193
166
  }) >= 0;
194
167
  }
195
-
196
168
  get focused() {
197
169
  return isActiveElement(this._input);
198
170
  }
199
-
200
171
  get value() {
201
172
  var _this$_input2;
202
-
203
173
  return (_this$_input2 = this._input) === null || _this$_input2 === void 0 ? void 0 : _this$_input2.value;
204
174
  }
205
-
206
175
  get id() {
207
176
  return this.props.id || this._defaultId;
208
177
  }
209
-
210
178
  renderInput() {
211
179
  var _this$props$styles;
212
-
213
180
  const _this$props3 = this.props,
214
- type = _this$props3.type,
215
- size = _this$props3.size,
216
- htmlSize = _this$props3.htmlSize,
217
- display = _this$props3.display,
218
- textAlign = _this$props3.textAlign,
219
- placeholder = _this$props3.placeholder,
220
- value = _this$props3.value,
221
- defaultValue = _this$props3.defaultValue,
222
- isRequired = _this$props3.isRequired,
223
- rest = _objectWithoutProperties(_this$props3, _excluded);
224
-
181
+ type = _this$props3.type,
182
+ size = _this$props3.size,
183
+ htmlSize = _this$props3.htmlSize,
184
+ display = _this$props3.display,
185
+ textAlign = _this$props3.textAlign,
186
+ placeholder = _this$props3.placeholder,
187
+ value = _this$props3.value,
188
+ defaultValue = _this$props3.defaultValue,
189
+ isRequired = _this$props3.isRequired,
190
+ rest = _objectWithoutProperties(_this$props3, _excluded);
225
191
  const props = passthroughProps(rest);
226
192
  const interaction = this.interaction;
227
193
  let descriptionIds = '';
228
-
229
194
  if (props['aria-describedby']) {
230
195
  descriptionIds = `${props['aria-describedby']}`;
231
196
  }
232
-
233
197
  if (this.hasMessages) {
234
198
  descriptionIds = descriptionIds !== '' ? `${descriptionIds} ${this._messagesId}` : this._messagesId;
235
199
  }
236
-
237
200
  return jsx("input", Object.assign({}, props, {
238
201
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.textInput,
239
202
  defaultValue: defaultValue,
@@ -252,30 +215,27 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
252
215
  onBlur: this.handleBlur
253
216
  }));
254
217
  }
255
-
256
218
  getElementHasWidth(element) {
257
219
  if (!element) {
258
220
  return void 0;
259
221
  }
260
-
261
222
  const computedStyle = getComputedStyle(element);
262
223
  const width = computedStyle.width,
263
- paddingInlineStart = computedStyle.paddingInlineStart,
264
- paddingInlineEnd = computedStyle.paddingInlineEnd;
224
+ paddingInlineStart = computedStyle.paddingInlineStart,
225
+ paddingInlineEnd = computedStyle.paddingInlineEnd;
265
226
  const elementWidth = parseFloat(width) - parseFloat(paddingInlineStart) - parseFloat(paddingInlineEnd);
266
227
  return elementWidth > 0;
267
228
  }
268
-
269
229
  render() {
270
230
  const _this$props4 = this.props,
271
- width = _this$props4.width,
272
- display = _this$props4.display,
273
- renderLabel = _this$props4.renderLabel,
274
- renderBeforeInput = _this$props4.renderBeforeInput,
275
- renderAfterInput = _this$props4.renderAfterInput,
276
- messages = _this$props4.messages,
277
- inputContainerRef = _this$props4.inputContainerRef,
278
- styles = _this$props4.styles;
231
+ width = _this$props4.width,
232
+ display = _this$props4.display,
233
+ renderLabel = _this$props4.renderLabel,
234
+ renderBeforeInput = _this$props4.renderBeforeInput,
235
+ renderAfterInput = _this$props4.renderAfterInput,
236
+ messages = _this$props4.messages,
237
+ inputContainerRef = _this$props4.inputContainerRef,
238
+ styles = _this$props4.styles;
279
239
  const beforeElement = renderBeforeInput ? callRenderProp(renderBeforeInput) : null;
280
240
  const afterElement = renderAfterInput ? callRenderProp(renderAfterInput) : null;
281
241
  const renderBeforeOrAfter = !!beforeElement || !!afterElement;
@@ -309,11 +269,9 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
309
269
  ref: e => {
310
270
  this._afterElement = e;
311
271
  }
312
- }, afterElement))))) :
313
- /* If no prepended or appended content, don't render Flex layout */
272
+ }, afterElement))))) : /* If no prepended or appended content, don't render Flex layout */
314
273
  this.renderInput()));
315
274
  }
316
-
317
275
  }, _class2.displayName = "TextInput", _class2.componentId = 'TextInput', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
318
276
  type: 'text',
319
277
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import PropTypes from 'prop-types';
25
26
  import { FormPropTypes } from '@instructure/ui-form-field';
26
27
  import { controllable } from '@instructure/ui-prop-types';
@@ -34,13 +34,13 @@
34
34
  */
35
35
  const generateStyle = (componentTheme, props, state) => {
36
36
  const size = props.size,
37
- textAlign = props.textAlign,
38
- shouldNotWrap = props.shouldNotWrap;
37
+ textAlign = props.textAlign,
38
+ shouldNotWrap = props.shouldNotWrap;
39
39
  const disabled = state.disabled,
40
- invalid = state.invalid,
41
- focused = state.focused,
42
- beforeElementHasWidth = state.beforeElementHasWidth,
43
- afterElementHasWidth = state.afterElementHasWidth;
40
+ invalid = state.invalid,
41
+ focused = state.focused,
42
+ beforeElementHasWidth = state.beforeElementHasWidth,
43
+ afterElementHasWidth = state.afterElementHasWidth;
44
44
  const sizeVariants = {
45
45
  small: {
46
46
  fontSize: componentTheme.smallFontSize,
@@ -115,13 +115,15 @@ const generateStyle = (componentTheme, props, state) => {
115
115
  overflow: 'visible',
116
116
  unicodeBidi: 'isolate'
117
117
  };
118
- const flexBase = { ...viewBase,
118
+ const flexBase = {
119
+ ...viewBase,
119
120
  display: 'flex',
120
121
  alignItems: 'center',
121
122
  justifyContent: 'flex-start',
122
123
  flexDirection: 'row'
123
124
  };
124
- const flexItemBase = { ...viewBase,
125
+ const flexItemBase = {
126
+ ...viewBase,
125
127
  flexShrink: 0
126
128
  };
127
129
  return {
@@ -200,5 +202,4 @@ const generateStyle = (componentTheme, props, state) => {
200
202
  }
201
203
  };
202
204
  };
203
-
204
205
  export default generateStyle;
@@ -29,11 +29,11 @@
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
31
  const colors = theme.colors,
32
- typography = theme.typography,
33
- borders = theme.borders,
34
- spacing = theme.spacing,
35
- forms = theme.forms,
36
- themeName = theme.key;
32
+ typography = theme.typography,
33
+ borders = theme.borders,
34
+ spacing = theme.spacing,
35
+ forms = theme.forms,
36
+ themeName = theme.key;
37
37
  const themeSpecificStyle = {
38
38
  canvas: {
39
39
  color: theme['ic-brand-font-color-dark'],
@@ -63,9 +63,9 @@ const generateComponentTheme = theme => {
63
63
  largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
64
64
  largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge
65
65
  };
66
- return { ...componentVariables,
66
+ return {
67
+ ...componentVariables,
67
68
  ...themeSpecificStyle[themeName]
68
69
  };
69
70
  };
70
-
71
71
  export default generateComponentTheme;
@@ -1,46 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = exports.TextInput = void 0;
11
-
12
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
-
14
10
  var _react = _interopRequireWildcard(require("react"));
15
-
16
11
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
17
-
18
12
  var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
19
-
20
13
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
21
-
22
14
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
23
-
24
15
  var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
25
-
26
16
  var _addEventListener = require("@instructure/ui-dom-utils/lib/addEventListener.js");
27
-
28
17
  var _FormField = require("@instructure/ui-form-field/lib/FormField");
29
-
30
18
  var _testable = require("@instructure/ui-testable/lib/testable.js");
31
-
32
19
  var _emotion = require("@instructure/emotion");
33
-
34
20
  var _styles = _interopRequireDefault(require("./styles"));
35
-
36
21
  var _theme = _interopRequireDefault(require("./theme"));
37
-
38
22
  var _props = require("./props");
39
-
40
23
  const _excluded = ["type", "size", "htmlSize", "display", "textAlign", "placeholder", "value", "defaultValue", "isRequired"];
41
-
42
24
  var _dec, _dec2, _dec3, _class, _class2;
43
-
44
25
  /**
45
26
  ---
46
27
  category: components
@@ -58,22 +39,19 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
58
39
  this._defaultId = void 0;
59
40
  this._messagesId = void 0;
60
41
  this._focusListener = null;
61
-
62
42
  this.handleRef = el => {
63
43
  const elementRef = this.props.elementRef;
64
44
  this.ref = el;
65
-
66
45
  if (typeof elementRef === 'function') {
67
46
  elementRef(el);
68
47
  }
69
48
  };
70
-
71
49
  this.makeStyleProps = () => {
72
50
  const interaction = this.interaction;
73
51
  const _this$state = this.state,
74
- hasFocus = _this$state.hasFocus,
75
- beforeElementHasWidth = _this$state.beforeElementHasWidth,
76
- afterElementHasWidth = _this$state.afterElementHasWidth;
52
+ hasFocus = _this$state.hasFocus,
53
+ beforeElementHasWidth = _this$state.beforeElementHasWidth,
54
+ afterElementHasWidth = _this$state.afterElementHasWidth;
77
55
  return {
78
56
  disabled: interaction === 'disabled',
79
57
  invalid: this.invalid,
@@ -82,41 +60,33 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
82
60
  afterElementHasWidth
83
61
  };
84
62
  };
85
-
86
63
  this.handleInputRef = node => {
87
64
  this._input = node;
88
-
89
65
  if (typeof this.props.inputRef === 'function') {
90
66
  this.props.inputRef(node);
91
67
  }
92
68
  };
93
-
94
69
  this.handleChange = event => {
95
70
  if (typeof this.props.onChange === 'function') {
96
71
  this.props.onChange(event, event.target.value);
97
72
  }
98
73
  };
99
-
100
74
  this.handleBlur = event => {
101
75
  if (typeof this.props.onBlur === 'function') {
102
76
  this.props.onBlur(event);
103
77
  }
104
-
105
78
  this.setState({
106
79
  hasFocus: false
107
80
  });
108
81
  };
109
-
110
82
  this.handleFocus = event => {
111
83
  if (typeof this.props.onFocus === 'function') {
112
84
  this.props.onFocus(event);
113
85
  }
114
-
115
86
  this.setState({
116
87
  hasFocus: true
117
88
  });
118
89
  };
119
-
120
90
  this.state = {
121
91
  hasFocus: false,
122
92
  beforeElementHasWidth: void 0,
@@ -125,10 +95,8 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
125
95
  this._defaultId = props.deterministicId();
126
96
  this._messagesId = props.deterministicId('TextInput-messages');
127
97
  }
128
-
129
98
  componentDidMount() {
130
99
  var _this$props$makeStyle, _this$props;
131
-
132
100
  if (this._input) {
133
101
  this._focusListener = (0, _addEventListener.addEventListener)(this._input, 'focus', this.handleFocus);
134
102
  this.setState({
@@ -136,31 +104,25 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
136
104
  afterElementHasWidth: this.getElementHasWidth(this._afterElement)
137
105
  });
138
106
  }
139
-
140
107
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
141
108
  }
142
-
143
109
  componentWillUnmount() {
144
110
  if (this._focusListener) {
145
111
  this._focusListener.remove();
146
112
  }
147
113
  }
148
-
149
114
  componentDidUpdate(prevProps) {
150
115
  var _this$props$makeStyle2, _this$props2;
151
-
152
116
  if (prevProps.renderBeforeInput !== this.props.renderBeforeInput) {
153
117
  this.setState({
154
118
  beforeElementHasWidth: this.getElementHasWidth(this._beforeElement)
155
119
  });
156
120
  }
157
-
158
121
  if (prevProps.renderAfterInput !== this.props.renderAfterInput) {
159
122
  this.setState({
160
123
  afterElementHasWidth: this.getElementHasWidth(this._afterElement)
161
124
  });
162
125
  }
163
-
164
126
  if ((0, _getInteraction.getInteraction)({
165
127
  props: prevProps
166
128
  }) !== 'disabled' && (0, _getInteraction.getInteraction)({
@@ -170,72 +132,57 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
170
132
  hasFocus: false
171
133
  });
172
134
  }
173
-
174
135
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
175
136
  }
176
-
177
137
  focus() {
178
138
  var _this$_input;
179
-
180
139
  (_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
181
140
  }
182
-
183
141
  get interaction() {
184
142
  return (0, _getInteraction.getInteraction)({
185
143
  props: this.props
186
144
  });
187
145
  }
188
-
189
146
  get hasMessages() {
190
147
  return !!this.props.messages && this.props.messages.length > 0;
191
148
  }
192
-
193
149
  get invalid() {
194
150
  return !!this.props.messages && this.props.messages.findIndex(message => {
195
151
  return message.type === 'error';
196
152
  }) >= 0;
197
153
  }
198
-
199
154
  get focused() {
200
155
  return (0, _isActiveElement.isActiveElement)(this._input);
201
156
  }
202
-
203
157
  get value() {
204
158
  var _this$_input2;
205
-
206
159
  return (_this$_input2 = this._input) === null || _this$_input2 === void 0 ? void 0 : _this$_input2.value;
207
160
  }
208
-
209
161
  get id() {
210
162
  return this.props.id || this._defaultId;
211
163
  }
212
-
213
164
  renderInput() {
214
165
  var _this$props$styles;
215
-
216
166
  const _this$props3 = this.props,
217
- type = _this$props3.type,
218
- size = _this$props3.size,
219
- htmlSize = _this$props3.htmlSize,
220
- display = _this$props3.display,
221
- textAlign = _this$props3.textAlign,
222
- placeholder = _this$props3.placeholder,
223
- value = _this$props3.value,
224
- defaultValue = _this$props3.defaultValue,
225
- isRequired = _this$props3.isRequired,
226
- rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
167
+ type = _this$props3.type,
168
+ size = _this$props3.size,
169
+ htmlSize = _this$props3.htmlSize,
170
+ display = _this$props3.display,
171
+ textAlign = _this$props3.textAlign,
172
+ placeholder = _this$props3.placeholder,
173
+ value = _this$props3.value,
174
+ defaultValue = _this$props3.defaultValue,
175
+ isRequired = _this$props3.isRequired,
176
+ rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
227
177
  const props = (0, _passthroughProps.passthroughProps)(rest);
228
178
  const interaction = this.interaction;
229
179
  let descriptionIds = '';
230
-
231
180
  if (props['aria-describedby']) {
232
181
  descriptionIds = `${props['aria-describedby']}`;
233
182
  }
234
-
235
183
  if (this.hasMessages) {
236
184
  descriptionIds = descriptionIds !== '' ? `${descriptionIds} ${this._messagesId}` : this._messagesId;
237
185
  }
238
-
239
186
  return (0, _emotion.jsx)("input", Object.assign({}, props, {
240
187
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.textInput,
241
188
  defaultValue: defaultValue,
@@ -254,30 +201,27 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
254
201
  onBlur: this.handleBlur
255
202
  }));
256
203
  }
257
-
258
204
  getElementHasWidth(element) {
259
205
  if (!element) {
260
206
  return void 0;
261
207
  }
262
-
263
208
  const computedStyle = getComputedStyle(element);
264
209
  const width = computedStyle.width,
265
- paddingInlineStart = computedStyle.paddingInlineStart,
266
- paddingInlineEnd = computedStyle.paddingInlineEnd;
210
+ paddingInlineStart = computedStyle.paddingInlineStart,
211
+ paddingInlineEnd = computedStyle.paddingInlineEnd;
267
212
  const elementWidth = parseFloat(width) - parseFloat(paddingInlineStart) - parseFloat(paddingInlineEnd);
268
213
  return elementWidth > 0;
269
214
  }
270
-
271
215
  render() {
272
216
  const _this$props4 = this.props,
273
- width = _this$props4.width,
274
- display = _this$props4.display,
275
- renderLabel = _this$props4.renderLabel,
276
- renderBeforeInput = _this$props4.renderBeforeInput,
277
- renderAfterInput = _this$props4.renderAfterInput,
278
- messages = _this$props4.messages,
279
- inputContainerRef = _this$props4.inputContainerRef,
280
- styles = _this$props4.styles;
217
+ width = _this$props4.width,
218
+ display = _this$props4.display,
219
+ renderLabel = _this$props4.renderLabel,
220
+ renderBeforeInput = _this$props4.renderBeforeInput,
221
+ renderAfterInput = _this$props4.renderAfterInput,
222
+ messages = _this$props4.messages,
223
+ inputContainerRef = _this$props4.inputContainerRef,
224
+ styles = _this$props4.styles;
281
225
  const beforeElement = renderBeforeInput ? (0, _callRenderProp.callRenderProp)(renderBeforeInput) : null;
282
226
  const afterElement = renderAfterInput ? (0, _callRenderProp.callRenderProp)(renderAfterInput) : null;
283
227
  const renderBeforeOrAfter = !!beforeElement || !!afterElement;
@@ -311,11 +255,9 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
311
255
  ref: e => {
312
256
  this._afterElement = e;
313
257
  }
314
- }, afterElement))))) :
315
- /* If no prepended or appended content, don't render Flex layout */
258
+ }, afterElement))))) : /* If no prepended or appended content, don't render Flex layout */
316
259
  this.renderInput()));
317
260
  }
318
-
319
261
  }, _class2.displayName = "TextInput", _class2.componentId = 'TextInput', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
320
262
  type: 'text',
321
263
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
13
-
14
10
  var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
15
-
16
11
  /*
17
12
  * The MIT License (MIT)
18
13
  *
@@ -36,6 +31,7 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
36
31
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
32
  * SOFTWARE.
38
33
  */
34
+
39
35
  const propTypes = {
40
36
  renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
41
37
  type: _propTypes.default.oneOf(['text', 'email', 'url', 'tel', 'search', 'password']),