@semcore/input-number 5.42.0-prerelease.5 → 5.42.0-prerelease.7
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/lib/cjs/InputNumber.js +61 -60
- package/lib/cjs/InputNumber.js.map +1 -1
- package/lib/cjs/buttons.js +7 -5
- package/lib/cjs/buttons.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/InputNumber.js +59 -61
- package/lib/es6/InputNumber.js.map +1 -1
- package/lib/es6/buttons.js +2 -2
- package/lib/es6/buttons.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/InputNumber.mjs +65 -65
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/index.d.ts +11 -3
- package/package.json +5 -5
package/lib/esm/InputNumber.mjs
CHANGED
|
@@ -2,35 +2,37 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
-
import
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import { sstyled
|
|
9
|
-
import {
|
|
10
|
-
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
11
|
-
import { forkRef } from "@semcore/core/lib/utils/ref";
|
|
12
|
-
import Input from "@semcore/input";
|
|
9
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
10
|
+
import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
13
11
|
import React from "react";
|
|
12
|
+
import Input from "@semcore/input";
|
|
14
13
|
import { IncrementIcon, DecrementIcon } from "./buttons.mjs";
|
|
15
14
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
15
|
+
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
16
|
+
import { forkRef } from "@semcore/utils/lib/ref";
|
|
17
|
+
import { callAllEventHandlers } from "@semcore/utils/lib/assignProps";
|
|
16
18
|
/*!__reshadow-styles__:"./style/input-number.shadow.css"*/
|
|
17
19
|
var style = (
|
|
18
20
|
/*__reshadow_css_start__*/
|
|
19
21
|
(sstyled.insert(
|
|
20
22
|
/*__inner_css_start__*/
|
|
21
|
-
".
|
|
23
|
+
".___SValue_ji1rt_gg_:focus~.___SControls_ji1rt_gg_{display:flex}.___SControls_ji1rt_gg_{display:none;flex-flow:column;justify-content:center;height:100%;box-sizing:border-box}.___SControls_ji1rt_gg_.__showControls_ji1rt_gg_{display:flex}.___SDown_ji1rt_gg_,.___SUp_ji1rt_gg_{padding:0;width:16px;color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385));box-sizing:border-box;display:inline-flex;justify-content:center;border:0;background:0 0;cursor:pointer}@supports (color:color(display-p3 0 0 0)){.___SDown_ji1rt_gg_,.___SUp_ji1rt_gg_{color:var(--intergalactic-icon-secondary-neutral, rgba(0, 5, 2, 0.385))}@media (color-gamut:p3){.___SDown_ji1rt_gg_,.___SUp_ji1rt_gg_{color:var(--intergalactic-icon-secondary-neutral, color(display-p3 0.0036 0.02041 0.00996 / 0.385))}}}.___SDown_ji1rt_gg_:focus,.___SUp_ji1rt_gg_:focus{outline:0}@media (hover:hover){.___SDown_ji1rt_gg_:hover,.___SUp_ji1rt_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, rgba(0, 5, 2, 0.433))}@supports (color:color(display-p3 0 0 0)){.___SDown_ji1rt_gg_:hover,.___SUp_ji1rt_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, rgba(0, 5, 2, 0.433))}@media (color-gamut:p3){.___SDown_ji1rt_gg_:hover,.___SUp_ji1rt_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, color(display-p3 0.00333 0.01824 0.00791 / 0.433))}}}}.___SUp_ji1rt_gg_{padding-bottom:1px}.___SDown_ji1rt_gg_{padding-top:1px}.___SValue_ji1rt_gg_::-webkit-inner-spin-button,.___SValue_ji1rt_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_ji1rt_gg_._type_number_ji1rt_gg_{-moz-appearance:textfield}.___SValue_ji1rt_gg_.__disabled_ji1rt_gg_~.___SControls_ji1rt_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SValueHidden_ji1rt_gg_{position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden}",
|
|
22
24
|
/*__inner_css_end__*/
|
|
23
|
-
"
|
|
25
|
+
"ji1rt_gg_"
|
|
24
26
|
), /*__reshadow_css_end__*/
|
|
25
27
|
{
|
|
26
|
-
"__SValue": "
|
|
27
|
-
"__SControls": "
|
|
28
|
-
"_showControls": "
|
|
29
|
-
"__SUp": "
|
|
30
|
-
"__SDown": "
|
|
31
|
-
"_disabled": "
|
|
32
|
-
"__SValueHidden": "
|
|
33
|
-
"_type_number": "
|
|
28
|
+
"__SValue": "___SValue_ji1rt_gg_",
|
|
29
|
+
"__SControls": "___SControls_ji1rt_gg_",
|
|
30
|
+
"_showControls": "__showControls_ji1rt_gg_",
|
|
31
|
+
"__SUp": "___SUp_ji1rt_gg_",
|
|
32
|
+
"__SDown": "___SDown_ji1rt_gg_",
|
|
33
|
+
"_disabled": "__disabled_ji1rt_gg_",
|
|
34
|
+
"__SValueHidden": "___SValueHidden_ji1rt_gg_",
|
|
35
|
+
"_type_number": "_type_number_ji1rt_gg_"
|
|
34
36
|
})
|
|
35
37
|
);
|
|
36
38
|
function parseValueWithMinMax(value) {
|
|
@@ -38,27 +40,28 @@ function parseValueWithMinMax(value) {
|
|
|
38
40
|
var max = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Number.MAX_SAFE_INTEGER;
|
|
39
41
|
return Math.max(min, Math.min(max, value));
|
|
40
42
|
}
|
|
41
|
-
var InputNumber = /* @__PURE__ */
|
|
43
|
+
var InputNumber = /* @__PURE__ */ function(_Component) {
|
|
44
|
+
_inherits(InputNumber2, _Component);
|
|
45
|
+
var _super = _createSuper(InputNumber2);
|
|
42
46
|
function InputNumber2() {
|
|
43
47
|
var _this;
|
|
44
48
|
_classCallCheck(this, InputNumber2);
|
|
45
49
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
46
50
|
args[_key] = arguments[_key];
|
|
47
51
|
}
|
|
48
|
-
_this =
|
|
49
|
-
_defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
|
|
50
|
-
_defineProperty(_this, "increment", function(event) {
|
|
52
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "inputRef", /* @__PURE__ */ React.createRef());
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "increment", function(event) {
|
|
51
55
|
var _this$inputRef$curren, _this$inputRef$curren2;
|
|
52
|
-
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0
|
|
56
|
+
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 ? void 0 : (_this$inputRef$curren2 = _this$inputRef$curren.stepUp) === null || _this$inputRef$curren2 === void 0 ? void 0 : _this$inputRef$curren2.call(_this$inputRef$curren, event);
|
|
53
57
|
});
|
|
54
|
-
_defineProperty(_this, "decrement", function(event) {
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "decrement", function(event) {
|
|
55
59
|
var _this$inputRef$curren3, _this$inputRef$curren4;
|
|
56
|
-
(_this$inputRef$curren3 = _this.inputRef.current) === null || _this$inputRef$curren3 === void 0
|
|
60
|
+
(_this$inputRef$curren3 = _this.inputRef.current) === null || _this$inputRef$curren3 === void 0 ? void 0 : (_this$inputRef$curren4 = _this$inputRef$curren3.stepDown) === null || _this$inputRef$curren4 === void 0 ? void 0 : _this$inputRef$curren4.call(_this$inputRef$curren3, event);
|
|
57
61
|
});
|
|
58
62
|
return _this;
|
|
59
63
|
}
|
|
60
|
-
|
|
61
|
-
return _createClass(InputNumber2, [{
|
|
64
|
+
_createClass(InputNumber2, [{
|
|
62
65
|
key: "getValueProps",
|
|
63
66
|
value: function getValueProps() {
|
|
64
67
|
var numberFormatter = new Intl.NumberFormat(this.asProps.locale, {
|
|
@@ -87,10 +90,11 @@ var InputNumber = /* @__PURE__ */ (function(_Component) {
|
|
|
87
90
|
value: function render() {
|
|
88
91
|
var _ref = this.asProps, _ref4;
|
|
89
92
|
var SInputNumber = Input;
|
|
90
|
-
return _ref4 = sstyled(this.asProps.style), /* @__PURE__ */ React.createElement(SInputNumber, _ref4.cn("SInputNumber", _objectSpread({}, assignProps({}, _ref))));
|
|
93
|
+
return _ref4 = sstyled$1(this.asProps.style), /* @__PURE__ */ React.createElement(SInputNumber, _ref4.cn("SInputNumber", _objectSpread({}, assignProps({}, _ref))));
|
|
91
94
|
}
|
|
92
95
|
}]);
|
|
93
|
-
|
|
96
|
+
return InputNumber2;
|
|
97
|
+
}(Component);
|
|
94
98
|
_defineProperty(InputNumber, "displayName", "InputNumber");
|
|
95
99
|
_defineProperty(InputNumber, "style", style);
|
|
96
100
|
_defineProperty(InputNumber, "enhance", [i18nEnhance(localizedMessages)]);
|
|
@@ -99,20 +103,22 @@ _defineProperty(InputNumber, "defaultProps", {
|
|
|
99
103
|
i18n: localizedMessages,
|
|
100
104
|
locale: "en"
|
|
101
105
|
});
|
|
102
|
-
var Value = /* @__PURE__ */
|
|
106
|
+
var Value = /* @__PURE__ */ function(_Component2) {
|
|
107
|
+
_inherits(Value2, _Component2);
|
|
108
|
+
var _super2 = _createSuper(Value2);
|
|
103
109
|
function Value2() {
|
|
104
110
|
var _this2;
|
|
105
111
|
_classCallCheck(this, Value2);
|
|
106
112
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
107
113
|
args[_key2] = arguments[_key2];
|
|
108
114
|
}
|
|
109
|
-
_this2 =
|
|
110
|
-
_defineProperty(_this2, "valueInputRef", /* @__PURE__ */ React.createRef());
|
|
111
|
-
_defineProperty(_this2, "cursorPosition", -1);
|
|
112
|
-
_defineProperty(_this2, "getFormattedValue", function(value) {
|
|
115
|
+
_this2 = _super2.call.apply(_super2, [this].concat(args));
|
|
116
|
+
_defineProperty(_assertThisInitialized(_this2), "valueInputRef", /* @__PURE__ */ React.createRef());
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this2), "cursorPosition", -1);
|
|
118
|
+
_defineProperty(_assertThisInitialized(_this2), "getFormattedValue", function(value) {
|
|
113
119
|
return value.replace(new RegExp("[".concat(_this2.separatorThousands, "]"), "g"), "").replace(_this2.separatorDecimal, ".");
|
|
114
120
|
});
|
|
115
|
-
_defineProperty(_this2, "valueParser", function(value, prevValue, prevDisplayValue) {
|
|
121
|
+
_defineProperty(_assertThisInitialized(_this2), "valueParser", function(value, prevValue, prevDisplayValue) {
|
|
116
122
|
var numberFormatter = _this2.props.numberFormatter;
|
|
117
123
|
var stringNumber = _this2.getFormattedValue(String(value));
|
|
118
124
|
if (Number.isNaN(Number(stringNumber))) {
|
|
@@ -133,7 +139,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
133
139
|
displayValue
|
|
134
140
|
};
|
|
135
141
|
});
|
|
136
|
-
_defineProperty(_this2, "handleValidation", function(event) {
|
|
142
|
+
_defineProperty(_assertThisInitialized(_this2), "handleValidation", function(event) {
|
|
137
143
|
var _this2$asProps = _this2.asProps, value = _this2$asProps.value, displayValue = _this2$asProps.displayValue, min = _this2$asProps.min, max = _this2$asProps.max, step = _this2$asProps.step;
|
|
138
144
|
var _this2$valueParser = _this2.valueParser(event.currentTarget.value, value, displayValue), parsedValue = _this2$valueParser.parsedValue;
|
|
139
145
|
var roundCoefficient = step < 1 ? step.toString().split(".")[1].length : 1;
|
|
@@ -154,10 +160,10 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
154
160
|
_this2.handlers.value(String(numberValueRounded), event);
|
|
155
161
|
}
|
|
156
162
|
});
|
|
157
|
-
_defineProperty(_this2, "onWheel", function(event) {
|
|
163
|
+
_defineProperty(_assertThisInitialized(_this2), "onWheel", function(event) {
|
|
158
164
|
callAllEventHandlers(_this2.asProps.onWheel, _this2.handleWheel)(event);
|
|
159
165
|
});
|
|
160
|
-
_defineProperty(_this2, "handleWheel", function(event) {
|
|
166
|
+
_defineProperty(_assertThisInitialized(_this2), "handleWheel", function(event) {
|
|
161
167
|
if (event.target !== _this2.valueInputRef.current) return;
|
|
162
168
|
if (document.activeElement !== _this2.valueInputRef.current) return;
|
|
163
169
|
event.preventDefault();
|
|
@@ -167,7 +173,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
167
173
|
_this2.stepDown(event);
|
|
168
174
|
}
|
|
169
175
|
});
|
|
170
|
-
_defineProperty(_this2, "handleChange", function(event) {
|
|
176
|
+
_defineProperty(_assertThisInitialized(_this2), "handleChange", function(event) {
|
|
171
177
|
var value = _this2.getFormattedValue(event.currentTarget.value);
|
|
172
178
|
var _this2$asProps2 = _this2.asProps, numberFormatter = _this2$asProps2.numberFormatter, prevValue = _this2$asProps2.value;
|
|
173
179
|
if (value === "." || value === "-") {
|
|
@@ -186,17 +192,17 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
186
192
|
return false;
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
|
-
var digits =
|
|
195
|
+
var digits = /[0-9.-]+/.test(value);
|
|
190
196
|
if (digits || value === "") {
|
|
191
197
|
_this2.handlers.value(value, event);
|
|
192
198
|
}
|
|
193
199
|
});
|
|
194
|
-
_defineProperty(_this2, "handleKeyUp", function(event) {
|
|
200
|
+
_defineProperty(_assertThisInitialized(_this2), "handleKeyUp", function(event) {
|
|
195
201
|
if (event.key === "Shift") {
|
|
196
202
|
_this2.cursorPosition = -1;
|
|
197
203
|
}
|
|
198
204
|
});
|
|
199
|
-
_defineProperty(_this2, "handleKeyDown", function(event) {
|
|
205
|
+
_defineProperty(_assertThisInitialized(_this2), "handleKeyDown", function(event) {
|
|
200
206
|
var element = event.currentTarget;
|
|
201
207
|
var value = element.value;
|
|
202
208
|
var length = value.length;
|
|
@@ -253,7 +259,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
261
|
});
|
|
256
|
-
_defineProperty(_this2, "moveSelectionLeft", function(element, cursorIndex) {
|
|
262
|
+
_defineProperty(_assertThisInitialized(_this2), "moveSelectionLeft", function(element, cursorIndex) {
|
|
257
263
|
var value = element.value;
|
|
258
264
|
var nextPosition = element.selectionStart - 1 >= 0 ? element.selectionStart - 1 : 0;
|
|
259
265
|
var cursorPosition = value[element.selectionStart - cursorIndex] === _this2.separatorThousands ? element.selectionStart - cursorIndex : nextPosition;
|
|
@@ -267,7 +273,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
267
273
|
}
|
|
268
274
|
}
|
|
269
275
|
});
|
|
270
|
-
_defineProperty(_this2, "moveSelectionRight", function(element, cursorIndex) {
|
|
276
|
+
_defineProperty(_assertThisInitialized(_this2), "moveSelectionRight", function(element, cursorIndex) {
|
|
271
277
|
var value = element.value;
|
|
272
278
|
var nextPosition = element.selectionEnd + 1;
|
|
273
279
|
var cursorPosition = value[element.selectionEnd] === _this2.separatorThousands ? element.selectionEnd + cursorIndex : nextPosition;
|
|
@@ -281,18 +287,18 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
281
287
|
}
|
|
282
288
|
}
|
|
283
289
|
});
|
|
284
|
-
_defineProperty(_this2, "handleClick", function(event) {
|
|
290
|
+
_defineProperty(_assertThisInitialized(_this2), "handleClick", function(event) {
|
|
285
291
|
var element = event.target;
|
|
286
292
|
var value = element.value;
|
|
287
293
|
if (value[element.selectionStart - 1] === _this2.separatorThousands) {
|
|
288
294
|
element.setSelectionRange(element.selectionStart - 1, element.selectionEnd - 1);
|
|
289
295
|
}
|
|
290
296
|
});
|
|
291
|
-
_defineProperty(_this2, "handleBlur", function(event) {
|
|
297
|
+
_defineProperty(_assertThisInitialized(_this2), "handleBlur", function(event) {
|
|
292
298
|
_this2.cursorPosition = -1;
|
|
293
299
|
_this2.handleValidation(event);
|
|
294
300
|
});
|
|
295
|
-
_defineProperty(_this2, "stepUp", function(event) {
|
|
301
|
+
_defineProperty(_assertThisInitialized(_this2), "stepUp", function(event) {
|
|
296
302
|
var _this2$asProps3 = _this2.asProps, _this2$asProps3$max = _this2$asProps3.max, max = _this2$asProps3$max === void 0 ? Number.MAX_SAFE_INTEGER : _this2$asProps3$max, min = _this2$asProps3.min, step = _this2$asProps3.step, value = _this2$asProps3.value;
|
|
297
303
|
var numberValue;
|
|
298
304
|
if (value === "") {
|
|
@@ -305,7 +311,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
305
311
|
_this2.handlers.value(newValue.toString(), event);
|
|
306
312
|
}
|
|
307
313
|
});
|
|
308
|
-
_defineProperty(_this2, "stepDown", function(event) {
|
|
314
|
+
_defineProperty(_assertThisInitialized(_this2), "stepDown", function(event) {
|
|
309
315
|
var _this2$asProps4 = _this2.asProps, max = _this2$asProps4.max, _this2$asProps4$min = _this2$asProps4.min, min = _this2$asProps4$min === void 0 ? Number.MIN_SAFE_INTEGER : _this2$asProps4$min, step = _this2$asProps4.step, value = _this2$asProps4.value;
|
|
310
316
|
var numberValue;
|
|
311
317
|
if (value === "") {
|
|
@@ -320,8 +326,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
320
326
|
});
|
|
321
327
|
return _this2;
|
|
322
328
|
}
|
|
323
|
-
|
|
324
|
-
return _createClass(Value2, [{
|
|
329
|
+
_createClass(Value2, [{
|
|
325
330
|
key: "uncontrolledProps",
|
|
326
331
|
value: function uncontrolledProps() {
|
|
327
332
|
var _this3 = this;
|
|
@@ -357,16 +362,10 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
357
362
|
key: "componentDidMount",
|
|
358
363
|
value: (
|
|
359
364
|
// https://stackoverflow.com/questions/57358640/cancel-wheel-event-with-e-preventdefault-in-react-event-bubbling
|
|
360
|
-
|
|
361
|
-
var _this$valueInputRef$c
|
|
362
|
-
(_this$valueInputRef$c = this.valueInputRef.current) === null || _this$valueInputRef$c === void 0
|
|
363
|
-
var _this$asProps2 = this.asProps, inputRef = _this$asProps2.inputRef, value = _this$asProps2.value
|
|
364
|
-
if (autoFocus) {
|
|
365
|
-
setTimeout(function() {
|
|
366
|
-
var _this4$valueInputRef$;
|
|
367
|
-
(_this4$valueInputRef$ = _this4.valueInputRef.current) === null || _this4$valueInputRef$ === void 0 || _this4$valueInputRef$.focus();
|
|
368
|
-
});
|
|
369
|
-
}
|
|
365
|
+
function componentDidMount() {
|
|
366
|
+
var _this$valueInputRef$c;
|
|
367
|
+
(_this$valueInputRef$c = this.valueInputRef.current) === null || _this$valueInputRef$c === void 0 ? void 0 : _this$valueInputRef$c.addEventListener("wheel", this.onWheel);
|
|
368
|
+
var _this$asProps2 = this.asProps, inputRef = _this$asProps2.inputRef, value = _this$asProps2.value;
|
|
370
369
|
if (inputRef.current) {
|
|
371
370
|
inputRef.current.stepUp = this.stepUp;
|
|
372
371
|
inputRef.current.stepDown = this.stepDown;
|
|
@@ -375,7 +374,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
375
374
|
var _this$valueParser = this.valueParser(value, "", ""), displayValue = _this$valueParser.displayValue;
|
|
376
375
|
this.handlers.displayValue(displayValue);
|
|
377
376
|
}
|
|
378
|
-
}
|
|
377
|
+
}
|
|
379
378
|
)
|
|
380
379
|
}, {
|
|
381
380
|
key: "componentDidUpdate",
|
|
@@ -389,7 +388,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
389
388
|
key: "componentWillUnmount",
|
|
390
389
|
value: function componentWillUnmount() {
|
|
391
390
|
var _this$valueInputRef$c2;
|
|
392
|
-
(_this$valueInputRef$c2 = this.valueInputRef.current) === null || _this$valueInputRef$c2 === void 0
|
|
391
|
+
(_this$valueInputRef$c2 = this.valueInputRef.current) === null || _this$valueInputRef$c2 === void 0 ? void 0 : _this$valueInputRef$c2.removeEventListener("wheel", this.onWheel);
|
|
393
392
|
}
|
|
394
393
|
}, {
|
|
395
394
|
key: "render",
|
|
@@ -397,7 +396,7 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
397
396
|
var _ref2 = this.asProps, _ref5;
|
|
398
397
|
var SValue = Input.Value;
|
|
399
398
|
var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, min = _this$asProps3.min, max = _this$asProps3.max, step = _this$asProps3.step, forwardRef = _this$asProps3.forwardRef, inputRef = _this$asProps3.inputRef, displayValue = _this$asProps3.displayValue;
|
|
400
|
-
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SValue, _ref5.cn("SValue", _objectSpread({}, assignProps({
|
|
399
|
+
return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SValue, _ref5.cn("SValue", _objectSpread({}, assignProps({
|
|
401
400
|
"autoComplete": "off",
|
|
402
401
|
"onBlur": this.handleValidation,
|
|
403
402
|
"use:onChange": this.handleChange,
|
|
@@ -413,7 +412,8 @@ var Value = /* @__PURE__ */ (function(_Component2) {
|
|
|
413
412
|
}, _ref2)))));
|
|
414
413
|
}
|
|
415
414
|
}]);
|
|
416
|
-
|
|
415
|
+
return Value2;
|
|
416
|
+
}(Component);
|
|
417
417
|
_defineProperty(Value, "style", style);
|
|
418
418
|
_defineProperty(Value, "defaultProps", {
|
|
419
419
|
defaultValue: "",
|
|
@@ -426,7 +426,7 @@ function Controls(props) {
|
|
|
426
426
|
var SControls = Input.Addon;
|
|
427
427
|
var SUp = "button";
|
|
428
428
|
var SDown = "button";
|
|
429
|
-
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SControls, _ref6.cn("SControls", _objectSpread({}, assignProps({
|
|
429
|
+
return _ref6 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SControls, _ref6.cn("SControls", _objectSpread({}, assignProps({
|
|
430
430
|
"aria-hidden": "true"
|
|
431
431
|
}, _ref3))), /* @__PURE__ */ React.createElement(SUp, _ref6.cn("SUp", {
|
|
432
432
|
"onClick": increment,
|
|
@@ -443,12 +443,12 @@ function Controls(props) {
|
|
|
443
443
|
}), /* @__PURE__ */ React.createElement(DecrementIcon, _ref6.cn("DecrementIcon", {}))), /* @__PURE__ */ React.createElement(Children, _ref6.cn("Children", {})));
|
|
444
444
|
}
|
|
445
445
|
Controls.style = style;
|
|
446
|
-
const
|
|
446
|
+
const InputNumber$1 = createComponent(InputNumber, {
|
|
447
447
|
Value,
|
|
448
448
|
Controls,
|
|
449
449
|
Addon: Input.Addon
|
|
450
450
|
});
|
|
451
451
|
export {
|
|
452
|
-
|
|
452
|
+
InputNumber$1 as default,
|
|
453
453
|
parseValueWithMinMax
|
|
454
454
|
};
|
|
@@ -6,12 +6,12 @@ import it from "./it.json.mjs";
|
|
|
6
6
|
import ja from "./ja.json.mjs";
|
|
7
7
|
import ko from "./ko.json.mjs";
|
|
8
8
|
import nl from "./nl.json.mjs";
|
|
9
|
-
import pl from "./pl.json.mjs";
|
|
10
9
|
import pt from "./pt.json.mjs";
|
|
11
|
-
import sv from "./sv.json.mjs";
|
|
12
10
|
import tr from "./tr.json.mjs";
|
|
13
11
|
import vi from "./vi.json.mjs";
|
|
14
12
|
import zh from "./zh.json.mjs";
|
|
13
|
+
import pl from "./pl.json.mjs";
|
|
14
|
+
import sv from "./sv.json.mjs";
|
|
15
15
|
var localizedMessages = {
|
|
16
16
|
de,
|
|
17
17
|
en,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Intergalactic, PropGetterFn, UnknownProperties } from '@semcore/core';
|
|
3
|
+
import { InputAddonProps, InputProps, InputValueProps } from '@semcore/input';
|
|
4
4
|
|
|
5
5
|
export type InputNumberValue = string;
|
|
6
6
|
export type InputNumberSize = 'm' | 'l';
|
|
7
7
|
|
|
8
|
+
/** @deprecated */
|
|
9
|
+
export interface IInputNumberProps extends InputNumberProps, UnknownProperties {}
|
|
8
10
|
export type InputNumberProps = InputProps & {
|
|
9
11
|
/** Input size
|
|
10
12
|
* @default m
|
|
@@ -16,6 +18,8 @@ export type InputNumberProps = InputProps & {
|
|
|
16
18
|
locale?: string;
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
/** @deprecated */
|
|
22
|
+
export interface IInputNumberValueProps extends InputNumberValueProps, UnknownProperties {}
|
|
19
23
|
export type InputNumberValueProps = InputValueProps & {
|
|
20
24
|
/** Minimum value
|
|
21
25
|
* @default Number.MIN_SAFE_INTEGER
|
|
@@ -35,6 +39,8 @@ export type InputNumberValueProps = InputValueProps & {
|
|
|
35
39
|
onChange?: (value: InputNumberValue, event?: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
36
40
|
};
|
|
37
41
|
|
|
42
|
+
/** @deprecated */
|
|
43
|
+
export interface IInputNumberControlsProps extends InputNumberControlsProps, UnknownProperties {}
|
|
38
44
|
export type InputNumberControlsProps = InputAddonProps & {
|
|
39
45
|
/** Always displays controls (steppers)
|
|
40
46
|
* @default false
|
|
@@ -42,6 +48,8 @@ export type InputNumberControlsProps = InputAddonProps & {
|
|
|
42
48
|
showControls?: boolean;
|
|
43
49
|
};
|
|
44
50
|
|
|
51
|
+
/** @deprecated */
|
|
52
|
+
export interface IInputNumberCtx extends InputNumberCtx, UnknownProperties {}
|
|
45
53
|
export type InputNumberCtx = {
|
|
46
54
|
getValueProps: PropGetterFn;
|
|
47
55
|
getControlsProps: PropGetterFn;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/input-number",
|
|
3
3
|
"description": "Semrush InputNumber Component",
|
|
4
|
-
"version": "5.42.0-prerelease.
|
|
4
|
+
"version": "5.42.0-prerelease.7",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/input": "4.43.0-prerelease.
|
|
18
|
-
"@semcore/utils": "4.49.0-prerelease.
|
|
19
|
-
"@semcore/flex-box": "5.42.0-prerelease.
|
|
17
|
+
"@semcore/input": "4.43.0-prerelease.7",
|
|
18
|
+
"@semcore/utils": "4.49.0-prerelease.7",
|
|
19
|
+
"@semcore/flex-box": "5.42.0-prerelease.7"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@semcore/core": "^2.40.0-prerelease.
|
|
22
|
+
"@semcore/core": "^2.40.0-prerelease.7",
|
|
23
23
|
"react": "16.8 - 18",
|
|
24
24
|
"react-dom": "16.8 - 18"
|
|
25
25
|
},
|