@instructure/ui-number-input 9.9.0 → 9.10.0
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 +11 -0
- package/es/NumberInput/index.js +4 -2
- package/es/NumberInput/props.js +3 -2
- package/lib/NumberInput/index.js +4 -2
- package/lib/NumberInput/props.js +3 -2
- package/package.json +16 -16
- package/src/NumberInput/index.tsx +4 -2
- package/src/NumberInput/props.ts +9 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/NumberInput/index.d.ts +3 -0
- package/types/NumberInput/index.d.ts.map +1 -1
- package/types/NumberInput/props.d.ts +4 -0
- package/types/NumberInput/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [9.10.0](https://github.com/instructure/instructure-ui/compare/v9.9.0...v9.10.0) (2024-11-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-number-input:** fix regression and allow string type for NumberInput again ([17685f8](https://github.com/instructure/instructure-ui/commit/17685f85ef022c9f29aedec844b0c43369f014d5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [9.9.0](https://github.com/instructure/instructure-ui/compare/v9.8.1...v9.9.0) (2024-11-12)
|
|
7
18
|
|
|
8
19
|
|
package/es/NumberInput/index.js
CHANGED
|
@@ -178,6 +178,7 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
178
178
|
showArrows = _this$props4.showArrows,
|
|
179
179
|
value = _this$props4.value,
|
|
180
180
|
width = _this$props4.width,
|
|
181
|
+
allowStringValue = _this$props4.allowStringValue,
|
|
181
182
|
styles = _this$props4.styles;
|
|
182
183
|
const interaction = this.interaction;
|
|
183
184
|
const rawLabel = callRenderProp(renderLabel);
|
|
@@ -200,7 +201,7 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
200
201
|
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
|
|
201
202
|
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
202
203
|
id: this.id,
|
|
203
|
-
type:
|
|
204
|
+
type: allowStringValue ? 'text' : 'number',
|
|
204
205
|
inputMode: this.props.inputMode,
|
|
205
206
|
placeholder: placeholder,
|
|
206
207
|
ref: this.handleInputRef,
|
|
@@ -223,7 +224,8 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
223
224
|
size: 'medium',
|
|
224
225
|
display: 'block',
|
|
225
226
|
textAlign: 'start',
|
|
226
|
-
inputMode: 'numeric'
|
|
227
|
+
inputMode: 'numeric',
|
|
228
|
+
allowStringValue: false
|
|
227
229
|
}, _NumberInput)) || _class) || _class) || _class);
|
|
228
230
|
export default NumberInput;
|
|
229
231
|
export { NumberInput };
|
package/es/NumberInput/props.js
CHANGED
|
@@ -44,7 +44,8 @@ const propTypes = {
|
|
|
44
44
|
onIncrement: PropTypes.func,
|
|
45
45
|
onKeyDown: PropTypes.func,
|
|
46
46
|
inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel']),
|
|
47
|
-
textAlign: PropTypes.oneOf(['start', 'center'])
|
|
47
|
+
textAlign: PropTypes.oneOf(['start', 'center']),
|
|
48
|
+
allowStringValue: PropTypes.bool
|
|
48
49
|
};
|
|
49
|
-
const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign'];
|
|
50
|
+
const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign', 'allowStringValue'];
|
|
50
51
|
export { propTypes, allowedProps };
|
package/lib/NumberInput/index.js
CHANGED
|
@@ -190,6 +190,7 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
|
|
|
190
190
|
showArrows = _this$props4.showArrows,
|
|
191
191
|
value = _this$props4.value,
|
|
192
192
|
width = _this$props4.width,
|
|
193
|
+
allowStringValue = _this$props4.allowStringValue,
|
|
193
194
|
styles = _this$props4.styles;
|
|
194
195
|
const interaction = this.interaction;
|
|
195
196
|
const rawLabel = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
@@ -212,7 +213,7 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
|
|
|
212
213
|
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
|
|
213
214
|
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
214
215
|
id: this.id,
|
|
215
|
-
type:
|
|
216
|
+
type: allowStringValue ? 'text' : 'number',
|
|
216
217
|
inputMode: this.props.inputMode,
|
|
217
218
|
placeholder: placeholder,
|
|
218
219
|
ref: this.handleInputRef,
|
|
@@ -235,6 +236,7 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
|
|
|
235
236
|
size: 'medium',
|
|
236
237
|
display: 'block',
|
|
237
238
|
textAlign: 'start',
|
|
238
|
-
inputMode: 'numeric'
|
|
239
|
+
inputMode: 'numeric',
|
|
240
|
+
allowStringValue: false
|
|
239
241
|
}, _NumberInput)) || _class) || _class) || _class);
|
|
240
242
|
var _default = exports.default = NumberInput;
|
package/lib/NumberInput/props.js
CHANGED
|
@@ -51,6 +51,7 @@ const propTypes = exports.propTypes = {
|
|
|
51
51
|
onIncrement: _propTypes.default.func,
|
|
52
52
|
onKeyDown: _propTypes.default.func,
|
|
53
53
|
inputMode: _propTypes.default.oneOf(['numeric', 'decimal', 'tel']),
|
|
54
|
-
textAlign: _propTypes.default.oneOf(['start', 'center'])
|
|
54
|
+
textAlign: _propTypes.default.oneOf(['start', 'center']),
|
|
55
|
+
allowStringValue: _propTypes.default.bool
|
|
55
56
|
};
|
|
56
|
-
const allowedProps = exports.allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign'];
|
|
57
|
+
const allowedProps = exports.allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign', 'allowStringValue'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-number-input",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"homepage": "https://instructure.github.io/instructure-ui/",
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
"ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "9.
|
|
27
|
-
"@instructure/ui-babel-preset": "9.
|
|
28
|
-
"@instructure/ui-scripts": "9.
|
|
29
|
-
"@instructure/ui-test-locator": "9.
|
|
30
|
-
"@instructure/ui-test-utils": "9.
|
|
31
|
-
"@instructure/ui-themes": "9.
|
|
26
|
+
"@instructure/ui-axe-check": "9.10.0",
|
|
27
|
+
"@instructure/ui-babel-preset": "9.10.0",
|
|
28
|
+
"@instructure/ui-scripts": "9.10.0",
|
|
29
|
+
"@instructure/ui-test-locator": "9.10.0",
|
|
30
|
+
"@instructure/ui-test-utils": "9.10.0",
|
|
31
|
+
"@instructure/ui-themes": "9.10.0",
|
|
32
32
|
"@testing-library/react": "^15.0.7",
|
|
33
33
|
"vitest": "^2.0.2"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.24.5",
|
|
37
|
-
"@instructure/emotion": "9.
|
|
38
|
-
"@instructure/shared-types": "9.
|
|
39
|
-
"@instructure/ui-a11y-utils": "9.
|
|
40
|
-
"@instructure/ui-form-field": "9.
|
|
41
|
-
"@instructure/ui-icons": "9.
|
|
42
|
-
"@instructure/ui-react-utils": "9.
|
|
43
|
-
"@instructure/ui-testable": "9.
|
|
44
|
-
"@instructure/ui-utils": "9.
|
|
45
|
-
"@instructure/uid": "9.
|
|
37
|
+
"@instructure/emotion": "9.10.0",
|
|
38
|
+
"@instructure/shared-types": "9.10.0",
|
|
39
|
+
"@instructure/ui-a11y-utils": "9.10.0",
|
|
40
|
+
"@instructure/ui-form-field": "9.10.0",
|
|
41
|
+
"@instructure/ui-icons": "9.10.0",
|
|
42
|
+
"@instructure/ui-react-utils": "9.10.0",
|
|
43
|
+
"@instructure/ui-testable": "9.10.0",
|
|
44
|
+
"@instructure/ui-utils": "9.10.0",
|
|
45
|
+
"@instructure/uid": "9.10.0",
|
|
46
46
|
"keycode": "^2",
|
|
47
47
|
"prop-types": "^15.8.1"
|
|
48
48
|
},
|
|
@@ -75,7 +75,8 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
75
75
|
size: 'medium',
|
|
76
76
|
display: 'block',
|
|
77
77
|
textAlign: 'start',
|
|
78
|
-
inputMode: 'numeric'
|
|
78
|
+
inputMode: 'numeric',
|
|
79
|
+
allowStringValue: false
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
state: NumberInputState = { hasFocus: false }
|
|
@@ -236,6 +237,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
236
237
|
showArrows,
|
|
237
238
|
value,
|
|
238
239
|
width,
|
|
240
|
+
allowStringValue,
|
|
239
241
|
styles
|
|
240
242
|
} = this.props
|
|
241
243
|
|
|
@@ -274,7 +276,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
274
276
|
css={this.props.styles?.input}
|
|
275
277
|
aria-invalid={this.invalid ? 'true' : undefined}
|
|
276
278
|
id={this.id}
|
|
277
|
-
type=
|
|
279
|
+
type={allowStringValue ? 'text' : 'number'}
|
|
278
280
|
inputMode={this.props.inputMode}
|
|
279
281
|
placeholder={placeholder}
|
|
280
282
|
ref={this.handleInputRef}
|
package/src/NumberInput/props.ts
CHANGED
|
@@ -161,6 +161,11 @@ type NumberInputOwnProps = {
|
|
|
161
161
|
* The text alignment of the input.
|
|
162
162
|
*/
|
|
163
163
|
textAlign?: 'start' | 'center'
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* sets the input type to string and allows string as value
|
|
167
|
+
*/
|
|
168
|
+
allowStringValue?: boolean
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
type NumberInputState = {
|
|
@@ -220,7 +225,8 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
220
225
|
onIncrement: PropTypes.func,
|
|
221
226
|
onKeyDown: PropTypes.func,
|
|
222
227
|
inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel']),
|
|
223
|
-
textAlign: PropTypes.oneOf(['start', 'center'])
|
|
228
|
+
textAlign: PropTypes.oneOf(['start', 'center']),
|
|
229
|
+
allowStringValue: PropTypes.bool
|
|
224
230
|
}
|
|
225
231
|
|
|
226
232
|
const allowedProps: AllowedPropKeys = [
|
|
@@ -243,7 +249,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
243
249
|
'onIncrement',
|
|
244
250
|
'onKeyDown',
|
|
245
251
|
'inputMode',
|
|
246
|
-
'textAlign'
|
|
252
|
+
'textAlign',
|
|
253
|
+
'allowStringValue'
|
|
247
254
|
]
|
|
248
255
|
|
|
249
256
|
export type {
|