bj-web-components 0.2.9 → 0.2.11

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 (62) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.mjs +29 -15
  3. package/dist/style.css +1 -1
  4. package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -0
  5. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +260 -0
  6. package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -0
  7. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +74 -0
  8. package/dist/web/FileCard/FileCard.js +1 -0
  9. package/dist/web/FileCard/FileCard.mjs +128 -0
  10. package/dist/web/Icon/Icon.js +1 -0
  11. package/dist/web/Icon/Icon.mjs +10 -0
  12. package/dist/web/Input/Input.js +1 -0
  13. package/dist/web/Input/Input.mjs +173 -0
  14. package/dist/web/InputNumber/BInputNumber.js +1 -0
  15. package/dist/web/InputNumber/BInputNumber.mjs +204 -0
  16. package/dist/web/InputNumber/StepHandler.js +1 -0
  17. package/dist/web/InputNumber/StepHandler.mjs +64 -0
  18. package/dist/web/InputNumber/hooks/useCursor.js +1 -0
  19. package/dist/web/InputNumber/hooks/useCursor.mjs +39 -0
  20. package/dist/web/InputNumber/hooks/useFrame.js +1 -0
  21. package/dist/web/InputNumber/hooks/useFrame.mjs +10 -0
  22. package/dist/web/InputNumber/utils/decimal.js +1 -0
  23. package/dist/web/InputNumber/utils/decimal.mjs +119 -0
  24. package/dist/web/Modal/Modal.js +1 -0
  25. package/dist/web/Modal/Modal.mjs +82 -0
  26. package/dist/web/Pagination/Pagination.js +1 -0
  27. package/dist/web/Pagination/Pagination.mjs +253 -0
  28. package/dist/web/ProductField/ProductField.js +1 -0
  29. package/dist/web/ProductField/ProductField.mjs +226 -0
  30. package/dist/web/ProductField/arrow-up.svg.js +1 -0
  31. package/dist/web/ProductField/arrow-up.svg.mjs +4 -0
  32. package/dist/web/ProductField/checkbox-no.svg.js +1 -0
  33. package/dist/web/ProductField/checkbox-no.svg.mjs +4 -0
  34. package/dist/web/ProductField/checkbox-ok.svg.js +1 -0
  35. package/dist/web/ProductField/checkbox-ok.svg.mjs +4 -0
  36. package/dist/web/ProductField/no_data_light.png.js +1 -0
  37. package/dist/web/ProductField/no_data_light.png.mjs +4 -0
  38. package/dist/web/ProductField/search.svg.js +1 -0
  39. package/dist/web/ProductField/search.svg.mjs +4 -0
  40. package/dist/web/ProductField/sort.svg.js +1 -0
  41. package/dist/web/ProductField/sort.svg.mjs +4 -0
  42. package/dist/web/SkuInputCard/SkuInputCard.js +1 -0
  43. package/dist/web/SkuInputCard/SkuInputCard.mjs +238 -0
  44. package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -0
  45. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +4 -0
  46. package/dist/web/Switch/Switch.js +1 -0
  47. package/dist/web/Switch/Switch.mjs +61 -0
  48. package/dist/web/Tooltip/ConfirmTooltip.js +1 -0
  49. package/dist/web/Tooltip/ConfirmTooltip.mjs +26 -0
  50. package/dist/web/Tooltip/ContentTooltip.js +1 -0
  51. package/dist/web/Tooltip/ContentTooltip.mjs +29 -0
  52. package/dist/web/Tooltip/ProgressTooltip.js +1 -0
  53. package/dist/web/Tooltip/ProgressTooltip.mjs +35 -0
  54. package/dist/web/Tooltip/TooltipWrapper.js +1 -0
  55. package/dist/web/Tooltip/TooltipWrapper.mjs +13 -0
  56. package/dist/web/Tooltip/useAutoPlacement.js +1 -0
  57. package/dist/web/Tooltip/useAutoPlacement.mjs +32 -0
  58. package/dist/web.js +1 -1
  59. package/dist/web.mjs +29 -15
  60. package/package.json +4 -2
  61. package/dist/BInputNumber-C9Rk9YRG.mjs +0 -1964
  62. package/dist/BInputNumber-CVx-lMcq.js +0 -1
@@ -0,0 +1,128 @@
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
+ import { useState as u, useRef as m, useEffect as b } from "react";
3
+ /* empty css */
4
+ const y = {
5
+ pdf: { color: "#F54A45", label: "PDF" },
6
+ image: { color: "#00AAFF", label: "IMG" },
7
+ doc: { color: "#3B64FC", label: "DOC" },
8
+ docx: { color: "#3B64FC", label: "DOC" },
9
+ xls: { color: "#1D9B4C", label: "XLS" },
10
+ xlsx: { color: "#1D9B4C", label: "XLS" },
11
+ ppt: { color: "#DF4023", label: "PPT" },
12
+ pptx: { color: "#DF4023", label: "PPT" },
13
+ zip: { color: "#7B5EA7", label: "ZIP" },
14
+ rar: { color: "#7B5EA7", label: "RAR" },
15
+ txt: { color: "#8C8C8C", label: "TXT" },
16
+ other: { color: "#1677FF", label: "FILE" }
17
+ };
18
+ function v({ fileType: r, fileUrl: l, fileName: o }) {
19
+ if (r === "image" && l)
20
+ return /* @__PURE__ */ e("img", { src: l, alt: o, className: "file-card__image-thumb" });
21
+ const { color: t, label: s } = y[r];
22
+ return /* @__PURE__ */ c("svg", { width: "88", height: "88", viewBox: "0 0 88 88", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
23
+ /* @__PURE__ */ e("rect", { x: "14", y: "8", width: "50", height: "62", rx: "4", fill: "#F5F5F5" }),
24
+ /* @__PURE__ */ e("path", { d: "M50 8L64 22H50V8Z", fill: "#E2E2E2" }),
25
+ /* @__PURE__ */ e("rect", { x: "20", y: "30", width: "30", height: "4", rx: "2", fill: "#E2E2E2" }),
26
+ /* @__PURE__ */ e("rect", { x: "20", y: "40", width: "30", height: "4", rx: "2", fill: "#E2E2E2" }),
27
+ /* @__PURE__ */ e("rect", { x: "20", y: "50", width: "20", height: "4", rx: "2", fill: "#E2E2E2" }),
28
+ /* @__PURE__ */ e("rect", { x: "42", y: "52", width: "32", height: "28", rx: "4", fill: t }),
29
+ /* @__PURE__ */ e("rect", { x: "42", y: "52", width: "4", height: "28", rx: "2", fill: "rgba(255,255,255,0.25)" }),
30
+ /* @__PURE__ */ e("rect", { x: "42", y: "76", width: "32", height: "4", rx: "2", fill: "rgba(0,0,0,0.15)" }),
31
+ /* @__PURE__ */ e(
32
+ "text",
33
+ {
34
+ x: "58",
35
+ y: "71",
36
+ textAnchor: "middle",
37
+ fill: "white",
38
+ fontSize: "9",
39
+ fontWeight: "700",
40
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
41
+ letterSpacing: "0.3",
42
+ children: s
43
+ }
44
+ )
45
+ ] });
46
+ }
47
+ function p() {
48
+ return /* @__PURE__ */ c("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
49
+ /* @__PURE__ */ e("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
50
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3", stroke: "currentColor", strokeWidth: "2" })
51
+ ] });
52
+ }
53
+ function g() {
54
+ return /* @__PURE__ */ c("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
55
+ /* @__PURE__ */ e("polyline", { points: "3,6 5,6 21,6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
56
+ /* @__PURE__ */ e("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
57
+ /* @__PURE__ */ e("path", { d: "M10 11v6M14 11v6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
58
+ /* @__PURE__ */ e("path", { d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
59
+ ] });
60
+ }
61
+ function k({ fileName: r, onRename: l }) {
62
+ const [o, t] = u(!1), [s, a] = u(r), n = m(null);
63
+ b(() => {
64
+ var i, f;
65
+ o && (a(r), (i = n.current) == null || i.focus(), (f = n.current) == null || f.select());
66
+ }, [o, r]);
67
+ const h = async () => {
68
+ const i = s.trim();
69
+ i && i !== r && await (l == null ? void 0 : l(i)), t(!1);
70
+ }, d = () => t(!1), x = (i) => {
71
+ i.key === "Enter" && !i.shiftKey && (i.preventDefault(), h()), i.key === "Escape" && d();
72
+ }, _ = () => {
73
+ h();
74
+ }, C = () => {
75
+ l && t(!0);
76
+ };
77
+ return o ? /* @__PURE__ */ e("div", { className: "file-card__name-area file-card__name-area--editing", children: /* @__PURE__ */ e(
78
+ "textarea",
79
+ {
80
+ ref: n,
81
+ className: "file-card__edit-input",
82
+ value: s,
83
+ onChange: (i) => a(i.target.value),
84
+ onKeyDown: x,
85
+ onBlur: _,
86
+ rows: 2,
87
+ style: { height: "42px" }
88
+ }
89
+ ) }) : /* @__PURE__ */ e("div", { className: "file-card__name-area", onDoubleClick: C, children: /* @__PURE__ */ e("span", { className: "file-card__filename", title: r, children: r }) });
90
+ }
91
+ function E({ fileName: r, onDelete: l, onRename: o, onPreview: t, className: s, style: a }) {
92
+ return /* @__PURE__ */ c("div", { className: `file-card file-card--pdf ${s || ""}`, style: a, children: [
93
+ /* @__PURE__ */ c("div", { className: "file-card__pdf-preview", onClick: t, children: [
94
+ (t || l) && /* @__PURE__ */ c("div", { className: "file-card__overlay", children: [
95
+ t && /* @__PURE__ */ e("button", { className: "file-card__overlay-btn", onClick: (n) => {
96
+ n.stopPropagation(), t();
97
+ }, children: /* @__PURE__ */ e(p, {}) }),
98
+ l && /* @__PURE__ */ e("button", { className: "file-card__overlay-btn", onClick: (n) => {
99
+ n.stopPropagation(), l();
100
+ }, children: /* @__PURE__ */ e(g, {}) })
101
+ ] }),
102
+ /* @__PURE__ */ e("div", { className: "file-card__pdf-label", children: /* @__PURE__ */ e("span", { children: "PDF" }) })
103
+ ] }),
104
+ /* @__PURE__ */ e(k, { fileName: r, onRename: o })
105
+ ] });
106
+ }
107
+ function F({ fileName: r, fileType: l, fileUrl: o, onDelete: t, onRename: s, onPreview: a, className: n, style: h }) {
108
+ return /* @__PURE__ */ c("div", { className: `file-card file-card--other ${n || ""}`, style: h, children: [
109
+ /* @__PURE__ */ c("div", { className: "file-card__other-preview", onClick: a, children: [
110
+ (a || t) && /* @__PURE__ */ c("div", { className: "file-card__overlay", children: [
111
+ a && /* @__PURE__ */ e("button", { className: "file-card__overlay-btn", onClick: (d) => {
112
+ d.stopPropagation(), a();
113
+ }, children: /* @__PURE__ */ e(p, {}) }),
114
+ t && /* @__PURE__ */ e("button", { className: "file-card__overlay-btn", onClick: (d) => {
115
+ d.stopPropagation(), t();
116
+ }, children: /* @__PURE__ */ e(g, {}) })
117
+ ] }),
118
+ /* @__PURE__ */ e(v, { fileType: l, fileUrl: o, fileName: r })
119
+ ] }),
120
+ /* @__PURE__ */ e(k, { fileName: r, onRename: s })
121
+ ] });
122
+ }
123
+ function N(r) {
124
+ return r.fileType === "pdf" ? /* @__PURE__ */ e(E, { ...r }) : /* @__PURE__ */ e(F, { ...r });
125
+ }
126
+ export {
127
+ N as default
128
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react/jsx-runtime");;/* empty css */const n=({type:r,style:i,onClick:u,className:e,...c})=>{const t=e?`bu-icon ${e}`:"bu-icon";return s.jsx("svg",{style:i,className:t,"aria-hidden":"true",onClick:u,...c,children:s.jsx("use",{xlinkHref:`#${r}`})})};n.displayName="BuIcon";module.exports=n;
@@ -0,0 +1,10 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ /* empty css */
3
+ const t = ({ type: r, style: e, onClick: i, className: n, ...c }) => {
4
+ const s = n ? `bu-icon ${n}` : "bu-icon";
5
+ return /* @__PURE__ */ o("svg", { style: e, className: s, "aria-hidden": "true", onClick: i, ...c, children: /* @__PURE__ */ o("use", { xlinkHref: `#${r}` }) });
6
+ };
7
+ t.displayName = "BuIcon";
8
+ export {
9
+ t as default
10
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),R=require("react");;/* empty css */function S(){return t.jsx("svg",{width:"8",height:"4.5",viewBox:"315 270 365 185",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M661.191111 440.106667c19.100444 0 28.664889-23.096889 15.160889-36.600889l-148.337778-148.337778a21.44 21.44 0 0 0-30.321778 0l-148.337777 148.337778c-13.511111 13.511111-3.946667 36.600889 15.153777 36.600889H661.191111z",fill:"currentColor"})})}function H(){return t.jsx("svg",{width:"8",height:"4.5",viewBox:"315 565 365 215",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M659.498667 582.328889c19.100444 0 28.657778 23.089778 15.160889 36.600889l-148.337778 148.337778a21.447111 21.447111 0 0 1-30.321778 0l-148.337778-148.337778c-13.511111-13.511111-3.946667-36.600889 15.146667-36.600889h296.689778z",fill:"currentColor"})})}function I(){return t.jsxs("svg",{className:"bu-input__error-icon",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}const T=R.forwardRef(function({type:n="input",mode:f="single",activeLang:G="zh",onLangChange:J,value:i="",onChange:s,label:v,required:D,placeholder:_,maxLength:c,showCount:F,error:N=!1,errorMessage:g,disabled:e,leftIcon:b,rightIcon:d,langToggle:$,translating:l=!1,translated:h=!1,onBlur:j,min:p,max:a,step:k=1,labels:u,id:x,className:q,style:z},w){u==null||u.zh,u==null||u.en;function M(r){let o=(parseFloat(i)||0)+r;p!==void 0&&(o=Math.max(p,o)),a!==void 0&&(o=Math.min(a,o)),s==null||s(String(o))}const B=n==="textarea"&&!!F,L=B||f==="bilingual"||l||h,W=c?`${i.length}/${c}`:`${i.length}`,E=N&&!!g&&i.length>0,A=["bu-input__box",(n==="input"||n==="number")&&"bu-input__box--single",n==="number"&&"bu-input__box--number",n==="textarea"&&"bu-input__box--textarea",N&&"bu-input__box--error",e&&"bu-input__box--disabled",!!b&&"bu-input__box--has-left",!!d&&"bu-input__box--has-right"].filter(Boolean).join(" "),m=`bu-input__field bu-input__field--${n}`;return t.jsxs("div",{className:["bu-input",q].filter(Boolean).join(" "),style:z,children:[v&&t.jsxs("label",{className:"bu-input__label",htmlFor:x,children:[D&&t.jsx("span",{className:"bu-input__required",children:"*"}),v]}),t.jsxs("div",{className:"bu-input__row",children:[b&&t.jsx("span",{className:"bu-input__icon bu-input__icon--left",children:b}),t.jsxs("div",{className:A,children:[n==="textarea"?t.jsx("textarea",{ref:w,id:x,className:m,value:i,onChange:r=>s==null?void 0:s(r.target.value),onBlur:j,placeholder:_,maxLength:c,disabled:e}):n==="number"?t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:w,id:x,className:m,value:i,onChange:r=>s==null?void 0:s(r.target.value),onBlur:j,placeholder:_,disabled:e,inputMode:"numeric"}),t.jsxs("div",{className:"bu-input__stepper",children:[t.jsx("button",{type:"button",className:"bu-input__stepper-btn bu-input__stepper-btn--up",onMouseDown:r=>r.preventDefault(),onClick:()=>M(k),disabled:e||a!==void 0&&parseFloat(i||"0")>=a,tabIndex:-1,children:t.jsx(S,{})}),t.jsx("button",{type:"button",className:"bu-input__stepper-btn bu-input__stepper-btn--down",onMouseDown:r=>r.preventDefault(),onClick:()=>M(-k),disabled:e||p!==void 0&&parseFloat(i||"0")<=p,tabIndex:-1,children:t.jsx(H,{})})]})]}):t.jsx("input",{ref:w,id:x,className:m,value:i,onChange:r=>s==null?void 0:s(r.target.value),onBlur:j,placeholder:_,maxLength:c,disabled:e}),L&&t.jsxs("div",{className:`bu-input__footer${n==="textarea"?" bu-input__footer--bottom":""}`,children:[B&&t.jsx("span",{className:"bu-input__count",children:W}),l&&t.jsxs("span",{className:"bu-input__translating",children:[t.jsx("svg",{className:"bu-input__translating-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"14 42"})}),"翻译中…"]}),h&&!l&&t.jsxs("span",{className:"bu-input__translated",children:[t.jsx("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M3 8l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}),"翻译完成"]}),f==="bilingual"&&!l&&!h&&($??t.jsx("div",{className:"bu-input__lang-toggle"}))]})]}),d&&t.jsx("span",{className:"bu-input__icon bu-input__icon--right",children:d})]}),E&&t.jsxs("div",{className:"bu-input__error-msg",children:[t.jsx(I,{}),g]})]})});module.exports=T;
@@ -0,0 +1,173 @@
1
+ import { jsxs as i, jsx as t, Fragment as H } from "react/jsx-runtime";
2
+ import { forwardRef as I } from "react";
3
+ /* empty css */
4
+ function R() {
5
+ return /* @__PURE__ */ t("svg", { width: "8", height: "4.5", viewBox: "315 270 365 185", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t(
6
+ "path",
7
+ {
8
+ d: "M661.191111 440.106667c19.100444 0 28.664889-23.096889 15.160889-36.600889l-148.337778-148.337778a21.44 21.44 0 0 0-30.321778 0l-148.337777 148.337778c-13.511111 13.511111-3.946667 36.600889 15.153777 36.600889H661.191111z",
9
+ fill: "currentColor"
10
+ }
11
+ ) });
12
+ }
13
+ function T() {
14
+ return /* @__PURE__ */ t("svg", { width: "8", height: "4.5", viewBox: "315 565 365 215", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t(
15
+ "path",
16
+ {
17
+ d: "M659.498667 582.328889c19.100444 0 28.657778 23.089778 15.160889 36.600889l-148.337778 148.337778a21.447111 21.447111 0 0 1-30.321778 0l-148.337778-148.337778c-13.511111-13.511111-3.946667-36.600889 15.146667-36.600889h296.689778z",
18
+ fill: "currentColor"
19
+ }
20
+ ) });
21
+ }
22
+ function U() {
23
+ return /* @__PURE__ */ i("svg", { className: "bu-input__error-icon", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
24
+ /* @__PURE__ */ t("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
25
+ /* @__PURE__ */ t("path", { d: "M5 8h6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
26
+ ] });
27
+ }
28
+ const X = I(
29
+ function({
30
+ type: e = "input",
31
+ mode: N = "single",
32
+ activeLang: J = "zh",
33
+ onLangChange: K,
34
+ value: u = "",
35
+ onChange: r,
36
+ label: g,
37
+ required: j,
38
+ placeholder: d,
39
+ maxLength: l,
40
+ showCount: $,
41
+ error: k = !1,
42
+ errorMessage: M,
43
+ disabled: o,
44
+ leftIcon: h,
45
+ rightIcon: w,
46
+ langToggle: z,
47
+ translating: p = !1,
48
+ translated: m = !1,
49
+ onBlur: x,
50
+ min: a,
51
+ max: _,
52
+ step: B = 1,
53
+ labels: s,
54
+ id: b,
55
+ className: L,
56
+ style: W
57
+ }, f) {
58
+ s == null || s.zh, s == null || s.en;
59
+ function D(n) {
60
+ let c = (parseFloat(u) || 0) + n;
61
+ a !== void 0 && (c = Math.max(a, c)), _ !== void 0 && (c = Math.min(_, c)), r == null || r(String(c));
62
+ }
63
+ const F = e === "textarea" && !!$, E = F || N === "bilingual" || p || m, A = l ? `${u.length}/${l}` : `${u.length}`, S = k && !!M && u.length > 0, q = [
64
+ "bu-input__box",
65
+ (e === "input" || e === "number") && "bu-input__box--single",
66
+ e === "number" && "bu-input__box--number",
67
+ e === "textarea" && "bu-input__box--textarea",
68
+ k && "bu-input__box--error",
69
+ o && "bu-input__box--disabled",
70
+ !!h && "bu-input__box--has-left",
71
+ !!w && "bu-input__box--has-right"
72
+ ].filter(Boolean).join(" "), v = `bu-input__field bu-input__field--${e}`;
73
+ return /* @__PURE__ */ i("div", { className: ["bu-input", L].filter(Boolean).join(" "), style: W, children: [
74
+ g && /* @__PURE__ */ i("label", { className: "bu-input__label", htmlFor: b, children: [
75
+ j && /* @__PURE__ */ t("span", { className: "bu-input__required", children: "*" }),
76
+ g
77
+ ] }),
78
+ /* @__PURE__ */ i("div", { className: "bu-input__row", children: [
79
+ h && /* @__PURE__ */ t("span", { className: "bu-input__icon bu-input__icon--left", children: h }),
80
+ /* @__PURE__ */ i("div", { className: q, children: [
81
+ e === "textarea" ? /* @__PURE__ */ t(
82
+ "textarea",
83
+ {
84
+ ref: f,
85
+ id: b,
86
+ className: v,
87
+ value: u,
88
+ onChange: (n) => r == null ? void 0 : r(n.target.value),
89
+ onBlur: x,
90
+ placeholder: d,
91
+ maxLength: l,
92
+ disabled: o
93
+ }
94
+ ) : e === "number" ? /* @__PURE__ */ i(H, { children: [
95
+ /* @__PURE__ */ t(
96
+ "input",
97
+ {
98
+ ref: f,
99
+ id: b,
100
+ className: v,
101
+ value: u,
102
+ onChange: (n) => r == null ? void 0 : r(n.target.value),
103
+ onBlur: x,
104
+ placeholder: d,
105
+ disabled: o,
106
+ inputMode: "numeric"
107
+ }
108
+ ),
109
+ /* @__PURE__ */ i("div", { className: "bu-input__stepper", children: [
110
+ /* @__PURE__ */ t(
111
+ "button",
112
+ {
113
+ type: "button",
114
+ className: "bu-input__stepper-btn bu-input__stepper-btn--up",
115
+ onMouseDown: (n) => n.preventDefault(),
116
+ onClick: () => D(B),
117
+ disabled: o || _ !== void 0 && parseFloat(u || "0") >= _,
118
+ tabIndex: -1,
119
+ children: /* @__PURE__ */ t(R, {})
120
+ }
121
+ ),
122
+ /* @__PURE__ */ t(
123
+ "button",
124
+ {
125
+ type: "button",
126
+ className: "bu-input__stepper-btn bu-input__stepper-btn--down",
127
+ onMouseDown: (n) => n.preventDefault(),
128
+ onClick: () => D(-B),
129
+ disabled: o || a !== void 0 && parseFloat(u || "0") <= a,
130
+ tabIndex: -1,
131
+ children: /* @__PURE__ */ t(T, {})
132
+ }
133
+ )
134
+ ] })
135
+ ] }) : /* @__PURE__ */ t(
136
+ "input",
137
+ {
138
+ ref: f,
139
+ id: b,
140
+ className: v,
141
+ value: u,
142
+ onChange: (n) => r == null ? void 0 : r(n.target.value),
143
+ onBlur: x,
144
+ placeholder: d,
145
+ maxLength: l,
146
+ disabled: o
147
+ }
148
+ ),
149
+ E && /* @__PURE__ */ i("div", { className: `bu-input__footer${e === "textarea" ? " bu-input__footer--bottom" : ""}`, children: [
150
+ F && /* @__PURE__ */ t("span", { className: "bu-input__count", children: A }),
151
+ p && /* @__PURE__ */ i("span", { className: "bu-input__translating", children: [
152
+ /* @__PURE__ */ t("svg", { className: "bu-input__translating-icon", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeDasharray: "14 42" }) }),
153
+ "翻译中…"
154
+ ] }),
155
+ m && !p && /* @__PURE__ */ i("span", { className: "bu-input__translated", children: [
156
+ /* @__PURE__ */ t("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
157
+ "翻译完成"
158
+ ] }),
159
+ N === "bilingual" && !p && !m && (z ?? /* @__PURE__ */ t("div", { className: "bu-input__lang-toggle" }))
160
+ ] })
161
+ ] }),
162
+ w && /* @__PURE__ */ t("span", { className: "bu-input__icon bu-input__icon--right", children: w })
163
+ ] }),
164
+ S && /* @__PURE__ */ i("div", { className: "bu-input__error-msg", children: [
165
+ /* @__PURE__ */ t(U, {}),
166
+ M
167
+ ] })
168
+ ] });
169
+ }
170
+ );
171
+ export {
172
+ X as default
173
+ };
@@ -0,0 +1 @@
1
+ "use strict";const l=require("react/jsx-runtime"),s=require("react");;/* empty css */const Me=require("./hooks/useCursor.js"),Ue=require("./hooks/useFrame.js"),ke=require("./StepHandler.js"),u=require("./utils/decimal.js");function ae(N){if(N==null)return null;const i=u.getDecimal(N);return i.isInvalidate()?null:i}const Ke=s.forwardRef(function({value:i,defaultValue:Z,onChange:C,min:E,max:F,step:a=1,precision:D,disabled:M=!1,readOnly:U=!1,placeholder:fe,autoFocus:me,size:z="middle",status:B,bordered:be=!0,controls:k=!0,keyboard:de=!0,changeOnWheel:pe=!1,changeOnBlur:ge=!0,addonBefore:f,addonAfter:m,prefix:I,suffix:v,formatter:R,parser:V,decimalSeparator:b,onStep:K,onPressEnter:S,onFocus:$,onBlur:P,id:je,name:Ne,className:O,style:A},q){const H=s.useRef(null),[W,T]=s.useState(!1),c=s.useRef(!1),j=s.useRef(!1),x=s.useRef(!1),Y=s.useRef(""),[r,ee]=s.useState(()=>u.getDecimal(i??Z)),De=e=>{i===void 0&&ee(e)},G=s.useCallback((e,t)=>{if(!t)return D!==void 0&&D>=0?D:Math.max(u.getNumberPrecision(e),u.getNumberPrecision(a))},[D,a]),J=s.useCallback(e=>{if(V)return V(e);let t=e;return b&&(t=t.replace(b,".")),t.replace(/[^\w.-]+/g,"")},[V,b]),te=s.useCallback((e,t)=>{if(R)return R(e,{userTyping:!!t,input:Y.current});let n=e;if(!t){const o=G(n,t);u.validateNumber(n)&&(b||(o??-1)>=0)&&(n=u.toFixed(n,b||".",o))}return n},[R,G,b]),[_,ne]=s.useState(()=>{const e=Z??i;return r.isInvalidate()&&["string","number"].includes(typeof e)?e==null||Number.isNaN(e)?"":String(e):te(r.toString(),!1)});Y.current=_;const h=(e,t)=>{ne(te(e.isInvalidate()?e.toString(!1):e.toString(!t),t))},d=s.useMemo(()=>ae(F),[F]),p=s.useMemo(()=>ae(E),[E]),re=s.useMemo(()=>!d||r.isInvalidate()?!1:d.lessEquals(r),[d,r]),ue=s.useMemo(()=>!p||r.isInvalidate()?!1:r.lessEquals(p),[p,r]),[Ie]=Me(H.current,W),se=e=>d&&!e.lessEquals(d)?d:p&&!p.lessEquals(e)?p:null,L=e=>!se(e),w=(e,t)=>{let n=e,o=L(n)||n.isEmpty();if(!n.isEmpty()&&!t&&(n=se(n)||n,o=!0),!U&&!M&&o){const g=n.toString(),y=G(g,t);return y!==void 0&&y>=0&&(n=u.getDecimal(u.toFixed(g,".",y)),L(n)||(n=u.getDecimal(u.toFixed(g,".",y,!0)))),n.equals(r)||(De(n),C==null||C(n.isEmpty()?null:n.toNumber()),i===void 0&&h(n,t)),n}return r},ve=Ue(),Q=e=>{if(Ie(),Y.current=e,ne(e),!j.current){const t=J(e),n=u.getDecimal(t);n.isNaN()||w(n,!0)}ve(()=>{const t=V?e:e.replace(/。/g,".");t!==e&&Q(t)})},Re=()=>{j.current=!0},Ve=e=>{j.current=!1,Q(e.target.value)},qe=e=>Q(e.target.value),X=e=>{var g;if(e&&re||!e&&ue)return;c.current=!1;let t=u.getDecimal(x.current?u.getDecupleSteps(a):a);e||(t=t.negate());const n=(r.isInvalidate()?u.getDecimal(0):r).add(t.toString()),o=w(n,!1);K==null||K(o.toNumber(),{offset:x.current?u.getDecupleSteps(a):a,type:e?"up":"down"}),(g=H.current)==null||g.focus()},ie=e=>{const t=u.getDecimal(J(_));let n;t.isNaN()?n=w(r,e):n=w(t,e),i!==void 0?h(r,!1):n.isNaN()||h(n,!1)},xe=e=>{const{key:t,shiftKey:n}=e;c.current=!0,x.current=n,t==="Enter"&&(j.current||(c.current=!1),ie(!1),S==null||S(e)),de&&!j.current&&(t==="ArrowUp"||t==="ArrowDown")&&(X(t==="ArrowUp"),e.preventDefault())},_e=()=>{c.current=!1,x.current=!1},he=e=>{T(!0),$==null||$(e)},we=e=>{ge&&ie(!1),T(!1),c.current=!1,P==null||P(e)},le=s.useRef(i);if(le.current!==i){le.current=i;const e=u.getDecimal(i);if(!e.equals(r)){ee(e);const t=u.getDecimal(J(_));(!e.equals(t)||!c.current||R)&&h(e,c.current)}}const ye=e=>{H.current=e,typeof q=="function"?q(e):q&&(q.current=e)},ce=!!k,Ce=typeof k=="object"?k.icon:void 0,Ee=!r.isInvalidate()&&!L(r),Fe=["bj-input-number",`bj-input-number--${z}`,W&&"bj-input-number--focused",M&&"bj-input-number--disabled",U&&"bj-input-number--readonly",!be&&"bj-input-number--borderless",B&&`bj-input-number--${B}`,Ee&&"bj-input-number--out-of-range",ce&&"bj-input-number--with-controls",f&&"bj-input-number--group-left",m&&"bj-input-number--group-right"].filter(Boolean).join(" "),oe=l.jsxs("div",{className:[Fe,!(f||m||I||v)&&O].filter(Boolean).join(" "),style:f||m||I||v?void 0:A,onKeyDown:xe,onKeyUp:_e,children:[I&&l.jsx("span",{className:"bj-input-number__prefix",children:I}),l.jsx("div",{className:"bj-input-number__input-wrap",children:l.jsx("input",{ref:ye,id:je,name:Ne,className:"bj-input-number__input",autoComplete:"off",role:"spinbutton","aria-valuemin":E,"aria-valuemax":F,"aria-valuenow":r.isInvalidate()?void 0:r.toNumber(),value:_,placeholder:fe,disabled:M,readOnly:U,autoFocus:me,onChange:qe,onFocus:he,onBlur:we,onCompositionStart:Re,onCompositionEnd:Ve,onWheel:pe?e=>{W&&X(e.deltaY<0)}:void 0})}),v&&l.jsx("span",{className:"bj-input-number__suffix",children:v}),ce&&l.jsx(ke,{icon:Ce,upDisabled:re,downDisabled:ue,onStep:X})]});return!f&&!m?oe:l.jsxs("div",{className:["bj-input-number-group",`bj-input-number-group--${z}`,O].filter(Boolean).join(" "),style:A,children:[f&&l.jsx("div",{className:"bj-input-number-group__addon",children:f}),oe,m&&l.jsx("div",{className:"bj-input-number-group__addon",children:m})]})});module.exports=Ke;
@@ -0,0 +1,204 @@
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";
3
+ /* 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
+ return u.isInvalidate() ? null : u;
12
+ }
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, "");
61
+ },
62
+ [R, m]
63
+ ), ie = B(
64
+ (e, t) => {
65
+ if (D) return D(e, { userTyping: !!t, input: G.current });
66
+ let n = e;
67
+ if (!t) {
68
+ const l = J(n, t);
69
+ Je(n) && (m || (l ?? -1) >= 0) && (n = O(n, m || ".", l));
70
+ }
71
+ return n;
72
+ },
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);
125
+ if (fe.current !== u) {
126
+ fe.current = u;
127
+ const e = i(u);
128
+ if (!e.equals(r)) {
129
+ ue(e);
130
+ const t = i(L(w));
131
+ (!e.equals(t) || !s.current || D) && q(e, s.current);
132
+ }
133
+ }
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
+ );
201
+ });
202
+ export {
203
+ Ae as default
204
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,64 @@
1
+ import { jsxs as d, jsx as e, Fragment as h } from "react/jsx-runtime";
2
+ import { useRef as _, useEffect as j } from "react";
3
+ const f = 600, w = 200;
4
+ function m({ className: t }) {
5
+ return /* @__PURE__ */ e("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: t, children: /* @__PURE__ */ e(
6
+ "path",
7
+ {
8
+ 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",
9
+ fill: "currentColor"
10
+ }
11
+ ) });
12
+ }
13
+ function C({ icon: t, upDisabled: o, downDisabled: l, onStep: i }) {
14
+ const u = _(void 0), a = _(i);
15
+ a.current = i;
16
+ const r = () => clearTimeout(u.current), s = (n, c) => {
17
+ n.preventDefault(), r(), a.current(c);
18
+ function p() {
19
+ a.current(c), u.current = setTimeout(p, w);
20
+ }
21
+ u.current = setTimeout(p, f);
22
+ };
23
+ j(() => r, []);
24
+ const b = {
25
+ unselectable: "on",
26
+ role: "button",
27
+ onMouseUp: r,
28
+ onMouseLeave: r
29
+ };
30
+ return (
31
+ // Click zones come before the icon(s) in DOM order so the icon halves
32
+ // can be dimmed via a `:hover ~`/`:active ~` sibling selector in CSS —
33
+ // the icon itself stays `pointer-events: none` and purely visual.
34
+ /* @__PURE__ */ d("div", { className: "bj-input-number__handler-wrap", children: [
35
+ /* @__PURE__ */ e(
36
+ "span",
37
+ {
38
+ ...b,
39
+ "aria-label": "Increase Value",
40
+ "aria-disabled": o,
41
+ 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",
42
+ onMouseDown: (n) => s(n, !0)
43
+ }
44
+ ),
45
+ /* @__PURE__ */ e(
46
+ "span",
47
+ {
48
+ ...b,
49
+ "aria-label": "Decrease Value",
50
+ "aria-disabled": l,
51
+ className: l ? "bj-input-number__handler bj-input-number__handler--down bj-input-number__handler--disabled" : "bj-input-number__handler bj-input-number__handler--down",
52
+ onMouseDown: (n) => s(n, !1)
53
+ }
54
+ ),
55
+ t || /* @__PURE__ */ d(h, { children: [
56
+ /* @__PURE__ */ e(m, { className: "bj-input-number__handler-icon bj-input-number__handler-icon--up" }),
57
+ /* @__PURE__ */ e(m, { className: "bj-input-number__handler-icon bj-input-number__handler-icon--down" })
58
+ ] })
59
+ ] })
60
+ );
61
+ }
62
+ export {
63
+ C as default
64
+ };
@@ -0,0 +1 @@
1
+ "use strict";const h=require("react");function d(s,a){const c=h.useRef(null);function f(){if(s)try{const{selectionStart:t,selectionEnd:e,value:r}=s;c.current={start:t??0,end:e??0,value:r,beforeTxt:r.substring(0,t??0),afterTxt:r.substring(e??0)}}catch{}}function i(){if(!(!s||!c.current||!a))try{const{value:t}=s,{beforeTxt:e,afterTxt:r,start:o}=c.current;let n=t.length;if(t.startsWith(e))n=e.length;else if(t.endsWith(r))n=t.length-r.length;else{const l=e[o-1],u=t.indexOf(l,o-1);u!==-1&&(n=u+1)}s.setSelectionRange(n,n)}catch{}}return[f,i]}module.exports=d;
@@ -0,0 +1,39 @@
1
+ import { useRef as h } from "react";
2
+ function g(n, a) {
3
+ const o = h(null);
4
+ function l() {
5
+ if (n)
6
+ try {
7
+ const { selectionStart: t, selectionEnd: e, value: r } = n;
8
+ o.current = {
9
+ start: t ?? 0,
10
+ end: e ?? 0,
11
+ value: r,
12
+ beforeTxt: r.substring(0, t ?? 0),
13
+ afterTxt: r.substring(e ?? 0)
14
+ };
15
+ } catch {
16
+ }
17
+ }
18
+ function u() {
19
+ if (!(!n || !o.current || !a))
20
+ try {
21
+ const { value: t } = n, { beforeTxt: e, afterTxt: r, start: c } = o.current;
22
+ let s = t.length;
23
+ if (t.startsWith(e))
24
+ s = e.length;
25
+ else if (t.endsWith(r))
26
+ s = t.length - r.length;
27
+ else {
28
+ const i = e[c - 1], f = t.indexOf(i, c - 1);
29
+ f !== -1 && (s = f + 1);
30
+ }
31
+ n.setSelectionRange(s, s);
32
+ } catch {
33
+ }
34
+ }
35
+ return [l, u];
36
+ }
37
+ export {
38
+ g as default
39
+ };