@instructure/ui-number-input 8.18.0 → 8.18.1-snapshot.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/LICENSE.md ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ ---
6
+
7
+ # The MIT License (MIT)
8
+
9
+ Copyright (c) 2015 Instructure, Inc.
10
+
11
+ **Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions.**
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
@@ -148,11 +148,15 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
148
148
  }
149
149
 
150
150
  componentDidMount() {
151
- this.props.makeStyles?.(this.makeStyleVariables);
151
+ var _this$props$makeStyle, _this$props2;
152
+
153
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStyleVariables);
152
154
  }
153
155
 
154
156
  componentDidUpdate() {
155
- this.props.makeStyles?.(this.makeStyleVariables);
157
+ var _this$props$makeStyle2, _this$props3;
158
+
159
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStyleVariables);
156
160
  }
157
161
 
158
162
  get makeStyleVariables() {
@@ -168,7 +172,9 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
168
172
  event.preventDefault();
169
173
 
170
174
  if (interaction === 'enabled') {
171
- this._input?.focus();
175
+ var _this$_input;
176
+
177
+ (_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
172
178
 
173
179
  if (typeof callback === 'function') {
174
180
  callback(event);
@@ -177,17 +183,19 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
177
183
  }
178
184
 
179
185
  renderArrows() {
186
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
187
+
180
188
  return jsx("span", {
181
- css: this.props.styles?.arrowContainer
189
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.arrowContainer
182
190
  }, jsx("button", {
183
191
  "aria-hidden": true,
184
- css: this.props.styles?.arrow,
192
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.arrow,
185
193
  onMouseDown: this.handleClickUpArrow,
186
194
  tabIndex: -1,
187
195
  type: "button"
188
196
  }, _IconArrowOpenUpLine || (_IconArrowOpenUpLine = jsx(IconArrowOpenUpLine, null))), jsx("button", {
189
197
  "aria-hidden": true,
190
- css: this.props.styles?.arrow,
198
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.arrow,
191
199
  onMouseDown: this.handleClickDownArrow,
192
200
  tabIndex: -1,
193
201
  type: "button"
@@ -195,14 +203,16 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
195
203
  }
196
204
 
197
205
  render() {
198
- const _this$props2 = this.props,
199
- renderLabel = _this$props2.renderLabel,
200
- display = _this$props2.display,
201
- placeholder = _this$props2.placeholder,
202
- isRequired = _this$props2.isRequired,
203
- showArrows = _this$props2.showArrows,
204
- value = _this$props2.value,
205
- width = _this$props2.width;
206
+ var _this$props$styles4, _this$props$styles5, _this$props$styles6;
207
+
208
+ const _this$props4 = this.props,
209
+ renderLabel = _this$props4.renderLabel,
210
+ display = _this$props4.display,
211
+ placeholder = _this$props4.placeholder,
212
+ isRequired = _this$props4.isRequired,
213
+ showArrows = _this$props4.showArrows,
214
+ value = _this$props4.value,
215
+ width = _this$props4.width;
206
216
  const interaction = this.interaction;
207
217
  return jsx(FormField, Object.assign({}, pickProps(this.props, FormField.allowedProps), {
208
218
  label: callRenderProp(renderLabel),
@@ -210,14 +220,14 @@ let NumberInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle
210
220
  id: this.id,
211
221
  elementRef: this.handleRef
212
222
  }), jsx("span", {
213
- css: this.props.styles?.inputWidth,
223
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.inputWidth,
214
224
  style: width ? {
215
225
  width
216
226
  } : void 0
217
227
  }, jsx("span", {
218
- css: this.props.styles?.inputContainer
228
+ css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.inputContainer
219
229
  }, jsx("input", Object.assign({}, omitProps(this.props, [...FormField.allowedProps, ...NumberInput.allowedProps]), {
220
- css: this.props.styles?.input,
230
+ css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
221
231
  "aria-invalid": this.invalid ? 'true' : void 0,
222
232
  id: this.id,
223
233
  type: "text",
@@ -42,31 +42,31 @@ const generateComponentTheme = theme => {
42
42
  }
43
43
  };
44
44
  const componentVariables = {
45
- fontFamily: typography?.fontFamily,
46
- fontWeight: typography?.fontWeightNormal,
47
- borderWidth: borders?.widthSmall,
48
- borderStyle: borders?.style,
49
- borderColor: colors?.borderMedium,
50
- borderRadius: borders?.radiusMedium,
51
- color: colors?.textDarkest,
52
- background: colors?.backgroundLightest,
53
- padding: `0 ${spacing?.small}`,
45
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
46
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
47
+ borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
48
+ borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
49
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
50
+ borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
51
+ color: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
52
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
53
+ padding: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
54
54
  arrowsContainerWidth: '2rem',
55
- arrowsColor: colors?.textDarkest,
56
- arrowsBackgroundColor: colors?.backgroundLight,
57
- arrowsHoverBackgroundColor: colors?.backgroundMedium,
58
- arrowsBorderColor: colors?.borderMedium,
59
- arrowsActiveBoxShadow: `inset 0 0 3px 1px ${colors?.borderMedium}`,
60
- focusOutlineWidth: borders?.widthMedium,
61
- focusOutlineStyle: borders?.style,
62
- focusOutlineColor: colors?.borderBrand,
63
- errorBorderColor: colors?.borderDanger,
64
- errorOutlineColor: colors?.borderDanger,
65
- placeholderColor: colors?.textDark,
66
- mediumFontSize: typography?.fontSizeMedium,
67
- mediumHeight: forms?.inputHeightMedium,
68
- largeFontSize: typography?.fontSizeLarge,
69
- largeHeight: forms?.inputHeightLarge
55
+ arrowsColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
56
+ arrowsBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLight,
57
+ arrowsHoverBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundMedium,
58
+ arrowsBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
59
+ arrowsActiveBoxShadow: `inset 0 0 3px 1px ${colors === null || colors === void 0 ? void 0 : colors.borderMedium}`,
60
+ focusOutlineWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
61
+ focusOutlineStyle: borders === null || borders === void 0 ? void 0 : borders.style,
62
+ focusOutlineColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
63
+ errorBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
64
+ errorOutlineColor: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
65
+ placeholderColor: colors === null || colors === void 0 ? void 0 : colors.textDark,
66
+ mediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
67
+ mediumHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightMedium,
68
+ largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
69
+ largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge
70
70
  };
71
71
  return { ...componentVariables,
72
72
  ...themeSpecificStyle[themeName]
@@ -153,11 +153,15 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
153
153
  }
154
154
 
155
155
  componentDidMount() {
156
- this.props.makeStyles?.(this.makeStyleVariables);
156
+ var _this$props$makeStyle, _this$props2;
157
+
158
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStyleVariables);
157
159
  }
158
160
 
159
161
  componentDidUpdate() {
160
- this.props.makeStyles?.(this.makeStyleVariables);
162
+ var _this$props$makeStyle2, _this$props3;
163
+
164
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStyleVariables);
161
165
  }
162
166
 
163
167
  get makeStyleVariables() {
@@ -173,7 +177,9 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
173
177
  event.preventDefault();
174
178
 
175
179
  if (interaction === 'enabled') {
176
- this._input?.focus();
180
+ var _this$_input;
181
+
182
+ (_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
177
183
 
178
184
  if (typeof callback === 'function') {
179
185
  callback(event);
@@ -182,17 +188,19 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
182
188
  }
183
189
 
184
190
  renderArrows() {
191
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
192
+
185
193
  return (0, _emotion.jsx)("span", {
186
- css: this.props.styles?.arrowContainer
194
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.arrowContainer
187
195
  }, (0, _emotion.jsx)("button", {
188
196
  "aria-hidden": true,
189
- css: this.props.styles?.arrow,
197
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.arrow,
190
198
  onMouseDown: this.handleClickUpArrow,
191
199
  tabIndex: -1,
192
200
  type: "button"
193
201
  }, _IconArrowOpenUpLine || (_IconArrowOpenUpLine = (0, _emotion.jsx)(_IconArrowOpenUpLine2.IconArrowOpenUpLine, null))), (0, _emotion.jsx)("button", {
194
202
  "aria-hidden": true,
195
- css: this.props.styles?.arrow,
203
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.arrow,
196
204
  onMouseDown: this.handleClickDownArrow,
197
205
  tabIndex: -1,
198
206
  type: "button"
@@ -200,14 +208,16 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
200
208
  }
201
209
 
202
210
  render() {
203
- const _this$props2 = this.props,
204
- renderLabel = _this$props2.renderLabel,
205
- display = _this$props2.display,
206
- placeholder = _this$props2.placeholder,
207
- isRequired = _this$props2.isRequired,
208
- showArrows = _this$props2.showArrows,
209
- value = _this$props2.value,
210
- width = _this$props2.width;
211
+ var _this$props$styles4, _this$props$styles5, _this$props$styles6;
212
+
213
+ const _this$props4 = this.props,
214
+ renderLabel = _this$props4.renderLabel,
215
+ display = _this$props4.display,
216
+ placeholder = _this$props4.placeholder,
217
+ isRequired = _this$props4.isRequired,
218
+ showArrows = _this$props4.showArrows,
219
+ value = _this$props4.value,
220
+ width = _this$props4.width;
211
221
  const interaction = this.interaction;
212
222
  return (0, _emotion.jsx)(_FormField.FormField, Object.assign({}, (0, _pickProps.pickProps)(this.props, _FormField.FormField.allowedProps), {
213
223
  label: (0, _callRenderProp.callRenderProp)(renderLabel),
@@ -215,14 +225,14 @@ let NumberInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
215
225
  id: this.id,
216
226
  elementRef: this.handleRef
217
227
  }), (0, _emotion.jsx)("span", {
218
- css: this.props.styles?.inputWidth,
228
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.inputWidth,
219
229
  style: width ? {
220
230
  width
221
231
  } : void 0
222
232
  }, (0, _emotion.jsx)("span", {
223
- css: this.props.styles?.inputContainer
233
+ css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.inputContainer
224
234
  }, (0, _emotion.jsx)("input", Object.assign({}, (0, _omitProps.omitProps)(this.props, [..._FormField.FormField.allowedProps, ...NumberInput.allowedProps]), {
225
- css: this.props.styles?.input,
235
+ css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.input,
226
236
  "aria-invalid": this.invalid ? 'true' : void 0,
227
237
  id: this.id,
228
238
  type: "text",
@@ -49,31 +49,31 @@ const generateComponentTheme = theme => {
49
49
  }
50
50
  };
51
51
  const componentVariables = {
52
- fontFamily: typography?.fontFamily,
53
- fontWeight: typography?.fontWeightNormal,
54
- borderWidth: borders?.widthSmall,
55
- borderStyle: borders?.style,
56
- borderColor: colors?.borderMedium,
57
- borderRadius: borders?.radiusMedium,
58
- color: colors?.textDarkest,
59
- background: colors?.backgroundLightest,
60
- padding: `0 ${spacing?.small}`,
52
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
53
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
54
+ borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
55
+ borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
56
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
57
+ borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
58
+ color: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
59
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
60
+ padding: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
61
61
  arrowsContainerWidth: '2rem',
62
- arrowsColor: colors?.textDarkest,
63
- arrowsBackgroundColor: colors?.backgroundLight,
64
- arrowsHoverBackgroundColor: colors?.backgroundMedium,
65
- arrowsBorderColor: colors?.borderMedium,
66
- arrowsActiveBoxShadow: `inset 0 0 3px 1px ${colors?.borderMedium}`,
67
- focusOutlineWidth: borders?.widthMedium,
68
- focusOutlineStyle: borders?.style,
69
- focusOutlineColor: colors?.borderBrand,
70
- errorBorderColor: colors?.borderDanger,
71
- errorOutlineColor: colors?.borderDanger,
72
- placeholderColor: colors?.textDark,
73
- mediumFontSize: typography?.fontSizeMedium,
74
- mediumHeight: forms?.inputHeightMedium,
75
- largeFontSize: typography?.fontSizeLarge,
76
- largeHeight: forms?.inputHeightLarge
62
+ arrowsColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
63
+ arrowsBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLight,
64
+ arrowsHoverBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundMedium,
65
+ arrowsBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
66
+ arrowsActiveBoxShadow: `inset 0 0 3px 1px ${colors === null || colors === void 0 ? void 0 : colors.borderMedium}`,
67
+ focusOutlineWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
68
+ focusOutlineStyle: borders === null || borders === void 0 ? void 0 : borders.style,
69
+ focusOutlineColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
70
+ errorBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
71
+ errorOutlineColor: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
72
+ placeholderColor: colors === null || colors === void 0 ? void 0 : colors.textDark,
73
+ mediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
74
+ mediumHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightMedium,
75
+ largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
76
+ largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge
77
77
  };
78
78
  return { ...componentVariables,
79
79
  ...themeSpecificStyle[themeName]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-number-input",
3
- "version": "8.18.0",
3
+ "version": "8.18.1-snapshot.2+ca4c1ff9d",
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": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
24
24
  },
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.18.0",
27
- "@instructure/ui-test-locator": "8.18.0",
28
- "@instructure/ui-test-utils": "8.18.0",
29
- "@instructure/ui-themes": "8.18.0"
26
+ "@instructure/ui-babel-preset": "8.18.1-snapshot.2+ca4c1ff9d",
27
+ "@instructure/ui-test-locator": "8.18.1-snapshot.2+ca4c1ff9d",
28
+ "@instructure/ui-test-utils": "8.18.1-snapshot.2+ca4c1ff9d",
29
+ "@instructure/ui-themes": "8.18.1-snapshot.2+ca4c1ff9d"
30
30
  },
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.13.10",
33
- "@instructure/emotion": "8.18.0",
34
- "@instructure/shared-types": "8.18.0",
35
- "@instructure/ui-form-field": "8.18.0",
36
- "@instructure/ui-icons": "8.18.0",
37
- "@instructure/ui-react-utils": "8.18.0",
38
- "@instructure/ui-testable": "8.18.0",
39
- "@instructure/ui-utils": "8.18.0",
40
- "@instructure/uid": "8.18.0",
33
+ "@instructure/emotion": "8.18.1-snapshot.2+ca4c1ff9d",
34
+ "@instructure/shared-types": "8.18.1-snapshot.2+ca4c1ff9d",
35
+ "@instructure/ui-form-field": "8.18.1-snapshot.2+ca4c1ff9d",
36
+ "@instructure/ui-icons": "8.18.1-snapshot.2+ca4c1ff9d",
37
+ "@instructure/ui-react-utils": "8.18.1-snapshot.2+ca4c1ff9d",
38
+ "@instructure/ui-testable": "8.18.1-snapshot.2+ca4c1ff9d",
39
+ "@instructure/ui-utils": "8.18.1-snapshot.2+ca4c1ff9d",
40
+ "@instructure/uid": "8.18.1-snapshot.2+ca4c1ff9d",
41
41
  "keycode": "^2",
42
42
  "prop-types": "^15"
43
43
  },
@@ -47,5 +47,6 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "sideEffects": false
50
+ "sideEffects": false,
51
+ "gitHead": "ca4c1ff9d3985151ae0758fb596de41652dbb58b"
51
52
  }