bj-web-components 0.2.27 → 0.2.28

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 (90) hide show
  1. package/dist/index.js +51 -1
  2. package/dist/index.mjs +49 -49
  3. package/dist/style.css +3744 -1
  4. package/dist/web/BasicInput/BInput.js +208 -1
  5. package/dist/web/BasicInput/BInput.mjs +164 -132
  6. package/dist/web/BasicInput/utils.js +47 -1
  7. package/dist/web/BasicInput/utils.mjs +38 -28
  8. package/dist/web/CategoryDropdown/CategoryDropdown.js +307 -1
  9. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +218 -170
  10. package/dist/web/CheckBox/BCheckBox.js +116 -1
  11. package/dist/web/CheckBox/BCheckBox.mjs +86 -70
  12. package/dist/web/CheckBox/Group.js +73 -1
  13. package/dist/web/CheckBox/Group.mjs +63 -56
  14. package/dist/web/CheckBox/context.js +5 -1
  15. package/dist/web/CheckBox/context.mjs +3 -3
  16. package/dist/web/CheckBox/index.js +8 -1
  17. package/dist/web/CheckBox/index.mjs +6 -6
  18. package/dist/web/Dropdown/BDropdown.js +186 -1
  19. package/dist/web/Dropdown/BDropdown.mjs +132 -106
  20. package/dist/web/EmptyInputBox/EmptyInputBox.js +77 -1
  21. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +52 -48
  22. package/dist/web/FileCard/FileCard.js +157 -1
  23. package/dist/web/FileCard/FileCard.mjs +112 -82
  24. package/dist/web/Icon/Icon.js +9 -1
  25. package/dist/web/Icon/Icon.mjs +6 -6
  26. package/dist/web/Input/Input.js +181 -1
  27. package/dist/web/Input/Input.mjs +122 -113
  28. package/dist/web/InputNumber/BInputNumber.js +311 -1
  29. package/dist/web/InputNumber/BInputNumber.mjs +275 -167
  30. package/dist/web/InputNumber/StepHandler.js +69 -1
  31. package/dist/web/InputNumber/StepHandler.mjs +38 -32
  32. package/dist/web/InputNumber/hooks/useCursor.js +40 -1
  33. package/dist/web/InputNumber/hooks/useCursor.mjs +35 -33
  34. package/dist/web/InputNumber/hooks/useFrame.js +12 -1
  35. package/dist/web/InputNumber/hooks/useFrame.mjs +9 -6
  36. package/dist/web/InputNumber/utils/decimal.js +147 -1
  37. package/dist/web/InputNumber/utils/decimal.mjs +109 -81
  38. package/dist/web/Modal/Modal.js +84 -1
  39. package/dist/web/Modal/Modal.mjs +52 -49
  40. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +232 -1
  41. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +206 -125
  42. package/dist/web/Pagination/Pagination.js +328 -1
  43. package/dist/web/Pagination/Pagination.mjs +254 -178
  44. package/dist/web/ProductField/ProductField.js +272 -1
  45. package/dist/web/ProductField/ProductField.mjs +190 -143
  46. package/dist/web/ProductField/arrow-up.svg.js +3 -1
  47. package/dist/web/ProductField/arrow-up.svg.mjs +2 -2
  48. package/dist/web/ProductField/checkbox-no.svg.js +3 -1
  49. package/dist/web/ProductField/checkbox-no.svg.mjs +2 -2
  50. package/dist/web/ProductField/checkbox-ok.svg.js +3 -1
  51. package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -2
  52. package/dist/web/ProductField/no_data_light.svg.js +3 -1
  53. package/dist/web/ProductField/no_data_light.svg.mjs +2 -2
  54. package/dist/web/ProductField/search.svg.js +3 -1
  55. package/dist/web/ProductField/search.svg.mjs +2 -2
  56. package/dist/web/ProductField/sort.svg.js +3 -1
  57. package/dist/web/ProductField/sort.svg.mjs +2 -2
  58. package/dist/web/SkuInputCard/SkuInputCard.js +276 -1
  59. package/dist/web/SkuInputCard/SkuInputCard.mjs +188 -149
  60. package/dist/web/SkuInputCard/spin_loading_red.gif.js +3 -1
  61. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -2
  62. package/dist/web/Switch/Switch.js +70 -1
  63. package/dist/web/Switch/Switch.mjs +47 -37
  64. package/dist/web/Table/BTable.js +950 -1
  65. package/dist/web/Table/BTable.mjs +771 -519
  66. package/dist/web/Table/Column.js +5 -1
  67. package/dist/web/Table/Column.mjs +2 -2
  68. package/dist/web/Table/ColumnGroup.js +5 -1
  69. package/dist/web/Table/ColumnGroup.mjs +2 -2
  70. package/dist/web/Table/utils/columns.js +48 -1
  71. package/dist/web/Table/utils/columns.mjs +35 -30
  72. package/dist/web/Table/utils/sortFilter.js +84 -1
  73. package/dist/web/Table/utils/sortFilter.mjs +73 -52
  74. package/dist/web/Tabs/BTabs.js +150 -1
  75. package/dist/web/Tabs/BTabs.mjs +118 -98
  76. package/dist/web/Tabs/TabPane.js +8 -1
  77. package/dist/web/Tabs/TabPane.mjs +4 -4
  78. package/dist/web/Tooltip/ConfirmTooltip.js +26 -1
  79. package/dist/web/Tooltip/ConfirmTooltip.mjs +20 -19
  80. package/dist/web/Tooltip/ContentTooltip.js +94 -1
  81. package/dist/web/Tooltip/ContentTooltip.mjs +72 -62
  82. package/dist/web/Tooltip/ProgressTooltip.js +36 -1
  83. package/dist/web/Tooltip/ProgressTooltip.mjs +22 -20
  84. package/dist/web/Tooltip/TooltipWrapper.js +12 -1
  85. package/dist/web/Tooltip/TooltipWrapper.mjs +8 -8
  86. package/dist/web/Tooltip/useAutoPlacement.js +41 -1
  87. package/dist/web/Tooltip/useAutoPlacement.mjs +34 -25
  88. package/dist/web.js +51 -1
  89. package/dist/web.mjs +49 -49
  90. package/package.json +1 -1
@@ -1 +1,157 @@
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
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("react");
4
+ ;/* empty css */
5
+ const FILE_TYPE_CONFIG = {
6
+ pdf: { color: "#F54A45", label: "PDF" },
7
+ image: { color: "#00AAFF", label: "IMG" },
8
+ doc: { color: "#3B64FC", label: "DOC" },
9
+ docx: { color: "#3B64FC", label: "DOC" },
10
+ xls: { color: "#1D9B4C", label: "XLS" },
11
+ xlsx: { color: "#1D9B4C", label: "XLS" },
12
+ ppt: { color: "#DF4023", label: "PPT" },
13
+ pptx: { color: "#DF4023", label: "PPT" },
14
+ zip: { color: "#7B5EA7", label: "ZIP" },
15
+ rar: { color: "#7B5EA7", label: "RAR" },
16
+ txt: { color: "#8C8C8C", label: "TXT" },
17
+ other: { color: "#1677FF", label: "FILE" }
18
+ };
19
+ function FileIcon({ fileType, fileUrl, fileName }) {
20
+ if (fileType === "image" && fileUrl) {
21
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: fileUrl, alt: fileName, className: "file-card__image-thumb" });
22
+ }
23
+ const { color, label } = FILE_TYPE_CONFIG[fileType];
24
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "88", height: "88", viewBox: "0 0 88 88", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
25
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "14", y: "8", width: "50", height: "62", rx: "4", fill: "#F5F5F5" }),
26
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M50 8L64 22H50V8Z", fill: "#E2E2E2" }),
27
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "20", y: "30", width: "30", height: "4", rx: "2", fill: "#E2E2E2" }),
28
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "20", y: "40", width: "30", height: "4", rx: "2", fill: "#E2E2E2" }),
29
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "20", y: "50", width: "20", height: "4", rx: "2", fill: "#E2E2E2" }),
30
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "42", y: "52", width: "32", height: "28", rx: "4", fill: color }),
31
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "42", y: "52", width: "4", height: "28", rx: "2", fill: "rgba(255,255,255,0.25)" }),
32
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "42", y: "76", width: "32", height: "4", rx: "2", fill: "rgba(0,0,0,0.15)" }),
33
+ /* @__PURE__ */ jsxRuntime.jsx(
34
+ "text",
35
+ {
36
+ x: "58",
37
+ y: "71",
38
+ textAnchor: "middle",
39
+ fill: "white",
40
+ fontSize: "9",
41
+ fontWeight: "700",
42
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
43
+ letterSpacing: "0.3",
44
+ children: label
45
+ }
46
+ )
47
+ ] });
48
+ }
49
+ function IconEye() {
50
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
51
+ /* @__PURE__ */ jsxRuntime.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" }),
52
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "3", stroke: "currentColor", strokeWidth: "2" })
53
+ ] });
54
+ }
55
+ function IconTrash() {
56
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
57
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "3,6 5,6 21,6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
58
+ /* @__PURE__ */ jsxRuntime.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" }),
59
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 11v6M14 11v6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
60
+ /* @__PURE__ */ jsxRuntime.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" })
61
+ ] });
62
+ }
63
+ function NameRow({ fileName, onRename }) {
64
+ const [editing, setEditing] = react.useState(false);
65
+ const [editValue, setEditValue] = react.useState(fileName);
66
+ const inputRef = react.useRef(null);
67
+ react.useEffect(() => {
68
+ var _a, _b;
69
+ if (editing) {
70
+ setEditValue(fileName);
71
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
72
+ (_b = inputRef.current) == null ? void 0 : _b.select();
73
+ }
74
+ }, [editing, fileName]);
75
+ const handleConfirm = async () => {
76
+ const trimmed = editValue.trim();
77
+ if (trimmed && trimmed !== fileName) {
78
+ await (onRename == null ? void 0 : onRename(trimmed));
79
+ }
80
+ setEditing(false);
81
+ };
82
+ const handleCancel = () => setEditing(false);
83
+ const handleKeyDown = (e) => {
84
+ if (e.key === "Enter" && !e.shiftKey) {
85
+ e.preventDefault();
86
+ handleConfirm();
87
+ }
88
+ if (e.key === "Escape") handleCancel();
89
+ };
90
+ const handleBlur = () => {
91
+ handleConfirm();
92
+ };
93
+ const handleDoubleClick = () => {
94
+ if (onRename) {
95
+ setEditing(true);
96
+ }
97
+ };
98
+ if (editing) {
99
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "file-card__name-area file-card__name-area--editing", children: /* @__PURE__ */ jsxRuntime.jsx(
100
+ "textarea",
101
+ {
102
+ ref: inputRef,
103
+ className: "file-card__edit-input",
104
+ value: editValue,
105
+ onChange: (e) => setEditValue(e.target.value),
106
+ onKeyDown: handleKeyDown,
107
+ onBlur: handleBlur,
108
+ rows: 2,
109
+ style: { height: "42px" }
110
+ }
111
+ ) });
112
+ }
113
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "file-card__name-area", onDoubleClick: handleDoubleClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "file-card__filename", title: fileName, children: fileName }) });
114
+ }
115
+ function PdfCard({ fileName, onDelete, onRename, onPreview, className, style }) {
116
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `file-card file-card--pdf ${className || ""}`, style, children: [
117
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-card__pdf-preview", onClick: onPreview, children: [
118
+ (onPreview || onDelete) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-card__overlay", children: [
119
+ onPreview && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
120
+ e.stopPropagation();
121
+ onPreview();
122
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(IconEye, {}) }),
123
+ onDelete && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
124
+ e.stopPropagation();
125
+ onDelete();
126
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(IconTrash, {}) })
127
+ ] }),
128
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "file-card__pdf-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "PDF" }) })
129
+ ] }),
130
+ /* @__PURE__ */ jsxRuntime.jsx(NameRow, { fileName, onRename })
131
+ ] });
132
+ }
133
+ function OtherCard({ fileName, fileType, fileUrl, onDelete, onRename, onPreview, className, style }) {
134
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `file-card file-card--other ${className || ""}`, style, children: [
135
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-card__other-preview", onClick: onPreview, children: [
136
+ (onPreview || onDelete) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-card__overlay", children: [
137
+ onPreview && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
138
+ e.stopPropagation();
139
+ onPreview();
140
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(IconEye, {}) }),
141
+ onDelete && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
142
+ e.stopPropagation();
143
+ onDelete();
144
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(IconTrash, {}) })
145
+ ] }),
146
+ /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { fileType, fileUrl, fileName })
147
+ ] }),
148
+ /* @__PURE__ */ jsxRuntime.jsx(NameRow, { fileName, onRename })
149
+ ] });
150
+ }
151
+ function FileCard(props) {
152
+ if (props.fileType === "pdf") {
153
+ return /* @__PURE__ */ jsxRuntime.jsx(PdfCard, { ...props });
154
+ }
155
+ return /* @__PURE__ */ jsxRuntime.jsx(OtherCard, { ...props });
156
+ }
157
+ module.exports = FileCard;
@@ -1,7 +1,7 @@
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";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useRef, useEffect } from "react";
3
3
  /* empty css */
4
- const y = {
4
+ const FILE_TYPE_CONFIG = {
5
5
  pdf: { color: "#F54A45", label: "PDF" },
6
6
  image: { color: "#00AAFF", label: "IMG" },
7
7
  doc: { color: "#3B64FC", label: "DOC" },
@@ -15,20 +15,21 @@ const y = {
15
15
  txt: { color: "#8C8C8C", label: "TXT" },
16
16
  other: { color: "#1677FF", label: "FILE" }
17
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(
18
+ function FileIcon({ fileType, fileUrl, fileName }) {
19
+ if (fileType === "image" && fileUrl) {
20
+ return /* @__PURE__ */ jsx("img", { src: fileUrl, alt: fileName, className: "file-card__image-thumb" });
21
+ }
22
+ const { color, label } = FILE_TYPE_CONFIG[fileType];
23
+ return /* @__PURE__ */ jsxs("svg", { width: "88", height: "88", viewBox: "0 0 88 88", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
24
+ /* @__PURE__ */ jsx("rect", { x: "14", y: "8", width: "50", height: "62", rx: "4", fill: "#F5F5F5" }),
25
+ /* @__PURE__ */ jsx("path", { d: "M50 8L64 22H50V8Z", fill: "#E2E2E2" }),
26
+ /* @__PURE__ */ jsx("rect", { x: "20", y: "30", width: "30", height: "4", rx: "2", fill: "#E2E2E2" }),
27
+ /* @__PURE__ */ jsx("rect", { x: "20", y: "40", width: "30", height: "4", rx: "2", fill: "#E2E2E2" }),
28
+ /* @__PURE__ */ jsx("rect", { x: "20", y: "50", width: "20", height: "4", rx: "2", fill: "#E2E2E2" }),
29
+ /* @__PURE__ */ jsx("rect", { x: "42", y: "52", width: "32", height: "28", rx: "4", fill: color }),
30
+ /* @__PURE__ */ jsx("rect", { x: "42", y: "52", width: "4", height: "28", rx: "2", fill: "rgba(255,255,255,0.25)" }),
31
+ /* @__PURE__ */ jsx("rect", { x: "42", y: "76", width: "32", height: "4", rx: "2", fill: "rgba(0,0,0,0.15)" }),
32
+ /* @__PURE__ */ jsx(
32
33
  "text",
33
34
  {
34
35
  x: "58",
@@ -39,90 +40,119 @@ function v({ fileType: r, fileUrl: l, fileName: o }) {
39
40
  fontWeight: "700",
40
41
  fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
41
42
  letterSpacing: "0.3",
42
- children: s
43
+ children: label
43
44
  }
44
45
  )
45
46
  ] });
46
47
  }
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" })
48
+ function IconEye() {
49
+ return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
50
+ /* @__PURE__ */ 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" }),
51
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3", stroke: "currentColor", strokeWidth: "2" })
51
52
  ] });
52
53
  }
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" })
54
+ function IconTrash() {
55
+ return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
56
+ /* @__PURE__ */ jsx("polyline", { points: "3,6 5,6 21,6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
57
+ /* @__PURE__ */ 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" }),
58
+ /* @__PURE__ */ jsx("path", { d: "M10 11v6M14 11v6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
59
+ /* @__PURE__ */ 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" })
59
60
  ] });
60
61
  }
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);
62
+ function NameRow({ fileName, onRename }) {
63
+ const [editing, setEditing] = useState(false);
64
+ const [editValue, setEditValue] = useState(fileName);
65
+ const inputRef = useRef(null);
66
+ useEffect(() => {
67
+ var _a, _b;
68
+ if (editing) {
69
+ setEditValue(fileName);
70
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
71
+ (_b = inputRef.current) == null ? void 0 : _b.select();
72
+ }
73
+ }, [editing, fileName]);
74
+ const handleConfirm = async () => {
75
+ const trimmed = editValue.trim();
76
+ if (trimmed && trimmed !== fileName) {
77
+ await (onRename == null ? void 0 : onRename(trimmed));
78
+ }
79
+ setEditing(false);
80
+ };
81
+ const handleCancel = () => setEditing(false);
82
+ const handleKeyDown = (e) => {
83
+ if (e.key === "Enter" && !e.shiftKey) {
84
+ e.preventDefault();
85
+ handleConfirm();
86
+ }
87
+ if (e.key === "Escape") handleCancel();
76
88
  };
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" }
89
+ const handleBlur = () => {
90
+ handleConfirm();
91
+ };
92
+ const handleDoubleClick = () => {
93
+ if (onRename) {
94
+ setEditing(true);
88
95
  }
89
- ) }) : /* @__PURE__ */ e("div", { className: "file-card__name-area", onDoubleClick: C, children: /* @__PURE__ */ e("span", { className: "file-card__filename", title: r, children: r }) });
96
+ };
97
+ if (editing) {
98
+ return /* @__PURE__ */ jsx("div", { className: "file-card__name-area file-card__name-area--editing", children: /* @__PURE__ */ jsx(
99
+ "textarea",
100
+ {
101
+ ref: inputRef,
102
+ className: "file-card__edit-input",
103
+ value: editValue,
104
+ onChange: (e) => setEditValue(e.target.value),
105
+ onKeyDown: handleKeyDown,
106
+ onBlur: handleBlur,
107
+ rows: 2,
108
+ style: { height: "42px" }
109
+ }
110
+ ) });
111
+ }
112
+ return /* @__PURE__ */ jsx("div", { className: "file-card__name-area", onDoubleClick: handleDoubleClick, children: /* @__PURE__ */ jsx("span", { className: "file-card__filename", title: fileName, children: fileName }) });
90
113
  }
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, {}) })
114
+ function PdfCard({ fileName, onDelete, onRename, onPreview, className, style }) {
115
+ return /* @__PURE__ */ jsxs("div", { className: `file-card file-card--pdf ${className || ""}`, style, children: [
116
+ /* @__PURE__ */ jsxs("div", { className: "file-card__pdf-preview", onClick: onPreview, children: [
117
+ (onPreview || onDelete) && /* @__PURE__ */ jsxs("div", { className: "file-card__overlay", children: [
118
+ onPreview && /* @__PURE__ */ jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
119
+ e.stopPropagation();
120
+ onPreview();
121
+ }, children: /* @__PURE__ */ jsx(IconEye, {}) }),
122
+ onDelete && /* @__PURE__ */ jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
123
+ e.stopPropagation();
124
+ onDelete();
125
+ }, children: /* @__PURE__ */ jsx(IconTrash, {}) })
101
126
  ] }),
102
- /* @__PURE__ */ e("div", { className: "file-card__pdf-label", children: /* @__PURE__ */ e("span", { children: "PDF" }) })
127
+ /* @__PURE__ */ jsx("div", { className: "file-card__pdf-label", children: /* @__PURE__ */ jsx("span", { children: "PDF" }) })
103
128
  ] }),
104
- /* @__PURE__ */ e(k, { fileName: r, onRename: o })
129
+ /* @__PURE__ */ jsx(NameRow, { fileName, onRename })
105
130
  ] });
106
131
  }
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, {}) })
132
+ function OtherCard({ fileName, fileType, fileUrl, onDelete, onRename, onPreview, className, style }) {
133
+ return /* @__PURE__ */ jsxs("div", { className: `file-card file-card--other ${className || ""}`, style, children: [
134
+ /* @__PURE__ */ jsxs("div", { className: "file-card__other-preview", onClick: onPreview, children: [
135
+ (onPreview || onDelete) && /* @__PURE__ */ jsxs("div", { className: "file-card__overlay", children: [
136
+ onPreview && /* @__PURE__ */ jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
137
+ e.stopPropagation();
138
+ onPreview();
139
+ }, children: /* @__PURE__ */ jsx(IconEye, {}) }),
140
+ onDelete && /* @__PURE__ */ jsx("button", { className: "file-card__overlay-btn", onClick: (e) => {
141
+ e.stopPropagation();
142
+ onDelete();
143
+ }, children: /* @__PURE__ */ jsx(IconTrash, {}) })
117
144
  ] }),
118
- /* @__PURE__ */ e(v, { fileType: l, fileUrl: o, fileName: r })
145
+ /* @__PURE__ */ jsx(FileIcon, { fileType, fileUrl, fileName })
119
146
  ] }),
120
- /* @__PURE__ */ e(k, { fileName: r, onRename: s })
147
+ /* @__PURE__ */ jsx(NameRow, { fileName, onRename })
121
148
  ] });
122
149
  }
123
- function N(r) {
124
- return r.fileType === "pdf" ? /* @__PURE__ */ e(E, { ...r }) : /* @__PURE__ */ e(F, { ...r });
150
+ function FileCard(props) {
151
+ if (props.fileType === "pdf") {
152
+ return /* @__PURE__ */ jsx(PdfCard, { ...props });
153
+ }
154
+ return /* @__PURE__ */ jsx(OtherCard, { ...props });
125
155
  }
126
156
  export {
127
- N as default
157
+ FileCard as default
128
158
  };
@@ -1 +1,9 @@
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;
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ ;/* empty css */
4
+ const BuIcon = ({ type, style, onClick, className, ...rest }) => {
5
+ const cls = className ? `bu-icon ${className}` : "bu-icon";
6
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { style, className: cls, "aria-hidden": "true", onClick, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx("use", { xlinkHref: `#${type}` }) });
7
+ };
8
+ BuIcon.displayName = "BuIcon";
9
+ module.exports = BuIcon;
@@ -1,10 +1,10 @@
1
- import { jsx as o } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
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}` }) });
3
+ const BuIcon = ({ type, style, onClick, className, ...rest }) => {
4
+ const cls = className ? `bu-icon ${className}` : "bu-icon";
5
+ return /* @__PURE__ */ jsx("svg", { style, className: cls, "aria-hidden": "true", onClick, ...rest, children: /* @__PURE__ */ jsx("use", { xlinkHref: `#${type}` }) });
6
6
  };
7
- t.displayName = "BuIcon";
7
+ BuIcon.displayName = "BuIcon";
8
8
  export {
9
- t as default
9
+ BuIcon as default
10
10
  };