virtual-ui-lib 1.0.70 → 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 +236 -0
- package/dist/index.mjs +235 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(index_exports, {
|
|
|
32
32
|
AvatarCard: () => AvatarCard,
|
|
33
33
|
BackgoundImageSlider: () => BackgoundImageSlider,
|
|
34
34
|
Charts: () => Charts,
|
|
35
|
+
ColorPicker: () => ColorPicker,
|
|
35
36
|
FileUpload: () => FileUpload,
|
|
36
37
|
Footer: () => Footer,
|
|
37
38
|
ImageCard: () => ImageCard,
|
|
@@ -2758,11 +2759,246 @@ var FileUpload = ({
|
|
|
2758
2759
|
} })));
|
|
2759
2760
|
})));
|
|
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
|
+
};
|
|
2761
2996
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2762
2997
|
0 && (module.exports = {
|
|
2763
2998
|
AvatarCard,
|
|
2764
2999
|
BackgoundImageSlider,
|
|
2765
3000
|
Charts,
|
|
3001
|
+
ColorPicker,
|
|
2766
3002
|
FileUpload,
|
|
2767
3003
|
Footer,
|
|
2768
3004
|
ImageCard,
|
package/dist/index.mjs
CHANGED
|
@@ -2709,10 +2709,245 @@ var FileUpload = ({
|
|
|
2709
2709
|
} })));
|
|
2710
2710
|
})));
|
|
2711
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
|
+
};
|
|
2712
2946
|
export {
|
|
2713
2947
|
AvatarCard,
|
|
2714
2948
|
BackgoundImageSlider,
|
|
2715
2949
|
Charts,
|
|
2950
|
+
ColorPicker,
|
|
2716
2951
|
FileUpload,
|
|
2717
2952
|
Footer,
|
|
2718
2953
|
ImageCard,
|