@instructure/ui-number-input 10.6.2-snapshot-2 → 10.6.2-snapshot-3
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 +2 -5
- package/es/NumberInput/index.js +3 -5
- package/es/NumberInput/props.js +2 -3
- package/lib/NumberInput/index.js +3 -5
- package/lib/NumberInput/props.js +2 -3
- package/package.json +14 -14
- package/src/NumberInput/README.md +3 -4
- package/src/NumberInput/index.tsx +3 -5
- package/src/NumberInput/props.ts +2 -9
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/NumberInput/index.d.ts +0 -3
- package/types/NumberInput/index.d.ts.map +1 -1
- package/types/NumberInput/props.d.ts +0 -4
- package/types/NumberInput/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,9 @@
|
|
|
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
|
-
## [10.6.2-snapshot-
|
|
6
|
+
## [10.6.2-snapshot-3](https://github.com/instructure/instructure-ui/compare/v10.6.1...v10.6.2-snapshot-3) (2024-11-29)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* **ui-number-input:** add back options for string input ([14bbaea](https://github.com/instructure/instructure-ui/commit/14bbaea13b0829887de946363cd21639e5643749))
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-number-input
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
|
package/es/NumberInput/index.js
CHANGED
|
@@ -178,8 +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
|
-
styles = _this$props4.styles
|
|
182
|
-
allowStringValue = _this$props4.allowStringValue;
|
|
181
|
+
styles = _this$props4.styles;
|
|
183
182
|
const interaction = this.interaction;
|
|
184
183
|
const rawLabel = callRenderProp(renderLabel);
|
|
185
184
|
const label = hasVisibleChildren(rawLabel) ? jsx(React.Fragment, null, rawLabel, isRequired && jsx("span", {
|
|
@@ -201,7 +200,7 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
201
200
|
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
|
|
202
201
|
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
203
202
|
id: this.id,
|
|
204
|
-
type:
|
|
203
|
+
type: "number",
|
|
205
204
|
inputMode: this.props.inputMode,
|
|
206
205
|
placeholder: placeholder,
|
|
207
206
|
ref: this.handleInputRef,
|
|
@@ -224,8 +223,7 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
224
223
|
size: 'medium',
|
|
225
224
|
display: 'block',
|
|
226
225
|
textAlign: 'start',
|
|
227
|
-
inputMode: 'numeric'
|
|
228
|
-
allowStringValue: false
|
|
226
|
+
inputMode: 'numeric'
|
|
229
227
|
}, _NumberInput)) || _class) || _class) || _class);
|
|
230
228
|
export default NumberInput;
|
|
231
229
|
export { NumberInput };
|
package/es/NumberInput/props.js
CHANGED
|
@@ -44,8 +44,7 @@ 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'])
|
|
48
|
-
allowStringValue: PropTypes.bool
|
|
47
|
+
textAlign: PropTypes.oneOf(['start', 'center'])
|
|
49
48
|
};
|
|
50
|
-
const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign'
|
|
49
|
+
const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign'];
|
|
51
50
|
export { propTypes, allowedProps };
|
package/lib/NumberInput/index.js
CHANGED
|
@@ -190,8 +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
|
-
styles = _this$props4.styles
|
|
194
|
-
allowStringValue = _this$props4.allowStringValue;
|
|
193
|
+
styles = _this$props4.styles;
|
|
195
194
|
const interaction = this.interaction;
|
|
196
195
|
const rawLabel = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
197
196
|
const label = (0, _hasVisibleChildren.hasVisibleChildren)(rawLabel) ? (0, _emotion.jsx)(_react.default.Fragment, null, rawLabel, isRequired && (0, _emotion.jsx)("span", {
|
|
@@ -213,7 +212,7 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
|
|
|
213
212
|
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
|
|
214
213
|
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
215
214
|
id: this.id,
|
|
216
|
-
type:
|
|
215
|
+
type: "number",
|
|
217
216
|
inputMode: this.props.inputMode,
|
|
218
217
|
placeholder: placeholder,
|
|
219
218
|
ref: this.handleInputRef,
|
|
@@ -236,7 +235,6 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
|
|
|
236
235
|
size: 'medium',
|
|
237
236
|
display: 'block',
|
|
238
237
|
textAlign: 'start',
|
|
239
|
-
inputMode: 'numeric'
|
|
240
|
-
allowStringValue: false
|
|
238
|
+
inputMode: 'numeric'
|
|
241
239
|
}, _NumberInput)) || _class) || _class) || _class);
|
|
242
240
|
var _default = exports.default = NumberInput;
|
package/lib/NumberInput/props.js
CHANGED
|
@@ -51,7 +51,6 @@ 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'])
|
|
55
|
-
allowStringValue: _propTypes.default.bool
|
|
54
|
+
textAlign: _propTypes.default.oneOf(['start', 'center'])
|
|
56
55
|
};
|
|
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'
|
|
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'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-number-input",
|
|
3
|
-
"version": "10.6.2-snapshot-
|
|
3
|
+
"version": "10.6.2-snapshot-3",
|
|
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,11 +23,11 @@
|
|
|
23
23
|
"ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "10.6.2-snapshot-
|
|
27
|
-
"@instructure/ui-babel-preset": "10.6.2-snapshot-
|
|
28
|
-
"@instructure/ui-scripts": "10.6.2-snapshot-
|
|
29
|
-
"@instructure/ui-test-utils": "10.6.2-snapshot-
|
|
30
|
-
"@instructure/ui-themes": "10.6.2-snapshot-
|
|
26
|
+
"@instructure/ui-axe-check": "10.6.2-snapshot-3",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.6.2-snapshot-3",
|
|
28
|
+
"@instructure/ui-scripts": "10.6.2-snapshot-3",
|
|
29
|
+
"@instructure/ui-test-utils": "10.6.2-snapshot-3",
|
|
30
|
+
"@instructure/ui-themes": "10.6.2-snapshot-3",
|
|
31
31
|
"@testing-library/jest-dom": "^6.4.6",
|
|
32
32
|
"@testing-library/react": "^16.0.1",
|
|
33
33
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/runtime": "^7.25.6",
|
|
38
|
-
"@instructure/emotion": "10.6.2-snapshot-
|
|
39
|
-
"@instructure/shared-types": "10.6.2-snapshot-
|
|
40
|
-
"@instructure/ui-form-field": "10.6.2-snapshot-
|
|
41
|
-
"@instructure/ui-icons": "10.6.2-snapshot-
|
|
42
|
-
"@instructure/ui-react-utils": "10.6.2-snapshot-
|
|
43
|
-
"@instructure/ui-testable": "10.6.2-snapshot-
|
|
44
|
-
"@instructure/ui-utils": "10.6.2-snapshot-
|
|
45
|
-
"@instructure/uid": "10.6.2-snapshot-
|
|
38
|
+
"@instructure/emotion": "10.6.2-snapshot-3",
|
|
39
|
+
"@instructure/shared-types": "10.6.2-snapshot-3",
|
|
40
|
+
"@instructure/ui-form-field": "10.6.2-snapshot-3",
|
|
41
|
+
"@instructure/ui-icons": "10.6.2-snapshot-3",
|
|
42
|
+
"@instructure/ui-react-utils": "10.6.2-snapshot-3",
|
|
43
|
+
"@instructure/ui-testable": "10.6.2-snapshot-3",
|
|
44
|
+
"@instructure/ui-utils": "10.6.2-snapshot-3",
|
|
45
|
+
"@instructure/uid": "10.6.2-snapshot-3",
|
|
46
46
|
"keycode": "^2",
|
|
47
47
|
"prop-types": "^15.8.1"
|
|
48
48
|
},
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
describes: NumberInput
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
A controlled number input field.
|
|
6
|
-
By deafult, it renders a `<intput type="number">` to the DOM. However, if you need any string value, use the `allowStringValue` flag. Only use this if absolutely necessary, since it could be confusing for screenreader users.
|
|
7
|
-
Note that this field **does not work
|
|
5
|
+
A controlled number input field. Note that this field **does not work
|
|
8
6
|
uncontrolled** - you must pass event handlers if you want it to respond to
|
|
9
7
|
user input.
|
|
10
8
|
|
|
@@ -302,11 +300,12 @@ type: embed
|
|
|
302
300
|
---
|
|
303
301
|
<Guidelines>
|
|
304
302
|
<Figure recommendation="yes" title="Do">
|
|
305
|
-
<Figure.Item>Use when
|
|
303
|
+
<Figure.Item>Use when the input is limited to a number (integer, rational, or irrational expressed with decimal points)</Figure.Item>
|
|
306
304
|
<Figure.Item>Use labels at the top or to the left of the input field</Figure.Item>
|
|
307
305
|
</Figure>
|
|
308
306
|
<Figure recommendation="no" title="Don't">
|
|
309
307
|
<Figure.Item>Place labels or text strings to the right of the input field</Figure.Item>
|
|
308
|
+
<Figure.Item>Use for alphanumeric input</Figure.Item>
|
|
310
309
|
</Figure>
|
|
311
310
|
</Guidelines>
|
|
312
311
|
```
|
|
@@ -75,8 +75,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
75
75
|
size: 'medium',
|
|
76
76
|
display: 'block',
|
|
77
77
|
textAlign: 'start',
|
|
78
|
-
inputMode: 'numeric'
|
|
79
|
-
allowStringValue: false
|
|
78
|
+
inputMode: 'numeric'
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
state: NumberInputState = { hasFocus: false }
|
|
@@ -237,8 +236,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
237
236
|
showArrows,
|
|
238
237
|
value,
|
|
239
238
|
width,
|
|
240
|
-
styles
|
|
241
|
-
allowStringValue
|
|
239
|
+
styles
|
|
242
240
|
} = this.props
|
|
243
241
|
|
|
244
242
|
const { interaction } = this
|
|
@@ -276,7 +274,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
276
274
|
css={this.props.styles?.input}
|
|
277
275
|
aria-invalid={this.invalid ? 'true' : undefined}
|
|
278
276
|
id={this.id}
|
|
279
|
-
type=
|
|
277
|
+
type="number"
|
|
280
278
|
inputMode={this.props.inputMode}
|
|
281
279
|
placeholder={placeholder}
|
|
282
280
|
ref={this.handleInputRef}
|
package/src/NumberInput/props.ts
CHANGED
|
@@ -161,11 +161,6 @@ 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
|
|
169
164
|
}
|
|
170
165
|
|
|
171
166
|
type NumberInputState = {
|
|
@@ -225,8 +220,7 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
225
220
|
onIncrement: PropTypes.func,
|
|
226
221
|
onKeyDown: PropTypes.func,
|
|
227
222
|
inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel']),
|
|
228
|
-
textAlign: PropTypes.oneOf(['start', 'center'])
|
|
229
|
-
allowStringValue: PropTypes.bool
|
|
223
|
+
textAlign: PropTypes.oneOf(['start', 'center'])
|
|
230
224
|
}
|
|
231
225
|
|
|
232
226
|
const allowedProps: AllowedPropKeys = [
|
|
@@ -249,8 +243,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
249
243
|
'onIncrement',
|
|
250
244
|
'onKeyDown',
|
|
251
245
|
'inputMode',
|
|
252
|
-
'textAlign'
|
|
253
|
-
'allowStringValue'
|
|
246
|
+
'textAlign'
|
|
254
247
|
]
|
|
255
248
|
|
|
256
249
|
export type {
|