@instructure/ui-number-input 10.11.1-snapshot-18 → 10.12.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 +5 -2
- 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 +14 -14
- package/src/NumberInput/index.tsx +3 -1
- package/src/NumberInput/props.ts +13 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/NumberInput/index.d.ts +2 -0
- package/types/NumberInput/index.d.ts.map +1 -1
- package/types/NumberInput/props.d.ts +5 -1
- package/types/NumberInput/props.d.ts.map +1 -1
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
|
-
|
|
6
|
+
# [10.12.0](https://github.com/instructure/instructure-ui/compare/v10.11.0...v10.12.0) (2025-02-24)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **many:** introduce new spacing tokens; add margin prop for more components ([048c902](https://github.com/instructure/instructure-ui/commit/048c902406c00611cd117fb2fb8164a6eba62fb8))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/es/NumberInput/index.js
CHANGED
|
@@ -180,7 +180,8 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
180
180
|
width = _this$props4.width,
|
|
181
181
|
styles = _this$props4.styles,
|
|
182
182
|
allowStringValue = _this$props4.allowStringValue,
|
|
183
|
-
renderIcons = _this$props4.renderIcons
|
|
183
|
+
renderIcons = _this$props4.renderIcons,
|
|
184
|
+
margin = _this$props4.margin;
|
|
184
185
|
const interaction = this.interaction;
|
|
185
186
|
const rawLabel = callRenderProp(renderLabel);
|
|
186
187
|
const label = hasVisibleChildren(rawLabel) ? jsx(React.Fragment, null, rawLabel, isRequired && jsx("span", {
|
|
@@ -191,7 +192,8 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
191
192
|
label: label,
|
|
192
193
|
inline: display === 'inline-block',
|
|
193
194
|
id: this.id,
|
|
194
|
-
elementRef: this.handleRef
|
|
195
|
+
elementRef: this.handleRef,
|
|
196
|
+
margin: margin
|
|
195
197
|
}), jsx("span", {
|
|
196
198
|
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.inputWidth,
|
|
197
199
|
style: width ? {
|
package/es/NumberInput/props.js
CHANGED
|
@@ -49,7 +49,8 @@ const propTypes = {
|
|
|
49
49
|
renderIcons: PropTypes.shape({
|
|
50
50
|
increase: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
51
51
|
decrease: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired
|
|
52
|
-
})
|
|
52
|
+
}),
|
|
53
|
+
margin: PropTypes.string
|
|
53
54
|
};
|
|
54
|
-
const allowedProps = ['renderLabel', 'id', 'interaction', 'messages', 'placeholder', 'isRequired', 'showArrows', 'size', 'value', 'width', 'display', 'inputRef', 'onFocus', 'onBlur', 'onChange', 'onDecrement', 'onIncrement', 'onKeyDown', 'inputMode', 'textAlign', 'allowStringValue', 'renderIcons'];
|
|
55
|
+
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'];
|
|
55
56
|
export { propTypes, allowedProps };
|
package/lib/NumberInput/index.js
CHANGED
|
@@ -192,7 +192,8 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
|
|
|
192
192
|
width = _this$props4.width,
|
|
193
193
|
styles = _this$props4.styles,
|
|
194
194
|
allowStringValue = _this$props4.allowStringValue,
|
|
195
|
-
renderIcons = _this$props4.renderIcons
|
|
195
|
+
renderIcons = _this$props4.renderIcons,
|
|
196
|
+
margin = _this$props4.margin;
|
|
196
197
|
const interaction = this.interaction;
|
|
197
198
|
const rawLabel = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
198
199
|
const label = (0, _hasVisibleChildren.hasVisibleChildren)(rawLabel) ? (0, _emotion.jsx)(_react.default.Fragment, null, rawLabel, isRequired && (0, _emotion.jsx)("span", {
|
|
@@ -203,7 +204,8 @@ let NumberInput = exports.NumberInput = (_dec = (0, _withDeterministicId.withDet
|
|
|
203
204
|
label: label,
|
|
204
205
|
inline: display === 'inline-block',
|
|
205
206
|
id: this.id,
|
|
206
|
-
elementRef: this.handleRef
|
|
207
|
+
elementRef: this.handleRef,
|
|
208
|
+
margin: margin
|
|
207
209
|
}), (0, _emotion.jsx)("span", {
|
|
208
210
|
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.inputWidth,
|
|
209
211
|
style: width ? {
|
package/lib/NumberInput/props.js
CHANGED
|
@@ -56,6 +56,7 @@ const propTypes = exports.propTypes = {
|
|
|
56
56
|
renderIcons: _propTypes.default.shape({
|
|
57
57
|
increase: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
58
58
|
decrease: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired
|
|
59
|
-
})
|
|
59
|
+
}),
|
|
60
|
+
margin: _propTypes.default.string
|
|
60
61
|
};
|
|
61
|
-
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', 'renderIcons'];
|
|
62
|
+
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', 'renderIcons', 'margin'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-number-input",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.12.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,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.
|
|
27
|
-
"@instructure/ui-babel-preset": "10.
|
|
28
|
-
"@instructure/ui-scripts": "10.
|
|
29
|
-
"@instructure/ui-test-utils": "10.
|
|
30
|
-
"@instructure/ui-themes": "10.
|
|
26
|
+
"@instructure/ui-axe-check": "10.12.0",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.12.0",
|
|
28
|
+
"@instructure/ui-scripts": "10.12.0",
|
|
29
|
+
"@instructure/ui-test-utils": "10.12.0",
|
|
30
|
+
"@instructure/ui-themes": "10.12.0",
|
|
31
31
|
"@testing-library/jest-dom": "^6.6.3",
|
|
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.26.0",
|
|
38
|
-
"@instructure/emotion": "10.
|
|
39
|
-
"@instructure/shared-types": "10.
|
|
40
|
-
"@instructure/ui-form-field": "10.
|
|
41
|
-
"@instructure/ui-icons": "10.
|
|
42
|
-
"@instructure/ui-react-utils": "10.
|
|
43
|
-
"@instructure/ui-testable": "10.
|
|
44
|
-
"@instructure/ui-utils": "10.
|
|
45
|
-
"@instructure/uid": "10.
|
|
38
|
+
"@instructure/emotion": "10.12.0",
|
|
39
|
+
"@instructure/shared-types": "10.12.0",
|
|
40
|
+
"@instructure/ui-form-field": "10.12.0",
|
|
41
|
+
"@instructure/ui-icons": "10.12.0",
|
|
42
|
+
"@instructure/ui-react-utils": "10.12.0",
|
|
43
|
+
"@instructure/ui-testable": "10.12.0",
|
|
44
|
+
"@instructure/ui-utils": "10.12.0",
|
|
45
|
+
"@instructure/uid": "10.12.0",
|
|
46
46
|
"keycode": "^2",
|
|
47
47
|
"prop-types": "^15.8.1"
|
|
48
48
|
},
|
|
@@ -248,7 +248,8 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
248
248
|
width,
|
|
249
249
|
styles,
|
|
250
250
|
allowStringValue,
|
|
251
|
-
renderIcons
|
|
251
|
+
renderIcons,
|
|
252
|
+
margin
|
|
252
253
|
} = this.props
|
|
253
254
|
|
|
254
255
|
const { interaction } = this
|
|
@@ -278,6 +279,7 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
|
|
|
278
279
|
inline={display === 'inline-block'}
|
|
279
280
|
id={this.id}
|
|
280
281
|
elementRef={this.handleRef}
|
|
282
|
+
margin={margin}
|
|
281
283
|
>
|
|
282
284
|
<span
|
|
283
285
|
css={this.props.styles?.inputWidth}
|
package/src/NumberInput/props.ts
CHANGED
|
@@ -34,7 +34,11 @@ import type {
|
|
|
34
34
|
OtherHTMLAttributes,
|
|
35
35
|
PickPropsWithExceptions
|
|
36
36
|
} from '@instructure/shared-types'
|
|
37
|
-
import type {
|
|
37
|
+
import type {
|
|
38
|
+
WithStyleProps,
|
|
39
|
+
ComponentStyle,
|
|
40
|
+
Spacing
|
|
41
|
+
} from '@instructure/emotion'
|
|
38
42
|
import type { FormFieldOwnProps, FormMessage } from '@instructure/ui-form-field'
|
|
39
43
|
import type {
|
|
40
44
|
InteractionType,
|
|
@@ -174,6 +178,10 @@ type NumberInputOwnProps = {
|
|
|
174
178
|
increase: Renderable
|
|
175
179
|
decrease: Renderable
|
|
176
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Margin around the component. Accepts a `Spacing` token. See token values and example usage in [this guide](https://instructure.design/#layout-spacing).
|
|
183
|
+
*/
|
|
184
|
+
margin?: Spacing
|
|
177
185
|
}
|
|
178
186
|
|
|
179
187
|
type NumberInputState = {
|
|
@@ -238,7 +246,8 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
238
246
|
renderIcons: PropTypes.shape({
|
|
239
247
|
increase: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
240
248
|
decrease: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired
|
|
241
|
-
})
|
|
249
|
+
}),
|
|
250
|
+
margin: PropTypes.string
|
|
242
251
|
}
|
|
243
252
|
|
|
244
253
|
const allowedProps: AllowedPropKeys = [
|
|
@@ -263,7 +272,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
263
272
|
'inputMode',
|
|
264
273
|
'textAlign',
|
|
265
274
|
'allowStringValue',
|
|
266
|
-
'renderIcons'
|
|
275
|
+
'renderIcons',
|
|
276
|
+
'margin'
|
|
267
277
|
]
|
|
268
278
|
|
|
269
279
|
export type {
|