bj-web-components 0.2.34 → 0.2.35

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.
Files changed (111) hide show
  1. package/README.md +10 -1
  2. package/dist/index.js +58 -1
  3. package/dist/index.mjs +1 -29
  4. package/dist/miniapp.js +1 -1
  5. package/dist/miniapp.mjs +0 -1
  6. package/dist/mobile.js +1 -1
  7. package/dist/mobile.mjs +0 -1
  8. package/dist/react.js +1 -1
  9. package/dist/react.mjs +0 -1
  10. package/dist/shared.js +1 -1
  11. package/dist/shared.mjs +0 -1
  12. package/dist/style.css +1 -1
  13. package/dist/web/BasicInput/BInput.js +278 -1
  14. package/dist/web/BasicInput/BInput.mjs +263 -164
  15. package/dist/web/BasicInput/utils.js +47 -1
  16. package/dist/web/BasicInput/utils.mjs +22 -20
  17. package/dist/web/CategoryDropdown/CategoryDropdown.js +376 -1
  18. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +355 -235
  19. package/dist/web/CheckBox/BCheckBox.js +176 -1
  20. package/dist/web/CheckBox/BCheckBox.mjs +169 -98
  21. package/dist/web/CheckBox/Group.js +111 -1
  22. package/dist/web/CheckBox/Group.mjs +104 -64
  23. package/dist/web/CheckBox/context.js +8 -1
  24. package/dist/web/CheckBox/context.mjs +2 -4
  25. package/dist/web/CheckBox/index.js +11 -1
  26. package/dist/web/CheckBox/index.mjs +2 -4
  27. package/dist/web/Dropdown/BDropdown.js +265 -1
  28. package/dist/web/Dropdown/BDropdown.mjs +234 -134
  29. package/dist/web/EmptyInputBox/EmptyInputBox.js +89 -1
  30. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +85 -72
  31. package/dist/web/FileCard/FileCard.js +414 -1
  32. package/dist/web/FileCard/FileCard.mjs +400 -116
  33. package/dist/web/Icon/Icon.js +82 -1
  34. package/dist/web/Icon/Icon.mjs +78 -8
  35. package/dist/web/Input/Input.js +230 -1
  36. package/dist/web/Input/Input.mjs +219 -164
  37. package/dist/web/InputNumber/BInputNumber.js +271 -1
  38. package/dist/web/InputNumber/BInputNumber.mjs +254 -189
  39. package/dist/web/InputNumber/StepHandler.js +112 -1
  40. package/dist/web/InputNumber/StepHandler.mjs +102 -50
  41. package/dist/web/InputNumber/hooks/useCursor.js +38 -1
  42. package/dist/web/InputNumber/hooks/useCursor.mjs +31 -34
  43. package/dist/web/InputNumber/hooks/useFrame.js +15 -1
  44. package/dist/web/InputNumber/hooks/useFrame.mjs +8 -5
  45. package/dist/web/InputNumber/utils/decimal.js +163 -1
  46. package/dist/web/InputNumber/utils/decimal.mjs +114 -79
  47. package/dist/web/MobileDrawer/BMobileDrawer.js +238 -1
  48. package/dist/web/MobileDrawer/BMobileDrawer.mjs +221 -139
  49. package/dist/web/Modal/Modal.js +148 -1
  50. package/dist/web/Modal/Modal.mjs +143 -79
  51. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +273 -1
  52. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +262 -143
  53. package/dist/web/Pagination/Pagination.js +352 -1
  54. package/dist/web/Pagination/Pagination.mjs +342 -247
  55. package/dist/web/ProductField/ProductField.js +443 -1
  56. package/dist/web/ProductField/ProductField.mjs +423 -208
  57. package/dist/web/ProductField/arrow-up.svg.js +4 -1
  58. package/dist/web/ProductField/arrow-up.svg.mjs +2 -4
  59. package/dist/web/ProductField/checkbox-no.svg.js +4 -1
  60. package/dist/web/ProductField/checkbox-no.svg.mjs +2 -4
  61. package/dist/web/ProductField/checkbox-ok.svg.js +4 -1
  62. package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -4
  63. package/dist/web/ProductField/no_data_light.svg.js +4 -1
  64. package/dist/web/ProductField/no_data_light.svg.mjs +2 -4
  65. package/dist/web/ProductField/search.svg.js +4 -1
  66. package/dist/web/ProductField/search.svg.mjs +2 -4
  67. package/dist/web/ProductField/sort.svg.js +4 -1
  68. package/dist/web/ProductField/sort.svg.mjs +2 -4
  69. package/dist/web/Radio/BRadio.js +151 -1
  70. package/dist/web/Radio/BRadio.mjs +147 -75
  71. package/dist/web/Radio/Button.js +54 -1
  72. package/dist/web/Radio/Button.mjs +51 -8
  73. package/dist/web/Radio/Group.js +97 -1
  74. package/dist/web/Radio/Group.mjs +92 -76
  75. package/dist/web/Radio/context.js +10 -1
  76. package/dist/web/Radio/context.mjs +3 -5
  77. package/dist/web/Radio/index.js +13 -1
  78. package/dist/web/Radio/index.mjs +2 -4
  79. package/dist/web/SkuInputCard/SkuInputCard.js +427 -1
  80. package/dist/web/SkuInputCard/SkuInputCard.mjs +414 -219
  81. package/dist/web/SkuInputCard/spin_loading_red.gif.js +4 -1
  82. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -4
  83. package/dist/web/Switch/Switch.js +114 -1
  84. package/dist/web/Switch/Switch.mjs +109 -58
  85. package/dist/web/Table/BTable.js +1049 -1
  86. package/dist/web/Table/BTable.mjs +1011 -667
  87. package/dist/web/Table/Column.js +6 -1
  88. package/dist/web/Table/Column.mjs +1 -3
  89. package/dist/web/Table/ColumnGroup.js +6 -1
  90. package/dist/web/Table/ColumnGroup.mjs +1 -3
  91. package/dist/web/Table/utils/columns.js +116 -1
  92. package/dist/web/Table/utils/columns.mjs +103 -37
  93. package/dist/web/Table/utils/sortFilter.js +145 -1
  94. package/dist/web/Table/utils/sortFilter.mjs +129 -57
  95. package/dist/web/Tabs/BTabs.js +260 -1
  96. package/dist/web/Tabs/BTabs.mjs +239 -122
  97. package/dist/web/Tabs/TabPane.js +19 -1
  98. package/dist/web/Tabs/TabPane.mjs +1 -4
  99. package/dist/web/Tooltip/ConfirmTooltip.js +53 -1
  100. package/dist/web/Tooltip/ConfirmTooltip.mjs +47 -22
  101. package/dist/web/Tooltip/ContentTooltip.js +156 -1
  102. package/dist/web/Tooltip/ContentTooltip.mjs +145 -76
  103. package/dist/web/Tooltip/ProgressTooltip.js +56 -1
  104. package/dist/web/Tooltip/ProgressTooltip.mjs +50 -31
  105. package/dist/web/Tooltip/TooltipWrapper.js +19 -1
  106. package/dist/web/Tooltip/TooltipWrapper.mjs +13 -9
  107. package/dist/web/Tooltip/useAutoPlacement.js +65 -1
  108. package/dist/web/Tooltip/useAutoPlacement.mjs +52 -24
  109. package/dist/web.js +58 -1
  110. package/dist/web.mjs +1 -29
  111. package/package.json +97 -95
@@ -1,204 +1,269 @@
1
- import { jsxs as pe, jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as Se, useRef as g, useState as z, useCallback as B, useMemo as U } from "react";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
+ import { jsxs as pe, jsx as l } from "react/jsx-runtime";
9
+ import { forwardRef as Me, useRef as d, useState as J, useCallback as L, useMemo as C } from "react";
3
10
  /* empty css */
4
- import We from "./hooks/useCursor.mjs";
5
- import Ye from "./hooks/useFrame.mjs";
6
- import Ge from "./StepHandler.mjs";
7
- import { getDecimal as i, getNumberPrecision as de, validateNumber as Je, toFixed as O, getDecupleSteps as ge } from "./utils/decimal.mjs";
8
- function je(I) {
9
- if (I == null) return null;
10
- const u = i(I);
11
+ import He from "./hooks/useCursor.mjs";
12
+ import We from "./hooks/useFrame.mjs";
13
+ import Ye from "./StepHandler.mjs";
14
+ import { getDecimal as i, getNumberPrecision as de, validateNumber as Ge, toFixed as Q, getDecupleSteps as ge } from "./utils/decimal.mjs";
15
+ function ve(j) {
16
+ if (j == null) return null;
17
+ var u = i(j);
11
18
  return u.isInvalidate() ? null : u;
12
19
  }
13
- const Ae = Se(function({
14
- value: u,
15
- defaultValue: A,
16
- onChange: x,
17
- min: C,
18
- max: K,
19
- step: c = 1,
20
- precision: N,
21
- disabled: F = !1,
22
- readOnly: $ = !1,
23
- placeholder: Ie,
24
- autoFocus: Ne,
25
- size: T = "middle",
26
- status: ee,
27
- bordered: ve = !0,
28
- controls: k = !0,
29
- keyboard: Ve = !0,
30
- changeOnWheel: De = !1,
31
- changeOnBlur: Re = !0,
32
- addonBefore: a,
33
- addonAfter: f,
34
- prefix: v,
35
- suffix: V,
36
- formatter: D,
37
- parser: R,
38
- decimalSeparator: m,
39
- onStep: M,
40
- onPressEnter: P,
41
- onFocus: H,
42
- onBlur: S,
43
- id: _e,
44
- name: he,
45
- className: te,
46
- style: ne
47
- }, _) {
48
- const W = g(null), [Y, re] = z(!1), s = g(!1), j = g(!1), h = g(!1), G = g(""), [r, ue] = z(() => i(u ?? A)), we = (e) => {
49
- u === void 0 && ue(e);
50
- }, J = B(
51
- (e, t) => {
52
- if (!t)
53
- return N !== void 0 && N >= 0 ? N : Math.max(de(e), de(c));
54
- },
55
- [N, c]
56
- ), L = B(
57
- (e) => {
58
- if (R) return R(e);
59
- let t = e;
60
- return m && (t = t.replace(m, ".")), t.replace(/[^\w.-]+/g, "");
20
+ var Ae = Me(function (_ref, R) {
21
+ var u = _ref.value,
22
+ F = _ref.defaultValue,
23
+ X = _ref.onChange,
24
+ P = _ref.min,
25
+ U = _ref.max,
26
+ _ref$step = _ref.step,
27
+ c = _ref$step === void 0 ? 1 : _ref$step,
28
+ I = _ref.precision,
29
+ _ref$disabled = _ref.disabled,
30
+ x = _ref$disabled === void 0 ? !1 : _ref$disabled,
31
+ _ref$readOnly = _ref.readOnly,
32
+ K = _ref$readOnly === void 0 ? !1 : _ref$readOnly,
33
+ je = _ref.placeholder,
34
+ Ie = _ref.autoFocus,
35
+ _ref$size = _ref.size,
36
+ Z = _ref$size === void 0 ? "middle" : _ref$size,
37
+ z = _ref.status,
38
+ _ref$bordered = _ref.bordered,
39
+ Ne = _ref$bordered === void 0 ? !0 : _ref$bordered,
40
+ _ref$controls = _ref.controls,
41
+ S = _ref$controls === void 0 ? !0 : _ref$controls,
42
+ _ref$keyboard = _ref.keyboard,
43
+ Ve = _ref$keyboard === void 0 ? !0 : _ref$keyboard,
44
+ _ref$changeOnWheel = _ref.changeOnWheel,
45
+ he = _ref$changeOnWheel === void 0 ? !1 : _ref$changeOnWheel,
46
+ _ref$changeOnBlur = _ref.changeOnBlur,
47
+ De = _ref$changeOnBlur === void 0 ? !0 : _ref$changeOnBlur,
48
+ a = _ref.addonBefore,
49
+ f = _ref.addonAfter,
50
+ N = _ref.prefix,
51
+ V = _ref.suffix,
52
+ h = _ref.formatter,
53
+ D = _ref.parser,
54
+ m = _ref.decimalSeparator,
55
+ O = _ref.onStep,
56
+ A = _ref.onPressEnter,
57
+ T = _ref.onFocus,
58
+ ee = _ref.onBlur,
59
+ Re = _ref.id,
60
+ _e = _ref.name,
61
+ ne = _ref.className,
62
+ te = _ref.style;
63
+ var $ = d(null),
64
+ _J = J(!1),
65
+ _J2 = _slicedToArray(_J, 2),
66
+ k = _J2[0],
67
+ re = _J2[1],
68
+ o = d(!1),
69
+ g = d(!1),
70
+ _ = d(!1),
71
+ B = d(""),
72
+ _J3 = J(function () {
73
+ return i(u != null ? u : F);
74
+ }),
75
+ _J4 = _slicedToArray(_J3, 2),
76
+ r = _J4[0],
77
+ ue = _J4[1],
78
+ we = function we(e) {
79
+ u === void 0 && ue(e);
61
80
  },
62
- [R, m]
63
- ), ie = B(
64
- (e, t) => {
65
- if (D) return D(e, { userTyping: !!t, input: G.current });
66
- let n = e;
81
+ M = L(function (e, t) {
82
+ if (!t) return I !== void 0 && I >= 0 ? I : Math.max(de(e), de(c));
83
+ }, [I, c]),
84
+ H = L(function (e) {
85
+ if (D) return D(e);
86
+ var t = e;
87
+ return m && (t = t.replace(m, ".")), t.replace(/[^\w.-]+/g, "");
88
+ }, [D, m]),
89
+ ie = L(function (e, t) {
90
+ if (h) return h(e, {
91
+ userTyping: !!t,
92
+ input: B.current
93
+ });
94
+ var n = e;
67
95
  if (!t) {
68
- const l = J(n, t);
69
- Je(n) && (m || (l ?? -1) >= 0) && (n = O(n, m || ".", l));
96
+ var s = M(n, t);
97
+ Ge(n) && (m || (s != null ? s : -1) >= 0) && (n = Q(n, m || ".", s));
70
98
  }
71
99
  return n;
100
+ }, [h, M, m]),
101
+ _J5 = J(function () {
102
+ var e = F != null ? F : u;
103
+ return r.isInvalidate() && ["string", "number"].includes(_typeof(e)) ? e == null || Number.isNaN(e) ? "" : String(e) : ie(r.toString(), !1);
104
+ }),
105
+ _J6 = _slicedToArray(_J5, 2),
106
+ w = _J6[0],
107
+ se = _J6[1];
108
+ B.current = w;
109
+ var E = function E(e, t) {
110
+ se(ie(e.isInvalidate() ? e.toString(!1) : e.toString(!t), t));
72
111
  },
73
- [D, J, m]
74
- ), [w, se] = z(() => {
75
- const e = A ?? u;
76
- return r.isInvalidate() && ["string", "number"].includes(typeof e) ? e == null || Number.isNaN(e) ? "" : String(e) : ie(r.toString(), !1);
77
- });
78
- G.current = w;
79
- const q = (e, t) => {
80
- se(
81
- ie(e.isInvalidate() ? e.toString(!1) : e.toString(!t), t)
82
- );
83
- }, b = U(() => je(K), [K]), p = U(() => je(C), [C]), le = U(() => !b || r.isInvalidate() ? !1 : b.lessEquals(r), [b, r]), oe = U(() => !p || r.isInvalidate() ? !1 : r.lessEquals(p), [p, r]), [qe] = We(W.current, Y), ce = (e) => b && !e.lessEquals(b) ? b : p && !p.lessEquals(e) ? p : null, Q = (e) => !ce(e), y = (e, t) => {
84
- let n = e, l = Q(n) || n.isEmpty();
85
- if (!n.isEmpty() && !t && (n = ce(n) || n, l = !0), !$ && !F && l) {
86
- const d = n.toString(), E = J(d, t);
87
- return E !== void 0 && E >= 0 && (n = i(O(d, ".", E)), Q(n) || (n = i(O(d, ".", E, !0)))), n.equals(r) || (we(n), x == null || x(n.isEmpty() ? null : n.toNumber()), u === void 0 && q(n, t)), n;
88
- }
89
- return r;
90
- }, ye = Ye(), X = (e) => {
91
- if (qe(), G.current = e, se(e), !j.current) {
92
- const t = L(e), n = i(t);
93
- n.isNaN() || y(n, !0);
94
- }
95
- ye(() => {
96
- const t = R ? e : e.replace(/。/g, ".");
97
- t !== e && X(t);
98
- });
99
- }, Ee = () => {
100
- j.current = !0;
101
- }, Ue = (e) => {
102
- j.current = !1, X(e.target.value);
103
- }, xe = (e) => X(e.target.value), Z = (e) => {
104
- var d;
105
- if (e && le || !e && oe) return;
106
- s.current = !1;
107
- let t = i(h.current ? ge(c) : c);
108
- e || (t = t.negate());
109
- const n = (r.isInvalidate() ? i(0) : r).add(t.toString()), l = y(n, !1);
110
- M == null || M(l.toNumber(), { offset: h.current ? ge(c) : c, type: e ? "up" : "down" }), (d = W.current) == null || d.focus();
111
- }, ae = (e) => {
112
- const t = i(L(w));
113
- let n;
114
- t.isNaN() ? n = y(r, e) : n = y(t, e), u !== void 0 ? q(r, !1) : n.isNaN() || q(n, !1);
115
- }, Ce = (e) => {
116
- const { key: t, shiftKey: n } = e;
117
- s.current = !0, h.current = n, t === "Enter" && (j.current || (s.current = !1), ae(!1), P == null || P(e)), Ve && !j.current && (t === "ArrowUp" || t === "ArrowDown") && (Z(t === "ArrowUp"), e.preventDefault());
118
- }, Ke = () => {
119
- s.current = !1, h.current = !1;
120
- }, Fe = (e) => {
121
- re(!0), H == null || H(e);
122
- }, $e = (e) => {
123
- Re && ae(!1), re(!1), s.current = !1, S == null || S(e);
124
- }, fe = g(u);
112
+ b = C(function () {
113
+ return ve(U);
114
+ }, [U]),
115
+ p = C(function () {
116
+ return ve(P);
117
+ }, [P]),
118
+ oe = C(function () {
119
+ return !b || r.isInvalidate() ? !1 : b.lessEquals(r);
120
+ }, [b, r]),
121
+ le = C(function () {
122
+ return !p || r.isInvalidate() ? !1 : r.lessEquals(p);
123
+ }, [p, r]),
124
+ _He = He($.current, k),
125
+ _He2 = _slicedToArray(_He, 1),
126
+ Ee = _He2[0],
127
+ ce = function ce(e) {
128
+ return b && !e.lessEquals(b) ? b : p && !p.lessEquals(e) ? p : null;
129
+ },
130
+ W = function W(e) {
131
+ return !ce(e);
132
+ },
133
+ q = function q(e, t) {
134
+ var n = e,
135
+ s = W(n) || n.isEmpty();
136
+ if (!n.isEmpty() && !t && (n = ce(n) || n, s = !0), !K && !x && s) {
137
+ var v = n.toString(),
138
+ y = M(v, t);
139
+ return y !== void 0 && y >= 0 && (n = i(Q(v, ".", y)), W(n) || (n = i(Q(v, ".", y, !0)))), n.equals(r) || (we(n), X == null || X(n.isEmpty() ? null : n.toNumber()), u === void 0 && E(n, t)), n;
140
+ }
141
+ return r;
142
+ },
143
+ qe = We(),
144
+ _Y = function Y(e) {
145
+ if (Ee(), B.current = e, se(e), !g.current) {
146
+ var t = H(e),
147
+ n = i(t);
148
+ n.isNaN() || q(n, !0);
149
+ }
150
+ qe(function () {
151
+ var t = D ? e : e.replace(/。/g, ".");
152
+ t !== e && _Y(t);
153
+ });
154
+ },
155
+ ye = function ye() {
156
+ g.current = !0;
157
+ },
158
+ Ce = function Ce(e) {
159
+ g.current = !1, _Y(e.target.value);
160
+ },
161
+ Fe = function Fe(e) {
162
+ return _Y(e.target.value);
163
+ },
164
+ G = function G(e) {
165
+ var t;
166
+ if (e && oe || !e && le) return;
167
+ o.current = !1;
168
+ var n = i(_.current ? ge(c) : c);
169
+ e || (n = n.negate());
170
+ var s = (r.isInvalidate() ? i(0) : r).add(n.toString()),
171
+ v = q(s, !1);
172
+ O == null || O(v.toNumber(), {
173
+ offset: _.current ? ge(c) : c,
174
+ type: e ? "up" : "down"
175
+ }), (t = $.current) == null || t.focus();
176
+ },
177
+ ae = function ae(e) {
178
+ var t = i(H(w));
179
+ var n;
180
+ t.isNaN() ? n = q(r, e) : n = q(t, e), u !== void 0 ? E(r, !1) : n.isNaN() || E(n, !1);
181
+ },
182
+ Pe = function Pe(e) {
183
+ var t = e.key,
184
+ n = e.shiftKey;
185
+ o.current = !0, _.current = n, t === "Enter" && (g.current || (o.current = !1), ae(!1), A == null || A(e)), Ve && !g.current && (t === "ArrowUp" || t === "ArrowDown") && (G(t === "ArrowUp"), e.preventDefault());
186
+ },
187
+ Ue = function Ue() {
188
+ o.current = !1, _.current = !1;
189
+ },
190
+ xe = function xe(e) {
191
+ re(!0), T == null || T(e);
192
+ },
193
+ Ke = function Ke(e) {
194
+ De && ae(!1), re(!1), o.current = !1, ee == null || ee(e);
195
+ },
196
+ fe = d(u);
125
197
  if (fe.current !== u) {
126
198
  fe.current = u;
127
- const e = i(u);
199
+ var e = i(u);
128
200
  if (!e.equals(r)) {
129
201
  ue(e);
130
- const t = i(L(w));
131
- (!e.equals(t) || !s.current || D) && q(e, s.current);
202
+ var t = i(H(w));
203
+ (!e.equals(t) || !o.current || h) && E(e, o.current);
132
204
  }
133
205
  }
134
- const ke = (e) => {
135
- W.current = e, typeof _ == "function" ? _(e) : _ && (_.current = e);
136
- }, me = !!k, Me = typeof k == "object" ? k.icon : void 0, Pe = !r.isInvalidate() && !Q(r), He = [
137
- "bj-input-number",
138
- `bj-input-number--${T}`,
139
- Y && "bj-input-number--focused",
140
- F && "bj-input-number--disabled",
141
- $ && "bj-input-number--readonly",
142
- !ve && "bj-input-number--borderless",
143
- ee && `bj-input-number--${ee}`,
144
- Pe && "bj-input-number--out-of-range",
145
- me && "bj-input-number--with-controls",
146
- a && "bj-input-number--group-left",
147
- f && "bj-input-number--group-right"
148
- ].filter(Boolean).join(" "), be = /* @__PURE__ */ pe(
149
- "div",
150
- {
151
- className: [He, !(a || f || v || V) && te].filter(Boolean).join(" "),
152
- style: a || f || v || V ? void 0 : ne,
153
- onKeyDown: Ce,
154
- onKeyUp: Ke,
155
- children: [
156
- v && /* @__PURE__ */ o("span", { className: "bj-input-number__prefix", children: v }),
157
- /* @__PURE__ */ o("div", { className: "bj-input-number__input-wrap", children: /* @__PURE__ */ o(
158
- "input",
159
- {
160
- ref: ke,
161
- id: _e,
162
- name: he,
163
- className: "bj-input-number__input",
164
- autoComplete: "off",
165
- role: "spinbutton",
166
- "aria-valuemin": C,
167
- "aria-valuemax": K,
168
- "aria-valuenow": r.isInvalidate() ? void 0 : r.toNumber(),
169
- value: w,
170
- placeholder: Ie,
171
- disabled: F,
172
- readOnly: $,
173
- autoFocus: Ne,
174
- onChange: xe,
175
- onFocus: Fe,
176
- onBlur: $e,
177
- onCompositionStart: Ee,
178
- onCompositionEnd: Ue,
179
- onWheel: De ? (e) => {
180
- Y && Z(e.deltaY < 0);
181
- } : void 0
182
- }
183
- ) }),
184
- V && /* @__PURE__ */ o("span", { className: "bj-input-number__suffix", children: V }),
185
- me && /* @__PURE__ */ o(Ge, { icon: Me, upDisabled: le, downDisabled: oe, onStep: Z })
186
- ]
187
- }
188
- );
189
- return !a && !f ? be : /* @__PURE__ */ pe(
190
- "div",
191
- {
192
- className: ["bj-input-number-group", `bj-input-number-group--${T}`, te].filter(Boolean).join(" "),
193
- style: ne,
194
- children: [
195
- a && /* @__PURE__ */ o("div", { className: "bj-input-number-group__addon", children: a }),
196
- be,
197
- f && /* @__PURE__ */ o("div", { className: "bj-input-number-group__addon", children: f })
198
- ]
199
- }
200
- );
206
+ var Se = function Se(e) {
207
+ $.current = e, typeof R == "function" ? R(e) : R && (R.current = e);
208
+ },
209
+ me = !!S,
210
+ $e = _typeof(S) == "object" ? S.icon : void 0,
211
+ ke = !r.isInvalidate() && !W(r),
212
+ Be = ["bj-input-number", "bj-input-number--".concat(Z), k && "bj-input-number--focused", x && "bj-input-number--disabled", K && "bj-input-number--readonly", !Ne && "bj-input-number--borderless", z && "bj-input-number--".concat(z), ke && "bj-input-number--out-of-range", me && "bj-input-number--with-controls", a && "bj-input-number--group-left", f && "bj-input-number--group-right"].filter(Boolean).join(" "),
213
+ be = /* @__PURE__ */pe("div", {
214
+ className: [Be, !(a || f || N || V) && ne].filter(Boolean).join(" "),
215
+ style: a || f || N || V ? void 0 : te,
216
+ onKeyDown: Pe,
217
+ onKeyUp: Ue,
218
+ children: [N && /* @__PURE__ */l("span", {
219
+ className: "bj-input-number__prefix",
220
+ children: N
221
+ }), /* @__PURE__ */l("div", {
222
+ className: "bj-input-number__input-wrap",
223
+ children: /* @__PURE__ */l("input", {
224
+ ref: Se,
225
+ id: Re,
226
+ name: _e,
227
+ className: "bj-input-number__input",
228
+ autoComplete: "off",
229
+ role: "spinbutton",
230
+ "aria-valuemin": P,
231
+ "aria-valuemax": U,
232
+ "aria-valuenow": r.isInvalidate() ? void 0 : r.toNumber(),
233
+ value: w,
234
+ placeholder: je,
235
+ disabled: x,
236
+ readOnly: K,
237
+ autoFocus: Ie,
238
+ onChange: Fe,
239
+ onFocus: xe,
240
+ onBlur: Ke,
241
+ onCompositionStart: ye,
242
+ onCompositionEnd: Ce,
243
+ onWheel: he ? function (e) {
244
+ k && G(e.deltaY < 0);
245
+ } : void 0
246
+ })
247
+ }), V && /* @__PURE__ */l("span", {
248
+ className: "bj-input-number__suffix",
249
+ children: V
250
+ }), me && /* @__PURE__ */l(Ye, {
251
+ icon: $e,
252
+ upDisabled: oe,
253
+ downDisabled: le,
254
+ onStep: G
255
+ })]
256
+ });
257
+ return !a && !f ? be : /* @__PURE__ */pe("div", {
258
+ className: ["bj-input-number-group", "bj-input-number-group--".concat(Z), ne].filter(Boolean).join(" "),
259
+ style: te,
260
+ children: [a && /* @__PURE__ */l("div", {
261
+ className: "bj-input-number-group__addon",
262
+ children: a
263
+ }), be, f && /* @__PURE__ */l("div", {
264
+ className: "bj-input-number-group__addon",
265
+ children: f
266
+ })]
267
+ });
201
268
  });
202
- export {
203
- Ae as default
204
- };
269
+ export { Ae as default };
@@ -1 +1,112 @@
1
- "use strict";const e=require("react/jsx-runtime"),a=require("react"),m=600,h=200;function _({className:t}){return e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:e.jsx("path",{d:"M15.4573 13.6501C15.9047 13.6504 16.129 14.192 15.8128 14.5085L12.3352 17.9851C12.139 18.1811 11.8214 18.1811 11.6253 17.9851L8.14772 14.5085C7.83144 14.192 8.0558 13.6504 8.50319 13.6501H15.4573ZM11.6643 5.98311C11.8606 5.78688 12.179 5.78688 12.3753 5.98311L15.8518 9.45967C16.1683 9.77623 15.944 10.3171 15.4964 10.3171H8.54323C8.09567 10.3171 7.87154 9.77625 8.18776 9.45967L11.6643 5.98311Z",fill:"currentColor"})})}function j({icon:t,upDisabled:o,downDisabled:i,onStep:l}){const u=a.useRef(void 0),s=a.useRef(l);s.current=l;const r=()=>clearTimeout(u.current),c=(n,p)=>{n.preventDefault(),r(),s.current(p);function d(){s.current(p),u.current=setTimeout(d,h)}u.current=setTimeout(d,m)};a.useEffect(()=>r,[]);const b={unselectable:"on",role:"button",onMouseUp:r,onMouseLeave:r};return e.jsxs("div",{className:"bj-input-number__handler-wrap",children:[e.jsx("span",{...b,"aria-label":"Increase Value","aria-disabled":o,className:o?"bj-input-number__handler bj-input-number__handler--up bj-input-number__handler--disabled":"bj-input-number__handler bj-input-number__handler--up",onMouseDown:n=>c(n,!0)}),e.jsx("span",{...b,"aria-label":"Decrease Value","aria-disabled":i,className:i?"bj-input-number__handler bj-input-number__handler--down bj-input-number__handler--disabled":"bj-input-number__handler bj-input-number__handler--down",onMouseDown:n=>c(n,!1)}),t||e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"bj-input-number__handler-icon bj-input-number__handler-icon--up"}),e.jsx(_,{className:"bj-input-number__handler-icon bj-input-number__handler-icon--down"})]})]})}module.exports=j;
1
+ "use strict";
2
+
3
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
+ var t = require("react/jsx-runtime"),
7
+ i = require("react");
8
+ var w = Object.defineProperty,
9
+ v = Object.defineProperties,
10
+ P = Object.getOwnPropertyDescriptors,
11
+ d = Object.getOwnPropertySymbols,
12
+ x = Object.prototype.hasOwnProperty,
13
+ O = Object.prototype.propertyIsEnumerable,
14
+ m = function m(r, e, n) {
15
+ return e in r ? w(r, e, {
16
+ enumerable: !0,
17
+ configurable: !0,
18
+ writable: !0,
19
+ value: n
20
+ }) : r[e] = n;
21
+ },
22
+ j = function j(r, e) {
23
+ for (var n in e || (e = {})) x.call(e, n) && m(r, n, e[n]);
24
+ if (d) {
25
+ var _iterator = _createForOfIteratorHelper(d(e)),
26
+ _step;
27
+ try {
28
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
29
+ var n = _step.value;
30
+ O.call(e, n) && m(r, n, e[n]);
31
+ }
32
+ } catch (err) {
33
+ _iterator.e(err);
34
+ } finally {
35
+ _iterator.f();
36
+ }
37
+ }
38
+ return r;
39
+ },
40
+ h = function h(r, e) {
41
+ return v(r, P(e));
42
+ };
43
+ var g = 600,
44
+ S = 200;
45
+ function f(_ref) {
46
+ var r = _ref.className;
47
+ return t.jsx("svg", {
48
+ width: "24",
49
+ height: "24",
50
+ viewBox: "0 0 24 24",
51
+ fill: "none",
52
+ xmlns: "http://www.w3.org/2000/svg",
53
+ className: r,
54
+ children: t.jsx("path", {
55
+ d: "M15.4573 13.6501C15.9047 13.6504 16.129 14.192 15.8128 14.5085L12.3352 17.9851C12.139 18.1811 11.8214 18.1811 11.6253 17.9851L8.14772 14.5085C7.83144 14.192 8.0558 13.6504 8.50319 13.6501H15.4573ZM11.6643 5.98311C11.8606 5.78688 12.179 5.78688 12.3753 5.98311L15.8518 9.45967C16.1683 9.77623 15.944 10.3171 15.4964 10.3171H8.54323C8.09567 10.3171 7.87154 9.77625 8.18776 9.45967L11.6643 5.98311Z",
56
+ fill: "currentColor"
57
+ })
58
+ });
59
+ }
60
+ function y(_ref2) {
61
+ var r = _ref2.icon,
62
+ e = _ref2.upDisabled,
63
+ n = _ref2.downDisabled,
64
+ l = _ref2.onStep;
65
+ var s = i.useRef(void 0),
66
+ u = i.useRef(l);
67
+ u.current = l;
68
+ var o = function o() {
69
+ return clearTimeout(s.current);
70
+ },
71
+ p = function p(a, _) {
72
+ a.preventDefault(), o(), u.current(_);
73
+ function b() {
74
+ u.current(_), s.current = setTimeout(b, S);
75
+ }
76
+ s.current = setTimeout(b, g);
77
+ };
78
+ i.useEffect(function () {
79
+ return o;
80
+ }, []);
81
+ var c = {
82
+ unselectable: "on",
83
+ role: "button",
84
+ onMouseUp: o,
85
+ onMouseLeave: o
86
+ };
87
+ return t.jsxs("div", {
88
+ className: "bj-input-number__handler-wrap",
89
+ children: [t.jsx("span", h(j({}, c), {
90
+ "aria-label": "Increase Value",
91
+ "aria-disabled": e,
92
+ className: e ? "bj-input-number__handler bj-input-number__handler--up bj-input-number__handler--disabled" : "bj-input-number__handler bj-input-number__handler--up",
93
+ onMouseDown: function onMouseDown(a) {
94
+ return p(a, !0);
95
+ }
96
+ })), t.jsx("span", h(j({}, c), {
97
+ "aria-label": "Decrease Value",
98
+ "aria-disabled": n,
99
+ className: n ? "bj-input-number__handler bj-input-number__handler--down bj-input-number__handler--disabled" : "bj-input-number__handler bj-input-number__handler--down",
100
+ onMouseDown: function onMouseDown(a) {
101
+ return p(a, !1);
102
+ }
103
+ })), r || t.jsxs(t.Fragment, {
104
+ children: [t.jsx(f, {
105
+ className: "bj-input-number__handler-icon bj-input-number__handler-icon--up"
106
+ }), t.jsx(f, {
107
+ className: "bj-input-number__handler-icon bj-input-number__handler-icon--down"
108
+ })]
109
+ })]
110
+ });
111
+ }
112
+ module.exports = y;