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,74 +1,87 @@
1
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
- import { forwardRef as N } from "react";
1
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
+ import { forwardRef as B } from "react";
3
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" }) });
4
+ function w() {
5
+ return /* @__PURE__ */e("svg", {
6
+ width: "20",
7
+ height: "20",
8
+ viewBox: "0 0 24 24",
9
+ fill: "none",
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ children: /* @__PURE__ */e("path", {
12
+ 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",
13
+ fill: "currentColor"
14
+ })
15
+ });
6
16
  }
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
- };
17
+ var j = B(function (_ref, f) {
18
+ var _ref$mode = _ref.mode,
19
+ _ = _ref$mode === void 0 ? "single" : _ref$mode,
20
+ _ref$activeLang = _ref.activeLang,
21
+ b = _ref$activeLang === void 0 ? "zh" : _ref$activeLang,
22
+ l = _ref.onLangChange,
23
+ _ref$value = _ref.value,
24
+ d = _ref$value === void 0 ? "" : _ref$value,
25
+ u = _ref.onChange,
26
+ C = _ref.placeholder,
27
+ h = _ref.maxLength,
28
+ _ref$error = _ref.error,
29
+ m = _ref$error === void 0 ? !1 : _ref$error,
30
+ s = _ref.disabled,
31
+ c = _ref.onDelete,
32
+ n = _ref.labels,
33
+ v = _ref.id,
34
+ p = _ref.className,
35
+ x = _ref.style;
36
+ var a, r;
37
+ var V = (a = n == null ? void 0 : n.zh) != null ? a : "中文",
38
+ g = (r = n == null ? void 0 : n.en) != null ? r : "EN",
39
+ i = _ === "bilingual",
40
+ t = !!c,
41
+ H = ["bu-eib__box", i && t && "bu-eib__box--actions-both", i && !t && "bu-eib__box--actions-toggle", !i && t && "bu-eib__box--actions-delete", m && "bu-eib__box--error", s && "bu-eib__box--disabled"].filter(Boolean).join(" ");
42
+ return /* @__PURE__ */e("div", {
43
+ className: ["bu-eib", p].filter(Boolean).join(" "),
44
+ style: x,
45
+ children: /* @__PURE__ */o("div", {
46
+ className: H,
47
+ children: [/* @__PURE__ */e("input", {
48
+ ref: f,
49
+ id: v,
50
+ className: "bu-eib__field",
51
+ value: d,
52
+ onChange: function onChange(N) {
53
+ return u == null ? void 0 : u(N.target.value);
54
+ },
55
+ placeholder: C,
56
+ maxLength: h,
57
+ disabled: s
58
+ }), (i || t) && /* @__PURE__ */o("div", {
59
+ className: "bu-eib__actions",
60
+ children: [i && /* @__PURE__ */o("div", {
61
+ className: "bu-eib__lang-toggle",
62
+ children: [/* @__PURE__ */e("button", {
63
+ type: "button",
64
+ className: "bu-eib__lang-btn".concat(b === "zh" ? " bu-eib__lang-btn--active" : ""),
65
+ onClick: function onClick() {
66
+ return l == null ? void 0 : l("zh");
67
+ },
68
+ children: V
69
+ }), /* @__PURE__ */e("button", {
70
+ type: "button",
71
+ className: "bu-eib__lang-btn".concat(b === "en" ? " bu-eib__lang-btn--active" : ""),
72
+ onClick: function onClick() {
73
+ return l == null ? void 0 : l("en");
74
+ },
75
+ children: g
76
+ })]
77
+ }), t && /* @__PURE__ */e("button", {
78
+ type: "button",
79
+ className: "bu-eib__delete",
80
+ onClick: c,
81
+ children: /* @__PURE__ */e(w, {})
82
+ })]
83
+ })]
84
+ })
85
+ });
86
+ });
87
+ export { j as default };
@@ -1 +1,414 @@
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;
1
+ "use strict";
2
+
3
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ 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; } } }; }
10
+ 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; } }
11
+ 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; }
12
+ var e = require("react/jsx-runtime"),
13
+ u = require("react");
14
+ ; /* empty css */
15
+ var k = Object.defineProperty,
16
+ f = Object.getOwnPropertySymbols,
17
+ b = Object.prototype.hasOwnProperty,
18
+ C = Object.prototype.propertyIsEnumerable,
19
+ p = function p(r, t, l) {
20
+ return t in r ? k(r, t, {
21
+ enumerable: !0,
22
+ configurable: !0,
23
+ writable: !0,
24
+ value: l
25
+ }) : r[t] = l;
26
+ },
27
+ j = function j(r, t) {
28
+ for (var l in t || (t = {})) b.call(t, l) && p(r, l, t[l]);
29
+ if (f) {
30
+ var _iterator = _createForOfIteratorHelper(f(t)),
31
+ _step;
32
+ try {
33
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
34
+ var l = _step.value;
35
+ C.call(t, l) && p(r, l, t[l]);
36
+ }
37
+ } catch (err) {
38
+ _iterator.e(err);
39
+ } finally {
40
+ _iterator.f();
41
+ }
42
+ }
43
+ return r;
44
+ },
45
+ w = function w(r, t, l) {
46
+ return new Promise(function (i, n) {
47
+ var a = function a(s) {
48
+ try {
49
+ d(l.next(s));
50
+ } catch (h) {
51
+ n(h);
52
+ }
53
+ },
54
+ c = function c(s) {
55
+ try {
56
+ d(l.throw(s));
57
+ } catch (h) {
58
+ n(h);
59
+ }
60
+ },
61
+ d = function d(s) {
62
+ return s.done ? i(s.value) : Promise.resolve(s.value).then(a, c);
63
+ };
64
+ d((l = l.apply(r, t)).next());
65
+ });
66
+ };
67
+ var E = {
68
+ pdf: {
69
+ color: "#F54A45",
70
+ label: "PDF"
71
+ },
72
+ image: {
73
+ color: "#00AAFF",
74
+ label: "IMG"
75
+ },
76
+ doc: {
77
+ color: "#3B64FC",
78
+ label: "DOC"
79
+ },
80
+ docx: {
81
+ color: "#3B64FC",
82
+ label: "DOC"
83
+ },
84
+ xls: {
85
+ color: "#1D9B4C",
86
+ label: "XLS"
87
+ },
88
+ xlsx: {
89
+ color: "#1D9B4C",
90
+ label: "XLS"
91
+ },
92
+ ppt: {
93
+ color: "#DF4023",
94
+ label: "PPT"
95
+ },
96
+ pptx: {
97
+ color: "#DF4023",
98
+ label: "PPT"
99
+ },
100
+ zip: {
101
+ color: "#7B5EA7",
102
+ label: "ZIP"
103
+ },
104
+ rar: {
105
+ color: "#7B5EA7",
106
+ label: "RAR"
107
+ },
108
+ txt: {
109
+ color: "#8C8C8C",
110
+ label: "TXT"
111
+ },
112
+ other: {
113
+ color: "#1677FF",
114
+ label: "FILE"
115
+ }
116
+ };
117
+ function F(_ref) {
118
+ var r = _ref.fileType,
119
+ t = _ref.fileUrl,
120
+ l = _ref.fileName;
121
+ if (r === "image" && t) return e.jsx("img", {
122
+ src: t,
123
+ alt: l,
124
+ className: "file-card__image-thumb"
125
+ });
126
+ var _E$r = E[r],
127
+ i = _E$r.color,
128
+ n = _E$r.label;
129
+ return e.jsxs("svg", {
130
+ width: "88",
131
+ height: "88",
132
+ viewBox: "0 0 88 88",
133
+ fill: "none",
134
+ xmlns: "http://www.w3.org/2000/svg",
135
+ children: [e.jsx("rect", {
136
+ x: "14",
137
+ y: "8",
138
+ width: "50",
139
+ height: "62",
140
+ rx: "4",
141
+ fill: "#F5F5F5"
142
+ }), e.jsx("path", {
143
+ d: "M50 8L64 22H50V8Z",
144
+ fill: "#E2E2E2"
145
+ }), e.jsx("rect", {
146
+ x: "20",
147
+ y: "30",
148
+ width: "30",
149
+ height: "4",
150
+ rx: "2",
151
+ fill: "#E2E2E2"
152
+ }), e.jsx("rect", {
153
+ x: "20",
154
+ y: "40",
155
+ width: "30",
156
+ height: "4",
157
+ rx: "2",
158
+ fill: "#E2E2E2"
159
+ }), e.jsx("rect", {
160
+ x: "20",
161
+ y: "50",
162
+ width: "20",
163
+ height: "4",
164
+ rx: "2",
165
+ fill: "#E2E2E2"
166
+ }), e.jsx("rect", {
167
+ x: "42",
168
+ y: "52",
169
+ width: "32",
170
+ height: "28",
171
+ rx: "4",
172
+ fill: i
173
+ }), e.jsx("rect", {
174
+ x: "42",
175
+ y: "52",
176
+ width: "4",
177
+ height: "28",
178
+ rx: "2",
179
+ fill: "rgba(255,255,255,0.25)"
180
+ }), e.jsx("rect", {
181
+ x: "42",
182
+ y: "76",
183
+ width: "32",
184
+ height: "4",
185
+ rx: "2",
186
+ fill: "rgba(0,0,0,0.15)"
187
+ }), e.jsx("text", {
188
+ x: "58",
189
+ y: "71",
190
+ textAnchor: "middle",
191
+ fill: "white",
192
+ fontSize: "9",
193
+ fontWeight: "700",
194
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
195
+ letterSpacing: "0.3",
196
+ children: n
197
+ })]
198
+ });
199
+ }
200
+ function _() {
201
+ return e.jsxs("svg", {
202
+ width: "16",
203
+ height: "16",
204
+ viewBox: "0 0 24 24",
205
+ fill: "none",
206
+ children: [e.jsx("path", {
207
+ d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z",
208
+ stroke: "currentColor",
209
+ strokeWidth: "2",
210
+ strokeLinecap: "round",
211
+ strokeLinejoin: "round"
212
+ }), e.jsx("circle", {
213
+ cx: "12",
214
+ cy: "12",
215
+ r: "3",
216
+ stroke: "currentColor",
217
+ strokeWidth: "2"
218
+ })]
219
+ });
220
+ }
221
+ function v() {
222
+ return e.jsxs("svg", {
223
+ width: "16",
224
+ height: "16",
225
+ viewBox: "0 0 24 24",
226
+ fill: "none",
227
+ children: [e.jsx("polyline", {
228
+ points: "3,6 5,6 21,6",
229
+ stroke: "currentColor",
230
+ strokeWidth: "2",
231
+ strokeLinecap: "round",
232
+ strokeLinejoin: "round"
233
+ }), e.jsx("path", {
234
+ d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6",
235
+ stroke: "currentColor",
236
+ strokeWidth: "2",
237
+ strokeLinecap: "round",
238
+ strokeLinejoin: "round"
239
+ }), e.jsx("path", {
240
+ d: "M10 11v6M14 11v6",
241
+ stroke: "currentColor",
242
+ strokeWidth: "2",
243
+ strokeLinecap: "round",
244
+ strokeLinejoin: "round"
245
+ }), e.jsx("path", {
246
+ d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2",
247
+ stroke: "currentColor",
248
+ strokeWidth: "2",
249
+ strokeLinecap: "round",
250
+ strokeLinejoin: "round"
251
+ })]
252
+ });
253
+ }
254
+ function y(_ref2) {
255
+ var r = _ref2.fileName,
256
+ t = _ref2.onRename;
257
+ var _u$useState = u.useState(!1),
258
+ _u$useState2 = _slicedToArray(_u$useState, 2),
259
+ l = _u$useState2[0],
260
+ i = _u$useState2[1],
261
+ _u$useState3 = u.useState(r),
262
+ _u$useState4 = _slicedToArray(_u$useState3, 2),
263
+ n = _u$useState4[0],
264
+ a = _u$useState4[1],
265
+ c = u.useRef(null);
266
+ u.useEffect(function () {
267
+ var o, x;
268
+ l && (a(r), (o = c.current) == null || o.focus(), (x = c.current) == null || x.select());
269
+ }, [l, r]);
270
+ var d = function d() {
271
+ return w(null, null, /*#__PURE__*/_regenerator().m(function _callee() {
272
+ var o, _t;
273
+ return _regenerator().w(function (_context) {
274
+ while (1) switch (_context.n) {
275
+ case 0:
276
+ o = n.trim();
277
+ _t = o && o !== r;
278
+ if (!_t) {
279
+ _context.n = 1;
280
+ break;
281
+ }
282
+ _context.n = 1;
283
+ return t == null ? void 0 : t(o);
284
+ case 1:
285
+ i(!1);
286
+ case 2:
287
+ return _context.a(2);
288
+ }
289
+ }, _callee);
290
+ }));
291
+ },
292
+ s = function s() {
293
+ return i(!1);
294
+ },
295
+ h = function h(o) {
296
+ o.key === "Enter" && !o.shiftKey && (o.preventDefault(), d()), o.key === "Escape" && s();
297
+ },
298
+ m = function m() {
299
+ d();
300
+ },
301
+ g = function g() {
302
+ t && i(!0);
303
+ };
304
+ return l ? e.jsx("div", {
305
+ className: "file-card__name-area file-card__name-area--editing",
306
+ children: e.jsx("textarea", {
307
+ ref: c,
308
+ className: "file-card__edit-input",
309
+ value: n,
310
+ onChange: function onChange(o) {
311
+ return a(o.target.value);
312
+ },
313
+ onKeyDown: h,
314
+ onBlur: m,
315
+ rows: 2,
316
+ style: {
317
+ height: "42px"
318
+ }
319
+ })
320
+ }) : e.jsx("div", {
321
+ className: "file-card__name-area",
322
+ onDoubleClick: g,
323
+ children: e.jsx("span", {
324
+ className: "file-card__filename",
325
+ title: r,
326
+ children: r
327
+ })
328
+ });
329
+ }
330
+ function L(_ref3) {
331
+ var r = _ref3.fileName,
332
+ t = _ref3.onDelete,
333
+ l = _ref3.onRename,
334
+ i = _ref3.onPreview,
335
+ n = _ref3.className,
336
+ a = _ref3.style;
337
+ return e.jsxs("div", {
338
+ className: "file-card file-card--pdf ".concat(n || ""),
339
+ style: a,
340
+ children: [e.jsxs("div", {
341
+ className: "file-card__pdf-preview",
342
+ onClick: i,
343
+ children: [(i || t) && e.jsxs("div", {
344
+ className: "file-card__overlay",
345
+ children: [i && e.jsx("button", {
346
+ className: "file-card__overlay-btn",
347
+ onClick: function onClick(c) {
348
+ c.stopPropagation(), i();
349
+ },
350
+ children: e.jsx(_, {})
351
+ }), t && e.jsx("button", {
352
+ className: "file-card__overlay-btn",
353
+ onClick: function onClick(c) {
354
+ c.stopPropagation(), t();
355
+ },
356
+ children: e.jsx(v, {})
357
+ })]
358
+ }), e.jsx("div", {
359
+ className: "file-card__pdf-label",
360
+ children: e.jsx("span", {
361
+ children: "PDF"
362
+ })
363
+ })]
364
+ }), e.jsx(y, {
365
+ fileName: r,
366
+ onRename: l
367
+ })]
368
+ });
369
+ }
370
+ function P(_ref4) {
371
+ var r = _ref4.fileName,
372
+ t = _ref4.fileType,
373
+ l = _ref4.fileUrl,
374
+ i = _ref4.onDelete,
375
+ n = _ref4.onRename,
376
+ a = _ref4.onPreview,
377
+ c = _ref4.className,
378
+ d = _ref4.style;
379
+ return e.jsxs("div", {
380
+ className: "file-card file-card--other ".concat(c || ""),
381
+ style: d,
382
+ children: [e.jsxs("div", {
383
+ className: "file-card__other-preview",
384
+ onClick: a,
385
+ children: [(a || i) && e.jsxs("div", {
386
+ className: "file-card__overlay",
387
+ children: [a && e.jsx("button", {
388
+ className: "file-card__overlay-btn",
389
+ onClick: function onClick(s) {
390
+ s.stopPropagation(), a();
391
+ },
392
+ children: e.jsx(_, {})
393
+ }), i && e.jsx("button", {
394
+ className: "file-card__overlay-btn",
395
+ onClick: function onClick(s) {
396
+ s.stopPropagation(), i();
397
+ },
398
+ children: e.jsx(v, {})
399
+ })]
400
+ }), e.jsx(F, {
401
+ fileType: t,
402
+ fileUrl: l,
403
+ fileName: r
404
+ })]
405
+ }), e.jsx(y, {
406
+ fileName: r,
407
+ onRename: n
408
+ })]
409
+ });
410
+ }
411
+ function N(r) {
412
+ return r.fileType === "pdf" ? e.jsx(L, j({}, r)) : e.jsx(P, j({}, r));
413
+ }
414
+ module.exports = N;