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