@oneplatformdev/ui 0.1.99-beta.281 → 0.1.99-beta.283
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/Dropzone/Dropzone.d.ts.map +1 -1
- package/Dropzone/Dropzone.js +254 -238
- package/Dropzone/Dropzone.js.map +1 -1
- package/Dropzone/Dropzone.types.d.ts +6 -0
- package/Dropzone/Dropzone.types.d.ts.map +1 -1
- package/Dropzone/Dropzone.types.js.map +1 -1
- package/Dropzone/DropzoneSinglePickPreview.d.ts +6 -1
- package/Dropzone/DropzoneSinglePickPreview.d.ts.map +1 -1
- package/Dropzone/DropzoneSinglePickPreview.js +119 -95
- package/Dropzone/DropzoneSinglePickPreview.js.map +1 -1
- package/package.json +4 -4
package/Dropzone/Dropzone.js
CHANGED
|
@@ -1,63 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { X as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useDropzone as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Card as
|
|
7
|
-
import { DEFAULT_FILE_TYPES as
|
|
8
|
-
import { FilePreview as
|
|
9
|
-
import { DropzoneSinglePickPreview as
|
|
10
|
-
import { isFile as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { X as B, Plus as Be, UploadIcon as Se, FileTextIcon as V, InfoIcon as ee } from "lucide-react";
|
|
3
|
+
import { forwardRef as Me, useState as te, useEffect as ke, useImperativeHandle as Re } from "react";
|
|
4
|
+
import { useDropzone as We } from "react-dropzone";
|
|
5
|
+
import { cn as x } from "@oneplatformdev/utils";
|
|
6
|
+
import { Card as Ae } from "../Card/Card.js";
|
|
7
|
+
import { DEFAULT_FILE_TYPES as _e } from "./Dropzone.types.js";
|
|
8
|
+
import { FilePreview as re } from "./DropzoneFilePreview.js";
|
|
9
|
+
import { DropzoneSinglePickPreview as $e } from "./DropzoneSinglePickPreview.js";
|
|
10
|
+
import { isFile as z, isVideoUrl as Xe, extractName as Ge } from "./DropzoneUtils.js";
|
|
11
|
+
import Ke from "./icons/file-csv.svg.js";
|
|
12
|
+
import Le from "./icons/file-doc.svg.js";
|
|
13
|
+
import Oe from "./icons/file-docx.svg.js";
|
|
14
|
+
import le from "./icons/file-jpg.svg.js";
|
|
15
15
|
import Te from "./icons/file-pdf.svg.js";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import { Button as
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
import qe from "./icons/file-png.svg.js";
|
|
17
|
+
import He from "./icons/file-ppt.svg.js";
|
|
18
|
+
import Je from "./icons/file-pptx.svg.js";
|
|
19
|
+
import Pe from "./icons/file-rar.svg.js";
|
|
20
|
+
import Ye from "./icons/file-svg.svg.js";
|
|
21
|
+
import Ze from "./icons/file-webp.svg.js";
|
|
22
|
+
import Qe from "./icons/file-xls.svg.js";
|
|
23
|
+
import Ue from "./icons/file-xlsx.svg.js";
|
|
24
|
+
import Ve from "./icons/file-zip.svg.js";
|
|
25
|
+
import { Button as et } from "../Button/Button.js";
|
|
26
|
+
const b = (l = 0) => {
|
|
27
|
+
if (!l || l < 0) return "0 KB";
|
|
28
|
+
const s = 1024, m = s * 1024, a = m * 1024;
|
|
29
|
+
if (l >= a) return `${(l / a).toFixed(2)} GB`;
|
|
30
|
+
if (l >= m) {
|
|
31
|
+
const c = l / m;
|
|
32
|
+
return `${c >= 100 ? c.toFixed(0) : c.toFixed(2)} MB`;
|
|
33
|
+
}
|
|
34
|
+
return l >= s ? `${(l / s).toFixed(l / s >= 100 ? 0 : 1)} KB` : `${l} B`;
|
|
35
|
+
}, tt = {
|
|
36
|
+
csv: Ke,
|
|
37
|
+
doc: Le,
|
|
38
|
+
docx: Oe,
|
|
39
|
+
jpg: le,
|
|
40
|
+
jpeg: le,
|
|
32
41
|
pdf: Te,
|
|
33
|
-
png:
|
|
34
|
-
ppt:
|
|
35
|
-
pptx:
|
|
36
|
-
rar:
|
|
37
|
-
svg:
|
|
38
|
-
webp:
|
|
39
|
-
xls:
|
|
40
|
-
xlsx:
|
|
41
|
-
zip:
|
|
42
|
-
},
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
},
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
},
|
|
50
|
-
if (
|
|
51
|
-
if (
|
|
52
|
-
for (let
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
if (typeof
|
|
56
|
-
if (
|
|
42
|
+
png: qe,
|
|
43
|
+
ppt: He,
|
|
44
|
+
pptx: Je,
|
|
45
|
+
rar: Pe,
|
|
46
|
+
svg: Ye,
|
|
47
|
+
webp: Ze,
|
|
48
|
+
xls: Qe,
|
|
49
|
+
xlsx: Ue,
|
|
50
|
+
zip: Ve
|
|
51
|
+
}, rt = (l) => {
|
|
52
|
+
if (!l) return "";
|
|
53
|
+
const s = l.toLowerCase().split(".");
|
|
54
|
+
return s.length > 1 ? s[s.length - 1] : "";
|
|
55
|
+
}, lt = (l) => {
|
|
56
|
+
const s = rt(l);
|
|
57
|
+
return tt[s] ?? null;
|
|
58
|
+
}, it = (l, s) => {
|
|
59
|
+
if (l === s) return !0;
|
|
60
|
+
if (l.length !== s.length) return !1;
|
|
61
|
+
for (let m = 0; m < l.length; m++) {
|
|
62
|
+
const a = l[m], c = s[m];
|
|
63
|
+
if (a !== c) {
|
|
64
|
+
if (typeof a == "string" && typeof c == "string") {
|
|
65
|
+
if (a !== c) return !1;
|
|
57
66
|
continue;
|
|
58
67
|
}
|
|
59
|
-
if (
|
|
60
|
-
if (
|
|
68
|
+
if (z(a) && z(c)) {
|
|
69
|
+
if (a.name !== c.name || a.size !== c.size || a.type !== c.type || a.lastModified !== c.lastModified)
|
|
61
70
|
return !1;
|
|
62
71
|
continue;
|
|
63
72
|
}
|
|
@@ -65,109 +74,112 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, Ue = {
|
|
|
65
74
|
}
|
|
66
75
|
}
|
|
67
76
|
return !0;
|
|
68
|
-
},
|
|
77
|
+
}, nt = Me(
|
|
69
78
|
({
|
|
70
|
-
acceptTypes:
|
|
71
|
-
maxSizeMB:
|
|
72
|
-
maxFiles:
|
|
73
|
-
onErrors:
|
|
74
|
-
hideErrors:
|
|
75
|
-
disabled:
|
|
79
|
+
acceptTypes: l = _e,
|
|
80
|
+
maxSizeMB: s,
|
|
81
|
+
maxFiles: m = 1,
|
|
82
|
+
onErrors: a,
|
|
83
|
+
hideErrors: c = !1,
|
|
84
|
+
disabled: f = !1,
|
|
76
85
|
classNames: u,
|
|
77
86
|
value: v,
|
|
78
|
-
onChangeValue:
|
|
79
|
-
className:
|
|
80
|
-
labelDropzonePrompt:
|
|
81
|
-
labelDropzoneSubPrompt:
|
|
87
|
+
onChangeValue: G,
|
|
88
|
+
className: ie,
|
|
89
|
+
labelDropzonePrompt: S = "Drop files here or click to select",
|
|
90
|
+
labelDropzoneSubPrompt: ne = "",
|
|
82
91
|
labelOrClickToSelect: oe = "Upload file",
|
|
83
|
-
labelSelectedFiles:
|
|
84
|
-
labelUploadErrors:
|
|
85
|
-
labelFileTooLarge:
|
|
86
|
-
labelInvalidFileType:
|
|
87
|
-
labelVideoUploaded:
|
|
88
|
-
labelVideoReplace:
|
|
89
|
-
singlePick:
|
|
90
|
-
labelDropzoneClassname:
|
|
91
|
-
labelDropzoneSubClassname:
|
|
92
|
-
isUploading:
|
|
93
|
-
uploadProgress:
|
|
94
|
-
uploadLoadedBytes:
|
|
95
|
-
uploadTotalBytes:
|
|
96
|
-
onCancelUpload:
|
|
97
|
-
labelUploadingTitle:
|
|
98
|
-
labelUploadingHint:
|
|
99
|
-
labelUploadingActionCancel:
|
|
100
|
-
|
|
92
|
+
labelSelectedFiles: se = "Selected Files",
|
|
93
|
+
labelUploadErrors: ce = "Upload Errors",
|
|
94
|
+
labelFileTooLarge: M = "File is too large",
|
|
95
|
+
labelInvalidFileType: I = "Invalid file type",
|
|
96
|
+
labelVideoUploaded: ae = "Uploaded",
|
|
97
|
+
labelVideoReplace: de = "Replace",
|
|
98
|
+
singlePick: n = !1,
|
|
99
|
+
labelDropzoneClassname: me,
|
|
100
|
+
labelDropzoneSubClassname: fe,
|
|
101
|
+
isUploading: p = !1,
|
|
102
|
+
uploadProgress: K = 0,
|
|
103
|
+
uploadLoadedBytes: pe = 0,
|
|
104
|
+
uploadTotalBytes: xe = 0,
|
|
105
|
+
onCancelUpload: L,
|
|
106
|
+
labelUploadingTitle: he = "Uploading video...",
|
|
107
|
+
labelUploadingHint: ue = "Please do not close this page",
|
|
108
|
+
labelUploadingActionCancel: ge = "Cancel",
|
|
109
|
+
labelUploadingOf: we = "of",
|
|
110
|
+
playerTranslations: Ne,
|
|
111
|
+
singlePickFileInfo: k,
|
|
112
|
+
persistentDropzone: O = !1,
|
|
101
113
|
previewVariant: g = "default",
|
|
102
|
-
coverFirstItem:
|
|
103
|
-
...
|
|
104
|
-
},
|
|
105
|
-
const [
|
|
106
|
-
|
|
107
|
-
const o =
|
|
108
|
-
|
|
114
|
+
coverFirstItem: Fe = !1,
|
|
115
|
+
...R
|
|
116
|
+
}, ve) => {
|
|
117
|
+
const [i, y] = te(v ?? []), [h, T] = te([]), w = i[0], W = h[0]?.file, Ce = !!W?.type?.includes("image"), A = n && i.length > 0 && z(w), be = A && w.type.includes("image"), q = A && w.type.includes("video") || n && i.length > 0 && typeof w == "string" && Xe(w), H = A && !be && !q, J = n && !i.length && !!W && !Ce, N = H ? w : W, D = lt(N?.name), _ = n && q, ze = _, $ = n && i.length > 0, Ie = (t, d) => {
|
|
118
|
+
T(d), a?.(d);
|
|
119
|
+
const o = n ? t.slice(0, 1) : [...i, ...t].slice(0, m);
|
|
120
|
+
y(o), G?.(o);
|
|
109
121
|
};
|
|
110
|
-
|
|
111
|
-
v && !
|
|
112
|
-
}, [
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
122
|
+
ke(() => {
|
|
123
|
+
v && !it(i, v) && y(v);
|
|
124
|
+
}, [i, v]);
|
|
125
|
+
const E = (t, d) => {
|
|
126
|
+
if (f) return;
|
|
115
127
|
t.stopPropagation();
|
|
116
|
-
const o =
|
|
117
|
-
|
|
118
|
-
}, { getRootProps:
|
|
119
|
-
onDrop:
|
|
120
|
-
accept:
|
|
121
|
-
maxSize:
|
|
122
|
-
maxFiles:
|
|
123
|
-
disabled:
|
|
128
|
+
const o = i.filter((F, j) => j !== d);
|
|
129
|
+
y(o), G?.(o);
|
|
130
|
+
}, { getRootProps: ye, getInputProps: De, isDragActive: Ee, open: X } = We({
|
|
131
|
+
onDrop: Ie,
|
|
132
|
+
accept: l.reduce((t, d) => (t[d] = [], t), {}),
|
|
133
|
+
maxSize: s * 1024 * 1024,
|
|
134
|
+
maxFiles: n ? 1 : m,
|
|
135
|
+
disabled: f || p,
|
|
124
136
|
noClick: !0
|
|
125
137
|
});
|
|
126
|
-
|
|
127
|
-
setItems:
|
|
138
|
+
Re(ve, () => ({
|
|
139
|
+
setItems: y
|
|
128
140
|
}), []);
|
|
129
|
-
const
|
|
130
|
-
g === "default" && /* @__PURE__ */
|
|
131
|
-
|
|
141
|
+
const C = Fe && g === "image-grid" && !n && i.length > 0, P = !p && !n && O && i.length > 0, Y = C ? i.slice(1) : i, Z = !f && !n && g === "image-grid" && i.length > 0 && i.length < m, Q = !p && !n && (Y.length > 0 || Z) && /* @__PURE__ */ r("div", { className: x("w-full mt-2", u?.previewWrapper), children: [
|
|
142
|
+
g === "default" && /* @__PURE__ */ r("pre", { className: "font-semibold text-gray-600", children: [
|
|
143
|
+
se,
|
|
132
144
|
":"
|
|
133
145
|
] }),
|
|
134
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ r(
|
|
135
147
|
"ul",
|
|
136
148
|
{
|
|
137
|
-
className:
|
|
149
|
+
className: x(
|
|
138
150
|
"mt-2 text-sm text-gray-500 flex flex-wrap items-start",
|
|
139
151
|
g === "image-grid" ? "gap-2 justify-start" : "gap-4 justify-center"
|
|
140
152
|
),
|
|
141
153
|
children: [
|
|
142
|
-
|
|
143
|
-
const o =
|
|
144
|
-
return /* @__PURE__ */
|
|
154
|
+
Y.map((t, d) => {
|
|
155
|
+
const o = C ? d + 1 : d, F = z(t) ? t.name : Ge(t), j = z(t) ? b(t.size) : "";
|
|
156
|
+
return /* @__PURE__ */ r(
|
|
145
157
|
"li",
|
|
146
158
|
{
|
|
147
|
-
className:
|
|
159
|
+
className: x(
|
|
148
160
|
"relative",
|
|
149
161
|
g === "image-grid" ? "w-[75px] h-[75px]" : "flex flex-col items-center gap-2"
|
|
150
162
|
),
|
|
151
163
|
children: [
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
/* @__PURE__ */ e(
|
|
164
|
+
/* @__PURE__ */ r("div", { className: "relative w-full h-full", children: [
|
|
165
|
+
/* @__PURE__ */ e(re, { item: t, styles: u }),
|
|
154
166
|
/* @__PURE__ */ e(
|
|
155
167
|
"div",
|
|
156
168
|
{
|
|
157
|
-
className:
|
|
169
|
+
className: x(
|
|
158
170
|
"absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm",
|
|
159
171
|
g === "image-grid" && "top-1 right-1 bg-white/90 rounded-full p-0.5"
|
|
160
172
|
),
|
|
161
|
-
onClick: (
|
|
162
|
-
children: /* @__PURE__ */ e(
|
|
173
|
+
onClick: (je) => E(je, o),
|
|
174
|
+
children: /* @__PURE__ */ e(B, { size: 16, strokeWidth: 1, color: "black" })
|
|
163
175
|
}
|
|
164
176
|
)
|
|
165
177
|
] }),
|
|
166
|
-
g === "default" && /* @__PURE__ */
|
|
178
|
+
g === "default" && /* @__PURE__ */ r("span", { className: "inline-flex flex-col items-center", children: [
|
|
167
179
|
/* @__PURE__ */ e("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: F }),
|
|
168
|
-
|
|
180
|
+
j && /* @__PURE__ */ r("span", { children: [
|
|
169
181
|
"(",
|
|
170
|
-
|
|
182
|
+
j,
|
|
171
183
|
")"
|
|
172
184
|
] })
|
|
173
185
|
] })
|
|
@@ -176,14 +188,14 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, Ue = {
|
|
|
176
188
|
o
|
|
177
189
|
);
|
|
178
190
|
}),
|
|
179
|
-
|
|
191
|
+
Z && /* @__PURE__ */ e(
|
|
180
192
|
"li",
|
|
181
193
|
{
|
|
182
194
|
className: "relative w-[75px] h-[75px] flex items-center justify-center rounded-[8px] border border-dashed border-[#9368FF80] bg-[#FCFCFC] cursor-pointer hover:bg-[#9368FF0F]",
|
|
183
195
|
onClick: (t) => {
|
|
184
|
-
t.stopPropagation(), !(
|
|
196
|
+
t.stopPropagation(), !(f || p) && X();
|
|
185
197
|
},
|
|
186
|
-
children: /* @__PURE__ */ e("div", { className: "flex size-6 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(
|
|
198
|
+
children: /* @__PURE__ */ e("div", { className: "flex size-6 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(Be, { size: 16, className: "text-[#9368FF]" }) })
|
|
187
199
|
},
|
|
188
200
|
"add-more"
|
|
189
201
|
)
|
|
@@ -191,93 +203,95 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, Ue = {
|
|
|
191
203
|
}
|
|
192
204
|
)
|
|
193
205
|
] });
|
|
194
|
-
return /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
|
|
206
|
+
return /* @__PURE__ */ r("div", { className: "w-full select-none", children: [
|
|
207
|
+
/* @__PURE__ */ r(
|
|
208
|
+
Ae,
|
|
197
209
|
{
|
|
198
|
-
...
|
|
199
|
-
...
|
|
210
|
+
...R,
|
|
211
|
+
...ye({
|
|
200
212
|
onClick: (t) => {
|
|
201
|
-
if (!(
|
|
202
|
-
if (
|
|
203
|
-
|
|
213
|
+
if (!(f || p)) {
|
|
214
|
+
if (ze) {
|
|
215
|
+
R.onClick?.(t);
|
|
204
216
|
return;
|
|
205
217
|
}
|
|
206
|
-
|
|
218
|
+
X(), R.onClick?.(t);
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
221
|
}),
|
|
210
|
-
className:
|
|
222
|
+
className: x(
|
|
211
223
|
"w-full text-center flex flex-col items-center justify-center gap-6 cursor-pointer",
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
224
|
+
!$ && "border border-dashed border-[#9368FF80] rounded-[8px] bg-[#FCFCFC] p-4",
|
|
225
|
+
$ && "min-h-0 border-0 bg-transparent p-0",
|
|
226
|
+
C && "relative",
|
|
227
|
+
f && "border-[#E4E4E7] pointer-events-none",
|
|
228
|
+
h.length > 0 && !$ && "border-red-500",
|
|
229
|
+
Ee && "bg-gray-100",
|
|
230
|
+
n && "shadow-none!",
|
|
231
|
+
n && i.length > 0 && !_ && "p-0! shadow-none!",
|
|
232
|
+
_ && "h-auto! max-h-none! min-h-0! p-2!",
|
|
233
|
+
ie
|
|
222
234
|
),
|
|
223
235
|
children: [
|
|
224
|
-
/* @__PURE__ */ e("input", { ...
|
|
225
|
-
|
|
236
|
+
/* @__PURE__ */ e("input", { ...De() }),
|
|
237
|
+
p && /* @__PURE__ */ r(
|
|
226
238
|
"div",
|
|
227
239
|
{
|
|
228
240
|
className: "w-full h-full min-h-46 rounded-lg border border-[#E4E4E7] bg-[#FCFCFC] flex flex-col items-center justify-center gap-4 p-4",
|
|
229
241
|
onClick: (t) => t.stopPropagation(),
|
|
230
242
|
children: [
|
|
231
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ r("div", { className: "relative h-24 w-24", children: [
|
|
232
244
|
/* @__PURE__ */ e("svg", { className: "h-24 w-24", viewBox: "0 0 100 100", children: /* @__PURE__ */ e("circle", { cx: "50", cy: "50", r: "42", stroke: "#E6E1F5", strokeWidth: "8", fill: "none" }) }),
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
Math.max(0, Math.min(100, Math.round(
|
|
245
|
+
/* @__PURE__ */ r("span", { className: "absolute inset-0 flex items-center justify-center text-lg font-semibold text-foreground", children: [
|
|
246
|
+
Math.max(0, Math.min(100, Math.round(K))),
|
|
235
247
|
"%"
|
|
236
248
|
] })
|
|
237
249
|
] }),
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
/* @__PURE__ */ e("p", { className: "text-xl font-semibold text-foreground", children:
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
|
|
242
|
-
"
|
|
243
|
-
|
|
250
|
+
/* @__PURE__ */ r("div", { className: "text-center", children: [
|
|
251
|
+
/* @__PURE__ */ e("p", { className: "text-xl font-semibold text-foreground", children: he }),
|
|
252
|
+
/* @__PURE__ */ r("p", { className: "text-sm text-[#666A78]", children: [
|
|
253
|
+
b(pe),
|
|
254
|
+
" ",
|
|
255
|
+
we,
|
|
256
|
+
" ",
|
|
257
|
+
b(xe)
|
|
244
258
|
] }),
|
|
245
|
-
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-[#666A78]", children:
|
|
259
|
+
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-[#666A78]", children: ue })
|
|
246
260
|
] }),
|
|
247
261
|
/* @__PURE__ */ e("div", { className: "w-full max-w-[520px] h-2 rounded-full bg-[#E6E1F5] overflow-hidden", children: /* @__PURE__ */ e(
|
|
248
262
|
"div",
|
|
249
263
|
{
|
|
250
264
|
className: "h-full bg-[#9368FF] transition-[width] duration-150 ease-linear",
|
|
251
|
-
style: { width: `${Math.max(0, Math.min(100,
|
|
265
|
+
style: { width: `${Math.max(0, Math.min(100, K))}%` }
|
|
252
266
|
}
|
|
253
267
|
) }),
|
|
254
|
-
|
|
268
|
+
L && /* @__PURE__ */ e(
|
|
255
269
|
"button",
|
|
256
270
|
{
|
|
257
271
|
type: "button",
|
|
258
272
|
className: "mt-1 h-10 min-w-36 rounded-md border border-[#E4E4E7] bg-white px-6 text-base font-medium text-foreground cursor-pointer",
|
|
259
273
|
onClick: (t) => {
|
|
260
|
-
t.stopPropagation(),
|
|
274
|
+
t.stopPropagation(), L();
|
|
261
275
|
},
|
|
262
|
-
children:
|
|
276
|
+
children: ge
|
|
263
277
|
}
|
|
264
278
|
)
|
|
265
279
|
]
|
|
266
280
|
}
|
|
267
281
|
),
|
|
268
|
-
!
|
|
282
|
+
!p && C && /* @__PURE__ */ r(
|
|
269
283
|
"div",
|
|
270
284
|
{
|
|
271
285
|
className: "absolute inset-0 rounded-[8px] overflow-hidden",
|
|
272
286
|
onClick: (t) => t.stopPropagation(),
|
|
273
287
|
children: [
|
|
274
288
|
/* @__PURE__ */ e(
|
|
275
|
-
|
|
289
|
+
re,
|
|
276
290
|
{
|
|
277
|
-
item:
|
|
291
|
+
item: i[0],
|
|
278
292
|
styles: {
|
|
279
293
|
...u,
|
|
280
|
-
previewWraper:
|
|
294
|
+
previewWraper: x(
|
|
281
295
|
"w-full h-full rounded-[8px] border-0",
|
|
282
296
|
u?.previewWraper?.replace(/w-\[[^\]]+\]|h-\[[^\]]+\]/g, "")
|
|
283
297
|
)
|
|
@@ -288,47 +302,47 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, Ue = {
|
|
|
288
302
|
"div",
|
|
289
303
|
{
|
|
290
304
|
className: "absolute top-2 right-2 cursor-pointer bg-white/90 rounded-full p-1",
|
|
291
|
-
onClick: (t) =>
|
|
292
|
-
children: /* @__PURE__ */ e(
|
|
305
|
+
onClick: (t) => E(t, 0),
|
|
306
|
+
children: /* @__PURE__ */ e(B, { size: 16, strokeWidth: 1, color: "black" })
|
|
293
307
|
}
|
|
294
308
|
)
|
|
295
309
|
]
|
|
296
310
|
}
|
|
297
311
|
),
|
|
298
|
-
!
|
|
312
|
+
!p && (i.length === 0 || !n && O) && (h.length === 0 || !n) && /* @__PURE__ */ r(
|
|
299
313
|
"div",
|
|
300
314
|
{
|
|
301
|
-
className:
|
|
315
|
+
className: x(
|
|
302
316
|
"flex flex-col items-center gap-2 w-full",
|
|
303
317
|
u?.idleWrapper,
|
|
304
|
-
|
|
318
|
+
C && "invisible"
|
|
305
319
|
),
|
|
306
320
|
children: [
|
|
307
|
-
/* @__PURE__ */ e("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(
|
|
308
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-1 w-full", children: !
|
|
321
|
+
/* @__PURE__ */ e("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(Se, { className: "size-6 text-[#9368FF]" }) }),
|
|
322
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-1 w-full", children: !f && /* @__PURE__ */ r(U, { children: [
|
|
309
323
|
/* @__PURE__ */ e(
|
|
310
324
|
"span",
|
|
311
325
|
{
|
|
312
|
-
className:
|
|
326
|
+
className: x(
|
|
313
327
|
"font-semibold text-[14px] leading-[125%] text-[#06080D] text-center w-full whitespace-pre-line",
|
|
314
|
-
|
|
328
|
+
me
|
|
315
329
|
),
|
|
316
|
-
children:
|
|
330
|
+
children: S
|
|
317
331
|
}
|
|
318
332
|
),
|
|
319
333
|
/* @__PURE__ */ e(
|
|
320
334
|
"span",
|
|
321
335
|
{
|
|
322
|
-
className:
|
|
336
|
+
className: x(
|
|
323
337
|
"font-medium text-[12px] leading-[120%] text-[#666A78] text-center w-full whitespace-pre-line",
|
|
324
|
-
|
|
338
|
+
fe
|
|
325
339
|
),
|
|
326
|
-
children:
|
|
340
|
+
children: ne
|
|
327
341
|
}
|
|
328
342
|
)
|
|
329
343
|
] }) }),
|
|
330
|
-
!
|
|
331
|
-
|
|
344
|
+
!f && /* @__PURE__ */ e(
|
|
345
|
+
et,
|
|
332
346
|
{
|
|
333
347
|
type: "button",
|
|
334
348
|
size: "md",
|
|
@@ -338,130 +352,132 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, Ue = {
|
|
|
338
352
|
]
|
|
339
353
|
}
|
|
340
354
|
),
|
|
341
|
-
!
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
|
|
355
|
+
!p && n && h.length > 0 && !J && /* @__PURE__ */ r("div", { className: x("w-full mt-4", u?.errorWrapper), children: [
|
|
356
|
+
/* @__PURE__ */ r("span", { className: "font-semibold text-red-500", children: [
|
|
357
|
+
ce,
|
|
344
358
|
":"
|
|
345
359
|
] }),
|
|
346
|
-
/* @__PURE__ */ e("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children:
|
|
360
|
+
/* @__PURE__ */ e("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: h.map((t, d) => /* @__PURE__ */ r("li", { children: [
|
|
347
361
|
t.file.name,
|
|
348
362
|
" (",
|
|
349
|
-
(t.file.size
|
|
350
|
-
"
|
|
351
|
-
!
|
|
352
|
-
o.code === "file-too-large" &&
|
|
353
|
-
o.code === "file-invalid-type" &&
|
|
363
|
+
b(t.file.size),
|
|
364
|
+
")",
|
|
365
|
+
!c && /* @__PURE__ */ e("ul", { className: "ml-4 list-disc list-inside", children: t.errors.map((o, F) => /* @__PURE__ */ r("li", { children: [
|
|
366
|
+
o.code === "file-too-large" && M,
|
|
367
|
+
o.code === "file-invalid-type" && I,
|
|
354
368
|
o.code !== "file-too-large" && o.code !== "file-invalid-type" && o.message
|
|
355
369
|
] }, F)) })
|
|
356
|
-
] },
|
|
370
|
+
] }, d)) })
|
|
357
371
|
] }),
|
|
358
|
-
!
|
|
372
|
+
!p && !!(n && i.length) && /* @__PURE__ */ e(U, { children: H ? /* @__PURE__ */ r(
|
|
359
373
|
"div",
|
|
360
374
|
{
|
|
361
375
|
className: "w-full max-w-[502px] flex flex-col items-center gap-4",
|
|
362
376
|
onClick: (t) => t.stopPropagation(),
|
|
363
377
|
children: [
|
|
364
|
-
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children:
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
|
|
378
|
+
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children: S }),
|
|
379
|
+
/* @__PURE__ */ r("div", { className: "w-full min-h-[72px] rounded-[8px] bg-[#F5F5F5] p-4 flex items-center gap-4", children: [
|
|
380
|
+
D ? /* @__PURE__ */ e(
|
|
367
381
|
"img",
|
|
368
382
|
{
|
|
369
|
-
src:
|
|
383
|
+
src: D,
|
|
370
384
|
alt: "",
|
|
371
385
|
className: "size-10 shrink-0"
|
|
372
386
|
}
|
|
373
|
-
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children:
|
|
376
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children:
|
|
387
|
+
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(V, { size: 20 }) }),
|
|
388
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col items-start text-left gap-1 min-w-0 flex-1", children: [
|
|
389
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children: k?.name || N?.name }),
|
|
390
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children: b(k?.size || N?.size) })
|
|
377
391
|
] }),
|
|
378
|
-
!
|
|
392
|
+
!f && /* @__PURE__ */ e(
|
|
379
393
|
"div",
|
|
380
394
|
{
|
|
381
395
|
className: "size-6 flex items-center justify-center cursor-pointer",
|
|
382
|
-
onClick: (t) =>
|
|
383
|
-
children: /* @__PURE__ */ e(
|
|
396
|
+
onClick: (t) => E(t, 0),
|
|
397
|
+
children: /* @__PURE__ */ e(B, { size: 24, color: "#06080D" })
|
|
384
398
|
}
|
|
385
399
|
)
|
|
386
400
|
] })
|
|
387
401
|
]
|
|
388
402
|
}
|
|
389
403
|
) : /* @__PURE__ */ e(
|
|
390
|
-
|
|
404
|
+
$e,
|
|
391
405
|
{
|
|
392
|
-
item:
|
|
393
|
-
onRemoveClick: (t) =>
|
|
406
|
+
item: i[0],
|
|
407
|
+
onRemoveClick: (t) => E(t, 0),
|
|
394
408
|
onReplaceClick: (t) => {
|
|
395
|
-
t.stopPropagation(), !
|
|
409
|
+
t.stopPropagation(), !f && X();
|
|
396
410
|
},
|
|
397
|
-
labelUploaded:
|
|
398
|
-
labelReplace:
|
|
399
|
-
|
|
411
|
+
labelUploaded: ae,
|
|
412
|
+
labelReplace: de,
|
|
413
|
+
fileInfo: k,
|
|
414
|
+
disabled: f,
|
|
415
|
+
playerTranslations: Ne
|
|
400
416
|
}
|
|
401
417
|
) }),
|
|
402
|
-
!
|
|
418
|
+
!p && J && /* @__PURE__ */ r(
|
|
403
419
|
"div",
|
|
404
420
|
{
|
|
405
421
|
className: "w-full max-w-[502px] flex flex-col items-center gap-4",
|
|
406
422
|
onClick: (t) => t.stopPropagation(),
|
|
407
423
|
children: [
|
|
408
|
-
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children:
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
|
|
424
|
+
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children: S }),
|
|
425
|
+
/* @__PURE__ */ r("div", { className: "w-full min-h-[72px] rounded-[8px] bg-[#F5F5F5] p-4 flex items-center gap-4", children: [
|
|
426
|
+
D ? /* @__PURE__ */ e(
|
|
411
427
|
"img",
|
|
412
428
|
{
|
|
413
|
-
src:
|
|
429
|
+
src: D,
|
|
414
430
|
alt: "",
|
|
415
431
|
className: "size-10 shrink-0"
|
|
416
432
|
}
|
|
417
|
-
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children:
|
|
420
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children:
|
|
433
|
+
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(V, { size: 20 }) }),
|
|
434
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col items-start text-left gap-1 min-w-0 flex-1", children: [
|
|
435
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children: N?.name }),
|
|
436
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children: N ? `${(N.size / (1024 * 1024)).toFixed(0)} MB` : "" })
|
|
421
437
|
] }),
|
|
422
|
-
!
|
|
438
|
+
!f && /* @__PURE__ */ e(
|
|
423
439
|
"div",
|
|
424
440
|
{
|
|
425
441
|
className: "size-6 flex items-center justify-center cursor-pointer",
|
|
426
442
|
onClick: (t) => {
|
|
427
|
-
t.stopPropagation(),
|
|
443
|
+
t.stopPropagation(), T([]);
|
|
428
444
|
},
|
|
429
|
-
children: /* @__PURE__ */ e(
|
|
445
|
+
children: /* @__PURE__ */ e(B, { size: 24, color: "#06080D" })
|
|
430
446
|
}
|
|
431
447
|
)
|
|
432
448
|
] }),
|
|
433
|
-
/* @__PURE__ */
|
|
434
|
-
/* @__PURE__ */ e(
|
|
435
|
-
/* @__PURE__ */ e("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children:
|
|
449
|
+
/* @__PURE__ */ r("div", { className: "w-full bg-[#DC26260F] p-4 flex items-start gap-4", children: [
|
|
450
|
+
/* @__PURE__ */ e(ee, { size: 20, color: "#DC2626" }),
|
|
451
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children: h[0]?.errors?.[0]?.code === "file-too-large" ? M : h[0]?.errors?.[0]?.message || I })
|
|
436
452
|
] })
|
|
437
453
|
]
|
|
438
454
|
}
|
|
439
455
|
),
|
|
440
|
-
!
|
|
456
|
+
!P && Q
|
|
441
457
|
]
|
|
442
458
|
}
|
|
443
459
|
),
|
|
444
|
-
|
|
445
|
-
!
|
|
460
|
+
P && /* @__PURE__ */ e("div", { className: "w-full", children: Q }),
|
|
461
|
+
!p && !n && h.length > 0 && /* @__PURE__ */ e(
|
|
446
462
|
"div",
|
|
447
463
|
{
|
|
448
|
-
className:
|
|
449
|
-
children:
|
|
450
|
-
const o = t.errors[0], F = o?.code === "file-too-large" ?
|
|
451
|
-
return /* @__PURE__ */
|
|
464
|
+
className: x("w-full mt-4 flex flex-col gap-2", u?.errorWrapper),
|
|
465
|
+
children: h.map((t, d) => {
|
|
466
|
+
const o = t.errors[0], F = o?.code === "file-too-large" ? M : o?.code === "file-invalid-type" ? I : o?.message || I;
|
|
467
|
+
return /* @__PURE__ */ r(
|
|
452
468
|
"div",
|
|
453
469
|
{
|
|
454
470
|
className: "w-full bg-[#DC26260F] p-4 flex items-start gap-4 rounded-[8px]",
|
|
455
471
|
children: [
|
|
456
|
-
/* @__PURE__ */ e(
|
|
457
|
-
/* @__PURE__ */
|
|
472
|
+
/* @__PURE__ */ e(ee, { size: 20, color: "#DC2626", className: "shrink-0" }),
|
|
473
|
+
/* @__PURE__ */ r("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children: [
|
|
458
474
|
/* @__PURE__ */ e("span", { className: "font-semibold", children: t.file.name }),
|
|
459
475
|
" — ",
|
|
460
476
|
F
|
|
461
477
|
] })
|
|
462
478
|
]
|
|
463
479
|
},
|
|
464
|
-
|
|
480
|
+
d
|
|
465
481
|
);
|
|
466
482
|
})
|
|
467
483
|
}
|
|
@@ -469,8 +485,8 @@ const le = (n = 0) => `${(n / (1024 * 1024)).toFixed(0)} MB`, Ue = {
|
|
|
469
485
|
] });
|
|
470
486
|
}
|
|
471
487
|
);
|
|
472
|
-
|
|
488
|
+
nt.displayName = "Dropzone";
|
|
473
489
|
export {
|
|
474
|
-
|
|
490
|
+
nt as Dropzone
|
|
475
491
|
};
|
|
476
492
|
//# sourceMappingURL=Dropzone.js.map
|