bj-web-components 0.2.28 → 0.2.29
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.
- package/dist/index.js +1 -51
- package/dist/index.mjs +49 -49
- package/dist/style.css +1 -3744
- package/dist/web/BasicInput/BInput.js +1 -208
- package/dist/web/BasicInput/BInput.mjs +132 -164
- package/dist/web/BasicInput/utils.js +1 -47
- package/dist/web/BasicInput/utils.mjs +28 -38
- package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -307
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +170 -218
- package/dist/web/CheckBox/BCheckBox.js +1 -116
- package/dist/web/CheckBox/BCheckBox.mjs +70 -86
- package/dist/web/CheckBox/Group.js +1 -73
- package/dist/web/CheckBox/Group.mjs +56 -63
- package/dist/web/CheckBox/context.js +1 -5
- package/dist/web/CheckBox/context.mjs +3 -3
- package/dist/web/CheckBox/index.js +1 -8
- package/dist/web/CheckBox/index.mjs +6 -6
- package/dist/web/Dropdown/BDropdown.js +1 -186
- package/dist/web/Dropdown/BDropdown.mjs +106 -132
- package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -77
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +48 -52
- package/dist/web/FileCard/FileCard.js +1 -157
- package/dist/web/FileCard/FileCard.mjs +82 -112
- package/dist/web/Icon/Icon.js +1 -9
- package/dist/web/Icon/Icon.mjs +6 -6
- package/dist/web/Input/Input.js +1 -181
- package/dist/web/Input/Input.mjs +113 -122
- package/dist/web/InputNumber/BInputNumber.js +1 -311
- package/dist/web/InputNumber/BInputNumber.mjs +167 -275
- package/dist/web/InputNumber/StepHandler.js +1 -69
- package/dist/web/InputNumber/StepHandler.mjs +32 -38
- package/dist/web/InputNumber/hooks/useCursor.js +1 -40
- package/dist/web/InputNumber/hooks/useCursor.mjs +33 -35
- package/dist/web/InputNumber/hooks/useFrame.js +1 -12
- package/dist/web/InputNumber/hooks/useFrame.mjs +6 -9
- package/dist/web/InputNumber/utils/decimal.js +1 -147
- package/dist/web/InputNumber/utils/decimal.mjs +81 -109
- package/dist/web/Modal/Modal.js +1 -84
- package/dist/web/Modal/Modal.mjs +49 -52
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -232
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +125 -206
- package/dist/web/Pagination/Pagination.js +1 -328
- package/dist/web/Pagination/Pagination.mjs +178 -254
- package/dist/web/ProductField/ProductField.js +1 -272
- package/dist/web/ProductField/ProductField.mjs +143 -190
- package/dist/web/ProductField/arrow-up.svg.js +1 -3
- package/dist/web/ProductField/arrow-up.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-no.svg.js +1 -3
- package/dist/web/ProductField/checkbox-no.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-ok.svg.js +1 -3
- package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -2
- package/dist/web/ProductField/no_data_light.svg.js +1 -3
- package/dist/web/ProductField/no_data_light.svg.mjs +2 -2
- package/dist/web/ProductField/search.svg.js +1 -3
- package/dist/web/ProductField/search.svg.mjs +2 -2
- package/dist/web/ProductField/sort.svg.js +1 -3
- package/dist/web/ProductField/sort.svg.mjs +2 -2
- package/dist/web/SkuInputCard/SkuInputCard.js +1 -276
- package/dist/web/SkuInputCard/SkuInputCard.mjs +149 -188
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -3
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -2
- package/dist/web/Switch/Switch.js +1 -70
- package/dist/web/Switch/Switch.mjs +37 -47
- package/dist/web/Table/BTable.js +1 -950
- package/dist/web/Table/BTable.mjs +521 -767
- package/dist/web/Table/Column.js +1 -5
- package/dist/web/Table/Column.mjs +2 -2
- package/dist/web/Table/ColumnGroup.js +1 -5
- package/dist/web/Table/ColumnGroup.mjs +2 -2
- package/dist/web/Table/utils/columns.js +1 -48
- package/dist/web/Table/utils/columns.mjs +30 -35
- package/dist/web/Table/utils/sortFilter.js +1 -84
- package/dist/web/Table/utils/sortFilter.mjs +52 -73
- package/dist/web/Tabs/BTabs.js +1 -150
- package/dist/web/Tabs/BTabs.mjs +98 -118
- package/dist/web/Tabs/TabPane.js +1 -8
- package/dist/web/Tabs/TabPane.mjs +4 -4
- package/dist/web/Tooltip/ConfirmTooltip.js +1 -26
- package/dist/web/Tooltip/ConfirmTooltip.mjs +19 -20
- package/dist/web/Tooltip/ContentTooltip.js +1 -94
- package/dist/web/Tooltip/ContentTooltip.mjs +62 -72
- package/dist/web/Tooltip/ProgressTooltip.js +1 -36
- package/dist/web/Tooltip/ProgressTooltip.mjs +20 -22
- package/dist/web/Tooltip/TooltipWrapper.js +1 -12
- package/dist/web/Tooltip/TooltipWrapper.mjs +8 -8
- package/dist/web/Tooltip/useAutoPlacement.js +1 -41
- package/dist/web/Tooltip/useAutoPlacement.mjs +25 -34
- package/dist/web.js +1 -51
- package/dist/web.mjs +49 -49
- package/package.json +1 -1
|
@@ -1,157 +1 @@
|
|
|
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
|
+
"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,7 +1,7 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useEffect } from "react";
|
|
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
3
|
/* empty css */
|
|
4
|
-
const
|
|
4
|
+
const y = {
|
|
5
5
|
pdf: { color: "#F54A45", label: "PDF" },
|
|
6
6
|
image: { color: "#00AAFF", label: "IMG" },
|
|
7
7
|
doc: { color: "#3B64FC", label: "DOC" },
|
|
@@ -15,21 +15,20 @@ const FILE_TYPE_CONFIG = {
|
|
|
15
15
|
txt: { color: "#8C8C8C", label: "TXT" },
|
|
16
16
|
other: { color: "#1677FF", label: "FILE" }
|
|
17
17
|
};
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */ jsx(
|
|
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(
|
|
33
32
|
"text",
|
|
34
33
|
{
|
|
35
34
|
x: "58",
|
|
@@ -40,119 +39,90 @@ function FileIcon({ fileType, fileUrl, fileName }) {
|
|
|
40
39
|
fontWeight: "700",
|
|
41
40
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
42
41
|
letterSpacing: "0.3",
|
|
43
|
-
children:
|
|
42
|
+
children: s
|
|
44
43
|
}
|
|
45
44
|
)
|
|
46
45
|
] });
|
|
47
46
|
}
|
|
48
|
-
function
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
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" })
|
|
52
51
|
] });
|
|
53
52
|
}
|
|
54
|
-
function
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
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" })
|
|
60
59
|
] });
|
|
61
60
|
}
|
|
62
|
-
function
|
|
63
|
-
const [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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();
|
|
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);
|
|
88
76
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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" }
|
|
95
88
|
}
|
|
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 }) });
|
|
89
|
+
) }) : /* @__PURE__ */ e("div", { className: "file-card__name-area", onDoubleClick: C, children: /* @__PURE__ */ e("span", { className: "file-card__filename", title: r, children: r }) });
|
|
113
90
|
}
|
|
114
|
-
function
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
onDelete();
|
|
125
|
-
}, children: /* @__PURE__ */ jsx(IconTrash, {}) })
|
|
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, {}) })
|
|
126
101
|
] }),
|
|
127
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ e("div", { className: "file-card__pdf-label", children: /* @__PURE__ */ e("span", { children: "PDF" }) })
|
|
128
103
|
] }),
|
|
129
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ e(k, { fileName: r, onRename: o })
|
|
130
105
|
] });
|
|
131
106
|
}
|
|
132
|
-
function
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
onDelete();
|
|
143
|
-
}, children: /* @__PURE__ */ jsx(IconTrash, {}) })
|
|
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, {}) })
|
|
144
117
|
] }),
|
|
145
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ e(v, { fileType: l, fileUrl: o, fileName: r })
|
|
146
119
|
] }),
|
|
147
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ e(k, { fileName: r, onRename: s })
|
|
148
121
|
] });
|
|
149
122
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
152
|
-
return /* @__PURE__ */ jsx(PdfCard, { ...props });
|
|
153
|
-
}
|
|
154
|
-
return /* @__PURE__ */ jsx(OtherCard, { ...props });
|
|
123
|
+
function N(r) {
|
|
124
|
+
return r.fileType === "pdf" ? /* @__PURE__ */ e(E, { ...r }) : /* @__PURE__ */ e(F, { ...r });
|
|
155
125
|
}
|
|
156
126
|
export {
|
|
157
|
-
|
|
127
|
+
N as default
|
|
158
128
|
};
|
package/dist/web/Icon/Icon.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
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
|
+
"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;
|
package/dist/web/Icon/Icon.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
/* empty css */
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
return /* @__PURE__ */
|
|
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
6
|
};
|
|
7
|
-
|
|
7
|
+
t.displayName = "BuIcon";
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
t as default
|
|
10
10
|
};
|