@geekapps/silo-elements-nextjs 0.2.36 → 0.2.37
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/FileUploader.js +145 -166
- package/dist/FileUploader.js.map +1 -1
- package/dist/ImageUploader.js +121 -100
- package/dist/ImageUploader.js.map +1 -1
- package/dist/MediaUploader.js +403 -359
- package/dist/MediaUploader.js.map +1 -1
- package/dist/VideoUploader.js +151 -125
- package/dist/VideoUploader.js.map +1 -1
- package/dist/components/DropZone.js +4 -4
- package/dist/components/DropZone.js.map +1 -1
- package/dist/components/ProgressBar.js +8 -2
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +581 -521
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -1
- package/package.json +6 -6
- package/styles.css +2 -0
package/dist/FileUploader.js
CHANGED
|
@@ -89,9 +89,9 @@ function DropZone({
|
|
|
89
89
|
...style
|
|
90
90
|
};
|
|
91
91
|
const cls = [
|
|
92
|
-
"
|
|
93
|
-
dragging ? "
|
|
94
|
-
disabled ? "
|
|
92
|
+
"border-2 border-dashed border-slate-200 rounded-xl bg-slate-50 text-slate-900 cursor-pointer outline-none transition-colors duration-150",
|
|
93
|
+
dragging ? "border-indigo-500 bg-slate-100" : "hover:border-indigo-500 hover:bg-slate-100",
|
|
94
|
+
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
95
95
|
className
|
|
96
96
|
].filter(Boolean).join(" ");
|
|
97
97
|
return /* @__PURE__ */ jsxs(
|
|
@@ -120,7 +120,7 @@ function DropZone({
|
|
|
120
120
|
type: "file",
|
|
121
121
|
accept,
|
|
122
122
|
multiple,
|
|
123
|
-
|
|
123
|
+
className: "hidden",
|
|
124
124
|
onChange: handleChange,
|
|
125
125
|
disabled
|
|
126
126
|
}
|
|
@@ -134,13 +134,19 @@ function ProgressBar({ progress, className = "", style }) {
|
|
|
134
134
|
return /* @__PURE__ */ jsx(
|
|
135
135
|
"div",
|
|
136
136
|
{
|
|
137
|
-
className: `
|
|
137
|
+
className: `h-1 rounded-full bg-slate-200 overflow-hidden${className ? ` ${className}` : ""}`,
|
|
138
138
|
style,
|
|
139
139
|
role: "progressbar",
|
|
140
140
|
"aria-valuenow": progress,
|
|
141
141
|
"aria-valuemin": 0,
|
|
142
142
|
"aria-valuemax": 100,
|
|
143
|
-
children: /* @__PURE__ */ jsx(
|
|
143
|
+
children: /* @__PURE__ */ jsx(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: "h-full rounded-full bg-indigo-500 transition-[width] duration-200 ease-linear",
|
|
147
|
+
style: { width: `${progress}%` }
|
|
148
|
+
}
|
|
149
|
+
)
|
|
144
150
|
}
|
|
145
151
|
);
|
|
146
152
|
}
|
|
@@ -153,60 +159,38 @@ var FORMATS = [
|
|
|
153
159
|
function ImageOptions({ value, onChange, style }) {
|
|
154
160
|
const fmt = value.format ?? "webp";
|
|
155
161
|
const optimize = value.optimize ?? true;
|
|
156
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5", style, children: [
|
|
157
163
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
158
|
-
/* @__PURE__ */ jsx("div", {
|
|
159
|
-
/* @__PURE__ */ jsx("div", {
|
|
164
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-1.5", children: "Formato de sa\xEDda" }),
|
|
165
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: FORMATS.map((f) => /* @__PURE__ */ jsx(
|
|
160
166
|
"button",
|
|
161
167
|
{
|
|
162
168
|
type: "button",
|
|
163
169
|
onClick: () => onChange({ ...value, format: f.value }),
|
|
164
170
|
title: f.hint,
|
|
165
|
-
|
|
166
|
-
padding: "4px 12px",
|
|
167
|
-
borderRadius: 6,
|
|
168
|
-
border: `1px solid ${fmt === f.value ? "var(--silo-accent, #6366f1)" : "var(--silo-border, #e2e8f0)"}`,
|
|
169
|
-
background: fmt === f.value ? "var(--silo-accent, #6366f1)" : "transparent",
|
|
170
|
-
color: fmt === f.value ? "#fff" : "var(--silo-text, #0f172a)",
|
|
171
|
-
fontSize: 12,
|
|
172
|
-
fontWeight: 600,
|
|
173
|
-
cursor: "pointer"
|
|
174
|
-
},
|
|
171
|
+
className: `py-1 px-3 rounded-md text-xs font-semibold cursor-pointer transition-colors border ${fmt === f.value ? "border-indigo-500 bg-indigo-500 text-white" : "border-slate-200 bg-transparent text-slate-900 hover:bg-slate-100"}`,
|
|
175
172
|
children: f.label
|
|
176
173
|
},
|
|
177
174
|
f.value
|
|
178
175
|
)) })
|
|
179
176
|
] }),
|
|
180
|
-
/* @__PURE__ */ jsxs("label", {
|
|
177
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
|
|
181
178
|
/* @__PURE__ */ jsx(
|
|
182
179
|
"span",
|
|
183
180
|
{
|
|
184
181
|
onClick: () => onChange({ ...value, optimize: !optimize }),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
cursor: "pointer"
|
|
194
|
-
},
|
|
195
|
-
children: /* @__PURE__ */ jsx("span", { style: {
|
|
196
|
-
position: "absolute",
|
|
197
|
-
top: 2,
|
|
198
|
-
left: optimize ? 18 : 2,
|
|
199
|
-
width: 16,
|
|
200
|
-
height: 16,
|
|
201
|
-
borderRadius: "50%",
|
|
202
|
-
background: "#fff",
|
|
203
|
-
transition: "left 0.15s",
|
|
204
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
205
|
-
} })
|
|
182
|
+
className: `relative w-9 h-5 rounded-full shrink-0 cursor-pointer transition-colors duration-150 ${optimize ? "bg-indigo-500" : "bg-slate-200"}`,
|
|
183
|
+
children: /* @__PURE__ */ jsx(
|
|
184
|
+
"span",
|
|
185
|
+
{
|
|
186
|
+
className: "absolute top-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-[left] duration-150",
|
|
187
|
+
style: { left: optimize ? "18px" : "2px" }
|
|
188
|
+
}
|
|
189
|
+
)
|
|
206
190
|
}
|
|
207
191
|
),
|
|
208
|
-
/* @__PURE__ */ jsx("span", {
|
|
209
|
-
/* @__PURE__ */ jsx("span", {
|
|
192
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-slate-900 font-medium", children: "Otimizar tamanho" }),
|
|
193
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-slate-400", children: optimize ? "Qualidade 85 \u2014 menor tamanho" : "Qualidade m\xE1xima" })
|
|
210
194
|
] })
|
|
211
195
|
] });
|
|
212
196
|
}
|
|
@@ -225,6 +209,27 @@ var RESOLUTION_LABELS = {
|
|
|
225
209
|
"1440": "1440p",
|
|
226
210
|
"2160": "4K"
|
|
227
211
|
};
|
|
212
|
+
function optionBtnCls(active) {
|
|
213
|
+
return `py-1 px-2.5 rounded-md text-xs font-semibold cursor-pointer transition-colors border ${active ? "border-indigo-500 bg-indigo-500 text-white" : "border-slate-200 bg-transparent text-slate-900 hover:bg-slate-100"}`;
|
|
214
|
+
}
|
|
215
|
+
function Toggle({ checked, onToggle, label }) {
|
|
216
|
+
return /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-1.5 cursor-pointer select-none text-xs text-slate-900 font-medium", onClick: onToggle, children: [
|
|
217
|
+
/* @__PURE__ */ jsx(
|
|
218
|
+
"span",
|
|
219
|
+
{
|
|
220
|
+
className: `relative inline-block w-8 h-[18px] rounded-full shrink-0 cursor-pointer transition-colors duration-150 ${checked ? "bg-indigo-500" : "bg-slate-200"}`,
|
|
221
|
+
children: /* @__PURE__ */ jsx(
|
|
222
|
+
"span",
|
|
223
|
+
{
|
|
224
|
+
className: "absolute top-0.5 w-3.5 h-3.5 rounded-full bg-white shadow-sm transition-[left] duration-150",
|
|
225
|
+
style: { left: checked ? "16px" : "2px" }
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
label
|
|
231
|
+
] });
|
|
232
|
+
}
|
|
228
233
|
function VideoOptions({ value, onChange, style }) {
|
|
229
234
|
const codec = value.codec ?? "h264";
|
|
230
235
|
const transcoding = value.transcoding ?? "auto";
|
|
@@ -241,76 +246,31 @@ function VideoOptions({ value, onChange, style }) {
|
|
|
241
246
|
function toggleFeature(key) {
|
|
242
247
|
onChange({ ...value, [key]: !value[key] });
|
|
243
248
|
}
|
|
244
|
-
|
|
245
|
-
padding: "4px 10px",
|
|
246
|
-
borderRadius: 6,
|
|
247
|
-
border: `1px solid ${active ? "var(--silo-accent, #6366f1)" : "var(--silo-border, #e2e8f0)"}`,
|
|
248
|
-
background: active ? "var(--silo-accent, #6366f1)" : "transparent",
|
|
249
|
-
color: active ? "#fff" : "var(--silo-text, #0f172a)",
|
|
250
|
-
fontSize: 12,
|
|
251
|
-
fontWeight: 600,
|
|
252
|
-
cursor: "pointer"
|
|
253
|
-
});
|
|
254
|
-
const toggle = (on) => ({
|
|
255
|
-
display: "inline-flex",
|
|
256
|
-
alignItems: "center",
|
|
257
|
-
gap: 6,
|
|
258
|
-
cursor: "pointer",
|
|
259
|
-
userSelect: "none",
|
|
260
|
-
fontSize: 12,
|
|
261
|
-
color: "var(--silo-text, #0f172a)",
|
|
262
|
-
fontWeight: 500
|
|
263
|
-
});
|
|
264
|
-
function Toggle({ checked, onToggle, label }) {
|
|
265
|
-
return /* @__PURE__ */ jsxs("label", { style: toggle(), onClick: onToggle, children: [
|
|
266
|
-
/* @__PURE__ */ jsx("span", { style: {
|
|
267
|
-
width: 32,
|
|
268
|
-
height: 18,
|
|
269
|
-
borderRadius: 9,
|
|
270
|
-
flexShrink: 0,
|
|
271
|
-
background: checked ? "var(--silo-accent, #6366f1)" : "var(--silo-border, #e2e8f0)",
|
|
272
|
-
position: "relative",
|
|
273
|
-
transition: "background 0.15s",
|
|
274
|
-
cursor: "pointer"
|
|
275
|
-
}, children: /* @__PURE__ */ jsx("span", { style: {
|
|
276
|
-
position: "absolute",
|
|
277
|
-
top: 2,
|
|
278
|
-
left: checked ? 16 : 2,
|
|
279
|
-
width: 14,
|
|
280
|
-
height: 14,
|
|
281
|
-
borderRadius: "50%",
|
|
282
|
-
background: "#fff",
|
|
283
|
-
transition: "left 0.15s",
|
|
284
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
285
|
-
} }) }),
|
|
286
|
-
label
|
|
287
|
-
] });
|
|
288
|
-
}
|
|
289
|
-
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12, ...style }, children: [
|
|
249
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", style, children: [
|
|
290
250
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
291
|
-
/* @__PURE__ */ jsx("div", {
|
|
292
|
-
/* @__PURE__ */ jsx("div", {
|
|
251
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-1.5", children: "Codec" }),
|
|
252
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: CODECS.map((c) => /* @__PURE__ */ jsx(
|
|
293
253
|
"button",
|
|
294
254
|
{
|
|
295
255
|
type: "button",
|
|
296
256
|
title: c.hint,
|
|
297
257
|
onClick: () => onChange({ ...value, codec: c.value }),
|
|
298
|
-
|
|
258
|
+
className: optionBtnCls(codec === c.value),
|
|
299
259
|
children: c.label
|
|
300
260
|
},
|
|
301
261
|
c.value
|
|
302
262
|
)) })
|
|
303
263
|
] }),
|
|
304
264
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
305
|
-
/* @__PURE__ */ jsx("div", {
|
|
306
|
-
/* @__PURE__ */ jsxs("div", {
|
|
307
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, transcoding: "auto" }),
|
|
265
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-1.5", children: "Resolu\xE7\xF5es" }),
|
|
266
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
|
|
267
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, transcoding: "auto" }), className: optionBtnCls(isAuto), children: "Auto" }),
|
|
308
268
|
RESOLUTIONS.map((r) => /* @__PURE__ */ jsx(
|
|
309
269
|
"button",
|
|
310
270
|
{
|
|
311
271
|
type: "button",
|
|
312
272
|
onClick: () => toggleRes(r),
|
|
313
|
-
|
|
273
|
+
className: optionBtnCls(!isAuto && selectedRes.includes(r)),
|
|
314
274
|
children: RESOLUTION_LABELS[r]
|
|
315
275
|
},
|
|
316
276
|
r
|
|
@@ -318,8 +278,8 @@ function VideoOptions({ value, onChange, style }) {
|
|
|
318
278
|
] })
|
|
319
279
|
] }),
|
|
320
280
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
321
|
-
/* @__PURE__ */ jsx("div", {
|
|
322
|
-
/* @__PURE__ */ jsxs("div", {
|
|
281
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-bold text-slate-500 uppercase tracking-[0.05em] mb-2", children: "Recursos" }),
|
|
282
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
323
283
|
/* @__PURE__ */ jsx(Toggle, { checked: value.thumbnails ?? true, onToggle: () => toggleFeature("thumbnails"), label: "Gerar thumbnails" }),
|
|
324
284
|
/* @__PURE__ */ jsx(Toggle, { checked: value.storyboard ?? false, onToggle: () => toggleFeature("storyboard"), label: "Gerar storyboard" }),
|
|
325
285
|
/* @__PURE__ */ jsx(Toggle, { checked: value.autoCaptions ?? false, onToggle: () => toggleFeature("autoCaptions"), label: "Legendas autom\xE1ticas (IA)" }),
|
|
@@ -396,11 +356,6 @@ function FileUploader({
|
|
|
396
356
|
const vars = themeToVars(t);
|
|
397
357
|
const containerStyle = {
|
|
398
358
|
...vars,
|
|
399
|
-
display: "flex",
|
|
400
|
-
flexDirection: "column",
|
|
401
|
-
gap: "12px",
|
|
402
|
-
width: "100%",
|
|
403
|
-
fontFamily: "var(--silo-font)",
|
|
404
359
|
...style
|
|
405
360
|
};
|
|
406
361
|
const single = useMultipartUpload(bucket);
|
|
@@ -477,9 +432,9 @@ function FileUploader({
|
|
|
477
432
|
const isBatchUploading = batch.state.status === "uploading" || batch.state.status === "preparing";
|
|
478
433
|
const isUploading = isSingleUploading || isBatchUploading;
|
|
479
434
|
const singleProgress = single.state.status === "uploading" ? single.state.progress : single.state.status === "completing" ? 99 : 0;
|
|
480
|
-
if (single.state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderError(single.state.error, single.reset) });
|
|
481
|
-
if (single.state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { style: containerStyle, children: renderSuccess(single.state.result) });
|
|
482
|
-
return /* @__PURE__ */ jsxs("div", { className: `
|
|
435
|
+
if (single.state.status === "error" && renderError) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderError(single.state.error, single.reset) });
|
|
436
|
+
if (single.state.status === "done" && renderSuccess) return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 w-full", style: containerStyle, children: renderSuccess(single.state.result) });
|
|
437
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-3 w-full${className ? ` ${className}` : ""}`, style: containerStyle, children: [
|
|
483
438
|
!isBatch && !staged && /* @__PURE__ */ jsx(
|
|
484
439
|
DropZone,
|
|
485
440
|
{
|
|
@@ -491,12 +446,12 @@ function FileUploader({
|
|
|
491
446
|
disabled: disabled || isUploading,
|
|
492
447
|
onFiles: handleFiles,
|
|
493
448
|
style: { padding: "28px 24px", textAlign: "center" },
|
|
494
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
495
|
-
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "
|
|
449
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
450
|
+
renderIcon ? renderIcon() : /* @__PURE__ */ jsx("svg", { width: "40", height: "40", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", className: "text-slate-400 opacity-50", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5" }) }),
|
|
496
451
|
children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
497
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
498
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
499
|
-
maxSize && /* @__PURE__ */ jsxs("span", { className: "
|
|
452
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-900 font-bold text-[15px]", children: multiple ? "Arraste seus arquivos aqui" : "Arraste seu arquivo aqui" }),
|
|
453
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-500 text-[13px]", children: "ou clique para escolher do seu dispositivo" }),
|
|
454
|
+
maxSize && /* @__PURE__ */ jsxs("span", { className: "text-slate-400 text-[12px]", children: [
|
|
500
455
|
"Tamanho m\xE1ximo: ",
|
|
501
456
|
formatBytes(maxSize)
|
|
502
457
|
] })
|
|
@@ -504,11 +459,11 @@ function FileUploader({
|
|
|
504
459
|
] })
|
|
505
460
|
}
|
|
506
461
|
),
|
|
507
|
-
staged && /* @__PURE__ */ jsxs("div", {
|
|
508
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
509
|
-
staged.map((f, i) => /* @__PURE__ */ jsxs("div", { className: "
|
|
510
|
-
/* @__PURE__ */ jsx("span", {
|
|
511
|
-
/* @__PURE__ */ jsxs("div", {
|
|
462
|
+
staged && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
463
|
+
/* @__PURE__ */ jsx("div", { className: "text-slate-500 text-[13px] font-semibold mb-0.5", children: staged.length === 1 ? "1 arquivo selecionado" : `${staged.length} arquivos selecionados` }),
|
|
464
|
+
staged.map((f, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 px-3 py-2.5 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
465
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl shrink-0", children: getFileIcon(f.type) }),
|
|
466
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
512
467
|
editingIndex === i ? /* @__PURE__ */ jsx(
|
|
513
468
|
"input",
|
|
514
469
|
{
|
|
@@ -526,30 +481,28 @@ function FileUploader({
|
|
|
526
481
|
}
|
|
527
482
|
if (e.key === "Escape") setEditingIndex(null);
|
|
528
483
|
},
|
|
529
|
-
|
|
484
|
+
className: "w-full text-[13px] font-medium border border-indigo-500 rounded-md py-0.5 px-2 outline-none bg-slate-50 text-slate-900"
|
|
530
485
|
}
|
|
531
486
|
) : /* @__PURE__ */ jsxs(
|
|
532
487
|
"div",
|
|
533
488
|
{
|
|
534
|
-
className: "
|
|
535
|
-
style: { fontSize: 13, fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", cursor: allowRename ? "text" : "default" },
|
|
489
|
+
className: `text-[13px] font-semibold text-slate-900 overflow-hidden text-ellipsis whitespace-nowrap ${allowRename ? "cursor-text" : "cursor-default"}`,
|
|
536
490
|
onClick: () => allowRename && setEditingIndex(i),
|
|
537
491
|
title: allowRename ? "Clique para renomear" : void 0,
|
|
538
492
|
children: [
|
|
539
493
|
effectiveName(i, staged),
|
|
540
|
-
renames.has(i) && /* @__PURE__ */ jsx("span", { className: "
|
|
494
|
+
renames.has(i) && /* @__PURE__ */ jsx("span", { className: "text-indigo-500 ml-1.5 text-[10px] font-bold", children: "renomeado" })
|
|
541
495
|
]
|
|
542
496
|
}
|
|
543
497
|
),
|
|
544
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
498
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] text-slate-400 mt-0.5", children: formatBytes(f.size) })
|
|
545
499
|
] }),
|
|
546
500
|
allowRename && /* @__PURE__ */ jsx(
|
|
547
501
|
"button",
|
|
548
502
|
{
|
|
549
503
|
onClick: () => setEditingIndex(i),
|
|
550
504
|
title: "Renomear",
|
|
551
|
-
className: "
|
|
552
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 14, padding: "0 4px", flexShrink: 0 },
|
|
505
|
+
className: "text-slate-400 bg-none border-none cursor-pointer text-sm px-1 shrink-0 hover:text-slate-600",
|
|
553
506
|
children: "\u270F\uFE0F"
|
|
554
507
|
}
|
|
555
508
|
),
|
|
@@ -561,63 +514,75 @@ function FileUploader({
|
|
|
561
514
|
if (next.length === 0) clearStaging();
|
|
562
515
|
else setStaged(next);
|
|
563
516
|
},
|
|
564
|
-
className: "
|
|
565
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 18, padding: "0 4px", lineHeight: 1, flexShrink: 0 },
|
|
517
|
+
className: "text-slate-400 bg-none border-none cursor-pointer text-lg px-1 leading-none shrink-0 hover:text-slate-600",
|
|
566
518
|
children: "\xD7"
|
|
567
519
|
}
|
|
568
520
|
)
|
|
569
521
|
] }, i)),
|
|
570
|
-
showImageOptions && staged.some((f) => f.type.startsWith("image/")) && /* @__PURE__ */ jsxs("div", { className: "
|
|
571
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
522
|
+
showImageOptions && staged.some((f) => f.type.startsWith("image/")) && /* @__PURE__ */ jsxs("div", { className: "border border-slate-200 rounded-xl overflow-hidden", children: [
|
|
523
|
+
/* @__PURE__ */ jsx("div", { className: "px-3.5 py-2 bg-slate-100 text-[12px] font-bold text-slate-500 tracking-[0.04em]", children: "\u{1F5BC}\uFE0F Configura\xE7\xF5es de imagem" }),
|
|
572
524
|
/* @__PURE__ */ jsx(ImageOptions, { value: imageOpts, onChange: setImageOpts, style: { padding: "12px 14px" } })
|
|
573
525
|
] }),
|
|
574
|
-
showVideoOptions && staged.some((f) => f.type.startsWith("video/")) && /* @__PURE__ */ jsxs("div", { className: "
|
|
575
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
526
|
+
showVideoOptions && staged.some((f) => f.type.startsWith("video/")) && /* @__PURE__ */ jsxs("div", { className: "border border-slate-200 rounded-xl overflow-hidden", children: [
|
|
527
|
+
/* @__PURE__ */ jsx("div", { className: "px-3.5 py-2 bg-slate-100 text-[12px] font-bold text-slate-500 tracking-[0.04em]", children: "\u{1F3AC} Configura\xE7\xF5es de v\xEDdeo" }),
|
|
576
528
|
/* @__PURE__ */ jsx(VideoOptions, { value: videoOpts, onChange: setVideoOpts, style: { padding: "12px 14px" } })
|
|
577
529
|
] }),
|
|
578
|
-
/* @__PURE__ */ jsxs("div", {
|
|
579
|
-
/* @__PURE__ */ jsx(
|
|
580
|
-
|
|
530
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-1", children: [
|
|
531
|
+
/* @__PURE__ */ jsx(
|
|
532
|
+
"button",
|
|
533
|
+
{
|
|
534
|
+
className: "inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border border-slate-200 bg-transparent text-slate-900 cursor-pointer transition-colors hover:bg-slate-100",
|
|
535
|
+
onClick: clearStaging,
|
|
536
|
+
children: "Cancelar"
|
|
537
|
+
}
|
|
538
|
+
),
|
|
539
|
+
/* @__PURE__ */ jsx(
|
|
540
|
+
"button",
|
|
541
|
+
{
|
|
542
|
+
className: "flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent bg-indigo-500 text-white cursor-pointer transition-opacity hover:opacity-90",
|
|
543
|
+
onClick: handleConfirmUpload,
|
|
544
|
+
children: staged.length > 1 ? `Enviar ${staged.length} arquivos` : "Enviar arquivo"
|
|
545
|
+
}
|
|
546
|
+
)
|
|
581
547
|
] })
|
|
582
548
|
] }),
|
|
583
|
-
isSingleUploading && !isBatch && (renderProgress ? renderProgress(singleProgress) : /* @__PURE__ */ jsxs("div", { className: "
|
|
584
|
-
/* @__PURE__ */ jsxs("div", {
|
|
585
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
586
|
-
/* @__PURE__ */ jsxs("span", { className: "
|
|
549
|
+
isSingleUploading && !isBatch && (renderProgress ? renderProgress(singleProgress) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 px-3 py-4 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
550
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
551
|
+
/* @__PURE__ */ jsx("span", { className: "text-[13px] font-semibold text-slate-900", children: uploadLabel(single.state.status, singleProgress) }),
|
|
552
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[13px] font-bold text-indigo-500", children: [
|
|
587
553
|
singleProgress,
|
|
588
554
|
"%"
|
|
589
555
|
] })
|
|
590
556
|
] }),
|
|
591
557
|
/* @__PURE__ */ jsx(ProgressBar, { progress: singleProgress })
|
|
592
558
|
] })),
|
|
593
|
-
isBatch && /* @__PURE__ */ jsxs("div", {
|
|
559
|
+
isBatch && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
594
560
|
batch.state.files.map((f, i) => {
|
|
595
561
|
const st = f.status;
|
|
596
562
|
const p = st.status === "uploading" ? st.progress : st.status === "paused" ? st.progress : st.status === "done" ? 100 : st.status === "completing" ? 99 : 0;
|
|
597
563
|
const isPaused = st.status === "paused";
|
|
598
564
|
const isDone = st.status === "done";
|
|
599
565
|
const isErr = st.status === "error";
|
|
600
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
601
|
-
/* @__PURE__ */ jsxs("div", {
|
|
602
|
-
/* @__PURE__ */ jsx("span", {
|
|
603
|
-
/* @__PURE__ */ jsxs("div", {
|
|
604
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
605
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
566
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-stretch gap-2 px-3.5 py-3 bg-slate-50 rounded-xl border border-slate-200", children: [
|
|
567
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
568
|
+
/* @__PURE__ */ jsx("span", { className: "text-lg shrink-0", children: getFileIcon(f.file.type) }),
|
|
569
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
570
|
+
/* @__PURE__ */ jsx("div", { className: "text-[13px] font-semibold text-slate-900 overflow-hidden text-ellipsis whitespace-nowrap", children: f.file.name }),
|
|
571
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] text-slate-400", children: formatBytes(f.file.size) })
|
|
606
572
|
] }),
|
|
607
|
-
isDone && /* @__PURE__ */ jsx("span", {
|
|
608
|
-
isErr && /* @__PURE__ */ jsx("span", { className: "
|
|
609
|
-
!isDone && !isErr && /* @__PURE__ */ jsx("span", { className: isPaused ? "
|
|
610
|
-
!isDone && !isErr && f.fileId && (isPaused ? /* @__PURE__ */ jsx("button", { className: "
|
|
573
|
+
isDone && /* @__PURE__ */ jsx("span", { className: "text-lg shrink-0", children: "\u2705" }),
|
|
574
|
+
isErr && /* @__PURE__ */ jsx("span", { className: "text-[12px] font-semibold text-red-500 shrink-0", children: "Erro no envio" }),
|
|
575
|
+
!isDone && !isErr && /* @__PURE__ */ jsx("span", { className: `text-[12px] font-bold shrink-0 ${isPaused ? "text-slate-400" : "text-indigo-500"}`, children: isPaused ? "Pausado" : `${p}%` }),
|
|
576
|
+
!isDone && !isErr && f.fileId && (isPaused ? /* @__PURE__ */ jsx("button", { className: "inline-flex items-center justify-center gap-1.5 text-[11px] font-semibold py-0.5 px-2.5 rounded-lg border-transparent bg-emerald-500 text-white cursor-pointer hover:opacity-90", onClick: () => batch.resumeFile(f.fileId), children: "Retomar" }) : st.status === "uploading" ? /* @__PURE__ */ jsx("button", { className: "inline-flex items-center justify-center gap-1.5 text-[11px] font-semibold py-0.5 px-2.5 rounded-lg border border-slate-200 bg-transparent text-slate-900 cursor-pointer hover:bg-slate-100", onClick: () => batch.pauseFile(f.fileId), children: "Pausar" }) : null)
|
|
611
577
|
] }),
|
|
612
578
|
!isDone && !isErr && /* @__PURE__ */ jsx(ProgressBar, { progress: p })
|
|
613
579
|
] }, i);
|
|
614
580
|
}),
|
|
615
|
-
/* @__PURE__ */ jsxs("div", {
|
|
581
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
616
582
|
batch.state.status !== "done" && /* @__PURE__ */ jsx(
|
|
617
583
|
"button",
|
|
618
584
|
{
|
|
619
|
-
className: `
|
|
620
|
-
style: { flex: 1 },
|
|
585
|
+
className: `flex-1 inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent text-white cursor-pointer hover:opacity-90 ${isBatchUploading ? "bg-amber-500" : "bg-emerald-500"}`,
|
|
621
586
|
onClick: isBatchUploading ? batch.pauseAll : batch.resumeAll,
|
|
622
587
|
children: isBatchUploading ? "\u23F8 Pausar tudo" : "\u25B6 Retomar tudo"
|
|
623
588
|
}
|
|
@@ -625,32 +590,46 @@ function FileUploader({
|
|
|
625
590
|
/* @__PURE__ */ jsx(
|
|
626
591
|
"button",
|
|
627
592
|
{
|
|
628
|
-
className: `
|
|
593
|
+
className: `inline-flex items-center justify-center gap-1.5 text-sm font-bold py-2.5 px-4 rounded-xl border-transparent text-white cursor-pointer hover:opacity-90 ${batch.state.status === "done" ? "bg-indigo-500" : "bg-red-500/90"}`,
|
|
629
594
|
onClick: batch.state.status === "done" ? batch.reset : batch.abortAll,
|
|
630
595
|
children: batch.state.status === "done" ? "Enviar mais arquivos" : "Cancelar"
|
|
631
596
|
}
|
|
632
597
|
)
|
|
633
598
|
] }),
|
|
634
|
-
batch.state.status === "done" && /* @__PURE__ */ jsxs("div", { className: "
|
|
635
|
-
/* @__PURE__ */ jsx("span", {
|
|
636
|
-
/* @__PURE__ */ jsx("span", {
|
|
599
|
+
batch.state.status === "done" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 px-3 py-2.5 bg-green-500/[0.08] rounded-xl border border-green-500/20", children: [
|
|
600
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl", children: "\u{1F389}" }),
|
|
601
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-green-700", children: batch.state.files.length === 1 ? "Arquivo enviado com sucesso!" : `${batch.state.files.length} arquivos enviados com sucesso!` })
|
|
637
602
|
] })
|
|
638
603
|
] }),
|
|
639
|
-
single.state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "
|
|
640
|
-
/* @__PURE__ */ jsx("span", {
|
|
641
|
-
/* @__PURE__ */ jsxs("div", {
|
|
642
|
-
/* @__PURE__ */ jsx("div", {
|
|
643
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
604
|
+
single.state.status === "done" && !renderSuccess && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3.5 bg-green-500/[0.08] rounded-xl border border-green-500/20", children: [
|
|
605
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl", children: "\u2705" }),
|
|
606
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
607
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-sm text-green-700", children: "Arquivo enviado com sucesso!" }),
|
|
608
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: formatBytes(single.state.result.size) })
|
|
644
609
|
] }),
|
|
645
|
-
/* @__PURE__ */ jsx(
|
|
610
|
+
/* @__PURE__ */ jsx(
|
|
611
|
+
"button",
|
|
612
|
+
{
|
|
613
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-green-500/30 text-green-700 bg-transparent cursor-pointer hover:bg-green-500/10 shrink-0",
|
|
614
|
+
onClick: single.reset,
|
|
615
|
+
children: "Enviar outro"
|
|
616
|
+
}
|
|
617
|
+
)
|
|
646
618
|
] }),
|
|
647
|
-
single.state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "
|
|
648
|
-
/* @__PURE__ */ jsx("span", {
|
|
649
|
-
/* @__PURE__ */ jsxs("div", {
|
|
650
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
651
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
619
|
+
single.state.status === "error" && !renderError && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3.5 bg-red-500/[0.07] rounded-xl border border-red-500/20", children: [
|
|
620
|
+
/* @__PURE__ */ jsx("span", { className: "text-[22px]", children: "\u26A0\uFE0F" }),
|
|
621
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
622
|
+
/* @__PURE__ */ jsx("div", { className: "font-bold text-[13px] text-red-500", children: "N\xE3o foi poss\xEDvel enviar o arquivo" }),
|
|
623
|
+
/* @__PURE__ */ jsx("div", { className: "text-[12px] text-slate-400 mt-0.5", children: single.state.error.message })
|
|
652
624
|
] }),
|
|
653
|
-
/* @__PURE__ */ jsx(
|
|
625
|
+
/* @__PURE__ */ jsx(
|
|
626
|
+
"button",
|
|
627
|
+
{
|
|
628
|
+
className: "inline-flex items-center justify-center text-xs font-semibold py-1 px-2.5 rounded-lg border border-red-500/30 text-red-500 bg-transparent cursor-pointer hover:bg-red-500/10 shrink-0",
|
|
629
|
+
onClick: single.reset,
|
|
630
|
+
children: "Tentar novamente"
|
|
631
|
+
}
|
|
632
|
+
)
|
|
654
633
|
] })
|
|
655
634
|
] });
|
|
656
635
|
}
|