@semcore/input-number 5.41.0 → 5.41.1-prerelease.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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [5.41.1] - 2025-03-18
6
+
7
+ ### Changed
8
+
9
+ - Version patch update due to children dependencies update (`@semcore/input` [4.42.0 ~> 4.42.1], `@semcore/utils` [4.48.0 ~> 4.48.1], `@semcore/flex-box` [5.41.0 ~> 5.41.1], `@semcore/core` [2.39.0 ~> 2.39.1]).
10
+
5
11
  ## [5.41.0] - 2025-03-14
6
12
 
7
13
  ### Added
@@ -25,15 +25,15 @@ var _i18nEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/i
25
25
  var _ref7 = require("@semcore/utils/lib/ref");
26
26
  var _assignProps4 = require("@semcore/utils/lib/assignProps");
27
27
  /*__reshadow-styles__:"./style/input-number.shadow.css"*/
28
- var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".___SValue_1uuai_gg_:focus~.___SControls_1uuai_gg_{display:flex}.___SControls_1uuai_gg_{display:none;flex-flow:column;justify-content:center;height:100%;box-sizing:border-box}.___SControls_1uuai_gg_.__showControls_1uuai_gg_{display:flex}.___SDown_1uuai_gg_,.___SUp_1uuai_gg_{padding:0;width:16px;color:var(--intergalactic-icon-secondary-neutral, #a9abb6);box-sizing:border-box;display:inline-flex;justify-content:center;border:0;background:0 0;cursor:pointer}.___SDown_1uuai_gg_:focus,.___SUp_1uuai_gg_:focus{outline:0}@media (hover:hover){.___SDown_1uuai_gg_:hover,.___SUp_1uuai_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SUp_1uuai_gg_{padding-bottom:1px}.___SDown_1uuai_gg_{padding-top:1px}.___SValue_1uuai_gg_::-webkit-inner-spin-button,.___SValue_1uuai_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_1uuai_gg_._type_number_1uuai_gg_{-moz-appearance:textfield}.___SValue_1uuai_gg_.__disabled_1uuai_gg_~.___SControls_1uuai_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SValueHidden_1uuai_gg_{position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden}" /*__inner_css_end__*/, "1uuai_gg_") /*__reshadow_css_end__*/, {
29
- "__SValue": "___SValue_1uuai_gg_",
30
- "__SControls": "___SControls_1uuai_gg_",
31
- "_showControls": "__showControls_1uuai_gg_",
32
- "__SUp": "___SUp_1uuai_gg_",
33
- "__SDown": "___SDown_1uuai_gg_",
34
- "_disabled": "__disabled_1uuai_gg_",
35
- "__SValueHidden": "___SValueHidden_1uuai_gg_",
36
- "_type_number": "_type_number_1uuai_gg_"
28
+ var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".___SValue_otw7a_gg_:focus~.___SControls_otw7a_gg_{display:flex}.___SControls_otw7a_gg_{display:none;flex-flow:column;justify-content:center;height:100%;box-sizing:border-box}.___SControls_otw7a_gg_.__showControls_otw7a_gg_{display:flex}.___SDown_otw7a_gg_,.___SUp_otw7a_gg_{padding:0;width:16px;color:var(--intergalactic-icon-secondary-neutral, #a9abb6);box-sizing:border-box;display:inline-flex;justify-content:center;border:0;background:0 0;cursor:pointer}.___SDown_otw7a_gg_:focus,.___SUp_otw7a_gg_:focus{outline:0}@media (hover:hover){.___SDown_otw7a_gg_:hover,.___SUp_otw7a_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SUp_otw7a_gg_{padding-bottom:1px}.___SDown_otw7a_gg_{padding-top:1px}.___SValue_otw7a_gg_::-webkit-inner-spin-button,.___SValue_otw7a_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_otw7a_gg_._type_number_otw7a_gg_{-moz-appearance:textfield}.___SValue_otw7a_gg_.__disabled_otw7a_gg_~.___SControls_otw7a_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SValueHidden_otw7a_gg_{position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden}" /*__inner_css_end__*/, "otw7a_gg_") /*__reshadow_css_end__*/, {
29
+ "__SValue": "___SValue_otw7a_gg_",
30
+ "__SControls": "___SControls_otw7a_gg_",
31
+ "_showControls": "__showControls_otw7a_gg_",
32
+ "__SUp": "___SUp_otw7a_gg_",
33
+ "__SDown": "___SDown_otw7a_gg_",
34
+ "_disabled": "__disabled_otw7a_gg_",
35
+ "__SValueHidden": "___SValueHidden_otw7a_gg_",
36
+ "_type_number": "_type_number_otw7a_gg_"
37
37
  });
38
38
  function parseValueWithMinMax(value) {
39
39
  var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MIN_SAFE_INTEGER;
@@ -17,15 +17,15 @@ import { IncrementIcon, DecrementIcon } from './buttons';
17
17
  import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
18
18
  import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
19
19
  /*__reshadow-styles__:"./style/input-number.shadow.css"*/
20
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SValue_1uuai_gg_:focus~.___SControls_1uuai_gg_{display:flex}.___SControls_1uuai_gg_{display:none;flex-flow:column;justify-content:center;height:100%;box-sizing:border-box}.___SControls_1uuai_gg_.__showControls_1uuai_gg_{display:flex}.___SDown_1uuai_gg_,.___SUp_1uuai_gg_{padding:0;width:16px;color:var(--intergalactic-icon-secondary-neutral, #a9abb6);box-sizing:border-box;display:inline-flex;justify-content:center;border:0;background:0 0;cursor:pointer}.___SDown_1uuai_gg_:focus,.___SUp_1uuai_gg_:focus{outline:0}@media (hover:hover){.___SDown_1uuai_gg_:hover,.___SUp_1uuai_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SUp_1uuai_gg_{padding-bottom:1px}.___SDown_1uuai_gg_{padding-top:1px}.___SValue_1uuai_gg_::-webkit-inner-spin-button,.___SValue_1uuai_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_1uuai_gg_._type_number_1uuai_gg_{-moz-appearance:textfield}.___SValue_1uuai_gg_.__disabled_1uuai_gg_~.___SControls_1uuai_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SValueHidden_1uuai_gg_{position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden}" /*__inner_css_end__*/, "1uuai_gg_") /*__reshadow_css_end__*/, {
21
- "__SValue": "___SValue_1uuai_gg_",
22
- "__SControls": "___SControls_1uuai_gg_",
23
- "_showControls": "__showControls_1uuai_gg_",
24
- "__SUp": "___SUp_1uuai_gg_",
25
- "__SDown": "___SDown_1uuai_gg_",
26
- "_disabled": "__disabled_1uuai_gg_",
27
- "__SValueHidden": "___SValueHidden_1uuai_gg_",
28
- "_type_number": "_type_number_1uuai_gg_"
20
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SValue_otw7a_gg_:focus~.___SControls_otw7a_gg_{display:flex}.___SControls_otw7a_gg_{display:none;flex-flow:column;justify-content:center;height:100%;box-sizing:border-box}.___SControls_otw7a_gg_.__showControls_otw7a_gg_{display:flex}.___SDown_otw7a_gg_,.___SUp_otw7a_gg_{padding:0;width:16px;color:var(--intergalactic-icon-secondary-neutral, #a9abb6);box-sizing:border-box;display:inline-flex;justify-content:center;border:0;background:0 0;cursor:pointer}.___SDown_otw7a_gg_:focus,.___SUp_otw7a_gg_:focus{outline:0}@media (hover:hover){.___SDown_otw7a_gg_:hover,.___SUp_otw7a_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SUp_otw7a_gg_{padding-bottom:1px}.___SDown_otw7a_gg_{padding-top:1px}.___SValue_otw7a_gg_::-webkit-inner-spin-button,.___SValue_otw7a_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_otw7a_gg_._type_number_otw7a_gg_{-moz-appearance:textfield}.___SValue_otw7a_gg_.__disabled_otw7a_gg_~.___SControls_otw7a_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SValueHidden_otw7a_gg_{position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden}" /*__inner_css_end__*/, "otw7a_gg_") /*__reshadow_css_end__*/, {
21
+ "__SValue": "___SValue_otw7a_gg_",
22
+ "__SControls": "___SControls_otw7a_gg_",
23
+ "_showControls": "__showControls_otw7a_gg_",
24
+ "__SUp": "___SUp_otw7a_gg_",
25
+ "__SDown": "___SDown_otw7a_gg_",
26
+ "_disabled": "__disabled_otw7a_gg_",
27
+ "__SValueHidden": "___SValueHidden_otw7a_gg_",
28
+ "_type_number": "_type_number_otw7a_gg_"
29
29
  });
30
30
  import { forkRef } from '@semcore/utils/lib/ref';
31
31
  import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
@@ -1,15 +1,15 @@
1
1
  import A from "@babel/runtime/helpers/esm/slicedToArray";
2
- import D from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import V from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import x from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import I from "@babel/runtime/helpers/esm/createClass";
5
5
  import d from "@babel/runtime/helpers/esm/assertThisInitialized";
6
6
  import C from "@babel/runtime/helpers/esm/inherits";
7
7
  import k from "@babel/runtime/helpers/esm/createSuper";
8
- import u from "@babel/runtime/helpers/esm/defineProperty";
8
+ import l from "@babel/runtime/helpers/esm/defineProperty";
9
9
  import { sstyled as M } from "@semcore/utils/lib/core/index";
10
- import z, { sstyled as w, assignProps as R, Component as $ } from "@semcore/core";
10
+ import z, { sstyled as D, assignProps as R, Component as $ } from "@semcore/core";
11
11
  import h from "react";
12
- import V from "@semcore/input";
12
+ import P from "@semcore/input";
13
13
  import { IncrementIcon as W, DecrementIcon as K } from "./buttons.mjs";
14
14
  import { localizedMessages as F } from "./translations/__intergalactic-dynamic-locales.mjs";
15
15
  import L from "@semcore/utils/lib/enhances/i18nEnhance";
@@ -19,38 +19,38 @@ var N = (
19
19
  /*__reshadow_css_start__*/
20
20
  (M.insert(
21
21
  /*__inner_css_start__*/
22
- ".___SValue_1uuai_gg_:focus~.___SControls_1uuai_gg_{display:flex}.___SControls_1uuai_gg_{display:none;flex-flow:column;justify-content:center;height:100%;box-sizing:border-box}.___SControls_1uuai_gg_.__showControls_1uuai_gg_{display:flex}.___SDown_1uuai_gg_,.___SUp_1uuai_gg_{padding:0;width:16px;color:var(--intergalactic-icon-secondary-neutral, #a9abb6);box-sizing:border-box;display:inline-flex;justify-content:center;border:0;background:0 0;cursor:pointer}.___SDown_1uuai_gg_:focus,.___SUp_1uuai_gg_:focus{outline:0}@media (hover:hover){.___SDown_1uuai_gg_:hover,.___SUp_1uuai_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SUp_1uuai_gg_{padding-bottom:1px}.___SDown_1uuai_gg_{padding-top:1px}.___SValue_1uuai_gg_::-webkit-inner-spin-button,.___SValue_1uuai_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_1uuai_gg_._type_number_1uuai_gg_{-moz-appearance:textfield}.___SValue_1uuai_gg_.__disabled_1uuai_gg_~.___SControls_1uuai_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SValueHidden_1uuai_gg_{position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden}",
23
- "1uuai_gg_"
22
+ ".___SValue_otw7a_gg_:focus~.___SControls_otw7a_gg_{display:flex}.___SControls_otw7a_gg_{display:none;flex-flow:column;justify-content:center;height:100%;box-sizing:border-box}.___SControls_otw7a_gg_.__showControls_otw7a_gg_{display:flex}.___SDown_otw7a_gg_,.___SUp_otw7a_gg_{padding:0;width:16px;color:var(--intergalactic-icon-secondary-neutral, #a9abb6);box-sizing:border-box;display:inline-flex;justify-content:center;border:0;background:0 0;cursor:pointer}.___SDown_otw7a_gg_:focus,.___SUp_otw7a_gg_:focus{outline:0}@media (hover:hover){.___SDown_otw7a_gg_:hover,.___SUp_otw7a_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SUp_otw7a_gg_{padding-bottom:1px}.___SDown_otw7a_gg_{padding-top:1px}.___SValue_otw7a_gg_::-webkit-inner-spin-button,.___SValue_otw7a_gg_::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.___SValue_otw7a_gg_._type_number_otw7a_gg_{-moz-appearance:textfield}.___SValue_otw7a_gg_.__disabled_otw7a_gg_~.___SControls_otw7a_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SValueHidden_otw7a_gg_{position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden}",
23
+ "otw7a_gg_"
24
24
  ), {
25
- __SValue: "___SValue_1uuai_gg_",
26
- __SControls: "___SControls_1uuai_gg_",
27
- _showControls: "__showControls_1uuai_gg_",
28
- __SUp: "___SUp_1uuai_gg_",
29
- __SDown: "___SDown_1uuai_gg_",
30
- _disabled: "__disabled_1uuai_gg_",
31
- __SValueHidden: "___SValueHidden_1uuai_gg_",
32
- _type_number: "_type_number_1uuai_gg_"
25
+ __SValue: "___SValue_otw7a_gg_",
26
+ __SControls: "___SControls_otw7a_gg_",
27
+ _showControls: "__showControls_otw7a_gg_",
28
+ __SUp: "___SUp_otw7a_gg_",
29
+ __SDown: "___SDown_otw7a_gg_",
30
+ _disabled: "__disabled_otw7a_gg_",
31
+ __SValueHidden: "___SValueHidden_otw7a_gg_",
32
+ _type_number: "_type_number_otw7a_gg_"
33
33
  })
34
34
  );
35
35
  function H(m) {
36
36
  var g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Number.MIN_SAFE_INTEGER, c = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Number.MAX_SAFE_INTEGER;
37
37
  return Math.max(g, Math.min(c, m));
38
38
  }
39
- var P = /* @__PURE__ */ function(m) {
39
+ var b = /* @__PURE__ */ function(m) {
40
40
  C(c, m);
41
41
  var g = k(c);
42
42
  function c() {
43
- var a;
43
+ var t;
44
44
  x(this, c);
45
- for (var n = arguments.length, s = new Array(n), o = 0; o < n; o++)
46
- s[o] = arguments[o];
47
- return a = g.call.apply(g, [this].concat(s)), u(d(a), "inputRef", /* @__PURE__ */ h.createRef()), u(d(a), "increment", function(e) {
48
- var r, t;
49
- (r = a.inputRef.current) === null || r === void 0 || (t = r.stepUp) === null || t === void 0 || t.call(r, e);
50
- }), u(d(a), "decrement", function(e) {
51
- var r, t;
52
- (r = a.inputRef.current) === null || r === void 0 || (t = r.stepDown) === null || t === void 0 || t.call(r, e);
53
- }), a;
45
+ for (var n = arguments.length, s = new Array(n), i = 0; i < n; i++)
46
+ s[i] = arguments[i];
47
+ return t = g.call.apply(g, [this].concat(s)), l(d(t), "inputRef", /* @__PURE__ */ h.createRef()), l(d(t), "increment", function(e) {
48
+ var a, r;
49
+ (a = t.inputRef.current) === null || a === void 0 || (r = a.stepUp) === null || r === void 0 || r.call(a, e);
50
+ }), l(d(t), "decrement", function(e) {
51
+ var a, r;
52
+ (a = t.inputRef.current) === null || a === void 0 || (r = a.stepDown) === null || r === void 0 || r.call(a, e);
53
+ }), t;
54
54
  }
55
55
  return I(c, [{
56
56
  key: "getValueProps",
@@ -68,26 +68,26 @@ var P = /* @__PURE__ */ function(m) {
68
68
  }, {
69
69
  key: "getControlsProps",
70
70
  value: function() {
71
- var n = this.asProps, s = n.size, o = n.getI18nText;
71
+ var n = this.asProps, s = n.size, i = n.getI18nText;
72
72
  return {
73
73
  size: s,
74
74
  increment: this.increment,
75
75
  decrement: this.decrement,
76
- getI18nText: o
76
+ getI18nText: i
77
77
  };
78
78
  }
79
79
  }, {
80
80
  key: "render",
81
81
  value: function() {
82
- var n = this.asProps, s, o = V;
83
- return s = w(this.asProps.style), /* @__PURE__ */ h.createElement(o, s.cn("SInputNumber", D({}, R({}, n))));
82
+ var n = this.asProps, s, i = P;
83
+ return s = D(this.asProps.style), /* @__PURE__ */ h.createElement(i, s.cn("SInputNumber", V({}, R({}, n))));
84
84
  }
85
85
  }]), c;
86
86
  }($);
87
- u(P, "displayName", "InputNumber");
88
- u(P, "style", N);
89
- u(P, "enhance", [L(F)]);
90
- u(P, "defaultProps", {
87
+ l(b, "displayName", "InputNumber");
88
+ l(b, "style", N);
89
+ l(b, "enhance", [L(F)]);
90
+ l(b, "defaultProps", {
91
91
  size: "m",
92
92
  i18n: F,
93
93
  locale: "en"
@@ -96,116 +96,116 @@ var E = /* @__PURE__ */ function(m) {
96
96
  C(c, m);
97
97
  var g = k(c);
98
98
  function c() {
99
- var a;
99
+ var t;
100
100
  x(this, c);
101
- for (var n = arguments.length, s = new Array(n), o = 0; o < n; o++)
102
- s[o] = arguments[o];
103
- return a = g.call.apply(g, [this].concat(s)), u(d(a), "valueInputRef", /* @__PURE__ */ h.createRef()), u(d(a), "cursorPosition", -1), u(d(a), "getFormattedValue", function(e) {
104
- return e.replace(new RegExp("[".concat(a.separatorThousands, "]"), "g"), "").replace(a.separatorDecimal, ".");
105
- }), u(d(a), "valueParser", function(e, r, t) {
106
- var l = a.props.numberFormatter, i = a.getFormattedValue(String(e));
107
- if (Number.isNaN(Number(i)))
101
+ for (var n = arguments.length, s = new Array(n), i = 0; i < n; i++)
102
+ s[i] = arguments[i];
103
+ return t = g.call.apply(g, [this].concat(s)), l(d(t), "valueInputRef", /* @__PURE__ */ h.createRef()), l(d(t), "cursorPosition", -1), l(d(t), "getFormattedValue", function(e) {
104
+ return e.replace(new RegExp("[".concat(t.separatorThousands, "]"), "g"), "").replace(t.separatorDecimal, ".");
105
+ }), l(d(t), "valueParser", function(e, a, r) {
106
+ var u = t.props.numberFormatter, o = t.getFormattedValue(String(e));
107
+ if (Number.isNaN(Number(o)))
108
108
  return {
109
- parsedValue: r,
110
- displayValue: t
109
+ parsedValue: a,
110
+ displayValue: r
111
111
  };
112
112
  var f = "";
113
- if (/\.[0-9]*0$/.test(i)) {
114
- var p = i.split(a.separatorDecimal), _ = A(p, 2), v = _[0], S = _[1];
115
- f = l.format(v) + a.separatorDecimal + S;
116
- } else i !== "" && (f = l.format(i));
113
+ if (/\.[0-9]*0$/.test(o)) {
114
+ var p = o.split(t.separatorDecimal), _ = A(p, 2), v = _[0], S = _[1];
115
+ f = u.format(v) + t.separatorDecimal + S;
116
+ } else o !== "" && (f = u.format(o));
117
117
  return {
118
- parsedValue: i,
118
+ parsedValue: o,
119
119
  displayValue: f
120
120
  };
121
- }), u(d(a), "handleValidation", function(e) {
122
- var r = a.asProps, t = r.value, l = r.displayValue, i = r.min, f = r.max, p = r.step, _ = a.valueParser(e.currentTarget.value, t, l), v = _.parsedValue, S = p < 1 ? p.toString().split(".")[1].length : 1;
123
- if (Number.isNaN(t) || Number.isNaN(Number.parseFloat(v)))
124
- e.currentTarget.value = "", a.handlers.value("", e);
121
+ }), l(d(t), "handleValidation", function(e) {
122
+ var a = t.asProps, r = a.value, u = a.displayValue, o = a.min, f = a.max, p = a.step, _ = t.valueParser(e.currentTarget.value, r, u), v = _.parsedValue, S = p < 1 ? p.toString().split(".")[1].length : 1;
123
+ if (Number.isNaN(r) || Number.isNaN(Number.parseFloat(v)))
124
+ e.currentTarget.value = "", t.handlers.value("", e);
125
125
  else {
126
- var y = H(Number.parseFloat(v), i, f), b = a.round(y % p, p);
127
- b !== 0 && (b >= p / 2 ? y += p - b : Math.abs(b) < p && (y -= b));
126
+ var y = H(Number.parseFloat(v), o, f), w = t.round(y % p, p);
127
+ w !== 0 && (w >= p / 2 ? y += p - w : Math.abs(w) < p && (y -= w));
128
128
  var U = Number(y.toFixed(S));
129
- a.handlers.value(String(U), e);
129
+ t.handlers.value(String(U), e);
130
130
  }
131
- }), u(d(a), "onWheel", function(e) {
132
- G(a.asProps.onWheel, a.handleWheel)(e);
133
- }), u(d(a), "handleWheel", function(e) {
134
- e.target === a.valueInputRef.current && document.activeElement === a.valueInputRef.current && (e.preventDefault(), e.wheelDelta > 0 ? a.stepUp(e) : e.wheelDelta < 0 && a.stepDown(e));
135
- }), u(d(a), "handleChange", function(e) {
136
- var r = a.getFormattedValue(e.currentTarget.value), t = a.asProps, l = t.numberFormatter, i = t.value;
137
- if (r === "." || r === "-")
138
- return a.handlers.displayValue(r), !1;
139
- if (r.endsWith("-"))
131
+ }), l(d(t), "onWheel", function(e) {
132
+ G(t.asProps.onWheel, t.handleWheel)(e);
133
+ }), l(d(t), "handleWheel", function(e) {
134
+ e.target === t.valueInputRef.current && document.activeElement === t.valueInputRef.current && (e.preventDefault(), e.wheelDelta > 0 ? t.stepUp(e) : e.wheelDelta < 0 && t.stepDown(e));
135
+ }), l(d(t), "handleChange", function(e) {
136
+ var a = t.getFormattedValue(e.currentTarget.value), r = t.asProps, u = r.numberFormatter, o = r.value;
137
+ if (a === "." || a === "-")
138
+ return t.handlers.displayValue(a), !1;
139
+ if (a.endsWith("-"))
140
140
  return !1;
141
- if (r.endsWith("."))
142
- return r.length > i.length ? (a.handlers.displayValue(l.format(r) + a.separatorDecimal), !1) : (a.handlers.value(r.slice(0, -1), e), !1);
143
- var f = /[0-9.-]+/.test(r);
144
- (f || r === "") && a.handlers.value(r, e);
145
- }), u(d(a), "handleKeyUp", function(e) {
146
- e.key === "Shift" && (a.cursorPosition = -1);
147
- }), u(d(a), "handleKeyDown", function(e) {
148
- var r = e.currentTarget, t = r.value, l = t.length, i = a.asProps.displayValue;
141
+ if (a.endsWith("."))
142
+ return a.length > o.length ? (t.handlers.displayValue(u.format(a) + t.separatorDecimal), !1) : (t.handlers.value(a.slice(0, -1), e), !1);
143
+ var f = /[0-9.-]+/.test(a);
144
+ (f || a === "") && t.handlers.value(a, e);
145
+ }), l(d(t), "handleKeyUp", function(e) {
146
+ e.key === "Shift" && (t.cursorPosition = -1);
147
+ }), l(d(t), "handleKeyDown", function(e) {
148
+ var a = e.currentTarget, r = a.value, u = r.length, o = t.asProps.displayValue;
149
149
  if (e.key === "." || e.key === ",") {
150
- if (t.indexOf(a.separatorDecimal) === -1 && e.key === ",")
151
- e.currentTarget.value = t + ".";
152
- else if (t.indexOf(a.separatorDecimal) !== -1) {
150
+ if (r.indexOf(t.separatorDecimal) === -1 && e.key === ",")
151
+ e.currentTarget.value = r + ".";
152
+ else if (r.indexOf(t.separatorDecimal) !== -1) {
153
153
  e.preventDefault(), e.stopPropagation();
154
154
  return;
155
155
  }
156
156
  }
157
- if (e.key === "Backspace" && t.endsWith(a.separatorDecimal))
158
- return e.preventDefault(), e.stopPropagation(), a.handlers.displayValue(i.slice(0, -1)), !1;
159
- if (r.selectionStart !== l && (e.key === "Backspace" || e.key === a.separatorDecimal || ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(e.key))) {
160
- var f = t.slice(r.selectionEnd);
157
+ if (e.key === "Backspace" && r.endsWith(t.separatorDecimal))
158
+ return e.preventDefault(), e.stopPropagation(), t.handlers.displayValue(o.slice(0, -1)), !1;
159
+ if (a.selectionStart !== u && (e.key === "Backspace" || e.key === t.separatorDecimal || ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(e.key))) {
160
+ var f = r.slice(a.selectionEnd);
161
161
  requestAnimationFrame(function() {
162
- var _ = a.state.displayValue, v = _.lastIndexOf(f), S = v, y = v;
163
- r.setSelectionRange(S, y);
162
+ var _ = t.state.displayValue, v = _.lastIndexOf(f), S = v, y = v;
163
+ a.setSelectionRange(S, y);
164
164
  });
165
165
  }
166
166
  var p = 2;
167
- switch (e.shiftKey && a.cursorPosition === -1 && (a.cursorPosition = r.selectionStart), e.key) {
167
+ switch (e.shiftKey && t.cursorPosition === -1 && (t.cursorPosition = a.selectionStart), e.key) {
168
168
  case "ArrowLeft": {
169
- e.preventDefault(), a.moveSelectionLeft(r, p);
169
+ e.preventDefault(), t.moveSelectionLeft(a, p);
170
170
  break;
171
171
  }
172
172
  case "ArrowRight": {
173
- e.preventDefault(), a.moveSelectionRight(r, p);
173
+ e.preventDefault(), t.moveSelectionRight(a, p);
174
174
  break;
175
175
  }
176
176
  case "ArrowDown": {
177
- e.preventDefault(), a.stepDown(e);
177
+ e.preventDefault(), t.stepDown(e);
178
178
  break;
179
179
  }
180
180
  case "ArrowUp": {
181
- e.preventDefault(), a.stepUp(e);
181
+ e.preventDefault(), t.stepUp(e);
182
182
  break;
183
183
  }
184
184
  }
185
- }), u(d(a), "moveSelectionLeft", function(e, r) {
186
- var t = e.value, l = e.selectionStart - 1 >= 0 ? e.selectionStart - 1 : 0, i = t[e.selectionStart - r] === a.separatorThousands ? e.selectionStart - r : l;
187
- a.cursorPosition === -1 ? e.setSelectionRange(i, i) : e.selectionStart <= a.cursorPosition && e.selectionEnd === a.cursorPosition ? e.setSelectionRange(i, e.selectionEnd) : e.setSelectionRange(e.selectionStart, t[e.selectionEnd - r] === a.separatorThousands ? e.selectionEnd - r : e.selectionEnd - 1);
188
- }), u(d(a), "moveSelectionRight", function(e, r) {
189
- var t = e.value, l = e.selectionEnd + 1, i = t[e.selectionEnd] === a.separatorThousands ? e.selectionEnd + r : l;
190
- a.cursorPosition === -1 ? e.setSelectionRange(i, i) : e.selectionEnd >= a.cursorPosition && e.selectionStart === a.cursorPosition ? e.setSelectionRange(e.selectionStart, i) : e.setSelectionRange(t[e.selectionStart] === a.separatorThousands ? e.selectionStart + r : e.selectionStart + 1, e.selectionEnd);
191
- }), u(d(a), "handleClick", function(e) {
192
- var r = e.target, t = r.value;
193
- t[r.selectionStart - 1] === a.separatorThousands && r.setSelectionRange(r.selectionStart - 1, r.selectionEnd - 1);
194
- }), u(d(a), "handleBlur", function(e) {
195
- a.cursorPosition = -1, a.handleValidation(e);
196
- }), u(d(a), "stepUp", function(e) {
197
- var r = a.asProps, t = r.max, l = t === void 0 ? Number.MAX_SAFE_INTEGER : t, i = r.min, f = r.step, p = r.value, _;
198
- if (p === "" ? _ = i ?? 0 : _ = Number.parseFloat(p), !Number.isNaN(_)) {
199
- var v = _ + f <= l ? _ + f : l;
200
- a.handlers.value(v.toString(), e);
185
+ }), l(d(t), "moveSelectionLeft", function(e, a) {
186
+ var r = e.value, u = e.selectionStart - 1 >= 0 ? e.selectionStart - 1 : 0, o = r[e.selectionStart - a] === t.separatorThousands ? e.selectionStart - a : u;
187
+ t.cursorPosition === -1 ? e.setSelectionRange(o, o) : e.selectionStart <= t.cursorPosition && e.selectionEnd === t.cursorPosition ? e.setSelectionRange(o, e.selectionEnd) : e.setSelectionRange(e.selectionStart, r[e.selectionEnd - a] === t.separatorThousands ? e.selectionEnd - a : e.selectionEnd - 1);
188
+ }), l(d(t), "moveSelectionRight", function(e, a) {
189
+ var r = e.value, u = e.selectionEnd + 1, o = r[e.selectionEnd] === t.separatorThousands ? e.selectionEnd + a : u;
190
+ t.cursorPosition === -1 ? e.setSelectionRange(o, o) : e.selectionEnd >= t.cursorPosition && e.selectionStart === t.cursorPosition ? e.setSelectionRange(e.selectionStart, o) : e.setSelectionRange(r[e.selectionStart] === t.separatorThousands ? e.selectionStart + a : e.selectionStart + 1, e.selectionEnd);
191
+ }), l(d(t), "handleClick", function(e) {
192
+ var a = e.target, r = a.value;
193
+ r[a.selectionStart - 1] === t.separatorThousands && a.setSelectionRange(a.selectionStart - 1, a.selectionEnd - 1);
194
+ }), l(d(t), "handleBlur", function(e) {
195
+ t.cursorPosition = -1, t.handleValidation(e);
196
+ }), l(d(t), "stepUp", function(e) {
197
+ var a = t.asProps, r = a.max, u = r === void 0 ? Number.MAX_SAFE_INTEGER : r, o = a.min, f = a.step, p = a.value, _;
198
+ if (p === "" ? _ = o ?? 0 : _ = Number.parseFloat(p), !Number.isNaN(_)) {
199
+ var v = _ + f <= u ? _ + f : u;
200
+ t.handlers.value(v.toString(), e);
201
201
  }
202
- }), u(d(a), "stepDown", function(e) {
203
- var r = a.asProps, t = r.max, l = r.min, i = l === void 0 ? Number.MIN_SAFE_INTEGER : l, f = r.step, p = r.value, _;
204
- if (p === "" ? _ = t ?? 0 : _ = Number.parseFloat(p), !Number.isNaN(_)) {
205
- var v = _ - f >= i ? _ - f : i;
206
- a.handlers.value(v.toString(), e);
202
+ }), l(d(t), "stepDown", function(e) {
203
+ var a = t.asProps, r = a.max, u = a.min, o = u === void 0 ? Number.MIN_SAFE_INTEGER : u, f = a.step, p = a.value, _;
204
+ if (p === "" ? _ = r ?? 0 : _ = Number.parseFloat(p), !Number.isNaN(_)) {
205
+ var v = _ - f >= o ? _ - f : o;
206
+ t.handlers.value(v.toString(), e);
207
207
  }
208
- }), a;
208
+ }), t;
209
209
  }
210
210
  return I(c, [{
211
211
  key: "uncontrolledProps",
@@ -214,8 +214,8 @@ var E = /* @__PURE__ */ function(m) {
214
214
  return {
215
215
  displayValue: null,
216
216
  value: [null, function(s) {
217
- var o = n.asProps, e = o.value, r = o.displayValue, t = n.valueParser(s, e, r), l = t.parsedValue, i = t.displayValue;
218
- return n.handlers.displayValue(i), l;
217
+ var i = n.asProps, e = i.value, a = i.displayValue, r = n.valueParser(s, e, a), u = r.parsedValue, o = r.displayValue;
218
+ return n.handlers.displayValue(o), u;
219
219
  }]
220
220
  };
221
221
  }
@@ -234,8 +234,8 @@ var E = /* @__PURE__ */ function(m) {
234
234
  }, {
235
235
  key: "round",
236
236
  value: function(n, s) {
237
- var o = Math.floor(s) === s ? 0 : s.toString().split(".")[1].length || 0;
238
- return o === 0 ? Number.parseFloat(n) : Number.parseFloat(n).toPrecision(o);
237
+ var i = Math.floor(s) === s ? 0 : s.toString().split(".")[1].length || 0;
238
+ return i === 0 ? Number.parseFloat(n) : Number.parseFloat(n).toPrecision(i);
239
239
  }
240
240
  }, {
241
241
  key: "componentDidMount",
@@ -244,10 +244,10 @@ var E = /* @__PURE__ */ function(m) {
244
244
  function() {
245
245
  var n;
246
246
  (n = this.valueInputRef.current) === null || n === void 0 || n.addEventListener("wheel", this.onWheel);
247
- var s = this.asProps, o = s.inputRef, e = s.value;
248
- if (o.current && (o.current.stepUp = this.stepUp, o.current.stepDown = this.stepDown), e !== "") {
249
- var r = this.valueParser(e, "", ""), t = r.displayValue;
250
- this.handlers.displayValue(t);
247
+ var s = this.asProps, i = s.inputRef, e = s.value;
248
+ if (i.current && (i.current.stepUp = this.stepUp, i.current.stepDown = this.stepDown), e !== "") {
249
+ var a = this.valueParser(e, "", ""), r = a.displayValue;
250
+ this.handlers.displayValue(r);
251
251
  }
252
252
  }
253
253
  )
@@ -255,8 +255,8 @@ var E = /* @__PURE__ */ function(m) {
255
255
  key: "componentDidUpdate",
256
256
  value: function(n) {
257
257
  if (n.value !== this.props.value) {
258
- var s = this.valueParser(this.props.value, n.value, n.displayValue), o = s.displayValue;
259
- this.handlers.displayValue(o);
258
+ var s = this.valueParser(this.props.value, n.value, n.displayValue), i = s.displayValue;
259
+ this.handlers.displayValue(i);
260
260
  }
261
261
  }
262
262
  }, {
@@ -268,8 +268,8 @@ var E = /* @__PURE__ */ function(m) {
268
268
  }, {
269
269
  key: "render",
270
270
  value: function() {
271
- var n = this.asProps, s, o = V.Value, e = this.asProps, r = e.styles, t = e.min, l = e.max, i = e.step, f = e.forwardRef, p = e.inputRef, _ = e.displayValue;
272
- return s = w(r), /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement(o, s.cn("SValue", D({}, R({
271
+ var n = this.asProps, s, i = P.Value, e = this.asProps, a = e.styles, r = e.min, u = e.max, o = e.step, f = e.forwardRef, p = e.inputRef, _ = e.displayValue;
272
+ return s = D(a), /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement(i, s.cn("SValue", V({}, R({
273
273
  autoComplete: "off",
274
274
  onBlur: this.handleValidation,
275
275
  "use:onChange": this.handleChange,
@@ -278,45 +278,45 @@ var E = /* @__PURE__ */ function(m) {
278
278
  onClick: this.handleClick,
279
279
  "use:ref": B(this.valueInputRef, p, f),
280
280
  "use:value": _,
281
- inputMode: Number.isInteger(i) ? "numeric" : "decimal",
282
- min: t,
283
- max: l,
284
- step: i
281
+ inputMode: Number.isInteger(o) ? "numeric" : "decimal",
282
+ min: r,
283
+ max: u,
284
+ step: o
285
285
  }, n)))));
286
286
  }
287
287
  }]), c;
288
288
  }($);
289
- u(E, "style", N);
290
- u(E, "defaultProps", {
289
+ l(E, "style", N);
290
+ l(E, "defaultProps", {
291
291
  defaultValue: "",
292
292
  defaultDisplayValue: "",
293
293
  step: 1
294
294
  });
295
295
  function T(m) {
296
- var g = arguments[0], c, a = m.Children, n = m.increment, s = m.decrement, o = m.size, e = m.styles, r = m.getI18nText, t = V.Addon, l = "button", i = "button";
297
- return c = w(e), /* @__PURE__ */ h.createElement(t, c.cn("SControls", D({}, R({
296
+ var g = arguments[0], c, t = m.Children, n = m.increment, s = m.decrement, i = m.size, e = m.styles, a = m.getI18nText, r = P.Addon, u = "button", o = "button";
297
+ return c = D(e), /* @__PURE__ */ h.createElement(r, c.cn("SControls", V({}, R({
298
298
  "aria-hidden": "true"
299
- }, g))), /* @__PURE__ */ h.createElement(l, c.cn("SUp", {
299
+ }, g))), /* @__PURE__ */ h.createElement(u, c.cn("SUp", {
300
300
  onClick: n,
301
301
  tabIndex: -1,
302
302
  type: "button",
303
- size: o,
304
- "aria-label": r("increment")
305
- }), /* @__PURE__ */ h.createElement(W, c.cn("IncrementIcon", {}))), /* @__PURE__ */ h.createElement(i, c.cn("SDown", {
303
+ size: i,
304
+ "aria-label": a("increment")
305
+ }), /* @__PURE__ */ h.createElement(W, c.cn("IncrementIcon", {}))), /* @__PURE__ */ h.createElement(o, c.cn("SDown", {
306
306
  onClick: s,
307
307
  tabIndex: -1,
308
308
  type: "button",
309
- size: o,
310
- "aria-label": r("decrement")
311
- }), /* @__PURE__ */ h.createElement(K, c.cn("DecrementIcon", {}))), /* @__PURE__ */ h.createElement(a, c.cn("Children", {})));
309
+ size: i,
310
+ "aria-label": a("decrement")
311
+ }), /* @__PURE__ */ h.createElement(K, c.cn("DecrementIcon", {}))), /* @__PURE__ */ h.createElement(t, c.cn("Children", {})));
312
312
  }
313
313
  T.style = N;
314
- const le = z(P, {
314
+ const ue = z(b, {
315
315
  Value: E,
316
316
  Controls: T,
317
- Addon: V.Addon
317
+ Addon: P.Addon
318
318
  });
319
319
  export {
320
- le as default,
320
+ ue as default,
321
321
  H as parseValueWithMinMax
322
322
  };
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.41.0",
4
+ "version": "5.41.1-prerelease.2",
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.42.0",
18
- "@semcore/utils": "4.48.0",
19
- "@semcore/flex-box": "5.41.0"
17
+ "@semcore/input": "4.42.1-prerelease.2",
18
+ "@semcore/utils": "4.48.1-prerelease.2",
19
+ "@semcore/flex-box": "5.41.1-prerelease.2"
20
20
  },
21
21
  "peerDependencies": {
22
- "@semcore/core": "^2.17.5",
22
+ "@semcore/core": "^2.39.1-prerelease.2",
23
23
  "react": "16.8 - 18",
24
24
  "react-dom": "16.8 - 18"
25
25
  },