virtual-ui-lib 1.0.69 → 1.0.71
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 +501 -0
- package/dist/index.mjs +499 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,6 +32,8 @@ __export(index_exports, {
|
|
|
32
32
|
AvatarCard: () => AvatarCard,
|
|
33
33
|
BackgoundImageSlider: () => BackgoundImageSlider,
|
|
34
34
|
Charts: () => Charts,
|
|
35
|
+
ColorPicker: () => ColorPicker,
|
|
36
|
+
FileUpload: () => FileUpload,
|
|
35
37
|
Footer: () => Footer,
|
|
36
38
|
ImageCard: () => ImageCard,
|
|
37
39
|
ImageSlider: () => ImageSlider,
|
|
@@ -2494,11 +2496,510 @@ var InvoiceCard = ({
|
|
|
2494
2496
|
)
|
|
2495
2497
|
)));
|
|
2496
2498
|
};
|
|
2499
|
+
|
|
2500
|
+
// src/components/FileUpload/FileUpload.jsx
|
|
2501
|
+
var import_react15 = __toESM(require("react"));
|
|
2502
|
+
var FileUpload = ({
|
|
2503
|
+
accept = "*",
|
|
2504
|
+
multiple = true,
|
|
2505
|
+
maxSizeMB = 5,
|
|
2506
|
+
accent = "#6366f1",
|
|
2507
|
+
bg = "#0f172a",
|
|
2508
|
+
radius = "16px",
|
|
2509
|
+
label = "Drop files here or click to upload",
|
|
2510
|
+
subLabel = "Supports any file up to",
|
|
2511
|
+
onUpload = () => {
|
|
2512
|
+
}
|
|
2513
|
+
}) => {
|
|
2514
|
+
const [files, setFiles] = (0, import_react15.useState)([]);
|
|
2515
|
+
const [dragging, setDragging] = (0, import_react15.useState)(false);
|
|
2516
|
+
const [error, setError] = (0, import_react15.useState)("");
|
|
2517
|
+
const inputRef = (0, import_react15.useRef)(null);
|
|
2518
|
+
const alpha = (hex, op) => {
|
|
2519
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
2520
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
2521
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
2522
|
+
return `rgba(${r},${g},${b},${op})`;
|
|
2523
|
+
};
|
|
2524
|
+
const formatSize = (bytes) => {
|
|
2525
|
+
if (bytes < 1024) return bytes + " B";
|
|
2526
|
+
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + " KB";
|
|
2527
|
+
return (bytes / (1024 * 1024)).toFixed(1) + " MB";
|
|
2528
|
+
};
|
|
2529
|
+
const getIcon = (type) => {
|
|
2530
|
+
if (type.startsWith("image/")) return { path: "M21 19V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2zM8.5 13.5l2.5 3 3.5-4.5 4.5 6H5l3.5-4.5z", color: "#a78bfa" };
|
|
2531
|
+
if (type.includes("pdf")) return { path: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6M16 13H8M16 17H8M10 9H8", color: "#f87171" };
|
|
2532
|
+
if (type.includes("video")) return { path: "M23 7l-7 5 7 5V7zM1 5h15a2 2 0 012 2v10a2 2 0 01-2 2H1a2 2 0 01-2-2V7a2 2 0 012-2z", color: "#34d399" };
|
|
2533
|
+
if (type.includes("audio")) return { path: "M9 18V5l12-2v13M9 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm12-2c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z", color: "#fbbf24" };
|
|
2534
|
+
return { path: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6", color: "#94a3b8" };
|
|
2535
|
+
};
|
|
2536
|
+
const processFiles = (incoming) => {
|
|
2537
|
+
setError("");
|
|
2538
|
+
const valid = [];
|
|
2539
|
+
for (const f of incoming) {
|
|
2540
|
+
if (f.size > maxSizeMB * 1024 * 1024) {
|
|
2541
|
+
setError(`"${f.name}" exceeds ${maxSizeMB}MB limit.`);
|
|
2542
|
+
continue;
|
|
2543
|
+
}
|
|
2544
|
+
valid.push({ file: f, id: Math.random().toString(36).slice(2), progress: 0, done: false });
|
|
2545
|
+
}
|
|
2546
|
+
if (!valid.length) return;
|
|
2547
|
+
const newFiles = multiple ? [...files, ...valid] : valid;
|
|
2548
|
+
setFiles(newFiles);
|
|
2549
|
+
valid.forEach(({ id }) => {
|
|
2550
|
+
let p = 0;
|
|
2551
|
+
const t = setInterval(() => {
|
|
2552
|
+
p += Math.floor(Math.random() * 15) + 5;
|
|
2553
|
+
if (p >= 100) {
|
|
2554
|
+
p = 100;
|
|
2555
|
+
clearInterval(t);
|
|
2556
|
+
setFiles((prev) => prev.map((f) => f.id === id ? { ...f, progress: 100, done: true } : f));
|
|
2557
|
+
onUpload(id);
|
|
2558
|
+
} else {
|
|
2559
|
+
setFiles((prev) => prev.map((f) => f.id === id ? { ...f, progress: p } : f));
|
|
2560
|
+
}
|
|
2561
|
+
}, 200);
|
|
2562
|
+
});
|
|
2563
|
+
};
|
|
2564
|
+
const handleDrop = (e) => {
|
|
2565
|
+
e.preventDefault();
|
|
2566
|
+
setDragging(false);
|
|
2567
|
+
processFiles(Array.from(e.dataTransfer.files));
|
|
2568
|
+
};
|
|
2569
|
+
const removeFile = (id) => setFiles((prev) => prev.filter((f) => f.id !== id));
|
|
2570
|
+
return /* @__PURE__ */ import_react15.default.createElement("div", { style: { width: "320px", fontFamily: "system-ui, sans-serif" } }, /* @__PURE__ */ import_react15.default.createElement(
|
|
2571
|
+
"div",
|
|
2572
|
+
{
|
|
2573
|
+
onClick: () => {
|
|
2574
|
+
var _a;
|
|
2575
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
2576
|
+
},
|
|
2577
|
+
onDragOver: (e) => {
|
|
2578
|
+
e.preventDefault();
|
|
2579
|
+
setDragging(true);
|
|
2580
|
+
},
|
|
2581
|
+
onDragLeave: () => setDragging(false),
|
|
2582
|
+
onDrop: handleDrop,
|
|
2583
|
+
style: {
|
|
2584
|
+
background: dragging ? alpha(accent, 0.1) : "rgba(255,255,255,0.03)",
|
|
2585
|
+
border: `2px dashed ${dragging ? accent : "rgba(255,255,255,0.1)"}`,
|
|
2586
|
+
borderRadius: radius,
|
|
2587
|
+
padding: "32px 20px",
|
|
2588
|
+
textAlign: "center",
|
|
2589
|
+
cursor: "pointer",
|
|
2590
|
+
transition: "all 0.2s"
|
|
2591
|
+
}
|
|
2592
|
+
},
|
|
2593
|
+
/* @__PURE__ */ import_react15.default.createElement(
|
|
2594
|
+
"input",
|
|
2595
|
+
{
|
|
2596
|
+
ref: inputRef,
|
|
2597
|
+
type: "file",
|
|
2598
|
+
accept,
|
|
2599
|
+
multiple,
|
|
2600
|
+
style: { display: "none" },
|
|
2601
|
+
onChange: (e) => processFiles(Array.from(e.target.files))
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ import_react15.default.createElement("div", { style: {
|
|
2605
|
+
width: "48px",
|
|
2606
|
+
height: "48px",
|
|
2607
|
+
borderRadius: "14px",
|
|
2608
|
+
background: alpha(accent, 0.12),
|
|
2609
|
+
border: `1px solid ${alpha(accent, 0.25)}`,
|
|
2610
|
+
display: "flex",
|
|
2611
|
+
alignItems: "center",
|
|
2612
|
+
justifyContent: "center",
|
|
2613
|
+
margin: "0 auto 14px",
|
|
2614
|
+
transition: "all 0.2s",
|
|
2615
|
+
transform: dragging ? "scale(1.1)" : "scale(1)"
|
|
2616
|
+
} }, /* @__PURE__ */ import_react15.default.createElement(
|
|
2617
|
+
"svg",
|
|
2618
|
+
{
|
|
2619
|
+
width: "22",
|
|
2620
|
+
height: "22",
|
|
2621
|
+
viewBox: "0 0 24 24",
|
|
2622
|
+
fill: "none",
|
|
2623
|
+
stroke: accent,
|
|
2624
|
+
strokeWidth: "2",
|
|
2625
|
+
strokeLinecap: "round",
|
|
2626
|
+
strokeLinejoin: "round"
|
|
2627
|
+
},
|
|
2628
|
+
/* @__PURE__ */ import_react15.default.createElement("path", { d: "M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M17 8l-5-5-5 5M12 3v12" })
|
|
2629
|
+
)),
|
|
2630
|
+
/* @__PURE__ */ import_react15.default.createElement("p", { style: { fontSize: "13px", fontWeight: "600", color: "#fff", margin: "0 0 4px" } }, label),
|
|
2631
|
+
/* @__PURE__ */ import_react15.default.createElement("p", { style: { fontSize: "11px", color: "rgba(255,255,255,0.3)", margin: 0 } }, subLabel, " ", maxSizeMB, "MB")
|
|
2632
|
+
), error && /* @__PURE__ */ import_react15.default.createElement("div", { style: {
|
|
2633
|
+
marginTop: "10px",
|
|
2634
|
+
padding: "9px 12px",
|
|
2635
|
+
borderRadius: "10px",
|
|
2636
|
+
background: "rgba(239,68,68,0.08)",
|
|
2637
|
+
border: "1px solid rgba(239,68,68,0.2)",
|
|
2638
|
+
display: "flex",
|
|
2639
|
+
alignItems: "center",
|
|
2640
|
+
gap: "8px"
|
|
2641
|
+
} }, /* @__PURE__ */ import_react15.default.createElement(
|
|
2642
|
+
"svg",
|
|
2643
|
+
{
|
|
2644
|
+
width: "13",
|
|
2645
|
+
height: "13",
|
|
2646
|
+
viewBox: "0 0 24 24",
|
|
2647
|
+
fill: "none",
|
|
2648
|
+
stroke: "#f87171",
|
|
2649
|
+
strokeWidth: "2.5",
|
|
2650
|
+
strokeLinecap: "round"
|
|
2651
|
+
},
|
|
2652
|
+
/* @__PURE__ */ import_react15.default.createElement("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2653
|
+
/* @__PURE__ */ import_react15.default.createElement("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
2654
|
+
/* @__PURE__ */ import_react15.default.createElement("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
2655
|
+
), /* @__PURE__ */ import_react15.default.createElement("span", { style: { fontSize: "11px", color: "#f87171" } }, error)), files.length > 0 && /* @__PURE__ */ import_react15.default.createElement("div", { style: { marginTop: "12px", display: "flex", flexDirection: "column", gap: "8px" } }, files.map(({ file, id, progress, done }) => {
|
|
2656
|
+
const icon = getIcon(file.type);
|
|
2657
|
+
const preview = file.type.startsWith("image/") ? URL.createObjectURL(file) : null;
|
|
2658
|
+
return /* @__PURE__ */ import_react15.default.createElement("div", { key: id, style: {
|
|
2659
|
+
background: "rgba(255,255,255,0.03)",
|
|
2660
|
+
border: `1px solid ${done ? alpha(accent, 0.2) : "rgba(255,255,255,0.07)"}`,
|
|
2661
|
+
borderRadius: "12px",
|
|
2662
|
+
padding: "10px 12px",
|
|
2663
|
+
transition: "border-color 0.3s"
|
|
2664
|
+
} }, /* @__PURE__ */ import_react15.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px" } }, /* @__PURE__ */ import_react15.default.createElement("div", { style: {
|
|
2665
|
+
width: "36px",
|
|
2666
|
+
height: "36px",
|
|
2667
|
+
borderRadius: "8px",
|
|
2668
|
+
flexShrink: 0,
|
|
2669
|
+
background: preview ? `url(${preview}) center/cover` : alpha(icon.color, 0.12),
|
|
2670
|
+
border: `1px solid ${alpha(icon.color, 0.2)}`,
|
|
2671
|
+
display: "flex",
|
|
2672
|
+
alignItems: "center",
|
|
2673
|
+
justifyContent: "center",
|
|
2674
|
+
overflow: "hidden"
|
|
2675
|
+
} }, !preview && /* @__PURE__ */ import_react15.default.createElement(
|
|
2676
|
+
"svg",
|
|
2677
|
+
{
|
|
2678
|
+
width: "16",
|
|
2679
|
+
height: "16",
|
|
2680
|
+
viewBox: "0 0 24 24",
|
|
2681
|
+
fill: "none",
|
|
2682
|
+
stroke: icon.color,
|
|
2683
|
+
strokeWidth: "2",
|
|
2684
|
+
strokeLinecap: "round",
|
|
2685
|
+
strokeLinejoin: "round"
|
|
2686
|
+
},
|
|
2687
|
+
/* @__PURE__ */ import_react15.default.createElement("path", { d: icon.path })
|
|
2688
|
+
)), /* @__PURE__ */ import_react15.default.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ import_react15.default.createElement("p", { style: {
|
|
2689
|
+
fontSize: "12px",
|
|
2690
|
+
fontWeight: "600",
|
|
2691
|
+
color: "#fff",
|
|
2692
|
+
margin: "0 0 2px",
|
|
2693
|
+
overflow: "hidden",
|
|
2694
|
+
textOverflow: "ellipsis",
|
|
2695
|
+
whiteSpace: "nowrap"
|
|
2696
|
+
} }, file.name), /* @__PURE__ */ import_react15.default.createElement("p", { style: { fontSize: "10px", color: "rgba(255,255,255,0.3)", margin: 0 } }, formatSize(file.size))), done ? /* @__PURE__ */ import_react15.default.createElement("div", { style: {
|
|
2697
|
+
width: "22px",
|
|
2698
|
+
height: "22px",
|
|
2699
|
+
borderRadius: "50%",
|
|
2700
|
+
background: "rgba(16,185,129,0.15)",
|
|
2701
|
+
border: "1px solid rgba(16,185,129,0.3)",
|
|
2702
|
+
display: "flex",
|
|
2703
|
+
alignItems: "center",
|
|
2704
|
+
justifyContent: "center",
|
|
2705
|
+
flexShrink: 0
|
|
2706
|
+
} }, /* @__PURE__ */ import_react15.default.createElement(
|
|
2707
|
+
"svg",
|
|
2708
|
+
{
|
|
2709
|
+
width: "10",
|
|
2710
|
+
height: "10",
|
|
2711
|
+
viewBox: "0 0 24 24",
|
|
2712
|
+
fill: "none",
|
|
2713
|
+
stroke: "#34d399",
|
|
2714
|
+
strokeWidth: "3",
|
|
2715
|
+
strokeLinecap: "round"
|
|
2716
|
+
},
|
|
2717
|
+
/* @__PURE__ */ import_react15.default.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
2718
|
+
)) : /* @__PURE__ */ import_react15.default.createElement(
|
|
2719
|
+
"button",
|
|
2720
|
+
{
|
|
2721
|
+
onClick: () => removeFile(id),
|
|
2722
|
+
style: {
|
|
2723
|
+
background: "transparent",
|
|
2724
|
+
border: "none",
|
|
2725
|
+
padding: "2px",
|
|
2726
|
+
cursor: "pointer",
|
|
2727
|
+
color: "rgba(255,255,255,0.25)",
|
|
2728
|
+
flexShrink: 0,
|
|
2729
|
+
transition: "color 0.2s"
|
|
2730
|
+
},
|
|
2731
|
+
onMouseEnter: (e) => e.currentTarget.style.color = "#f87171",
|
|
2732
|
+
onMouseLeave: (e) => e.currentTarget.style.color = "rgba(255,255,255,0.25)"
|
|
2733
|
+
},
|
|
2734
|
+
/* @__PURE__ */ import_react15.default.createElement(
|
|
2735
|
+
"svg",
|
|
2736
|
+
{
|
|
2737
|
+
width: "14",
|
|
2738
|
+
height: "14",
|
|
2739
|
+
viewBox: "0 0 24 24",
|
|
2740
|
+
fill: "none",
|
|
2741
|
+
stroke: "currentColor",
|
|
2742
|
+
strokeWidth: "2.5",
|
|
2743
|
+
strokeLinecap: "round"
|
|
2744
|
+
},
|
|
2745
|
+
/* @__PURE__ */ import_react15.default.createElement("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
2746
|
+
)
|
|
2747
|
+
)), !done && /* @__PURE__ */ import_react15.default.createElement("div", { style: {
|
|
2748
|
+
marginTop: "8px",
|
|
2749
|
+
height: "3px",
|
|
2750
|
+
background: "rgba(255,255,255,0.06)",
|
|
2751
|
+
borderRadius: "2px",
|
|
2752
|
+
overflow: "hidden"
|
|
2753
|
+
} }, /* @__PURE__ */ import_react15.default.createElement("div", { style: {
|
|
2754
|
+
height: "100%",
|
|
2755
|
+
borderRadius: "2px",
|
|
2756
|
+
width: `${progress}%`,
|
|
2757
|
+
background: `linear-gradient(90deg, ${accent}, ${alpha(accent, 0.6)})`,
|
|
2758
|
+
transition: "width 0.2s ease"
|
|
2759
|
+
} })));
|
|
2760
|
+
})));
|
|
2761
|
+
};
|
|
2762
|
+
|
|
2763
|
+
// src/components/ColorPicker/ColorPicker.jsx
|
|
2764
|
+
var import_react16 = __toESM(require("react"));
|
|
2765
|
+
var ColorPicker = ({
|
|
2766
|
+
defaultColor = "#6366f1",
|
|
2767
|
+
showOpacity = true,
|
|
2768
|
+
showEyedropper = true,
|
|
2769
|
+
showInput = true,
|
|
2770
|
+
accent = "#6366f1",
|
|
2771
|
+
bg = "#0f172a",
|
|
2772
|
+
radius = "16px",
|
|
2773
|
+
onChange = () => {
|
|
2774
|
+
},
|
|
2775
|
+
swatches = [
|
|
2776
|
+
"#6366f1",
|
|
2777
|
+
"#8b5cf6",
|
|
2778
|
+
"#a855f7",
|
|
2779
|
+
"#ec4899",
|
|
2780
|
+
"#f43f5e",
|
|
2781
|
+
"#ef4444",
|
|
2782
|
+
"#f97316",
|
|
2783
|
+
"#f59e0b",
|
|
2784
|
+
"#eab308",
|
|
2785
|
+
"#84cc16",
|
|
2786
|
+
"#22c55e",
|
|
2787
|
+
"#10b981",
|
|
2788
|
+
"#14b8a6",
|
|
2789
|
+
"#06b6d4",
|
|
2790
|
+
"#3b82f6",
|
|
2791
|
+
"#0ea5e9",
|
|
2792
|
+
"#64748b",
|
|
2793
|
+
"#94a3b8",
|
|
2794
|
+
"#ffffff",
|
|
2795
|
+
"#000000"
|
|
2796
|
+
]
|
|
2797
|
+
}) => {
|
|
2798
|
+
const [color, setColor] = (0, import_react16.useState)(defaultColor);
|
|
2799
|
+
const [hex, setHex] = (0, import_react16.useState)(defaultColor);
|
|
2800
|
+
const [opacity, setOpacity] = (0, import_react16.useState)(100);
|
|
2801
|
+
const [inputErr, setInputErr] = (0, import_react16.useState)(false);
|
|
2802
|
+
const [copied, setCopied] = (0, import_react16.useState)(false);
|
|
2803
|
+
const alpha = (hexVal, op) => {
|
|
2804
|
+
const r = parseInt(hexVal.slice(1, 3), 16);
|
|
2805
|
+
const g = parseInt(hexVal.slice(3, 5), 16);
|
|
2806
|
+
const b = parseInt(hexVal.slice(5, 7), 16);
|
|
2807
|
+
return `rgba(${r},${g},${b},${op})`;
|
|
2808
|
+
};
|
|
2809
|
+
const isValidHex = (v) => /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(v);
|
|
2810
|
+
const applyColor = (val) => {
|
|
2811
|
+
if (!isValidHex(val)) {
|
|
2812
|
+
setInputErr(true);
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
setInputErr(false);
|
|
2816
|
+
setColor(val);
|
|
2817
|
+
setHex(val);
|
|
2818
|
+
onChange({ hex: val, opacity, rgba: alpha(val, opacity / 100) });
|
|
2819
|
+
};
|
|
2820
|
+
const pickSwatch = (val) => {
|
|
2821
|
+
setColor(val);
|
|
2822
|
+
setHex(val);
|
|
2823
|
+
setInputErr(false);
|
|
2824
|
+
onChange({ hex: val, opacity, rgba: alpha(val, opacity / 100) });
|
|
2825
|
+
};
|
|
2826
|
+
const handleOpacity = (v) => {
|
|
2827
|
+
setOpacity(v);
|
|
2828
|
+
onChange({ hex: color, opacity: v, rgba: alpha(color, v / 100) });
|
|
2829
|
+
};
|
|
2830
|
+
const copyHex = () => {
|
|
2831
|
+
var _a;
|
|
2832
|
+
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(hex).catch(() => {
|
|
2833
|
+
});
|
|
2834
|
+
setCopied(true);
|
|
2835
|
+
setTimeout(() => setCopied(false), 1500);
|
|
2836
|
+
};
|
|
2837
|
+
const hueGradient = "linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)";
|
|
2838
|
+
return /* @__PURE__ */ import_react16.default.createElement("div", { style: {
|
|
2839
|
+
background: bg,
|
|
2840
|
+
borderRadius: radius,
|
|
2841
|
+
padding: "20px",
|
|
2842
|
+
width: "260px",
|
|
2843
|
+
fontFamily: "system-ui, sans-serif",
|
|
2844
|
+
border: "1px solid rgba(255,255,255,0.07)",
|
|
2845
|
+
boxShadow: "0 10px 40px rgba(0,0,0,0.4)"
|
|
2846
|
+
} }, /* @__PURE__ */ import_react16.default.createElement("div", { style: {
|
|
2847
|
+
height: "52px",
|
|
2848
|
+
borderRadius: "12px",
|
|
2849
|
+
marginBottom: "16px",
|
|
2850
|
+
background: alpha(color, opacity / 100),
|
|
2851
|
+
border: "1px solid rgba(255,255,255,0.08)",
|
|
2852
|
+
position: "relative",
|
|
2853
|
+
overflow: "hidden"
|
|
2854
|
+
} }, /* @__PURE__ */ import_react16.default.createElement("div", { style: {
|
|
2855
|
+
position: "absolute",
|
|
2856
|
+
inset: 0,
|
|
2857
|
+
zIndex: 0,
|
|
2858
|
+
backgroundImage: "linear-gradient(45deg,#555 25%,transparent 25%),linear-gradient(-45deg,#555 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#555 75%),linear-gradient(-45deg,transparent 75%,#555 75%)",
|
|
2859
|
+
backgroundSize: "10px 10px",
|
|
2860
|
+
backgroundPosition: "0 0,0 5px,5px -5px,-5px 0",
|
|
2861
|
+
opacity: 0.3
|
|
2862
|
+
} }), /* @__PURE__ */ import_react16.default.createElement("div", { style: { position: "absolute", inset: 0, background: alpha(color, opacity / 100) } })), /* @__PURE__ */ import_react16.default.createElement("div", { style: { position: "relative", marginBottom: "12px" } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
2863
|
+
"input",
|
|
2864
|
+
{
|
|
2865
|
+
type: "range",
|
|
2866
|
+
min: "0",
|
|
2867
|
+
max: "360",
|
|
2868
|
+
defaultValue: "240",
|
|
2869
|
+
onChange: (e) => {
|
|
2870
|
+
const h = e.target.value;
|
|
2871
|
+
const c = `hsl(${h},80%,60%)`;
|
|
2872
|
+
const el = document.createElement("div");
|
|
2873
|
+
el.style.color = c;
|
|
2874
|
+
document.body.appendChild(el);
|
|
2875
|
+
const rgb = getComputedStyle(el).color;
|
|
2876
|
+
document.body.removeChild(el);
|
|
2877
|
+
const [r, g, b] = rgb.match(/\d+/g).map(Number);
|
|
2878
|
+
const hex6 = "#" + [r, g, b].map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
2879
|
+
pickSwatch(hex6);
|
|
2880
|
+
},
|
|
2881
|
+
style: {
|
|
2882
|
+
width: "100%",
|
|
2883
|
+
height: "10px",
|
|
2884
|
+
borderRadius: "5px",
|
|
2885
|
+
appearance: "none",
|
|
2886
|
+
WebkitAppearance: "none",
|
|
2887
|
+
background: hueGradient,
|
|
2888
|
+
cursor: "pointer",
|
|
2889
|
+
outline: "none",
|
|
2890
|
+
border: "none"
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
)), showOpacity && /* @__PURE__ */ import_react16.default.createElement("div", { style: { marginBottom: "16px" } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
2894
|
+
"input",
|
|
2895
|
+
{
|
|
2896
|
+
type: "range",
|
|
2897
|
+
min: "0",
|
|
2898
|
+
max: "100",
|
|
2899
|
+
value: opacity,
|
|
2900
|
+
onChange: (e) => handleOpacity(Number(e.target.value)),
|
|
2901
|
+
style: {
|
|
2902
|
+
width: "100%",
|
|
2903
|
+
height: "10px",
|
|
2904
|
+
borderRadius: "5px",
|
|
2905
|
+
appearance: "none",
|
|
2906
|
+
WebkitAppearance: "none",
|
|
2907
|
+
background: `linear-gradient(90deg, transparent, ${color})`,
|
|
2908
|
+
cursor: "pointer",
|
|
2909
|
+
outline: "none",
|
|
2910
|
+
border: "none"
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
), /* @__PURE__ */ import_react16.default.createElement("div", { style: { display: "flex", justifyContent: "space-between", marginTop: "4px" } }, /* @__PURE__ */ import_react16.default.createElement("span", { style: { fontSize: "10px", color: "rgba(255,255,255,0.25)" } }, "Opacity"), /* @__PURE__ */ import_react16.default.createElement("span", { style: { fontSize: "10px", color: "rgba(255,255,255,0.45)", fontWeight: "600" } }, opacity, "%"))), showInput && /* @__PURE__ */ import_react16.default.createElement("div", { style: { display: "flex", gap: "8px", marginBottom: "16px", alignItems: "center" } }, /* @__PURE__ */ import_react16.default.createElement("div", { style: {
|
|
2914
|
+
width: "32px",
|
|
2915
|
+
height: "32px",
|
|
2916
|
+
borderRadius: "8px",
|
|
2917
|
+
flexShrink: 0,
|
|
2918
|
+
background: color,
|
|
2919
|
+
border: "1px solid rgba(255,255,255,0.1)"
|
|
2920
|
+
} }), /* @__PURE__ */ import_react16.default.createElement(
|
|
2921
|
+
"input",
|
|
2922
|
+
{
|
|
2923
|
+
value: hex,
|
|
2924
|
+
onChange: (e) => {
|
|
2925
|
+
setHex(e.target.value);
|
|
2926
|
+
setInputErr(false);
|
|
2927
|
+
},
|
|
2928
|
+
onBlur: (e) => applyColor(e.target.value),
|
|
2929
|
+
onKeyDown: (e) => e.key === "Enter" && applyColor(hex),
|
|
2930
|
+
placeholder: "#000000",
|
|
2931
|
+
style: {
|
|
2932
|
+
flex: 1,
|
|
2933
|
+
background: "rgba(255,255,255,0.05)",
|
|
2934
|
+
border: `1px solid ${inputErr ? "rgba(239,68,68,0.6)" : "rgba(255,255,255,0.1)"}`,
|
|
2935
|
+
borderRadius: "8px",
|
|
2936
|
+
padding: "7px 10px",
|
|
2937
|
+
fontSize: "12px",
|
|
2938
|
+
fontFamily: "monospace",
|
|
2939
|
+
color: inputErr ? "#f87171" : "#fff",
|
|
2940
|
+
outline: "none"
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
2944
|
+
"button",
|
|
2945
|
+
{
|
|
2946
|
+
onClick: copyHex,
|
|
2947
|
+
title: "Copy hex",
|
|
2948
|
+
style: {
|
|
2949
|
+
width: "32px",
|
|
2950
|
+
height: "32px",
|
|
2951
|
+
borderRadius: "8px",
|
|
2952
|
+
flexShrink: 0,
|
|
2953
|
+
background: copied ? "rgba(16,185,129,0.15)" : "rgba(255,255,255,0.05)",
|
|
2954
|
+
border: `1px solid ${copied ? "rgba(16,185,129,0.3)" : "rgba(255,255,255,0.1)"}`,
|
|
2955
|
+
cursor: "pointer",
|
|
2956
|
+
display: "flex",
|
|
2957
|
+
alignItems: "center",
|
|
2958
|
+
justifyContent: "center",
|
|
2959
|
+
color: copied ? "#34d399" : "rgba(255,255,255,0.4)",
|
|
2960
|
+
transition: "all 0.2s"
|
|
2961
|
+
}
|
|
2962
|
+
},
|
|
2963
|
+
copied ? /* @__PURE__ */ import_react16.default.createElement("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ import_react16.default.createElement("polyline", { points: "20 6 9 17 4 12" })) : /* @__PURE__ */ import_react16.default.createElement("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }, /* @__PURE__ */ import_react16.default.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }), /* @__PURE__ */ import_react16.default.createElement("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" }))
|
|
2964
|
+
)), /* @__PURE__ */ import_react16.default.createElement("div", { style: { height: "1px", background: "rgba(255,255,255,0.06)", marginBottom: "14px" } }), /* @__PURE__ */ import_react16.default.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "7px" } }, swatches.map((s) => /* @__PURE__ */ import_react16.default.createElement(
|
|
2965
|
+
"button",
|
|
2966
|
+
{
|
|
2967
|
+
key: s,
|
|
2968
|
+
onClick: () => pickSwatch(s),
|
|
2969
|
+
title: s,
|
|
2970
|
+
style: {
|
|
2971
|
+
width: "22px",
|
|
2972
|
+
height: "22px",
|
|
2973
|
+
borderRadius: "6px",
|
|
2974
|
+
background: s,
|
|
2975
|
+
border: `2px solid ${color === s ? "#fff" : "transparent"}`,
|
|
2976
|
+
cursor: "pointer",
|
|
2977
|
+
padding: 0,
|
|
2978
|
+
transition: "transform 0.15s, border-color 0.15s",
|
|
2979
|
+
outline: "none",
|
|
2980
|
+
boxShadow: s === "#ffffff" ? "inset 0 0 0 1px rgba(0,0,0,0.15)" : "none"
|
|
2981
|
+
},
|
|
2982
|
+
onMouseEnter: (e) => e.currentTarget.style.transform = "scale(1.2)",
|
|
2983
|
+
onMouseLeave: (e) => e.currentTarget.style.transform = "scale(1)"
|
|
2984
|
+
}
|
|
2985
|
+
))), /* @__PURE__ */ import_react16.default.createElement("div", { style: {
|
|
2986
|
+
marginTop: "14px",
|
|
2987
|
+
padding: "8px 10px",
|
|
2988
|
+
borderRadius: "8px",
|
|
2989
|
+
background: "rgba(255,255,255,0.03)",
|
|
2990
|
+
border: "1px solid rgba(255,255,255,0.06)",
|
|
2991
|
+
display: "flex",
|
|
2992
|
+
justifyContent: "space-between",
|
|
2993
|
+
alignItems: "center"
|
|
2994
|
+
} }, /* @__PURE__ */ import_react16.default.createElement("span", { style: { fontSize: "10px", color: "rgba(255,255,255,0.25)", fontWeight: "600", textTransform: "uppercase", letterSpacing: "0.5px" } }, "RGBA"), /* @__PURE__ */ import_react16.default.createElement("span", { style: { fontSize: "10px", fontFamily: "monospace", color: "rgba(255,255,255,0.5)" } }, alpha(color, opacity / 100))));
|
|
2995
|
+
};
|
|
2497
2996
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2498
2997
|
0 && (module.exports = {
|
|
2499
2998
|
AvatarCard,
|
|
2500
2999
|
BackgoundImageSlider,
|
|
2501
3000
|
Charts,
|
|
3001
|
+
ColorPicker,
|
|
3002
|
+
FileUpload,
|
|
2502
3003
|
Footer,
|
|
2503
3004
|
ImageCard,
|
|
2504
3005
|
ImageSlider,
|
package/dist/index.mjs
CHANGED
|
@@ -2446,10 +2446,509 @@ var InvoiceCard = ({
|
|
|
2446
2446
|
)
|
|
2447
2447
|
)));
|
|
2448
2448
|
};
|
|
2449
|
+
|
|
2450
|
+
// src/components/FileUpload/FileUpload.jsx
|
|
2451
|
+
import React15, { useState as useState13, useRef as useRef2 } from "react";
|
|
2452
|
+
var FileUpload = ({
|
|
2453
|
+
accept = "*",
|
|
2454
|
+
multiple = true,
|
|
2455
|
+
maxSizeMB = 5,
|
|
2456
|
+
accent = "#6366f1",
|
|
2457
|
+
bg = "#0f172a",
|
|
2458
|
+
radius = "16px",
|
|
2459
|
+
label = "Drop files here or click to upload",
|
|
2460
|
+
subLabel = "Supports any file up to",
|
|
2461
|
+
onUpload = () => {
|
|
2462
|
+
}
|
|
2463
|
+
}) => {
|
|
2464
|
+
const [files, setFiles] = useState13([]);
|
|
2465
|
+
const [dragging, setDragging] = useState13(false);
|
|
2466
|
+
const [error, setError] = useState13("");
|
|
2467
|
+
const inputRef = useRef2(null);
|
|
2468
|
+
const alpha = (hex, op) => {
|
|
2469
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
2470
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
2471
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
2472
|
+
return `rgba(${r},${g},${b},${op})`;
|
|
2473
|
+
};
|
|
2474
|
+
const formatSize = (bytes) => {
|
|
2475
|
+
if (bytes < 1024) return bytes + " B";
|
|
2476
|
+
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + " KB";
|
|
2477
|
+
return (bytes / (1024 * 1024)).toFixed(1) + " MB";
|
|
2478
|
+
};
|
|
2479
|
+
const getIcon = (type) => {
|
|
2480
|
+
if (type.startsWith("image/")) return { path: "M21 19V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2zM8.5 13.5l2.5 3 3.5-4.5 4.5 6H5l3.5-4.5z", color: "#a78bfa" };
|
|
2481
|
+
if (type.includes("pdf")) return { path: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6M16 13H8M16 17H8M10 9H8", color: "#f87171" };
|
|
2482
|
+
if (type.includes("video")) return { path: "M23 7l-7 5 7 5V7zM1 5h15a2 2 0 012 2v10a2 2 0 01-2 2H1a2 2 0 01-2-2V7a2 2 0 012-2z", color: "#34d399" };
|
|
2483
|
+
if (type.includes("audio")) return { path: "M9 18V5l12-2v13M9 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm12-2c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z", color: "#fbbf24" };
|
|
2484
|
+
return { path: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6", color: "#94a3b8" };
|
|
2485
|
+
};
|
|
2486
|
+
const processFiles = (incoming) => {
|
|
2487
|
+
setError("");
|
|
2488
|
+
const valid = [];
|
|
2489
|
+
for (const f of incoming) {
|
|
2490
|
+
if (f.size > maxSizeMB * 1024 * 1024) {
|
|
2491
|
+
setError(`"${f.name}" exceeds ${maxSizeMB}MB limit.`);
|
|
2492
|
+
continue;
|
|
2493
|
+
}
|
|
2494
|
+
valid.push({ file: f, id: Math.random().toString(36).slice(2), progress: 0, done: false });
|
|
2495
|
+
}
|
|
2496
|
+
if (!valid.length) return;
|
|
2497
|
+
const newFiles = multiple ? [...files, ...valid] : valid;
|
|
2498
|
+
setFiles(newFiles);
|
|
2499
|
+
valid.forEach(({ id }) => {
|
|
2500
|
+
let p = 0;
|
|
2501
|
+
const t = setInterval(() => {
|
|
2502
|
+
p += Math.floor(Math.random() * 15) + 5;
|
|
2503
|
+
if (p >= 100) {
|
|
2504
|
+
p = 100;
|
|
2505
|
+
clearInterval(t);
|
|
2506
|
+
setFiles((prev) => prev.map((f) => f.id === id ? { ...f, progress: 100, done: true } : f));
|
|
2507
|
+
onUpload(id);
|
|
2508
|
+
} else {
|
|
2509
|
+
setFiles((prev) => prev.map((f) => f.id === id ? { ...f, progress: p } : f));
|
|
2510
|
+
}
|
|
2511
|
+
}, 200);
|
|
2512
|
+
});
|
|
2513
|
+
};
|
|
2514
|
+
const handleDrop = (e) => {
|
|
2515
|
+
e.preventDefault();
|
|
2516
|
+
setDragging(false);
|
|
2517
|
+
processFiles(Array.from(e.dataTransfer.files));
|
|
2518
|
+
};
|
|
2519
|
+
const removeFile = (id) => setFiles((prev) => prev.filter((f) => f.id !== id));
|
|
2520
|
+
return /* @__PURE__ */ React15.createElement("div", { style: { width: "320px", fontFamily: "system-ui, sans-serif" } }, /* @__PURE__ */ React15.createElement(
|
|
2521
|
+
"div",
|
|
2522
|
+
{
|
|
2523
|
+
onClick: () => {
|
|
2524
|
+
var _a;
|
|
2525
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
2526
|
+
},
|
|
2527
|
+
onDragOver: (e) => {
|
|
2528
|
+
e.preventDefault();
|
|
2529
|
+
setDragging(true);
|
|
2530
|
+
},
|
|
2531
|
+
onDragLeave: () => setDragging(false),
|
|
2532
|
+
onDrop: handleDrop,
|
|
2533
|
+
style: {
|
|
2534
|
+
background: dragging ? alpha(accent, 0.1) : "rgba(255,255,255,0.03)",
|
|
2535
|
+
border: `2px dashed ${dragging ? accent : "rgba(255,255,255,0.1)"}`,
|
|
2536
|
+
borderRadius: radius,
|
|
2537
|
+
padding: "32px 20px",
|
|
2538
|
+
textAlign: "center",
|
|
2539
|
+
cursor: "pointer",
|
|
2540
|
+
transition: "all 0.2s"
|
|
2541
|
+
}
|
|
2542
|
+
},
|
|
2543
|
+
/* @__PURE__ */ React15.createElement(
|
|
2544
|
+
"input",
|
|
2545
|
+
{
|
|
2546
|
+
ref: inputRef,
|
|
2547
|
+
type: "file",
|
|
2548
|
+
accept,
|
|
2549
|
+
multiple,
|
|
2550
|
+
style: { display: "none" },
|
|
2551
|
+
onChange: (e) => processFiles(Array.from(e.target.files))
|
|
2552
|
+
}
|
|
2553
|
+
),
|
|
2554
|
+
/* @__PURE__ */ React15.createElement("div", { style: {
|
|
2555
|
+
width: "48px",
|
|
2556
|
+
height: "48px",
|
|
2557
|
+
borderRadius: "14px",
|
|
2558
|
+
background: alpha(accent, 0.12),
|
|
2559
|
+
border: `1px solid ${alpha(accent, 0.25)}`,
|
|
2560
|
+
display: "flex",
|
|
2561
|
+
alignItems: "center",
|
|
2562
|
+
justifyContent: "center",
|
|
2563
|
+
margin: "0 auto 14px",
|
|
2564
|
+
transition: "all 0.2s",
|
|
2565
|
+
transform: dragging ? "scale(1.1)" : "scale(1)"
|
|
2566
|
+
} }, /* @__PURE__ */ React15.createElement(
|
|
2567
|
+
"svg",
|
|
2568
|
+
{
|
|
2569
|
+
width: "22",
|
|
2570
|
+
height: "22",
|
|
2571
|
+
viewBox: "0 0 24 24",
|
|
2572
|
+
fill: "none",
|
|
2573
|
+
stroke: accent,
|
|
2574
|
+
strokeWidth: "2",
|
|
2575
|
+
strokeLinecap: "round",
|
|
2576
|
+
strokeLinejoin: "round"
|
|
2577
|
+
},
|
|
2578
|
+
/* @__PURE__ */ React15.createElement("path", { d: "M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M17 8l-5-5-5 5M12 3v12" })
|
|
2579
|
+
)),
|
|
2580
|
+
/* @__PURE__ */ React15.createElement("p", { style: { fontSize: "13px", fontWeight: "600", color: "#fff", margin: "0 0 4px" } }, label),
|
|
2581
|
+
/* @__PURE__ */ React15.createElement("p", { style: { fontSize: "11px", color: "rgba(255,255,255,0.3)", margin: 0 } }, subLabel, " ", maxSizeMB, "MB")
|
|
2582
|
+
), error && /* @__PURE__ */ React15.createElement("div", { style: {
|
|
2583
|
+
marginTop: "10px",
|
|
2584
|
+
padding: "9px 12px",
|
|
2585
|
+
borderRadius: "10px",
|
|
2586
|
+
background: "rgba(239,68,68,0.08)",
|
|
2587
|
+
border: "1px solid rgba(239,68,68,0.2)",
|
|
2588
|
+
display: "flex",
|
|
2589
|
+
alignItems: "center",
|
|
2590
|
+
gap: "8px"
|
|
2591
|
+
} }, /* @__PURE__ */ React15.createElement(
|
|
2592
|
+
"svg",
|
|
2593
|
+
{
|
|
2594
|
+
width: "13",
|
|
2595
|
+
height: "13",
|
|
2596
|
+
viewBox: "0 0 24 24",
|
|
2597
|
+
fill: "none",
|
|
2598
|
+
stroke: "#f87171",
|
|
2599
|
+
strokeWidth: "2.5",
|
|
2600
|
+
strokeLinecap: "round"
|
|
2601
|
+
},
|
|
2602
|
+
/* @__PURE__ */ React15.createElement("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2603
|
+
/* @__PURE__ */ React15.createElement("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
2604
|
+
/* @__PURE__ */ React15.createElement("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
2605
|
+
), /* @__PURE__ */ React15.createElement("span", { style: { fontSize: "11px", color: "#f87171" } }, error)), files.length > 0 && /* @__PURE__ */ React15.createElement("div", { style: { marginTop: "12px", display: "flex", flexDirection: "column", gap: "8px" } }, files.map(({ file, id, progress, done }) => {
|
|
2606
|
+
const icon = getIcon(file.type);
|
|
2607
|
+
const preview = file.type.startsWith("image/") ? URL.createObjectURL(file) : null;
|
|
2608
|
+
return /* @__PURE__ */ React15.createElement("div", { key: id, style: {
|
|
2609
|
+
background: "rgba(255,255,255,0.03)",
|
|
2610
|
+
border: `1px solid ${done ? alpha(accent, 0.2) : "rgba(255,255,255,0.07)"}`,
|
|
2611
|
+
borderRadius: "12px",
|
|
2612
|
+
padding: "10px 12px",
|
|
2613
|
+
transition: "border-color 0.3s"
|
|
2614
|
+
} }, /* @__PURE__ */ React15.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px" } }, /* @__PURE__ */ React15.createElement("div", { style: {
|
|
2615
|
+
width: "36px",
|
|
2616
|
+
height: "36px",
|
|
2617
|
+
borderRadius: "8px",
|
|
2618
|
+
flexShrink: 0,
|
|
2619
|
+
background: preview ? `url(${preview}) center/cover` : alpha(icon.color, 0.12),
|
|
2620
|
+
border: `1px solid ${alpha(icon.color, 0.2)}`,
|
|
2621
|
+
display: "flex",
|
|
2622
|
+
alignItems: "center",
|
|
2623
|
+
justifyContent: "center",
|
|
2624
|
+
overflow: "hidden"
|
|
2625
|
+
} }, !preview && /* @__PURE__ */ React15.createElement(
|
|
2626
|
+
"svg",
|
|
2627
|
+
{
|
|
2628
|
+
width: "16",
|
|
2629
|
+
height: "16",
|
|
2630
|
+
viewBox: "0 0 24 24",
|
|
2631
|
+
fill: "none",
|
|
2632
|
+
stroke: icon.color,
|
|
2633
|
+
strokeWidth: "2",
|
|
2634
|
+
strokeLinecap: "round",
|
|
2635
|
+
strokeLinejoin: "round"
|
|
2636
|
+
},
|
|
2637
|
+
/* @__PURE__ */ React15.createElement("path", { d: icon.path })
|
|
2638
|
+
)), /* @__PURE__ */ React15.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React15.createElement("p", { style: {
|
|
2639
|
+
fontSize: "12px",
|
|
2640
|
+
fontWeight: "600",
|
|
2641
|
+
color: "#fff",
|
|
2642
|
+
margin: "0 0 2px",
|
|
2643
|
+
overflow: "hidden",
|
|
2644
|
+
textOverflow: "ellipsis",
|
|
2645
|
+
whiteSpace: "nowrap"
|
|
2646
|
+
} }, file.name), /* @__PURE__ */ React15.createElement("p", { style: { fontSize: "10px", color: "rgba(255,255,255,0.3)", margin: 0 } }, formatSize(file.size))), done ? /* @__PURE__ */ React15.createElement("div", { style: {
|
|
2647
|
+
width: "22px",
|
|
2648
|
+
height: "22px",
|
|
2649
|
+
borderRadius: "50%",
|
|
2650
|
+
background: "rgba(16,185,129,0.15)",
|
|
2651
|
+
border: "1px solid rgba(16,185,129,0.3)",
|
|
2652
|
+
display: "flex",
|
|
2653
|
+
alignItems: "center",
|
|
2654
|
+
justifyContent: "center",
|
|
2655
|
+
flexShrink: 0
|
|
2656
|
+
} }, /* @__PURE__ */ React15.createElement(
|
|
2657
|
+
"svg",
|
|
2658
|
+
{
|
|
2659
|
+
width: "10",
|
|
2660
|
+
height: "10",
|
|
2661
|
+
viewBox: "0 0 24 24",
|
|
2662
|
+
fill: "none",
|
|
2663
|
+
stroke: "#34d399",
|
|
2664
|
+
strokeWidth: "3",
|
|
2665
|
+
strokeLinecap: "round"
|
|
2666
|
+
},
|
|
2667
|
+
/* @__PURE__ */ React15.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
2668
|
+
)) : /* @__PURE__ */ React15.createElement(
|
|
2669
|
+
"button",
|
|
2670
|
+
{
|
|
2671
|
+
onClick: () => removeFile(id),
|
|
2672
|
+
style: {
|
|
2673
|
+
background: "transparent",
|
|
2674
|
+
border: "none",
|
|
2675
|
+
padding: "2px",
|
|
2676
|
+
cursor: "pointer",
|
|
2677
|
+
color: "rgba(255,255,255,0.25)",
|
|
2678
|
+
flexShrink: 0,
|
|
2679
|
+
transition: "color 0.2s"
|
|
2680
|
+
},
|
|
2681
|
+
onMouseEnter: (e) => e.currentTarget.style.color = "#f87171",
|
|
2682
|
+
onMouseLeave: (e) => e.currentTarget.style.color = "rgba(255,255,255,0.25)"
|
|
2683
|
+
},
|
|
2684
|
+
/* @__PURE__ */ React15.createElement(
|
|
2685
|
+
"svg",
|
|
2686
|
+
{
|
|
2687
|
+
width: "14",
|
|
2688
|
+
height: "14",
|
|
2689
|
+
viewBox: "0 0 24 24",
|
|
2690
|
+
fill: "none",
|
|
2691
|
+
stroke: "currentColor",
|
|
2692
|
+
strokeWidth: "2.5",
|
|
2693
|
+
strokeLinecap: "round"
|
|
2694
|
+
},
|
|
2695
|
+
/* @__PURE__ */ React15.createElement("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
2696
|
+
)
|
|
2697
|
+
)), !done && /* @__PURE__ */ React15.createElement("div", { style: {
|
|
2698
|
+
marginTop: "8px",
|
|
2699
|
+
height: "3px",
|
|
2700
|
+
background: "rgba(255,255,255,0.06)",
|
|
2701
|
+
borderRadius: "2px",
|
|
2702
|
+
overflow: "hidden"
|
|
2703
|
+
} }, /* @__PURE__ */ React15.createElement("div", { style: {
|
|
2704
|
+
height: "100%",
|
|
2705
|
+
borderRadius: "2px",
|
|
2706
|
+
width: `${progress}%`,
|
|
2707
|
+
background: `linear-gradient(90deg, ${accent}, ${alpha(accent, 0.6)})`,
|
|
2708
|
+
transition: "width 0.2s ease"
|
|
2709
|
+
} })));
|
|
2710
|
+
})));
|
|
2711
|
+
};
|
|
2712
|
+
|
|
2713
|
+
// src/components/ColorPicker/ColorPicker.jsx
|
|
2714
|
+
import React16, { useState as useState14 } from "react";
|
|
2715
|
+
var ColorPicker = ({
|
|
2716
|
+
defaultColor = "#6366f1",
|
|
2717
|
+
showOpacity = true,
|
|
2718
|
+
showEyedropper = true,
|
|
2719
|
+
showInput = true,
|
|
2720
|
+
accent = "#6366f1",
|
|
2721
|
+
bg = "#0f172a",
|
|
2722
|
+
radius = "16px",
|
|
2723
|
+
onChange = () => {
|
|
2724
|
+
},
|
|
2725
|
+
swatches = [
|
|
2726
|
+
"#6366f1",
|
|
2727
|
+
"#8b5cf6",
|
|
2728
|
+
"#a855f7",
|
|
2729
|
+
"#ec4899",
|
|
2730
|
+
"#f43f5e",
|
|
2731
|
+
"#ef4444",
|
|
2732
|
+
"#f97316",
|
|
2733
|
+
"#f59e0b",
|
|
2734
|
+
"#eab308",
|
|
2735
|
+
"#84cc16",
|
|
2736
|
+
"#22c55e",
|
|
2737
|
+
"#10b981",
|
|
2738
|
+
"#14b8a6",
|
|
2739
|
+
"#06b6d4",
|
|
2740
|
+
"#3b82f6",
|
|
2741
|
+
"#0ea5e9",
|
|
2742
|
+
"#64748b",
|
|
2743
|
+
"#94a3b8",
|
|
2744
|
+
"#ffffff",
|
|
2745
|
+
"#000000"
|
|
2746
|
+
]
|
|
2747
|
+
}) => {
|
|
2748
|
+
const [color, setColor] = useState14(defaultColor);
|
|
2749
|
+
const [hex, setHex] = useState14(defaultColor);
|
|
2750
|
+
const [opacity, setOpacity] = useState14(100);
|
|
2751
|
+
const [inputErr, setInputErr] = useState14(false);
|
|
2752
|
+
const [copied, setCopied] = useState14(false);
|
|
2753
|
+
const alpha = (hexVal, op) => {
|
|
2754
|
+
const r = parseInt(hexVal.slice(1, 3), 16);
|
|
2755
|
+
const g = parseInt(hexVal.slice(3, 5), 16);
|
|
2756
|
+
const b = parseInt(hexVal.slice(5, 7), 16);
|
|
2757
|
+
return `rgba(${r},${g},${b},${op})`;
|
|
2758
|
+
};
|
|
2759
|
+
const isValidHex = (v) => /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(v);
|
|
2760
|
+
const applyColor = (val) => {
|
|
2761
|
+
if (!isValidHex(val)) {
|
|
2762
|
+
setInputErr(true);
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2765
|
+
setInputErr(false);
|
|
2766
|
+
setColor(val);
|
|
2767
|
+
setHex(val);
|
|
2768
|
+
onChange({ hex: val, opacity, rgba: alpha(val, opacity / 100) });
|
|
2769
|
+
};
|
|
2770
|
+
const pickSwatch = (val) => {
|
|
2771
|
+
setColor(val);
|
|
2772
|
+
setHex(val);
|
|
2773
|
+
setInputErr(false);
|
|
2774
|
+
onChange({ hex: val, opacity, rgba: alpha(val, opacity / 100) });
|
|
2775
|
+
};
|
|
2776
|
+
const handleOpacity = (v) => {
|
|
2777
|
+
setOpacity(v);
|
|
2778
|
+
onChange({ hex: color, opacity: v, rgba: alpha(color, v / 100) });
|
|
2779
|
+
};
|
|
2780
|
+
const copyHex = () => {
|
|
2781
|
+
var _a;
|
|
2782
|
+
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(hex).catch(() => {
|
|
2783
|
+
});
|
|
2784
|
+
setCopied(true);
|
|
2785
|
+
setTimeout(() => setCopied(false), 1500);
|
|
2786
|
+
};
|
|
2787
|
+
const hueGradient = "linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)";
|
|
2788
|
+
return /* @__PURE__ */ React16.createElement("div", { style: {
|
|
2789
|
+
background: bg,
|
|
2790
|
+
borderRadius: radius,
|
|
2791
|
+
padding: "20px",
|
|
2792
|
+
width: "260px",
|
|
2793
|
+
fontFamily: "system-ui, sans-serif",
|
|
2794
|
+
border: "1px solid rgba(255,255,255,0.07)",
|
|
2795
|
+
boxShadow: "0 10px 40px rgba(0,0,0,0.4)"
|
|
2796
|
+
} }, /* @__PURE__ */ React16.createElement("div", { style: {
|
|
2797
|
+
height: "52px",
|
|
2798
|
+
borderRadius: "12px",
|
|
2799
|
+
marginBottom: "16px",
|
|
2800
|
+
background: alpha(color, opacity / 100),
|
|
2801
|
+
border: "1px solid rgba(255,255,255,0.08)",
|
|
2802
|
+
position: "relative",
|
|
2803
|
+
overflow: "hidden"
|
|
2804
|
+
} }, /* @__PURE__ */ React16.createElement("div", { style: {
|
|
2805
|
+
position: "absolute",
|
|
2806
|
+
inset: 0,
|
|
2807
|
+
zIndex: 0,
|
|
2808
|
+
backgroundImage: "linear-gradient(45deg,#555 25%,transparent 25%),linear-gradient(-45deg,#555 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#555 75%),linear-gradient(-45deg,transparent 75%,#555 75%)",
|
|
2809
|
+
backgroundSize: "10px 10px",
|
|
2810
|
+
backgroundPosition: "0 0,0 5px,5px -5px,-5px 0",
|
|
2811
|
+
opacity: 0.3
|
|
2812
|
+
} }), /* @__PURE__ */ React16.createElement("div", { style: { position: "absolute", inset: 0, background: alpha(color, opacity / 100) } })), /* @__PURE__ */ React16.createElement("div", { style: { position: "relative", marginBottom: "12px" } }, /* @__PURE__ */ React16.createElement(
|
|
2813
|
+
"input",
|
|
2814
|
+
{
|
|
2815
|
+
type: "range",
|
|
2816
|
+
min: "0",
|
|
2817
|
+
max: "360",
|
|
2818
|
+
defaultValue: "240",
|
|
2819
|
+
onChange: (e) => {
|
|
2820
|
+
const h = e.target.value;
|
|
2821
|
+
const c = `hsl(${h},80%,60%)`;
|
|
2822
|
+
const el = document.createElement("div");
|
|
2823
|
+
el.style.color = c;
|
|
2824
|
+
document.body.appendChild(el);
|
|
2825
|
+
const rgb = getComputedStyle(el).color;
|
|
2826
|
+
document.body.removeChild(el);
|
|
2827
|
+
const [r, g, b] = rgb.match(/\d+/g).map(Number);
|
|
2828
|
+
const hex6 = "#" + [r, g, b].map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
2829
|
+
pickSwatch(hex6);
|
|
2830
|
+
},
|
|
2831
|
+
style: {
|
|
2832
|
+
width: "100%",
|
|
2833
|
+
height: "10px",
|
|
2834
|
+
borderRadius: "5px",
|
|
2835
|
+
appearance: "none",
|
|
2836
|
+
WebkitAppearance: "none",
|
|
2837
|
+
background: hueGradient,
|
|
2838
|
+
cursor: "pointer",
|
|
2839
|
+
outline: "none",
|
|
2840
|
+
border: "none"
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
)), showOpacity && /* @__PURE__ */ React16.createElement("div", { style: { marginBottom: "16px" } }, /* @__PURE__ */ React16.createElement(
|
|
2844
|
+
"input",
|
|
2845
|
+
{
|
|
2846
|
+
type: "range",
|
|
2847
|
+
min: "0",
|
|
2848
|
+
max: "100",
|
|
2849
|
+
value: opacity,
|
|
2850
|
+
onChange: (e) => handleOpacity(Number(e.target.value)),
|
|
2851
|
+
style: {
|
|
2852
|
+
width: "100%",
|
|
2853
|
+
height: "10px",
|
|
2854
|
+
borderRadius: "5px",
|
|
2855
|
+
appearance: "none",
|
|
2856
|
+
WebkitAppearance: "none",
|
|
2857
|
+
background: `linear-gradient(90deg, transparent, ${color})`,
|
|
2858
|
+
cursor: "pointer",
|
|
2859
|
+
outline: "none",
|
|
2860
|
+
border: "none"
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
), /* @__PURE__ */ React16.createElement("div", { style: { display: "flex", justifyContent: "space-between", marginTop: "4px" } }, /* @__PURE__ */ React16.createElement("span", { style: { fontSize: "10px", color: "rgba(255,255,255,0.25)" } }, "Opacity"), /* @__PURE__ */ React16.createElement("span", { style: { fontSize: "10px", color: "rgba(255,255,255,0.45)", fontWeight: "600" } }, opacity, "%"))), showInput && /* @__PURE__ */ React16.createElement("div", { style: { display: "flex", gap: "8px", marginBottom: "16px", alignItems: "center" } }, /* @__PURE__ */ React16.createElement("div", { style: {
|
|
2864
|
+
width: "32px",
|
|
2865
|
+
height: "32px",
|
|
2866
|
+
borderRadius: "8px",
|
|
2867
|
+
flexShrink: 0,
|
|
2868
|
+
background: color,
|
|
2869
|
+
border: "1px solid rgba(255,255,255,0.1)"
|
|
2870
|
+
} }), /* @__PURE__ */ React16.createElement(
|
|
2871
|
+
"input",
|
|
2872
|
+
{
|
|
2873
|
+
value: hex,
|
|
2874
|
+
onChange: (e) => {
|
|
2875
|
+
setHex(e.target.value);
|
|
2876
|
+
setInputErr(false);
|
|
2877
|
+
},
|
|
2878
|
+
onBlur: (e) => applyColor(e.target.value),
|
|
2879
|
+
onKeyDown: (e) => e.key === "Enter" && applyColor(hex),
|
|
2880
|
+
placeholder: "#000000",
|
|
2881
|
+
style: {
|
|
2882
|
+
flex: 1,
|
|
2883
|
+
background: "rgba(255,255,255,0.05)",
|
|
2884
|
+
border: `1px solid ${inputErr ? "rgba(239,68,68,0.6)" : "rgba(255,255,255,0.1)"}`,
|
|
2885
|
+
borderRadius: "8px",
|
|
2886
|
+
padding: "7px 10px",
|
|
2887
|
+
fontSize: "12px",
|
|
2888
|
+
fontFamily: "monospace",
|
|
2889
|
+
color: inputErr ? "#f87171" : "#fff",
|
|
2890
|
+
outline: "none"
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
), /* @__PURE__ */ React16.createElement(
|
|
2894
|
+
"button",
|
|
2895
|
+
{
|
|
2896
|
+
onClick: copyHex,
|
|
2897
|
+
title: "Copy hex",
|
|
2898
|
+
style: {
|
|
2899
|
+
width: "32px",
|
|
2900
|
+
height: "32px",
|
|
2901
|
+
borderRadius: "8px",
|
|
2902
|
+
flexShrink: 0,
|
|
2903
|
+
background: copied ? "rgba(16,185,129,0.15)" : "rgba(255,255,255,0.05)",
|
|
2904
|
+
border: `1px solid ${copied ? "rgba(16,185,129,0.3)" : "rgba(255,255,255,0.1)"}`,
|
|
2905
|
+
cursor: "pointer",
|
|
2906
|
+
display: "flex",
|
|
2907
|
+
alignItems: "center",
|
|
2908
|
+
justifyContent: "center",
|
|
2909
|
+
color: copied ? "#34d399" : "rgba(255,255,255,0.4)",
|
|
2910
|
+
transition: "all 0.2s"
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
copied ? /* @__PURE__ */ React16.createElement("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }, /* @__PURE__ */ React16.createElement("polyline", { points: "20 6 9 17 4 12" })) : /* @__PURE__ */ React16.createElement("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }, /* @__PURE__ */ React16.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }), /* @__PURE__ */ React16.createElement("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" }))
|
|
2914
|
+
)), /* @__PURE__ */ React16.createElement("div", { style: { height: "1px", background: "rgba(255,255,255,0.06)", marginBottom: "14px" } }), /* @__PURE__ */ React16.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "7px" } }, swatches.map((s) => /* @__PURE__ */ React16.createElement(
|
|
2915
|
+
"button",
|
|
2916
|
+
{
|
|
2917
|
+
key: s,
|
|
2918
|
+
onClick: () => pickSwatch(s),
|
|
2919
|
+
title: s,
|
|
2920
|
+
style: {
|
|
2921
|
+
width: "22px",
|
|
2922
|
+
height: "22px",
|
|
2923
|
+
borderRadius: "6px",
|
|
2924
|
+
background: s,
|
|
2925
|
+
border: `2px solid ${color === s ? "#fff" : "transparent"}`,
|
|
2926
|
+
cursor: "pointer",
|
|
2927
|
+
padding: 0,
|
|
2928
|
+
transition: "transform 0.15s, border-color 0.15s",
|
|
2929
|
+
outline: "none",
|
|
2930
|
+
boxShadow: s === "#ffffff" ? "inset 0 0 0 1px rgba(0,0,0,0.15)" : "none"
|
|
2931
|
+
},
|
|
2932
|
+
onMouseEnter: (e) => e.currentTarget.style.transform = "scale(1.2)",
|
|
2933
|
+
onMouseLeave: (e) => e.currentTarget.style.transform = "scale(1)"
|
|
2934
|
+
}
|
|
2935
|
+
))), /* @__PURE__ */ React16.createElement("div", { style: {
|
|
2936
|
+
marginTop: "14px",
|
|
2937
|
+
padding: "8px 10px",
|
|
2938
|
+
borderRadius: "8px",
|
|
2939
|
+
background: "rgba(255,255,255,0.03)",
|
|
2940
|
+
border: "1px solid rgba(255,255,255,0.06)",
|
|
2941
|
+
display: "flex",
|
|
2942
|
+
justifyContent: "space-between",
|
|
2943
|
+
alignItems: "center"
|
|
2944
|
+
} }, /* @__PURE__ */ React16.createElement("span", { style: { fontSize: "10px", color: "rgba(255,255,255,0.25)", fontWeight: "600", textTransform: "uppercase", letterSpacing: "0.5px" } }, "RGBA"), /* @__PURE__ */ React16.createElement("span", { style: { fontSize: "10px", fontFamily: "monospace", color: "rgba(255,255,255,0.5)" } }, alpha(color, opacity / 100))));
|
|
2945
|
+
};
|
|
2449
2946
|
export {
|
|
2450
2947
|
AvatarCard,
|
|
2451
2948
|
BackgoundImageSlider,
|
|
2452
2949
|
Charts,
|
|
2950
|
+
ColorPicker,
|
|
2951
|
+
FileUpload,
|
|
2453
2952
|
Footer,
|
|
2454
2953
|
ImageCard,
|
|
2455
2954
|
ImageSlider,
|