@instructure/ui-number-input 8.33.1 → 8.33.2
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 +4 -0
- package/es/NumberInput/NumberInputLocator.js +3 -1
- package/es/NumberInput/index.js +10 -46
- package/es/NumberInput/locator.js +1 -0
- package/es/NumberInput/props.js +1 -0
- package/es/NumberInput/styles.js +3 -4
- package/es/NumberInput/theme.js +7 -7
- package/lib/NumberInput/NumberInputLocator.js +1 -3
- package/lib/NumberInput/index.js +10 -63
- package/lib/NumberInput/locator.js +0 -2
- package/lib/NumberInput/props.js +1 -4
- package/lib/NumberInput/styles.js +3 -5
- package/lib/NumberInput/theme.js +7 -8
- package/lib/index.js +0 -1
- package/package.json +13 -13
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/NumberInput/index.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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
|
+
## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-number-input
|
|
9
|
+
|
|
6
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-number-input
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { NumberInput } from './index';
|
|
26
|
+
import { NumberInput } from './index';
|
|
26
27
|
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
27
29
|
export const NumberInputLocator = locator(NumberInput.selector, {
|
|
28
30
|
findInput: function () {
|
|
29
31
|
return locator('input').find(...arguments);
|
package/es/NumberInput/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -35,7 +34,6 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
35
34
|
import generateStyle from './styles';
|
|
36
35
|
import generateComponentTheme from './theme';
|
|
37
36
|
import { allowedProps, propTypes } from './props';
|
|
38
|
-
|
|
39
37
|
/**
|
|
40
38
|
---
|
|
41
39
|
category: components
|
|
@@ -52,113 +50,88 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
52
50
|
this.ref = null;
|
|
53
51
|
this._input = null;
|
|
54
52
|
this._id = void 0;
|
|
55
|
-
|
|
56
53
|
this.handleRef = el => {
|
|
57
54
|
this.ref = el;
|
|
58
55
|
};
|
|
59
|
-
|
|
60
56
|
this.handleInputRef = element => {
|
|
61
57
|
this._input = element;
|
|
62
|
-
|
|
63
58
|
if (typeof this.props.inputRef === 'function') {
|
|
64
59
|
this.props.inputRef(element);
|
|
65
60
|
}
|
|
66
61
|
};
|
|
67
|
-
|
|
68
62
|
this.handleFocus = event => {
|
|
69
63
|
this.setState({
|
|
70
64
|
hasFocus: true
|
|
71
65
|
});
|
|
72
|
-
|
|
73
66
|
if (typeof this.props.onFocus === 'function') {
|
|
74
67
|
this.props.onFocus(event);
|
|
75
68
|
}
|
|
76
69
|
};
|
|
77
|
-
|
|
78
70
|
this.handleBlur = event => {
|
|
79
71
|
this.setState({
|
|
80
72
|
hasFocus: false
|
|
81
73
|
});
|
|
82
|
-
|
|
83
74
|
if (typeof this.props.onBlur === 'function') {
|
|
84
75
|
this.props.onBlur(event);
|
|
85
76
|
}
|
|
86
77
|
};
|
|
87
|
-
|
|
88
78
|
this.handleChange = event => {
|
|
89
79
|
if (typeof this.props.onChange === 'function') {
|
|
90
80
|
this.props.onChange(event, event.target.value);
|
|
91
81
|
}
|
|
92
82
|
};
|
|
93
|
-
|
|
94
83
|
this.handleKeyDown = event => {
|
|
95
84
|
const _this$props = this.props,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
85
|
+
onKeyDown = _this$props.onKeyDown,
|
|
86
|
+
onDecrement = _this$props.onDecrement,
|
|
87
|
+
onIncrement = _this$props.onIncrement;
|
|
100
88
|
if (typeof onKeyDown === 'function') {
|
|
101
89
|
onKeyDown(event);
|
|
102
90
|
}
|
|
103
|
-
|
|
104
91
|
if (event.keyCode === keycode.codes.down) {
|
|
105
92
|
event.preventDefault();
|
|
106
|
-
|
|
107
93
|
if (typeof onDecrement === 'function') {
|
|
108
94
|
onDecrement(event);
|
|
109
95
|
}
|
|
110
96
|
} else if (event.keyCode === keycode.codes.up) {
|
|
111
97
|
event.preventDefault();
|
|
112
|
-
|
|
113
98
|
if (typeof onIncrement === 'function') {
|
|
114
99
|
onIncrement(event);
|
|
115
100
|
}
|
|
116
101
|
}
|
|
117
102
|
};
|
|
118
|
-
|
|
119
103
|
this.handleClickUpArrow = event => {
|
|
120
104
|
this.arrowClicked(event, this.props.onIncrement);
|
|
121
105
|
};
|
|
122
|
-
|
|
123
106
|
this.handleClickDownArrow = event => {
|
|
124
107
|
this.arrowClicked(event, this.props.onDecrement);
|
|
125
108
|
};
|
|
126
109
|
}
|
|
127
|
-
|
|
128
110
|
get id() {
|
|
129
111
|
if (this.props.id) {
|
|
130
112
|
return this.props.id;
|
|
131
113
|
}
|
|
132
|
-
|
|
133
114
|
if (!this._id) {
|
|
134
115
|
this._id = this.props.deterministicId();
|
|
135
116
|
}
|
|
136
|
-
|
|
137
117
|
return this._id;
|
|
138
118
|
}
|
|
139
|
-
|
|
140
119
|
get invalid() {
|
|
141
120
|
return !!this.props.messages && this.props.messages.some(message => message.type === 'error');
|
|
142
121
|
}
|
|
143
|
-
|
|
144
122
|
get interaction() {
|
|
145
123
|
return getInteraction({
|
|
146
124
|
props: this.props
|
|
147
125
|
});
|
|
148
126
|
}
|
|
149
|
-
|
|
150
127
|
componentDidMount() {
|
|
151
128
|
var _this$props$makeStyle, _this$props2;
|
|
152
|
-
|
|
153
129
|
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStyleVariables);
|
|
154
130
|
}
|
|
155
|
-
|
|
156
131
|
componentDidUpdate() {
|
|
157
132
|
var _this$props$makeStyle2, _this$props3;
|
|
158
|
-
|
|
159
133
|
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStyleVariables);
|
|
160
134
|
}
|
|
161
|
-
|
|
162
135
|
get makeStyleVariables() {
|
|
163
136
|
return {
|
|
164
137
|
interaction: this.interaction,
|
|
@@ -166,25 +139,19 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
166
139
|
invalid: this.invalid
|
|
167
140
|
};
|
|
168
141
|
}
|
|
169
|
-
|
|
170
142
|
arrowClicked(event, callback) {
|
|
171
143
|
const interaction = this.interaction;
|
|
172
144
|
event.preventDefault();
|
|
173
|
-
|
|
174
145
|
if (interaction === 'enabled') {
|
|
175
146
|
var _this$_input;
|
|
176
|
-
|
|
177
147
|
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
178
|
-
|
|
179
148
|
if (typeof callback === 'function') {
|
|
180
149
|
callback(event);
|
|
181
150
|
}
|
|
182
151
|
}
|
|
183
152
|
}
|
|
184
|
-
|
|
185
153
|
renderArrows() {
|
|
186
154
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
187
|
-
|
|
188
155
|
return jsx("span", {
|
|
189
156
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.arrowContainer
|
|
190
157
|
}, jsx("button", {
|
|
@@ -201,18 +168,16 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
201
168
|
type: "button"
|
|
202
169
|
}, _IconArrowOpenDownLin || (_IconArrowOpenDownLin = jsx(IconArrowOpenDownLine, null))));
|
|
203
170
|
}
|
|
204
|
-
|
|
205
171
|
render() {
|
|
206
172
|
var _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
207
|
-
|
|
208
173
|
const _this$props4 = this.props,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
174
|
+
renderLabel = _this$props4.renderLabel,
|
|
175
|
+
display = _this$props4.display,
|
|
176
|
+
placeholder = _this$props4.placeholder,
|
|
177
|
+
isRequired = _this$props4.isRequired,
|
|
178
|
+
showArrows = _this$props4.showArrows,
|
|
179
|
+
value = _this$props4.value,
|
|
180
|
+
width = _this$props4.width;
|
|
216
181
|
const interaction = this.interaction;
|
|
217
182
|
return jsx(FormField, Object.assign({}, pickProps(this.props, FormField.allowedProps), {
|
|
218
183
|
label: callRenderProp(renderLabel),
|
|
@@ -244,7 +209,6 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
|
|
|
244
209
|
onKeyDown: this.handleKeyDown
|
|
245
210
|
})), showArrows ? this.renderArrows() : null)));
|
|
246
211
|
}
|
|
247
|
-
|
|
248
212
|
}, _class2.displayName = "NumberInput", _class2.componentId = 'NumberInput', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
249
213
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
250
214
|
interaction: void 0,
|
package/es/NumberInput/props.js
CHANGED
package/es/NumberInput/styles.js
CHANGED
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props, state) => {
|
|
36
36
|
const size = props.size,
|
|
37
|
-
|
|
37
|
+
textAlign = props.textAlign;
|
|
38
38
|
const interaction = state.interaction,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
hasFocus = state.hasFocus,
|
|
40
|
+
invalid = state.invalid;
|
|
41
41
|
const disabledStyles = interaction === 'disabled' ? {
|
|
42
42
|
cursor: 'not-allowed',
|
|
43
43
|
pointerEvents: 'none',
|
|
@@ -158,5 +158,4 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
|
-
|
|
162
161
|
export default generateStyle;
|
package/es/NumberInput/theme.js
CHANGED
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
spacing = theme.spacing,
|
|
33
|
+
borders = theme.borders,
|
|
34
|
+
typography = theme.typography,
|
|
35
|
+
forms = theme.forms,
|
|
36
|
+
themeName = theme.key;
|
|
37
37
|
const themeSpecificStyle = {
|
|
38
38
|
canvas: {
|
|
39
39
|
color: theme['ic-brand-font-color-dark'],
|
|
@@ -68,9 +68,9 @@ const generateComponentTheme = theme => {
|
|
|
68
68
|
largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
|
|
69
69
|
largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge
|
|
70
70
|
};
|
|
71
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
...componentVariables,
|
|
72
73
|
...themeSpecificStyle[themeName]
|
|
73
74
|
};
|
|
74
75
|
};
|
|
75
|
-
|
|
76
76
|
export default generateComponentTheme;
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.NumberInputLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _index = require("./index");
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _index = require("./index");
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
36
34
|
const NumberInputLocator = (0, _locator.locator)(_index.NumberInput.selector, {
|
|
37
35
|
findInput: function () {
|
package/lib/NumberInput/index.js
CHANGED
|
@@ -1,46 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.NumberInput = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
15
|
-
|
|
16
11
|
var _FormField = require("@instructure/ui-form-field/lib/FormField");
|
|
17
|
-
|
|
18
12
|
var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDownLine.js");
|
|
19
|
-
|
|
20
13
|
var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
|
|
21
|
-
|
|
22
14
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
23
|
-
|
|
24
15
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
25
|
-
|
|
26
16
|
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
27
|
-
|
|
28
17
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
29
|
-
|
|
30
18
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
31
|
-
|
|
32
19
|
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
33
|
-
|
|
34
20
|
var _emotion = require("@instructure/emotion");
|
|
35
|
-
|
|
36
21
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
37
|
-
|
|
38
22
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
39
|
-
|
|
40
23
|
var _props = require("./props");
|
|
41
|
-
|
|
42
24
|
var _dec, _dec2, _dec3, _class, _class2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
|
|
43
|
-
|
|
44
25
|
/**
|
|
45
26
|
---
|
|
46
27
|
category: components
|
|
@@ -57,113 +38,88 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
57
38
|
this.ref = null;
|
|
58
39
|
this._input = null;
|
|
59
40
|
this._id = void 0;
|
|
60
|
-
|
|
61
41
|
this.handleRef = el => {
|
|
62
42
|
this.ref = el;
|
|
63
43
|
};
|
|
64
|
-
|
|
65
44
|
this.handleInputRef = element => {
|
|
66
45
|
this._input = element;
|
|
67
|
-
|
|
68
46
|
if (typeof this.props.inputRef === 'function') {
|
|
69
47
|
this.props.inputRef(element);
|
|
70
48
|
}
|
|
71
49
|
};
|
|
72
|
-
|
|
73
50
|
this.handleFocus = event => {
|
|
74
51
|
this.setState({
|
|
75
52
|
hasFocus: true
|
|
76
53
|
});
|
|
77
|
-
|
|
78
54
|
if (typeof this.props.onFocus === 'function') {
|
|
79
55
|
this.props.onFocus(event);
|
|
80
56
|
}
|
|
81
57
|
};
|
|
82
|
-
|
|
83
58
|
this.handleBlur = event => {
|
|
84
59
|
this.setState({
|
|
85
60
|
hasFocus: false
|
|
86
61
|
});
|
|
87
|
-
|
|
88
62
|
if (typeof this.props.onBlur === 'function') {
|
|
89
63
|
this.props.onBlur(event);
|
|
90
64
|
}
|
|
91
65
|
};
|
|
92
|
-
|
|
93
66
|
this.handleChange = event => {
|
|
94
67
|
if (typeof this.props.onChange === 'function') {
|
|
95
68
|
this.props.onChange(event, event.target.value);
|
|
96
69
|
}
|
|
97
70
|
};
|
|
98
|
-
|
|
99
71
|
this.handleKeyDown = event => {
|
|
100
72
|
const _this$props = this.props,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
73
|
+
onKeyDown = _this$props.onKeyDown,
|
|
74
|
+
onDecrement = _this$props.onDecrement,
|
|
75
|
+
onIncrement = _this$props.onIncrement;
|
|
105
76
|
if (typeof onKeyDown === 'function') {
|
|
106
77
|
onKeyDown(event);
|
|
107
78
|
}
|
|
108
|
-
|
|
109
79
|
if (event.keyCode === _keycode.default.codes.down) {
|
|
110
80
|
event.preventDefault();
|
|
111
|
-
|
|
112
81
|
if (typeof onDecrement === 'function') {
|
|
113
82
|
onDecrement(event);
|
|
114
83
|
}
|
|
115
84
|
} else if (event.keyCode === _keycode.default.codes.up) {
|
|
116
85
|
event.preventDefault();
|
|
117
|
-
|
|
118
86
|
if (typeof onIncrement === 'function') {
|
|
119
87
|
onIncrement(event);
|
|
120
88
|
}
|
|
121
89
|
}
|
|
122
90
|
};
|
|
123
|
-
|
|
124
91
|
this.handleClickUpArrow = event => {
|
|
125
92
|
this.arrowClicked(event, this.props.onIncrement);
|
|
126
93
|
};
|
|
127
|
-
|
|
128
94
|
this.handleClickDownArrow = event => {
|
|
129
95
|
this.arrowClicked(event, this.props.onDecrement);
|
|
130
96
|
};
|
|
131
97
|
}
|
|
132
|
-
|
|
133
98
|
get id() {
|
|
134
99
|
if (this.props.id) {
|
|
135
100
|
return this.props.id;
|
|
136
101
|
}
|
|
137
|
-
|
|
138
102
|
if (!this._id) {
|
|
139
103
|
this._id = this.props.deterministicId();
|
|
140
104
|
}
|
|
141
|
-
|
|
142
105
|
return this._id;
|
|
143
106
|
}
|
|
144
|
-
|
|
145
107
|
get invalid() {
|
|
146
108
|
return !!this.props.messages && this.props.messages.some(message => message.type === 'error');
|
|
147
109
|
}
|
|
148
|
-
|
|
149
110
|
get interaction() {
|
|
150
111
|
return (0, _getInteraction.getInteraction)({
|
|
151
112
|
props: this.props
|
|
152
113
|
});
|
|
153
114
|
}
|
|
154
|
-
|
|
155
115
|
componentDidMount() {
|
|
156
116
|
var _this$props$makeStyle, _this$props2;
|
|
157
|
-
|
|
158
117
|
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStyleVariables);
|
|
159
118
|
}
|
|
160
|
-
|
|
161
119
|
componentDidUpdate() {
|
|
162
120
|
var _this$props$makeStyle2, _this$props3;
|
|
163
|
-
|
|
164
121
|
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStyleVariables);
|
|
165
122
|
}
|
|
166
|
-
|
|
167
123
|
get makeStyleVariables() {
|
|
168
124
|
return {
|
|
169
125
|
interaction: this.interaction,
|
|
@@ -171,25 +127,19 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
171
127
|
invalid: this.invalid
|
|
172
128
|
};
|
|
173
129
|
}
|
|
174
|
-
|
|
175
130
|
arrowClicked(event, callback) {
|
|
176
131
|
const interaction = this.interaction;
|
|
177
132
|
event.preventDefault();
|
|
178
|
-
|
|
179
133
|
if (interaction === 'enabled') {
|
|
180
134
|
var _this$_input;
|
|
181
|
-
|
|
182
135
|
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
183
|
-
|
|
184
136
|
if (typeof callback === 'function') {
|
|
185
137
|
callback(event);
|
|
186
138
|
}
|
|
187
139
|
}
|
|
188
140
|
}
|
|
189
|
-
|
|
190
141
|
renderArrows() {
|
|
191
142
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
192
|
-
|
|
193
143
|
return (0, _emotion.jsx)("span", {
|
|
194
144
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.arrowContainer
|
|
195
145
|
}, (0, _emotion.jsx)("button", {
|
|
@@ -206,18 +156,16 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
206
156
|
type: "button"
|
|
207
157
|
}, _IconArrowOpenDownLin || (_IconArrowOpenDownLin = (0, _emotion.jsx)(_IconArrowOpenDownLine.IconArrowOpenDownLine, null))));
|
|
208
158
|
}
|
|
209
|
-
|
|
210
159
|
render() {
|
|
211
160
|
var _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
212
|
-
|
|
213
161
|
const _this$props4 = this.props,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
162
|
+
renderLabel = _this$props4.renderLabel,
|
|
163
|
+
display = _this$props4.display,
|
|
164
|
+
placeholder = _this$props4.placeholder,
|
|
165
|
+
isRequired = _this$props4.isRequired,
|
|
166
|
+
showArrows = _this$props4.showArrows,
|
|
167
|
+
value = _this$props4.value,
|
|
168
|
+
width = _this$props4.width;
|
|
221
169
|
const interaction = this.interaction;
|
|
222
170
|
return (0, _emotion.jsx)(_FormField.FormField, Object.assign({}, (0, _pickProps.pickProps)(this.props, _FormField.FormField.allowedProps), {
|
|
223
171
|
label: (0, _callRenderProp.callRenderProp)(renderLabel),
|
|
@@ -249,7 +197,6 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
249
197
|
onKeyDown: this.handleKeyDown
|
|
250
198
|
})), showArrows ? this.renderArrows() : null)));
|
|
251
199
|
}
|
|
252
|
-
|
|
253
200
|
}, _class2.displayName = "NumberInput", _class2.componentId = 'NumberInput', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
254
201
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
255
202
|
interaction: void 0,
|
package/lib/NumberInput/props.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
const propTypes = {
|
|
38
35
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
39
36
|
id: _propTypes.default.string,
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -41,10 +40,10 @@ exports.default = void 0;
|
|
|
41
40
|
*/
|
|
42
41
|
const generateStyle = (componentTheme, props, state) => {
|
|
43
42
|
const size = props.size,
|
|
44
|
-
|
|
43
|
+
textAlign = props.textAlign;
|
|
45
44
|
const interaction = state.interaction,
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
hasFocus = state.hasFocus,
|
|
46
|
+
invalid = state.invalid;
|
|
48
47
|
const disabledStyles = interaction === 'disabled' ? {
|
|
49
48
|
cursor: 'not-allowed',
|
|
50
49
|
pointerEvents: 'none',
|
|
@@ -165,6 +164,5 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
165
164
|
}
|
|
166
165
|
};
|
|
167
166
|
};
|
|
168
|
-
|
|
169
167
|
var _default = generateStyle;
|
|
170
168
|
exports.default = _default;
|
package/lib/NumberInput/theme.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,11 +35,11 @@ exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const colors = theme.colors,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
spacing = theme.spacing,
|
|
39
|
+
borders = theme.borders,
|
|
40
|
+
typography = theme.typography,
|
|
41
|
+
forms = theme.forms,
|
|
42
|
+
themeName = theme.key;
|
|
44
43
|
const themeSpecificStyle = {
|
|
45
44
|
canvas: {
|
|
46
45
|
color: theme['ic-brand-font-color-dark'],
|
|
@@ -75,10 +74,10 @@ const generateComponentTheme = theme => {
|
|
|
75
74
|
largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
|
|
76
75
|
largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge
|
|
77
76
|
};
|
|
78
|
-
return {
|
|
77
|
+
return {
|
|
78
|
+
...componentVariables,
|
|
79
79
|
...themeSpecificStyle[themeName]
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
|
-
|
|
83
82
|
var _default = generateComponentTheme;
|
|
84
83
|
exports.default = _default;
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-number-input",
|
|
3
|
-
"version": "8.33.
|
|
3
|
+
"version": "8.33.2",
|
|
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,21 +23,21 @@
|
|
|
23
23
|
"ts:check": "run -T tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.33.
|
|
27
|
-
"@instructure/ui-test-locator": "8.33.
|
|
28
|
-
"@instructure/ui-test-utils": "8.33.
|
|
29
|
-
"@instructure/ui-themes": "8.33.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.33.2",
|
|
27
|
+
"@instructure/ui-test-locator": "8.33.2",
|
|
28
|
+
"@instructure/ui-test-utils": "8.33.2",
|
|
29
|
+
"@instructure/ui-themes": "8.33.2"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "^7.13.10",
|
|
33
|
-
"@instructure/emotion": "8.33.
|
|
34
|
-
"@instructure/shared-types": "8.33.
|
|
35
|
-
"@instructure/ui-form-field": "8.33.
|
|
36
|
-
"@instructure/ui-icons": "8.33.
|
|
37
|
-
"@instructure/ui-react-utils": "8.33.
|
|
38
|
-
"@instructure/ui-testable": "8.33.
|
|
39
|
-
"@instructure/ui-utils": "8.33.
|
|
40
|
-
"@instructure/uid": "8.33.
|
|
33
|
+
"@instructure/emotion": "8.33.2",
|
|
34
|
+
"@instructure/shared-types": "8.33.2",
|
|
35
|
+
"@instructure/ui-form-field": "8.33.2",
|
|
36
|
+
"@instructure/ui-icons": "8.33.2",
|
|
37
|
+
"@instructure/ui-react-utils": "8.33.2",
|
|
38
|
+
"@instructure/ui-testable": "8.33.2",
|
|
39
|
+
"@instructure/ui-utils": "8.33.2",
|
|
40
|
+
"@instructure/uid": "8.33.2",
|
|
41
41
|
"keycode": "^2",
|
|
42
42
|
"prop-types": "^15"
|
|
43
43
|
},
|