bj-web-components 0.2.26 → 0.2.27

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 (109) hide show
  1. package/dist/favicon.ico +0 -0
  2. package/dist/file.svg +1 -0
  3. package/dist/globe.svg +1 -0
  4. package/dist/index.d.ts +1141 -0
  5. package/dist/index.js +1 -0
  6. package/dist/index.mjs +51 -0
  7. package/dist/miniapp.d.ts +1 -0
  8. package/dist/miniapp.js +1 -0
  9. package/dist/miniapp.mjs +1 -0
  10. package/dist/mobile.d.ts +1 -0
  11. package/dist/mobile.js +1 -0
  12. package/dist/mobile.mjs +1 -0
  13. package/dist/next.svg +1 -0
  14. package/dist/react.d.ts +1 -0
  15. package/dist/react.js +1 -0
  16. package/dist/react.mjs +1 -0
  17. package/dist/shared.d.ts +1 -0
  18. package/dist/shared.js +1 -0
  19. package/dist/shared.mjs +1 -0
  20. package/dist/style.css +1 -0
  21. package/dist/vercel.svg +1 -0
  22. package/dist/web/BasicInput/BInput.js +1 -0
  23. package/dist/web/BasicInput/BInput.mjs +177 -0
  24. package/dist/web/BasicInput/utils.js +1 -0
  25. package/dist/web/BasicInput/utils.mjs +37 -0
  26. package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -0
  27. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +260 -0
  28. package/dist/web/CheckBox/BCheckBox.js +1 -0
  29. package/dist/web/CheckBox/BCheckBox.mjs +101 -0
  30. package/dist/web/CheckBox/Group.js +1 -0
  31. package/dist/web/CheckBox/Group.mjs +67 -0
  32. package/dist/web/CheckBox/context.js +1 -0
  33. package/dist/web/CheckBox/context.mjs +5 -0
  34. package/dist/web/CheckBox/index.js +1 -0
  35. package/dist/web/CheckBox/index.mjs +8 -0
  36. package/dist/web/Dropdown/BDropdown.js +1 -0
  37. package/dist/web/Dropdown/BDropdown.mjs +160 -0
  38. package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -0
  39. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +74 -0
  40. package/dist/web/FileCard/FileCard.js +1 -0
  41. package/dist/web/FileCard/FileCard.mjs +128 -0
  42. package/dist/web/Icon/Icon.js +1 -0
  43. package/dist/web/Icon/Icon.mjs +10 -0
  44. package/dist/web/Input/Input.js +1 -0
  45. package/dist/web/Input/Input.mjs +173 -0
  46. package/dist/web/InputNumber/BInputNumber.js +1 -0
  47. package/dist/web/InputNumber/BInputNumber.mjs +204 -0
  48. package/dist/web/InputNumber/StepHandler.js +1 -0
  49. package/dist/web/InputNumber/StepHandler.mjs +64 -0
  50. package/dist/web/InputNumber/hooks/useCursor.js +1 -0
  51. package/dist/web/InputNumber/hooks/useCursor.mjs +39 -0
  52. package/dist/web/InputNumber/hooks/useFrame.js +1 -0
  53. package/dist/web/InputNumber/hooks/useFrame.mjs +10 -0
  54. package/dist/web/InputNumber/utils/decimal.js +1 -0
  55. package/dist/web/InputNumber/utils/decimal.mjs +119 -0
  56. package/dist/web/Modal/Modal.js +1 -0
  57. package/dist/web/Modal/Modal.mjs +82 -0
  58. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -0
  59. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +152 -0
  60. package/dist/web/Pagination/Pagination.js +1 -0
  61. package/dist/web/Pagination/Pagination.mjs +253 -0
  62. package/dist/web/ProductField/ProductField.js +1 -0
  63. package/dist/web/ProductField/ProductField.mjs +226 -0
  64. package/dist/web/ProductField/arrow-up.svg.js +1 -0
  65. package/dist/web/ProductField/arrow-up.svg.mjs +4 -0
  66. package/dist/web/ProductField/checkbox-no.svg.js +1 -0
  67. package/dist/web/ProductField/checkbox-no.svg.mjs +4 -0
  68. package/dist/web/ProductField/checkbox-ok.svg.js +1 -0
  69. package/dist/web/ProductField/checkbox-ok.svg.mjs +4 -0
  70. package/dist/web/ProductField/no_data_light.svg.js +1 -0
  71. package/dist/web/ProductField/no_data_light.svg.mjs +4 -0
  72. package/dist/web/ProductField/search.svg.js +1 -0
  73. package/dist/web/ProductField/search.svg.mjs +4 -0
  74. package/dist/web/ProductField/sort.svg.js +1 -0
  75. package/dist/web/ProductField/sort.svg.mjs +4 -0
  76. package/dist/web/SkuInputCard/SkuInputCard.js +1 -0
  77. package/dist/web/SkuInputCard/SkuInputCard.mjs +238 -0
  78. package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -0
  79. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +4 -0
  80. package/dist/web/Switch/Switch.js +1 -0
  81. package/dist/web/Switch/Switch.mjs +61 -0
  82. package/dist/web/Table/BTable.js +1 -0
  83. package/dist/web/Table/BTable.mjs +698 -0
  84. package/dist/web/Table/Column.js +1 -0
  85. package/dist/web/Table/Column.mjs +6 -0
  86. package/dist/web/Table/ColumnGroup.js +1 -0
  87. package/dist/web/Table/ColumnGroup.mjs +6 -0
  88. package/dist/web/Table/utils/columns.js +1 -0
  89. package/dist/web/Table/utils/columns.mjs +43 -0
  90. package/dist/web/Table/utils/sortFilter.js +1 -0
  91. package/dist/web/Table/utils/sortFilter.mjs +63 -0
  92. package/dist/web/Tabs/BTabs.js +1 -0
  93. package/dist/web/Tabs/BTabs.mjs +130 -0
  94. package/dist/web/Tabs/TabPane.js +1 -0
  95. package/dist/web/Tabs/TabPane.mjs +8 -0
  96. package/dist/web/Tooltip/ConfirmTooltip.js +1 -0
  97. package/dist/web/Tooltip/ConfirmTooltip.mjs +26 -0
  98. package/dist/web/Tooltip/ContentTooltip.js +1 -0
  99. package/dist/web/Tooltip/ContentTooltip.mjs +85 -0
  100. package/dist/web/Tooltip/ProgressTooltip.js +1 -0
  101. package/dist/web/Tooltip/ProgressTooltip.mjs +35 -0
  102. package/dist/web/Tooltip/TooltipWrapper.js +1 -0
  103. package/dist/web/Tooltip/TooltipWrapper.mjs +13 -0
  104. package/dist/web/Tooltip/useAutoPlacement.js +1 -0
  105. package/dist/web/Tooltip/useAutoPlacement.mjs +32 -0
  106. package/dist/web.d.ts +1141 -0
  107. package/dist/web.js +1 -0
  108. package/dist/web.mjs +51 -0
  109. package/package.json +1 -1
@@ -0,0 +1,74 @@
1
+ import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
+ import { forwardRef as N } from "react";
3
+ /* empty css */
4
+ function B() {
5
+ return /* @__PURE__ */ t("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("path", { d: "M14.1667 5.3335C15.1792 5.3335 16 6.15431 16 7.16683V8.00016H19C19.2761 8.00016 19.5 8.22402 19.5 8.50016C19.5 8.7763 19.2761 9.00016 19 9.00016H17.3333V16.8335C17.3333 17.846 16.5125 18.6668 15.5 18.6668H8.5C7.48748 18.6668 6.66667 17.846 6.66667 16.8335V9.00016H5C4.72386 9.00016 4.5 8.7763 4.5 8.50016C4.5 8.22402 4.72386 8.00016 5 8.00016H8V7.16683C8 6.15431 8.82081 5.3335 9.83333 5.3335H14.1667ZM7.66667 16.8335C7.66667 17.2937 8.03976 17.6668 8.5 17.6668H15.5C15.9602 17.6668 16.3333 17.2937 16.3333 16.8335V9.00016H7.66667V16.8335ZM10.5 11.3335C10.7761 11.3335 11 11.5574 11 11.8335V15.0002C11 15.2763 10.7761 15.5002 10.5 15.5002C10.2239 15.5002 10 15.2763 10 15.0002V11.8335C10 11.5574 10.2239 11.3335 10.5 11.3335ZM13.5 11.3335C13.7761 11.3335 14 11.5574 14 11.8335V15.0002C14 15.2763 13.7761 15.5002 13.5 15.5002C13.2239 15.5002 13 15.2763 13 15.0002V11.8335C13 11.5574 13.2239 11.3335 13.5 11.3335ZM9.83333 6.3335C9.3731 6.3335 9 6.70659 9 7.16683V8.00016H15V7.16683C15 6.70659 14.6269 6.3335 14.1667 6.3335H9.83333Z", fill: "currentColor" }) });
6
+ }
7
+ const Z = N(
8
+ function({
9
+ mode: _ = "single",
10
+ activeLang: l = "zh",
11
+ onLangChange: i,
12
+ value: n = "",
13
+ onChange: u,
14
+ placeholder: d,
15
+ maxLength: m,
16
+ error: p = !1,
17
+ disabled: r,
18
+ onDelete: s,
19
+ labels: e,
20
+ id: x,
21
+ className: f,
22
+ style: C
23
+ }, V) {
24
+ const a = (e == null ? void 0 : e.zh) ?? "中文", H = (e == null ? void 0 : e.en) ?? "EN", b = _ === "bilingual", o = !!s, h = [
25
+ "bu-eib__box",
26
+ b && o && "bu-eib__box--actions-both",
27
+ b && !o && "bu-eib__box--actions-toggle",
28
+ !b && o && "bu-eib__box--actions-delete",
29
+ p && "bu-eib__box--error",
30
+ r && "bu-eib__box--disabled"
31
+ ].filter(Boolean).join(" ");
32
+ return /* @__PURE__ */ t("div", { className: ["bu-eib", f].filter(Boolean).join(" "), style: C, children: /* @__PURE__ */ c("div", { className: h, children: [
33
+ /* @__PURE__ */ t(
34
+ "input",
35
+ {
36
+ ref: V,
37
+ id: x,
38
+ className: "bu-eib__field",
39
+ value: n,
40
+ onChange: (v) => u == null ? void 0 : u(v.target.value),
41
+ placeholder: d,
42
+ maxLength: m,
43
+ disabled: r
44
+ }
45
+ ),
46
+ (b || o) && /* @__PURE__ */ c("div", { className: "bu-eib__actions", children: [
47
+ b && /* @__PURE__ */ c("div", { className: "bu-eib__lang-toggle", children: [
48
+ /* @__PURE__ */ t(
49
+ "button",
50
+ {
51
+ type: "button",
52
+ className: `bu-eib__lang-btn${l === "zh" ? " bu-eib__lang-btn--active" : ""}`,
53
+ onClick: () => i == null ? void 0 : i("zh"),
54
+ children: a
55
+ }
56
+ ),
57
+ /* @__PURE__ */ t(
58
+ "button",
59
+ {
60
+ type: "button",
61
+ className: `bu-eib__lang-btn${l === "en" ? " bu-eib__lang-btn--active" : ""}`,
62
+ onClick: () => i == null ? void 0 : i("en"),
63
+ children: H
64
+ }
65
+ )
66
+ ] }),
67
+ o && /* @__PURE__ */ t("button", { type: "button", className: "bu-eib__delete", onClick: s, children: /* @__PURE__ */ t(B, {}) })
68
+ ] })
69
+ ] }) });
70
+ }
71
+ );
72
+ export {
73
+ Z as default
74
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),h=require("react");;/* empty css */const _={pdf:{color:"#F54A45",label:"PDF"},image:{color:"#00AAFF",label:"IMG"},doc:{color:"#3B64FC",label:"DOC"},docx:{color:"#3B64FC",label:"DOC"},xls:{color:"#1D9B4C",label:"XLS"},xlsx:{color:"#1D9B4C",label:"XLS"},ppt:{color:"#DF4023",label:"PPT"},pptx:{color:"#DF4023",label:"PPT"},zip:{color:"#7B5EA7",label:"ZIP"},rar:{color:"#7B5EA7",label:"RAR"},txt:{color:"#8C8C8C",label:"TXT"},other:{color:"#1677FF",label:"FILE"}};function C({fileType:r,fileUrl:l,fileName:s}){if(r==="image"&&l)return e.jsx("img",{src:l,alt:s,className:"file-card__image-thumb"});const{color:t,label:a}=_[r];return e.jsxs("svg",{width:"88",height:"88",viewBox:"0 0 88 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"14",y:"8",width:"50",height:"62",rx:"4",fill:"#F5F5F5"}),e.jsx("path",{d:"M50 8L64 22H50V8Z",fill:"#E2E2E2"}),e.jsx("rect",{x:"20",y:"30",width:"30",height:"4",rx:"2",fill:"#E2E2E2"}),e.jsx("rect",{x:"20",y:"40",width:"30",height:"4",rx:"2",fill:"#E2E2E2"}),e.jsx("rect",{x:"20",y:"50",width:"20",height:"4",rx:"2",fill:"#E2E2E2"}),e.jsx("rect",{x:"42",y:"52",width:"32",height:"28",rx:"4",fill:t}),e.jsx("rect",{x:"42",y:"52",width:"4",height:"28",rx:"2",fill:"rgba(255,255,255,0.25)"}),e.jsx("rect",{x:"42",y:"76",width:"32",height:"4",rx:"2",fill:"rgba(0,0,0,0.15)"}),e.jsx("text",{x:"58",y:"71",textAnchor:"middle",fill:"white",fontSize:"9",fontWeight:"700",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",letterSpacing:"0.3",children:a})]})}function u(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("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"}),e.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"})]})}function f(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("polyline",{points:"3,6 5,6 21,6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("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"}),e.jsx("path",{d:"M10 11v6M14 11v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function j({fileName:r,onRename:l}){const[s,t]=h.useState(!1),[a,o]=h.useState(r),n=h.useRef(null);h.useEffect(()=>{var i,x;s&&(o(r),(i=n.current)==null||i.focus(),(x=n.current)==null||x.select())},[s,r]);const d=async()=>{const i=a.trim();i&&i!==r&&await(l==null?void 0:l(i)),t(!1)},c=()=>t(!1),p=i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),d()),i.key==="Escape"&&c()},g=()=>{d()},k=()=>{l&&t(!0)};return s?e.jsx("div",{className:"file-card__name-area file-card__name-area--editing",children:e.jsx("textarea",{ref:n,className:"file-card__edit-input",value:a,onChange:i=>o(i.target.value),onKeyDown:p,onBlur:g,rows:2,style:{height:"42px"}})}):e.jsx("div",{className:"file-card__name-area",onDoubleClick:k,children:e.jsx("span",{className:"file-card__filename",title:r,children:r})})}function b({fileName:r,onDelete:l,onRename:s,onPreview:t,className:a,style:o}){return e.jsxs("div",{className:`file-card file-card--pdf ${a||""}`,style:o,children:[e.jsxs("div",{className:"file-card__pdf-preview",onClick:t,children:[(t||l)&&e.jsxs("div",{className:"file-card__overlay",children:[t&&e.jsx("button",{className:"file-card__overlay-btn",onClick:n=>{n.stopPropagation(),t()},children:e.jsx(u,{})}),l&&e.jsx("button",{className:"file-card__overlay-btn",onClick:n=>{n.stopPropagation(),l()},children:e.jsx(f,{})})]}),e.jsx("div",{className:"file-card__pdf-label",children:e.jsx("span",{children:"PDF"})})]}),e.jsx(j,{fileName:r,onRename:s})]})}function y({fileName:r,fileType:l,fileUrl:s,onDelete:t,onRename:a,onPreview:o,className:n,style:d}){return e.jsxs("div",{className:`file-card file-card--other ${n||""}`,style:d,children:[e.jsxs("div",{className:"file-card__other-preview",onClick:o,children:[(o||t)&&e.jsxs("div",{className:"file-card__overlay",children:[o&&e.jsx("button",{className:"file-card__overlay-btn",onClick:c=>{c.stopPropagation(),o()},children:e.jsx(u,{})}),t&&e.jsx("button",{className:"file-card__overlay-btn",onClick:c=>{c.stopPropagation(),t()},children:e.jsx(f,{})})]}),e.jsx(C,{fileType:l,fileUrl:s,fileName:r})]}),e.jsx(j,{fileName:r,onRename:a})]})}function m(r){return r.fileType==="pdf"?e.jsx(b,{...r}):e.jsx(y,{...r})}module.exports=m;
@@ -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;