@instructure/ui-number-input 11.7.8 → 11.7.9-pr-snapshot-1792147648392

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,19 @@
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.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
7
+
8
+ ### Build System
9
+
10
+ * **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * **many:** `@instructure/ui-babel-preset` and
15
+ `@instructure/browserslist-config-instui` are removed and will no longer be
16
+ published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
17
+
18
+
6
19
  ## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
7
20
 
8
21
  **Note:** Version bump only for package @instructure/ui-number-input
@@ -1,28 +1,5 @@
1
- var _dec, _dec2, _class;
2
- /*
3
- * The MIT License (MIT)
4
- *
5
- * Copyright (c) 2015 - present Instructure, Inc.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
-
1
+ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
26
3
  import { Fragment, Component } from 'react';
27
4
  import keycode from 'keycode';
28
5
  import { FormField } from '@instructure/ui-form-field/v11_6';
@@ -33,216 +10,206 @@ import { withStyle } from '@instructure/emotion';
33
10
  import generateStyle from './styles.js';
34
11
  import generateComponentTheme from './theme.js';
35
12
  import { allowedProps } from './props.js';
36
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
37
- /**
38
- ---
39
- category: components
40
- id: NumberInput
41
- ---
42
- **/
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
- };
68
- get id() {
69
- if (this.props.id) {
70
- return this.props.id;
13
+ class NumberInput extends Component {
14
+ static{
15
+ this.displayName = 'NumberInput';
16
+ }
17
+ static{
18
+ this.componentId = 'NumberInput';
19
+ }
20
+ static{
21
+ this.allowedProps = allowedProps;
71
22
  }
72
- if (!this._id) {
73
- this._id = this.props.deterministicId();
23
+ static{
24
+ this.defaultProps = {
25
+ interaction: undefined,
26
+ messages: [],
27
+ isRequired: false,
28
+ showArrows: true,
29
+ size: 'medium',
30
+ display: 'block',
31
+ textAlign: 'start',
32
+ inputMode: 'numeric',
33
+ allowStringValue: false
34
+ };
74
35
  }
75
- return this._id;
76
- }
77
- get invalid() {
78
- return !!this.props.messages && this.props.messages.some(message => message.type === 'error' || message.type === 'newError');
79
- }
80
- get interaction() {
81
- return getInteraction({
82
- props: this.props
83
- });
84
- }
85
- componentDidMount() {
86
- this.props.makeStyles?.(this.makeStyleVariables);
87
- }
88
- componentDidUpdate() {
89
- this.props.makeStyles?.(this.makeStyleVariables);
90
- }
91
- get makeStyleVariables() {
92
- return {
93
- interaction: this.interaction,
94
- hasFocus: this.state.hasFocus,
95
- invalid: this.invalid
96
- };
97
- }
98
- handleInputRef = element => {
99
- this._input = element;
100
- if (typeof this.props.inputRef === 'function') {
101
- this.props.inputRef(element);
36
+ get id() {
37
+ if (this.props.id) {
38
+ return this.props.id;
39
+ }
40
+ if (!this._id) {
41
+ this._id = this.props.deterministicId();
42
+ }
43
+ return this._id;
102
44
  }
103
- };
104
- handleFocus = event => {
105
- this.setState({
106
- hasFocus: true
107
- });
108
- if (typeof this.props.onFocus === 'function') {
109
- this.props.onFocus(event);
45
+ get invalid() {
46
+ return !!this.props.messages && this.props.messages.some((message)=>message.type === 'error' || message.type === 'newError');
110
47
  }
111
- };
112
- handleBlur = event => {
113
- this.setState({
114
- hasFocus: false
115
- });
116
- if (typeof this.props.onBlur === 'function') {
117
- this.props.onBlur(event);
48
+ get interaction() {
49
+ return getInteraction({
50
+ props: this.props
51
+ });
118
52
  }
119
- };
120
- handleChange = event => {
121
- if (typeof this.props.onChange === 'function') {
122
- this.props.onChange(event, event.target.value);
53
+ componentDidMount() {
54
+ this.props.makeStyles?.(this.makeStyleVariables);
123
55
  }
124
- };
125
- handleKeyDown = event => {
126
- const {
127
- onKeyDown,
128
- onDecrement,
129
- onIncrement
130
- } = this.props;
131
- if (typeof onKeyDown === 'function') {
132
- onKeyDown(event);
56
+ componentDidUpdate() {
57
+ this.props.makeStyles?.(this.makeStyleVariables);
133
58
  }
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
- }
59
+ get makeStyleVariables() {
60
+ return {
61
+ interaction: this.interaction,
62
+ hasFocus: this.state.hasFocus,
63
+ invalid: this.invalid
64
+ };
144
65
  }
145
- };
146
- handleClickUpArrow = event => {
147
- this.arrowClicked(event, this.props.onIncrement);
148
- };
149
- handleClickDownArrow = event => {
150
- this.arrowClicked(event, this.props.onDecrement);
151
- };
152
- arrowClicked(event, callback) {
153
- const {
154
- interaction
155
- } = this;
156
- event.preventDefault();
157
- if (interaction === 'enabled') {
158
- this._input?.focus();
159
- if (typeof callback === 'function') {
160
- callback(event);
161
- }
66
+ arrowClicked(event, callback) {
67
+ const { interaction } = this;
68
+ event.preventDefault();
69
+ if (interaction === 'enabled') {
70
+ this._input?.focus();
71
+ if (typeof callback === 'function') {
72
+ callback(event);
73
+ }
74
+ }
162
75
  }
163
- }
164
- renderArrows(customIcons) {
165
- return _jsxs("span", {
166
- css: this.props.styles?.arrowContainer,
167
- children: [_jsx("button", {
168
- "aria-hidden": true,
169
- css: this.props.styles?.arrow,
170
- onMouseDown: this.handleClickUpArrow,
171
- tabIndex: -1,
172
- type: "button",
173
- children: customIcons?.increase ? callRenderProp(customIcons.increase) : _jsx(IconArrowOpenUpLine, {})
174
- }), _jsx("button", {
175
- "aria-hidden": true,
176
- css: this.props.styles?.arrow,
177
- onMouseDown: this.handleClickDownArrow,
178
- tabIndex: -1,
179
- type: "button",
180
- children: customIcons?.decrease ? callRenderProp(customIcons.decrease) : _jsx(IconArrowOpenDownLine, {})
181
- })]
182
- });
183
- }
184
- render() {
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;
201
- const rawLabel = callRenderProp(renderLabel);
202
- const label = hasVisibleChildren(rawLabel) ? _jsxs(Fragment, {
203
- children: [rawLabel, isRequired && _jsxs("span", {
204
- css: this.invalid ? styles?.requiredInvalid : {},
205
- "aria-hidden": true,
206
- children: [' ', "*"]
207
- })]
208
- }) : rawLabel;
209
- return _jsx(FormField, {
210
- ...pickProps(this.props, FormField.allowedProps),
211
- label: label,
212
- inline: display === 'inline-block',
213
- id: this.id,
214
- elementRef: this.handleRef,
215
- margin: margin,
216
- "data-cid": "NumberInput",
217
- children: _jsx("span", {
218
- css: this.props.styles?.inputWidth,
219
- style: width ? {
220
- width
221
- } : undefined,
222
- children: _jsxs("span", {
223
- css: this.props.styles?.inputContainer,
224
- children: [_jsx("input", {
225
- ...omitProps(this.props, [...FormField.allowedProps, ...NumberInput.allowedProps]),
226
- css: this.props.styles?.input,
227
- "aria-invalid": this.invalid ? 'true' : undefined,
76
+ renderArrows(customIcons) {
77
+ return /*#__PURE__*/ _jsxs("span", {
78
+ css: this.props.styles?.arrowContainer,
79
+ children: [
80
+ /*#__PURE__*/ _jsx("button", {
81
+ "aria-hidden": true,
82
+ css: this.props.styles?.arrow,
83
+ onMouseDown: this.handleClickUpArrow,
84
+ tabIndex: -1,
85
+ type: "button",
86
+ children: customIcons?.increase ? callRenderProp(customIcons.increase) : /*#__PURE__*/ _jsx(IconArrowOpenUpLine, {})
87
+ }),
88
+ /*#__PURE__*/ _jsx("button", {
89
+ "aria-hidden": true,
90
+ css: this.props.styles?.arrow,
91
+ onMouseDown: this.handleClickDownArrow,
92
+ tabIndex: -1,
93
+ type: "button",
94
+ children: customIcons?.decrease ? callRenderProp(customIcons.decrease) : /*#__PURE__*/ _jsx(IconArrowOpenDownLine, {})
95
+ })
96
+ ]
97
+ });
98
+ }
99
+ render() {
100
+ const { renderLabel, display, placeholder, isRequired, showArrows, value, width, styles, allowStringValue, renderIcons, margin } = this.props;
101
+ const { interaction } = this;
102
+ const rawLabel = callRenderProp(renderLabel);
103
+ const label = hasVisibleChildren(rawLabel) ? /*#__PURE__*/ _jsxs(Fragment, {
104
+ children: [
105
+ rawLabel,
106
+ isRequired && /*#__PURE__*/ _jsxs("span", {
107
+ css: this.invalid ? styles?.requiredInvalid : {},
108
+ "aria-hidden": true,
109
+ children: [
110
+ ' ',
111
+ "*"
112
+ ]
113
+ })
114
+ ]
115
+ }) : rawLabel;
116
+ return /*#__PURE__*/ _jsx(FormField, {
117
+ ...pickProps(this.props, FormField.allowedProps),
118
+ label: label,
119
+ inline: display === 'inline-block',
228
120
  id: this.id,
229
- type: allowStringValue ? 'text' : 'number',
230
- inputMode: this.props.inputMode,
231
- placeholder: placeholder,
232
- ref: this.handleInputRef,
233
- required: isRequired,
234
- value: value,
235
- disabled: interaction === 'disabled',
236
- readOnly: interaction === 'readonly',
237
- onFocus: this.handleFocus,
238
- onBlur: this.handleBlur,
239
- onChange: this.handleChange,
240
- onKeyDown: this.handleKeyDown
241
- }), showArrows ? this.renderArrows(renderIcons) : null]
242
- })
243
- })
244
- });
245
- }
246
- }) || _class) || _class);
121
+ elementRef: this.handleRef,
122
+ margin: margin,
123
+ "data-cid": "NumberInput",
124
+ children: /*#__PURE__*/ _jsx("span", {
125
+ css: this.props.styles?.inputWidth,
126
+ style: width ? {
127
+ width
128
+ } : undefined,
129
+ children: /*#__PURE__*/ _jsxs("span", {
130
+ css: this.props.styles?.inputContainer,
131
+ children: [
132
+ /*#__PURE__*/ _jsx("input", {
133
+ ...omitProps(this.props, [
134
+ ...FormField.allowedProps,
135
+ ...NumberInput.allowedProps
136
+ ]),
137
+ css: this.props.styles?.input,
138
+ "aria-invalid": this.invalid ? 'true' : undefined,
139
+ id: this.id,
140
+ type: allowStringValue ? 'text' : 'number',
141
+ inputMode: this.props.inputMode,
142
+ placeholder: placeholder,
143
+ ref: this.handleInputRef,
144
+ required: isRequired,
145
+ value: value,
146
+ disabled: interaction === 'disabled',
147
+ readOnly: interaction === 'readonly',
148
+ onFocus: this.handleFocus,
149
+ onBlur: this.handleBlur,
150
+ onChange: this.handleChange,
151
+ onKeyDown: this.handleKeyDown
152
+ }),
153
+ showArrows ? this.renderArrows(renderIcons) : null
154
+ ]
155
+ })
156
+ })
157
+ });
158
+ }
159
+ constructor(...args){
160
+ super(...args), this.state = {
161
+ hasFocus: false
162
+ }, this.ref = null, this._input = null, this.handleRef = (el)=>{
163
+ this.ref = el;
164
+ }, this.handleInputRef = (element)=>{
165
+ this._input = element;
166
+ if (typeof this.props.inputRef === 'function') {
167
+ this.props.inputRef(element);
168
+ }
169
+ }, this.handleFocus = (event)=>{
170
+ this.setState({
171
+ hasFocus: true
172
+ });
173
+ if (typeof this.props.onFocus === 'function') {
174
+ this.props.onFocus(event);
175
+ }
176
+ }, this.handleBlur = (event)=>{
177
+ this.setState({
178
+ hasFocus: false
179
+ });
180
+ if (typeof this.props.onBlur === 'function') {
181
+ this.props.onBlur(event);
182
+ }
183
+ }, this.handleChange = (event)=>{
184
+ if (typeof this.props.onChange === 'function') {
185
+ this.props.onChange(event, event.target.value);
186
+ }
187
+ }, this.handleKeyDown = (event)=>{
188
+ const { onKeyDown, onDecrement, onIncrement } = this.props;
189
+ if (typeof onKeyDown === 'function') {
190
+ onKeyDown(event);
191
+ }
192
+ if (event.keyCode === keycode.codes.down) {
193
+ event.preventDefault();
194
+ if (typeof onDecrement === 'function') {
195
+ onDecrement(event);
196
+ }
197
+ } else if (event.keyCode === keycode.codes.up) {
198
+ event.preventDefault();
199
+ if (typeof onIncrement === 'function') {
200
+ onIncrement(event);
201
+ }
202
+ }
203
+ }, this.handleClickUpArrow = (event)=>{
204
+ this.arrowClicked(event, this.props.onIncrement);
205
+ }, this.handleClickDownArrow = (event)=>{
206
+ this.arrowClicked(event, this.props.onDecrement);
207
+ };
208
+ }
209
+ }
210
+ NumberInput = _ts_decorate([
211
+ withDeterministicId(),
212
+ withStyle(generateStyle, generateComponentTheme)
213
+ ], NumberInput);
247
214
  export default NumberInput;
248
- export { NumberInput };
215
+ export { NumberInput };
@@ -1,26 +1,26 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign', 'allowStringValue', 'renderIcons', 'margin'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'renderLabel',
3
+ 'id',
4
+ 'interaction',
5
+ 'messages',
6
+ 'placeholder',
7
+ 'isRequired',
8
+ 'showArrows',
9
+ 'size',
10
+ 'value',
11
+ 'width',
12
+ 'display',
13
+ 'inputRef',
14
+ 'onFocus',
15
+ 'onBlur',
16
+ 'onChange',
17
+ 'onDecrement',
18
+ 'onIncrement',
19
+ 'onKeyDown',
20
+ 'inputMode',
21
+ 'textAlign',
22
+ 'allowStringValue',
23
+ 'renderIcons',
24
+ 'margin'
25
+ ];
26
+ export { allowedProps };