@instructure/ui-number-input 9.7.2 → 9.8.1-pr-snapshot-1729275373690

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,25 @@
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.8.1-pr-snapshot-1729275373690](https://github.com/instructure/instructure-ui/compare/v9.8.0...v9.8.1-pr-snapshot-1729275373690) (2024-10-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-number-input:** add back options for string input ([1ddaf59](https://github.com/instructure/instructure-ui/commit/1ddaf59a0cdb000ef5bb60b7fd7d440639f65ef1))
12
+
13
+
14
+
15
+
16
+
17
+ # [9.8.0](https://github.com/instructure/instructure-ui/compare/v9.7.2...v9.8.0) (2024-10-16)
18
+
19
+ **Note:** Version bump only for package @instructure/ui-number-input
20
+
21
+
22
+
23
+
24
+
6
25
  ## [9.7.2](https://github.com/instructure/instructure-ui/compare/v9.7.0...v9.7.2) (2024-10-10)
7
26
 
8
27
  **Note:** Version bump only for package @instructure/ui-number-input
@@ -176,7 +176,8 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
176
176
  isRequired = _this$props4.isRequired,
177
177
  showArrows = _this$props4.showArrows,
178
178
  value = _this$props4.value,
179
- width = _this$props4.width;
179
+ width = _this$props4.width,
180
+ allowStringValue = _this$props4.allowStringValue;
180
181
  const interaction = this.interaction;
181
182
  return jsx(FormField, Object.assign({}, pickProps(this.props, FormField.allowedProps), {
182
183
  label: callRenderProp(renderLabel),
@@ -194,7 +195,7 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
194
195
  css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
195
196
  "aria-invalid": this.invalid ? 'true' : void 0,
196
197
  id: this.id,
197
- type: "number",
198
+ type: allowStringValue ? 'string' : 'number',
198
199
  inputMode: this.props.inputMode,
199
200
  placeholder: placeholder,
200
201
  ref: this.handleInputRef,
@@ -217,7 +218,8 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
217
218
  size: 'medium',
218
219
  display: 'block',
219
220
  textAlign: 'start',
220
- inputMode: 'numeric'
221
+ inputMode: 'numeric',
222
+ allowStringValue: false
221
223
  }, _NumberInput)) || _class) || _class) || _class);
222
224
  export default NumberInput;
223
225
  export { NumberInput };
@@ -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 };
@@ -188,7 +188,8 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
188
188
  isRequired = _this$props4.isRequired,
189
189
  showArrows = _this$props4.showArrows,
190
190
  value = _this$props4.value,
191
- width = _this$props4.width;
191
+ width = _this$props4.width,
192
+ allowStringValue = _this$props4.allowStringValue;
192
193
  const interaction = this.interaction;
193
194
  return (0, _emotion.jsx)(_FormField.FormField, Object.assign({}, (0, _pickProps.pickProps)(this.props, _FormField.FormField.allowedProps), {
194
195
  label: (0, _callRenderProp.callRenderProp)(renderLabel),
@@ -206,7 +207,7 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
206
207
  css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
207
208
  "aria-invalid": this.invalid ? 'true' : void 0,
208
209
  id: this.id,
209
- type: "number",
210
+ type: allowStringValue ? 'string' : 'number',
210
211
  inputMode: this.props.inputMode,
211
212
  placeholder: placeholder,
212
213
  ref: this.handleInputRef,
@@ -229,6 +230,7 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
229
230
  size: 'medium',
230
231
  display: 'block',
231
232
  textAlign: 'start',
232
- inputMode: 'numeric'
233
+ inputMode: 'numeric',
234
+ allowStringValue: false
233
235
  }, _NumberInput)) || _class) || _class) || _class);
234
236
  var _default = exports.default = NumberInput;
@@ -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.7.2",
3
+ "version": "9.8.1-pr-snapshot-1729275373690",
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,25 +23,25 @@
23
23
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
24
24
  },
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "9.7.2",
27
- "@instructure/ui-babel-preset": "9.7.2",
28
- "@instructure/ui-scripts": "9.7.2",
29
- "@instructure/ui-test-locator": "9.7.2",
30
- "@instructure/ui-test-utils": "9.7.2",
31
- "@instructure/ui-themes": "9.7.2",
26
+ "@instructure/ui-axe-check": "9.8.1-pr-snapshot-1729275373690",
27
+ "@instructure/ui-babel-preset": "9.8.1-pr-snapshot-1729275373690",
28
+ "@instructure/ui-scripts": "9.8.1-pr-snapshot-1729275373690",
29
+ "@instructure/ui-test-locator": "9.8.1-pr-snapshot-1729275373690",
30
+ "@instructure/ui-test-utils": "9.8.1-pr-snapshot-1729275373690",
31
+ "@instructure/ui-themes": "9.8.1-pr-snapshot-1729275373690",
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.7.2",
38
- "@instructure/shared-types": "9.7.2",
39
- "@instructure/ui-form-field": "9.7.2",
40
- "@instructure/ui-icons": "9.7.2",
41
- "@instructure/ui-react-utils": "9.7.2",
42
- "@instructure/ui-testable": "9.7.2",
43
- "@instructure/ui-utils": "9.7.2",
44
- "@instructure/uid": "9.7.2",
37
+ "@instructure/emotion": "9.8.1-pr-snapshot-1729275373690",
38
+ "@instructure/shared-types": "9.8.1-pr-snapshot-1729275373690",
39
+ "@instructure/ui-form-field": "9.8.1-pr-snapshot-1729275373690",
40
+ "@instructure/ui-icons": "9.8.1-pr-snapshot-1729275373690",
41
+ "@instructure/ui-react-utils": "9.8.1-pr-snapshot-1729275373690",
42
+ "@instructure/ui-testable": "9.8.1-pr-snapshot-1729275373690",
43
+ "@instructure/ui-utils": "9.8.1-pr-snapshot-1729275373690",
44
+ "@instructure/uid": "9.8.1-pr-snapshot-1729275373690",
45
45
  "keycode": "^2",
46
46
  "prop-types": "^15.8.1"
47
47
  },
@@ -74,7 +74,8 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
74
74
  size: 'medium',
75
75
  display: 'block',
76
76
  textAlign: 'start',
77
- inputMode: 'numeric'
77
+ inputMode: 'numeric',
78
+ allowStringValue: false
78
79
  }
79
80
 
80
81
  state: NumberInputState = { hasFocus: false }
@@ -232,7 +233,8 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
232
233
  isRequired,
233
234
  showArrows,
234
235
  value,
235
- width
236
+ width,
237
+ allowStringValue
236
238
  } = this.props
237
239
 
238
240
  const { interaction } = this
@@ -258,7 +260,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
258
260
  css={this.props.styles?.input}
259
261
  aria-invalid={this.invalid ? 'true' : undefined}
260
262
  id={this.id}
261
- type="number"
263
+ type={allowStringValue ? 'string' : 'number'}
262
264
  inputMode={this.props.inputMode}
263
265
  placeholder={placeholder}
264
266
  ref={this.handleInputRef}
@@ -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 = {
@@ -219,7 +224,8 @@ const propTypes: PropValidators<PropKeys> = {
219
224
  onIncrement: PropTypes.func,
220
225
  onKeyDown: PropTypes.func,
221
226
  inputMode: PropTypes.oneOf(['numeric', 'decimal', 'tel']),
222
- textAlign: PropTypes.oneOf(['start', 'center'])
227
+ textAlign: PropTypes.oneOf(['start', 'center']),
228
+ allowStringValue: PropTypes.bool
223
229
  }
224
230
 
225
231
  const allowedProps: AllowedPropKeys = [
@@ -242,7 +248,8 @@ const allowedProps: AllowedPropKeys = [
242
248
  'onIncrement',
243
249
  'onKeyDown',
244
250
  'inputMode',
245
- 'textAlign'
251
+ 'textAlign',
252
+ 'allowStringValue'
246
253
  ]
247
254
 
248
255
  export type {