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.
- package/dist/index.js +51 -1
- package/dist/index.mjs +49 -49
- package/dist/style.css +3744 -1
- package/dist/web/BasicInput/BInput.js +208 -1
- package/dist/web/BasicInput/BInput.mjs +164 -132
- package/dist/web/BasicInput/utils.js +47 -1
- package/dist/web/BasicInput/utils.mjs +38 -28
- package/dist/web/CategoryDropdown/CategoryDropdown.js +307 -1
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +218 -170
- package/dist/web/CheckBox/BCheckBox.js +116 -1
- package/dist/web/CheckBox/BCheckBox.mjs +86 -70
- package/dist/web/CheckBox/Group.js +73 -1
- package/dist/web/CheckBox/Group.mjs +63 -56
- package/dist/web/CheckBox/context.js +5 -1
- package/dist/web/CheckBox/context.mjs +3 -3
- package/dist/web/CheckBox/index.js +8 -1
- package/dist/web/CheckBox/index.mjs +6 -6
- package/dist/web/Dropdown/BDropdown.js +186 -1
- package/dist/web/Dropdown/BDropdown.mjs +132 -106
- package/dist/web/EmptyInputBox/EmptyInputBox.js +77 -1
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +52 -48
- package/dist/web/FileCard/FileCard.js +157 -1
- package/dist/web/FileCard/FileCard.mjs +112 -82
- package/dist/web/Icon/Icon.js +9 -1
- package/dist/web/Icon/Icon.mjs +6 -6
- package/dist/web/Input/Input.js +181 -1
- package/dist/web/Input/Input.mjs +122 -113
- package/dist/web/InputNumber/BInputNumber.js +311 -1
- package/dist/web/InputNumber/BInputNumber.mjs +275 -167
- package/dist/web/InputNumber/StepHandler.js +69 -1
- package/dist/web/InputNumber/StepHandler.mjs +38 -32
- package/dist/web/InputNumber/hooks/useCursor.js +40 -1
- package/dist/web/InputNumber/hooks/useCursor.mjs +35 -33
- package/dist/web/InputNumber/hooks/useFrame.js +12 -1
- package/dist/web/InputNumber/hooks/useFrame.mjs +9 -6
- package/dist/web/InputNumber/utils/decimal.js +147 -1
- package/dist/web/InputNumber/utils/decimal.mjs +109 -81
- package/dist/web/Modal/Modal.js +84 -1
- package/dist/web/Modal/Modal.mjs +52 -49
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +232 -1
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +206 -125
- package/dist/web/Pagination/Pagination.js +328 -1
- package/dist/web/Pagination/Pagination.mjs +254 -178
- package/dist/web/ProductField/ProductField.js +272 -1
- package/dist/web/ProductField/ProductField.mjs +190 -143
- package/dist/web/ProductField/arrow-up.svg.js +3 -1
- package/dist/web/ProductField/arrow-up.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-no.svg.js +3 -1
- package/dist/web/ProductField/checkbox-no.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-ok.svg.js +3 -1
- package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -2
- package/dist/web/ProductField/no_data_light.svg.js +3 -1
- package/dist/web/ProductField/no_data_light.svg.mjs +2 -2
- package/dist/web/ProductField/search.svg.js +3 -1
- package/dist/web/ProductField/search.svg.mjs +2 -2
- package/dist/web/ProductField/sort.svg.js +3 -1
- package/dist/web/ProductField/sort.svg.mjs +2 -2
- package/dist/web/SkuInputCard/SkuInputCard.js +276 -1
- package/dist/web/SkuInputCard/SkuInputCard.mjs +188 -149
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +3 -1
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -2
- package/dist/web/Switch/Switch.js +70 -1
- package/dist/web/Switch/Switch.mjs +47 -37
- package/dist/web/Table/BTable.js +950 -1
- package/dist/web/Table/BTable.mjs +771 -519
- package/dist/web/Table/Column.js +5 -1
- package/dist/web/Table/Column.mjs +2 -2
- package/dist/web/Table/ColumnGroup.js +5 -1
- package/dist/web/Table/ColumnGroup.mjs +2 -2
- package/dist/web/Table/utils/columns.js +48 -1
- package/dist/web/Table/utils/columns.mjs +35 -30
- package/dist/web/Table/utils/sortFilter.js +84 -1
- package/dist/web/Table/utils/sortFilter.mjs +73 -52
- package/dist/web/Tabs/BTabs.js +150 -1
- package/dist/web/Tabs/BTabs.mjs +118 -98
- package/dist/web/Tabs/TabPane.js +8 -1
- package/dist/web/Tabs/TabPane.mjs +4 -4
- package/dist/web/Tooltip/ConfirmTooltip.js +26 -1
- package/dist/web/Tooltip/ConfirmTooltip.mjs +20 -19
- package/dist/web/Tooltip/ContentTooltip.js +94 -1
- package/dist/web/Tooltip/ContentTooltip.mjs +72 -62
- package/dist/web/Tooltip/ProgressTooltip.js +36 -1
- package/dist/web/Tooltip/ProgressTooltip.mjs +22 -20
- package/dist/web/Tooltip/TooltipWrapper.js +12 -1
- package/dist/web/Tooltip/TooltipWrapper.mjs +8 -8
- package/dist/web/Tooltip/useAutoPlacement.js +41 -1
- package/dist/web/Tooltip/useAutoPlacement.mjs +34 -25
- package/dist/web.js +51 -1
- package/dist/web.mjs +49 -49
- package/package.json +1 -1
|
@@ -1 +1,157 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
|
2
|
-
import { useState
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
/* empty css */
|
|
4
|
-
const
|
|
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
|
|
19
|
-
if (
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
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:
|
|
43
|
+
children: label
|
|
43
44
|
}
|
|
44
45
|
)
|
|
45
46
|
] });
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
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
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
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
|
|
62
|
-
const [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
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
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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__ */
|
|
127
|
+
/* @__PURE__ */ jsx("div", { className: "file-card__pdf-label", children: /* @__PURE__ */ jsx("span", { children: "PDF" }) })
|
|
103
128
|
] }),
|
|
104
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ jsx(NameRow, { fileName, onRename })
|
|
105
130
|
] });
|
|
106
131
|
}
|
|
107
|
-
function
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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__ */
|
|
145
|
+
/* @__PURE__ */ jsx(FileIcon, { fileType, fileUrl, fileName })
|
|
119
146
|
] }),
|
|
120
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ jsx(NameRow, { fileName, onRename })
|
|
121
148
|
] });
|
|
122
149
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
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
|
-
|
|
157
|
+
FileCard as default
|
|
128
158
|
};
|
package/dist/web/Icon/Icon.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
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;
|
package/dist/web/Icon/Icon.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
/* empty css */
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
7
|
+
BuIcon.displayName = "BuIcon";
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
BuIcon as default
|
|
10
10
|
};
|