@instructure/ui-number-input 11.7.3-snapshot-25 → 11.7.3-snapshot-27

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,9 +3,12 @@
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
- ## [11.7.3-snapshot-25](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-25) (2026-04-30)
6
+ ## [11.7.3-snapshot-27](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-27) (2026-05-05)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-number-input
8
+
9
+ ### Bug Fixes
10
+
11
+ * **many:** update dependencies, remove lots of Babel plugins, remove Webpack 4 support ([f916fca](https://github.com/instructure/instructure-ui/commit/f916fcafdddcb2d7de401f93e8ff92cfdfa47bba))
9
12
 
10
13
 
11
14
 
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class, _NumberInput, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
1
+ var _dec, _dec2, _class;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -40,72 +40,31 @@ category: components
40
40
  id: NumberInput
41
41
  ---
42
42
  **/
43
- let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_NumberInput = class NumberInput extends Component {
44
- constructor(...args) {
45
- super(...args);
46
- this.state = {
47
- hasFocus: false
48
- };
49
- this.ref = null;
50
- this._input = null;
51
- this._id = void 0;
52
- this.handleRef = el => {
53
- this.ref = el;
54
- };
55
- this.handleInputRef = element => {
56
- this._input = element;
57
- if (typeof this.props.inputRef === 'function') {
58
- this.props.inputRef(element);
59
- }
60
- };
61
- this.handleFocus = event => {
62
- this.setState({
63
- hasFocus: true
64
- });
65
- if (typeof this.props.onFocus === 'function') {
66
- this.props.onFocus(event);
67
- }
68
- };
69
- this.handleBlur = event => {
70
- this.setState({
71
- hasFocus: false
72
- });
73
- if (typeof this.props.onBlur === 'function') {
74
- this.props.onBlur(event);
75
- }
76
- };
77
- this.handleChange = event => {
78
- if (typeof this.props.onChange === 'function') {
79
- this.props.onChange(event, event.target.value);
80
- }
81
- };
82
- this.handleKeyDown = event => {
83
- const _this$props = this.props,
84
- onKeyDown = _this$props.onKeyDown,
85
- onDecrement = _this$props.onDecrement,
86
- onIncrement = _this$props.onIncrement;
87
- if (typeof onKeyDown === 'function') {
88
- onKeyDown(event);
89
- }
90
- if (event.keyCode === keycode.codes.down) {
91
- event.preventDefault();
92
- if (typeof onDecrement === 'function') {
93
- onDecrement(event);
94
- }
95
- } else if (event.keyCode === keycode.codes.up) {
96
- event.preventDefault();
97
- if (typeof onIncrement === 'function') {
98
- onIncrement(event);
99
- }
100
- }
101
- };
102
- this.handleClickUpArrow = event => {
103
- this.arrowClicked(event, this.props.onIncrement);
104
- };
105
- this.handleClickDownArrow = event => {
106
- this.arrowClicked(event, this.props.onDecrement);
107
- };
108
- }
43
+ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = class NumberInput extends Component {
44
+ static displayName = "NumberInput";
45
+ static componentId = 'NumberInput';
46
+ static allowedProps = allowedProps;
47
+ static defaultProps = {
48
+ // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
49
+ interaction: undefined,
50
+ messages: [],
51
+ isRequired: false,
52
+ showArrows: true,
53
+ size: 'medium',
54
+ display: 'block',
55
+ textAlign: 'start',
56
+ inputMode: 'numeric',
57
+ allowStringValue: false
58
+ };
59
+ state = {
60
+ hasFocus: false
61
+ };
62
+ ref = null;
63
+ _input = null;
64
+ _id;
65
+ handleRef = el => {
66
+ this.ref = el;
67
+ };
109
68
  get id() {
110
69
  if (this.props.id) {
111
70
  return this.props.id;
@@ -124,12 +83,10 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
124
83
  });
125
84
  }
126
85
  componentDidMount() {
127
- var _this$props$makeStyle, _this$props2;
128
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStyleVariables);
86
+ this.props.makeStyles?.(this.makeStyleVariables);
129
87
  }
130
88
  componentDidUpdate() {
131
- var _this$props$makeStyle2, _this$props3;
132
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStyleVariables);
89
+ this.props.makeStyles?.(this.makeStyleVariables);
133
90
  }
134
91
  get makeStyleVariables() {
135
92
  return {
@@ -138,57 +95,113 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
138
95
  invalid: this.invalid
139
96
  };
140
97
  }
98
+ handleInputRef = element => {
99
+ this._input = element;
100
+ if (typeof this.props.inputRef === 'function') {
101
+ this.props.inputRef(element);
102
+ }
103
+ };
104
+ handleFocus = event => {
105
+ this.setState({
106
+ hasFocus: true
107
+ });
108
+ if (typeof this.props.onFocus === 'function') {
109
+ this.props.onFocus(event);
110
+ }
111
+ };
112
+ handleBlur = event => {
113
+ this.setState({
114
+ hasFocus: false
115
+ });
116
+ if (typeof this.props.onBlur === 'function') {
117
+ this.props.onBlur(event);
118
+ }
119
+ };
120
+ handleChange = event => {
121
+ if (typeof this.props.onChange === 'function') {
122
+ this.props.onChange(event, event.target.value);
123
+ }
124
+ };
125
+ handleKeyDown = event => {
126
+ const {
127
+ onKeyDown,
128
+ onDecrement,
129
+ onIncrement
130
+ } = this.props;
131
+ if (typeof onKeyDown === 'function') {
132
+ onKeyDown(event);
133
+ }
134
+ if (event.keyCode === keycode.codes.down) {
135
+ event.preventDefault();
136
+ if (typeof onDecrement === 'function') {
137
+ onDecrement(event);
138
+ }
139
+ } else if (event.keyCode === keycode.codes.up) {
140
+ event.preventDefault();
141
+ if (typeof onIncrement === 'function') {
142
+ onIncrement(event);
143
+ }
144
+ }
145
+ };
146
+ handleClickUpArrow = event => {
147
+ this.arrowClicked(event, this.props.onIncrement);
148
+ };
149
+ handleClickDownArrow = event => {
150
+ this.arrowClicked(event, this.props.onDecrement);
151
+ };
141
152
  arrowClicked(event, callback) {
142
- const interaction = this.interaction;
153
+ const {
154
+ interaction
155
+ } = this;
143
156
  event.preventDefault();
144
157
  if (interaction === 'enabled') {
145
- var _this$_input;
146
- (_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
158
+ this._input?.focus();
147
159
  if (typeof callback === 'function') {
148
160
  callback(event);
149
161
  }
150
162
  }
151
163
  }
152
164
  renderArrows(customIcons) {
153
- var _this$props$styles, _this$props$styles2, _this$props$styles3;
154
165
  return _jsxs("span", {
155
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.arrowContainer,
166
+ css: this.props.styles?.arrowContainer,
156
167
  children: [_jsx("button", {
157
168
  "aria-hidden": true,
158
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.arrow,
169
+ css: this.props.styles?.arrow,
159
170
  onMouseDown: this.handleClickUpArrow,
160
171
  tabIndex: -1,
161
172
  type: "button",
162
- children: customIcons !== null && customIcons !== void 0 && customIcons.increase ? callRenderProp(customIcons.increase) : _IconArrowOpenUpLine || (_IconArrowOpenUpLine = _jsx(IconArrowOpenUpLine, {}))
173
+ children: customIcons?.increase ? callRenderProp(customIcons.increase) : _jsx(IconArrowOpenUpLine, {})
163
174
  }), _jsx("button", {
164
175
  "aria-hidden": true,
165
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.arrow,
176
+ css: this.props.styles?.arrow,
166
177
  onMouseDown: this.handleClickDownArrow,
167
178
  tabIndex: -1,
168
179
  type: "button",
169
- children: customIcons !== null && customIcons !== void 0 && customIcons.decrease ? callRenderProp(customIcons.decrease) : _IconArrowOpenDownLin || (_IconArrowOpenDownLin = _jsx(IconArrowOpenDownLine, {}))
180
+ children: customIcons?.decrease ? callRenderProp(customIcons.decrease) : _jsx(IconArrowOpenDownLine, {})
170
181
  })]
171
182
  });
172
183
  }
173
184
  render() {
174
- var _this$props$styles4, _this$props$styles5, _this$props$styles6;
175
- const _this$props4 = this.props,
176
- renderLabel = _this$props4.renderLabel,
177
- display = _this$props4.display,
178
- placeholder = _this$props4.placeholder,
179
- isRequired = _this$props4.isRequired,
180
- showArrows = _this$props4.showArrows,
181
- value = _this$props4.value,
182
- width = _this$props4.width,
183
- styles = _this$props4.styles,
184
- allowStringValue = _this$props4.allowStringValue,
185
- renderIcons = _this$props4.renderIcons,
186
- margin = _this$props4.margin;
187
- const interaction = this.interaction;
185
+ const {
186
+ renderLabel,
187
+ display,
188
+ placeholder,
189
+ isRequired,
190
+ showArrows,
191
+ value,
192
+ width,
193
+ styles,
194
+ allowStringValue,
195
+ renderIcons,
196
+ margin
197
+ } = this.props;
198
+ const {
199
+ interaction
200
+ } = this;
188
201
  const rawLabel = callRenderProp(renderLabel);
189
202
  const label = hasVisibleChildren(rawLabel) ? _jsxs(Fragment, {
190
203
  children: [rawLabel, isRequired && _jsxs("span", {
191
- css: this.invalid ? styles === null || styles === void 0 ? void 0 : styles.requiredInvalid : {},
204
+ css: this.invalid ? styles?.requiredInvalid : {},
192
205
  "aria-hidden": true,
193
206
  children: [' ', "*"]
194
207
  })]
@@ -202,16 +215,16 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
202
215
  margin: margin,
203
216
  "data-cid": "NumberInput",
204
217
  children: _jsx("span", {
205
- css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.inputWidth,
218
+ css: this.props.styles?.inputWidth,
206
219
  style: width ? {
207
220
  width
208
- } : void 0,
221
+ } : undefined,
209
222
  children: _jsxs("span", {
210
- css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.inputContainer,
223
+ css: this.props.styles?.inputContainer,
211
224
  children: [_jsx("input", {
212
225
  ...omitProps(this.props, [...FormField.allowedProps, ...NumberInput.allowedProps]),
213
- css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
214
- "aria-invalid": this.invalid ? 'true' : void 0,
226
+ css: this.props.styles?.input,
227
+ "aria-invalid": this.invalid ? 'true' : undefined,
215
228
  id: this.id,
216
229
  type: allowStringValue ? 'text' : 'number',
217
230
  inputMode: this.props.inputMode,
@@ -230,17 +243,6 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
230
243
  })
231
244
  });
232
245
  }
233
- }, _NumberInput.displayName = "NumberInput", _NumberInput.componentId = 'NumberInput', _NumberInput.allowedProps = allowedProps, _NumberInput.defaultProps = {
234
- // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
235
- interaction: void 0,
236
- messages: [],
237
- isRequired: false,
238
- showArrows: true,
239
- size: 'medium',
240
- display: 'block',
241
- textAlign: 'start',
242
- inputMode: 'numeric',
243
- allowStringValue: false
244
- }, _NumberInput)) || _class) || _class);
246
+ }) || _class) || _class);
245
247
  export default NumberInput;
246
248
  export { NumberInput };
@@ -33,11 +33,15 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props, state) => {
36
- const size = props.size,
37
- textAlign = props.textAlign;
38
- const interaction = state.interaction,
39
- hasFocus = state.hasFocus,
40
- invalid = state.invalid;
36
+ const {
37
+ size,
38
+ textAlign
39
+ } = props;
40
+ const {
41
+ interaction,
42
+ hasFocus,
43
+ invalid
44
+ } = state;
41
45
  const disabledStyles = interaction === 'disabled' ? {
42
46
  cursor: 'not-allowed',
43
47
  pointerEvents: 'none',
@@ -28,13 +28,14 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8, _colors$contrasts9, _colors$contrasts0, _colors$contrasts1, _colors$contrasts10, _colors$contrasts11;
32
- const colors = theme.colors,
33
- spacing = theme.spacing,
34
- borders = theme.borders,
35
- typography = theme.typography,
36
- forms = theme.forms,
37
- themeName = theme.key;
31
+ const {
32
+ colors,
33
+ spacing,
34
+ borders,
35
+ typography,
36
+ forms,
37
+ key: themeName
38
+ } = theme;
38
39
  const themeSpecificStyle = {
39
40
  canvas: {
40
41
  color: theme['ic-brand-font-color-dark'],
@@ -43,32 +44,32 @@ const generateComponentTheme = theme => {
43
44
  }
44
45
  };
45
46
  const componentVariables = {
46
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
47
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
48
- borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
49
- borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
50
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey3045,
51
- borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
52
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey125125,
53
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.white1010,
54
- requiredInvalidColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.red5782,
55
- padding: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
47
+ fontFamily: typography?.fontFamily,
48
+ fontWeight: typography?.fontWeightNormal,
49
+ borderWidth: borders?.widthSmall,
50
+ borderStyle: borders?.style,
51
+ borderColor: colors?.contrasts?.grey3045,
52
+ borderRadius: borders?.radiusMedium,
53
+ color: colors?.contrasts?.grey125125,
54
+ background: colors?.contrasts?.white1010,
55
+ requiredInvalidColor: colors?.contrasts?.red5782,
56
+ padding: `0 ${spacing?.small}`,
56
57
  arrowsContainerWidth: '2rem',
57
- arrowsColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.grey125125,
58
- arrowsBackgroundColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.grey1111,
59
- arrowsHoverBackgroundColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.grey1214,
60
- arrowsBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.grey3045,
61
- arrowsActiveBoxShadow: `inset 0 0 3px 1px ${colors === null || colors === void 0 ? void 0 : (_colors$contrasts9 = colors.contrasts) === null || _colors$contrasts9 === void 0 ? void 0 : _colors$contrasts9.grey1214}`,
62
- focusOutlineWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
63
- focusOutlineStyle: borders === null || borders === void 0 ? void 0 : borders.style,
64
- focusOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts0 = colors.contrasts) === null || _colors$contrasts0 === void 0 ? void 0 : _colors$contrasts0.blue4570,
65
- errorBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts1 = colors.contrasts) === null || _colors$contrasts1 === void 0 ? void 0 : _colors$contrasts1.red4570,
66
- errorOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts10 = colors.contrasts) === null || _colors$contrasts10 === void 0 ? void 0 : _colors$contrasts10.red4570,
67
- placeholderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts11 = colors.contrasts) === null || _colors$contrasts11 === void 0 ? void 0 : _colors$contrasts11.grey4570,
68
- mediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
69
- mediumHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightMedium,
70
- largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
71
- largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge
58
+ arrowsColor: colors?.contrasts?.grey125125,
59
+ arrowsBackgroundColor: colors?.contrasts?.grey1111,
60
+ arrowsHoverBackgroundColor: colors?.contrasts?.grey1214,
61
+ arrowsBorderColor: colors?.contrasts?.grey3045,
62
+ arrowsActiveBoxShadow: `inset 0 0 3px 1px ${colors?.contrasts?.grey1214}`,
63
+ focusOutlineWidth: borders?.widthMedium,
64
+ focusOutlineStyle: borders?.style,
65
+ focusOutlineColor: colors?.contrasts?.blue4570,
66
+ errorBorderColor: colors?.contrasts?.red4570,
67
+ errorOutlineColor: colors?.contrasts?.red4570,
68
+ placeholderColor: colors?.contrasts?.grey4570,
69
+ mediumFontSize: typography?.fontSizeMedium,
70
+ mediumHeight: forms?.inputHeightMedium,
71
+ largeFontSize: typography?.fontSizeLarge,
72
+ largeHeight: forms?.inputHeightLarge
72
73
  };
73
74
  return {
74
75
  ...componentVariables,
@@ -1,6 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- const _excluded = ["messages", "isRequired", "showArrows", "size", "display", "textAlign", "inputMode", "allowStringValue", "renderLabel", "placeholder", "value", "width", "renderIcons", "margin", "inputRef", "onFocus", "onBlur", "onChange", "onKeyDown", "onDecrement", "onIncrement", "id", "themeOverride"];
4
1
  /*
5
2
  * The MIT License (MIT)
6
3
  *
@@ -40,58 +37,42 @@ id: NumberInput
40
37
  ---
41
38
  **/
42
39
  const NumberInput = /*#__PURE__*/forwardRef((props, ref) => {
43
- var _ChevronUpInstUIIcon, _ChevronDownInstUIIco;
44
- const _props$messages = props.messages,
45
- messages = _props$messages === void 0 ? [] : _props$messages,
46
- _props$isRequired = props.isRequired,
47
- isRequired = _props$isRequired === void 0 ? false : _props$isRequired,
48
- _props$showArrows = props.showArrows,
49
- showArrows = _props$showArrows === void 0 ? true : _props$showArrows,
50
- _props$size = props.size,
51
- size = _props$size === void 0 ? 'medium' : _props$size,
52
- _props$display = props.display,
53
- display = _props$display === void 0 ? 'block' : _props$display,
54
- _props$textAlign = props.textAlign,
55
- textAlign = _props$textAlign === void 0 ? 'start' : _props$textAlign,
56
- _props$inputMode = props.inputMode,
57
- inputMode = _props$inputMode === void 0 ? 'numeric' : _props$inputMode,
58
- _props$allowStringVal = props.allowStringValue,
59
- allowStringValue = _props$allowStringVal === void 0 ? false : _props$allowStringVal,
60
- renderLabel = props.renderLabel,
61
- placeholder = props.placeholder,
62
- value = props.value,
63
- width = props.width,
64
- renderIcons = props.renderIcons,
65
- margin = props.margin,
66
- inputRefProp = props.inputRef,
67
- onFocus = props.onFocus,
68
- onBlur = props.onBlur,
69
- onChange = props.onChange,
70
- onKeyDown = props.onKeyDown,
71
- onDecrement = props.onDecrement,
72
- onIncrement = props.onIncrement,
73
- idProp = props.id,
74
- themeOverride = props.themeOverride,
75
- rest = _objectWithoutProperties(props, _excluded);
40
+ const {
41
+ messages = [],
42
+ isRequired = false,
43
+ showArrows = true,
44
+ size = 'medium',
45
+ display = 'block',
46
+ textAlign = 'start',
47
+ inputMode = 'numeric',
48
+ allowStringValue = false,
49
+ renderLabel,
50
+ placeholder,
51
+ value,
52
+ width,
53
+ renderIcons,
54
+ margin,
55
+ inputRef: inputRefProp,
56
+ onFocus,
57
+ onBlur,
58
+ onChange,
59
+ onKeyDown,
60
+ onDecrement,
61
+ onIncrement,
62
+ id: idProp,
63
+ themeOverride,
64
+ ...rest
65
+ } = props;
76
66
  // these are icon tokens
77
67
 
78
- const _useState = useState('actionSecondaryBaseColor'),
79
- _useState2 = _slicedToArray(_useState, 2),
80
- upButtonState = _useState2[0],
81
- setUpButtonState = _useState2[1];
82
- const _useState3 = useState('actionSecondaryBaseColor'),
83
- _useState4 = _slicedToArray(_useState3, 2),
84
- downButtonState = _useState4[0],
85
- setDownButtonState = _useState4[1];
68
+ const [upButtonState, setUpButtonState] = useState('actionSecondaryBaseColor');
69
+ const [downButtonState, setDownButtonState] = useState('actionSecondaryBaseColor');
86
70
  // Refs
87
71
  const containerRef = useRef(null);
88
72
  const inputRef = useRef(null);
89
73
 
90
74
  // Deterministic ID generation
91
- const _useState5 = useState(),
92
- _useState6 = _slicedToArray(_useState5, 2),
93
- deterministicId = _useState6[0],
94
- setDeterministicId = _useState6[1];
75
+ const [deterministicId, setDeterministicId] = useState();
95
76
  const getId = useDeterministicId('NumberInput');
96
77
  useEffect(() => {
97
78
  setDeterministicId(getId());
@@ -172,8 +153,7 @@ const NumberInput = /*#__PURE__*/forwardRef((props, ref) => {
172
153
  const arrowClicked = useCallback((event, callback) => {
173
154
  event.preventDefault();
174
155
  if (interaction === 'enabled') {
175
- var _inputRef$current;
176
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
156
+ inputRef.current?.focus();
177
157
  if (typeof callback === 'function') {
178
158
  callback(event);
179
159
  }
@@ -191,8 +171,7 @@ const NumberInput = /*#__PURE__*/forwardRef((props, ref) => {
191
171
  // Expose imperative API via ref
192
172
  useImperativeHandle(ref, () => ({
193
173
  focus: () => {
194
- var _inputRef$current2;
195
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
174
+ inputRef.current?.focus();
196
175
  },
197
176
  get id() {
198
177
  return id;
@@ -204,8 +183,7 @@ const NumberInput = /*#__PURE__*/forwardRef((props, ref) => {
204
183
  return interaction;
205
184
  },
206
185
  get value() {
207
- var _inputRef$current3;
208
- return (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value;
186
+ return inputRef.current?.value;
209
187
  },
210
188
  ref: containerRef
211
189
  }), [id, invalid, interaction]);
@@ -213,31 +191,31 @@ const NumberInput = /*#__PURE__*/forwardRef((props, ref) => {
213
191
  // Render methods
214
192
  const renderArrows = customIcons => {
215
193
  return _jsxs("span", {
216
- css: styles === null || styles === void 0 ? void 0 : styles.arrowContainer,
194
+ css: styles?.arrowContainer,
217
195
  children: [_jsx("button", {
218
196
  "aria-hidden": true,
219
- css: styles === null || styles === void 0 ? void 0 : styles.arrow,
197
+ css: styles?.arrow,
220
198
  onMouseDown: handleClickUpArrow,
221
199
  onMouseOver: () => setUpButtonState('actionSecondaryHoverColor'),
222
200
  onMouseOut: () => setUpButtonState('actionSecondaryBaseColor'),
223
201
  tabIndex: -1,
224
202
  type: "button",
225
- children: customIcons !== null && customIcons !== void 0 && customIcons.increase ? callRenderProp(customIcons.increase) : _ChevronUpInstUIIcon || (_ChevronUpInstUIIcon = _jsx(ChevronUpInstUIIcon, {
203
+ children: customIcons?.increase ? callRenderProp(customIcons.increase) : _jsx(ChevronUpInstUIIcon, {
226
204
  size: "sm",
227
205
  color: upButtonState
228
- }))
206
+ })
229
207
  }), _jsx("button", {
230
208
  "aria-hidden": true,
231
- css: styles === null || styles === void 0 ? void 0 : styles.arrow,
209
+ css: styles?.arrow,
232
210
  onMouseDown: handleClickDownArrow,
233
211
  onMouseOver: () => setDownButtonState('actionSecondaryHoverColor'),
234
212
  onMouseOut: () => setDownButtonState('actionSecondaryBaseColor'),
235
213
  tabIndex: -1,
236
214
  type: "button",
237
- children: customIcons !== null && customIcons !== void 0 && customIcons.decrease ? callRenderProp(customIcons.decrease) : _ChevronDownInstUIIco || (_ChevronDownInstUIIco = _jsx(ChevronDownInstUIIcon, {
215
+ children: customIcons?.decrease ? callRenderProp(customIcons.decrease) : _jsx(ChevronDownInstUIIcon, {
238
216
  size: "sm",
239
217
  color: downButtonState
240
- }))
218
+ })
241
219
  })]
242
220
  });
243
221
  };
@@ -260,20 +238,20 @@ const NumberInput = /*#__PURE__*/forwardRef((props, ref) => {
260
238
  readOnly: interaction === 'readonly',
261
239
  "data-cid": "NumberInput",
262
240
  children: _jsx("span", {
263
- css: styles === null || styles === void 0 ? void 0 : styles.inputWidth,
241
+ css: styles?.inputWidth,
264
242
  style: width ? {
265
243
  width
266
- } : void 0,
244
+ } : undefined,
267
245
  children: _jsxs("span", {
268
- css: styles === null || styles === void 0 ? void 0 : styles.inputContainer,
246
+ css: styles?.inputContainer,
269
247
  children: [_jsx("input", {
270
248
  ...passedProps,
271
- css: styles === null || styles === void 0 ? void 0 : styles.input,
272
- "aria-invalid": invalid ? 'true' : void 0,
249
+ css: styles?.input,
250
+ "aria-invalid": invalid ? 'true' : undefined,
273
251
  id: id,
274
252
  type: allowStringValue ? 'text' : 'number',
275
253
  inputMode: inputMode,
276
- placeholder: interaction === 'enabled' ? placeholder : void 0,
254
+ placeholder: interaction === 'enabled' ? placeholder : undefined,
277
255
  ref: handleInputRef,
278
256
  required: isRequired,
279
257
  value: value,
@@ -34,11 +34,13 @@ import { calcFocusOutlineStyles } from '@instructure/emotion';
34
34
  * @return The final style object, which will be used in the component
35
35
  */
36
36
  const generateStyle = (componentTheme, params, sharedTokens) => {
37
- const size = params.size,
38
- textAlign = params.textAlign,
39
- interaction = params.interaction,
40
- success = params.success,
41
- invalid = params.invalid;
37
+ const {
38
+ size,
39
+ textAlign,
40
+ interaction,
41
+ success,
42
+ invalid
43
+ } = params;
42
44
  const containerInteractionStates = {
43
45
  ...(interaction === 'enabled' && {
44
46
  backgroundColor: componentTheme.backgroundColor,