virtual-ui-lib 1.0.58 → 1.0.59
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 +105 -2
- package/dist/index.mjs +114 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -623,8 +623,111 @@ var FileUpload = ({ bg = "#1e293b", textColor = "#f1f5f9", accent = "#7c3aed", r
|
|
|
623
623
|
|
|
624
624
|
// src/components/Loader/Loader.jsx
|
|
625
625
|
var import_react13 = __toESM(require("react"));
|
|
626
|
-
var Loader = ({
|
|
627
|
-
|
|
626
|
+
var Loader = ({
|
|
627
|
+
type = "spinner",
|
|
628
|
+
size = 48,
|
|
629
|
+
accent = "#6366f1",
|
|
630
|
+
bg = "transparent",
|
|
631
|
+
label = "",
|
|
632
|
+
speed = 1
|
|
633
|
+
}) => {
|
|
634
|
+
const [dots, setDots] = (0, import_react13.useState)(0);
|
|
635
|
+
const [progress, setProgress] = (0, import_react13.useState)(0);
|
|
636
|
+
const alpha = (hex, op) => {
|
|
637
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
638
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
639
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
640
|
+
return `rgba(${r},${g},${b},${op})`;
|
|
641
|
+
};
|
|
642
|
+
(0, import_react13.useEffect)(() => {
|
|
643
|
+
if (type === "dots") {
|
|
644
|
+
const t = setInterval(() => setDots((d) => (d + 1) % 4), 400 / speed);
|
|
645
|
+
return () => clearInterval(t);
|
|
646
|
+
}
|
|
647
|
+
if (type === "bar") {
|
|
648
|
+
const t = setInterval(() => setProgress((p) => p >= 100 ? 0 : p + 2), 30 / speed);
|
|
649
|
+
return () => clearInterval(t);
|
|
650
|
+
}
|
|
651
|
+
}, [type, speed]);
|
|
652
|
+
const dur = `${1 / speed}s`;
|
|
653
|
+
const wrapStyle = {
|
|
654
|
+
display: "inline-flex",
|
|
655
|
+
flexDirection: "column",
|
|
656
|
+
alignItems: "center",
|
|
657
|
+
justifyContent: "center",
|
|
658
|
+
gap: "12px",
|
|
659
|
+
background: bg,
|
|
660
|
+
padding: bg !== "transparent" ? "24px" : "0",
|
|
661
|
+
borderRadius: "16px",
|
|
662
|
+
fontFamily: "system-ui, sans-serif"
|
|
663
|
+
};
|
|
664
|
+
const labelEl = label ? /* @__PURE__ */ import_react13.default.createElement("span", { style: { fontSize: "13px", color: "rgba(255,255,255,0.45)", letterSpacing: "0.3px" } }, label) : null;
|
|
665
|
+
if (type === "spinner") return /* @__PURE__ */ import_react13.default.createElement("div", { style: wrapStyle }, /* @__PURE__ */ import_react13.default.createElement("svg", { width: size, height: size, viewBox: "0 0 48 48" }, /* @__PURE__ */ import_react13.default.createElement(
|
|
666
|
+
"circle",
|
|
667
|
+
{
|
|
668
|
+
cx: "24",
|
|
669
|
+
cy: "24",
|
|
670
|
+
r: "20",
|
|
671
|
+
fill: "none",
|
|
672
|
+
stroke: alpha(accent, 0.15),
|
|
673
|
+
strokeWidth: "4"
|
|
674
|
+
}
|
|
675
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
676
|
+
"circle",
|
|
677
|
+
{
|
|
678
|
+
cx: "24",
|
|
679
|
+
cy: "24",
|
|
680
|
+
r: "20",
|
|
681
|
+
fill: "none",
|
|
682
|
+
stroke: accent,
|
|
683
|
+
strokeWidth: "4",
|
|
684
|
+
strokeLinecap: "round",
|
|
685
|
+
strokeDasharray: "31.4 94.2",
|
|
686
|
+
style: { transformOrigin: "center", animation: `spin ${dur} linear infinite` }
|
|
687
|
+
}
|
|
688
|
+
), /* @__PURE__ */ import_react13.default.createElement("style", null, `@keyframes spin { to { transform: rotate(360deg); } }`)), labelEl);
|
|
689
|
+
if (type === "pulse") return /* @__PURE__ */ import_react13.default.createElement("div", { style: wrapStyle }, /* @__PURE__ */ import_react13.default.createElement("div", { style: { position: "relative", width: size, height: size } }, /* @__PURE__ */ import_react13.default.createElement("div", { style: {
|
|
690
|
+
position: "absolute",
|
|
691
|
+
inset: 0,
|
|
692
|
+
borderRadius: "50%",
|
|
693
|
+
background: alpha(accent, 0.2),
|
|
694
|
+
animation: `pulse ${dur} ease-out infinite`
|
|
695
|
+
} }), /* @__PURE__ */ import_react13.default.createElement("div", { style: {
|
|
696
|
+
position: "absolute",
|
|
697
|
+
inset: "25%",
|
|
698
|
+
borderRadius: "50%",
|
|
699
|
+
background: accent
|
|
700
|
+
} }), /* @__PURE__ */ import_react13.default.createElement("style", null, `@keyframes pulse { 0%{transform:scale(1);opacity:1} 100%{transform:scale(2);opacity:0} }`)), labelEl);
|
|
701
|
+
if (type === "dots") return /* @__PURE__ */ import_react13.default.createElement("div", { style: wrapStyle }, /* @__PURE__ */ import_react13.default.createElement("div", { style: { display: "flex", gap: "8px", alignItems: "center" } }, [0, 1, 2].map((i) => /* @__PURE__ */ import_react13.default.createElement("div", { key: i, style: {
|
|
702
|
+
width: size / 5,
|
|
703
|
+
height: size / 5,
|
|
704
|
+
borderRadius: "50%",
|
|
705
|
+
background: dots === i ? accent : alpha(accent, 0.25),
|
|
706
|
+
transition: "background 0.2s"
|
|
707
|
+
} }))), labelEl);
|
|
708
|
+
if (type === "bar") return /* @__PURE__ */ import_react13.default.createElement("div", { style: wrapStyle }, /* @__PURE__ */ import_react13.default.createElement("div", { style: {
|
|
709
|
+
width: size * 3,
|
|
710
|
+
height: size / 8,
|
|
711
|
+
background: alpha(accent, 0.15),
|
|
712
|
+
borderRadius: "99px",
|
|
713
|
+
overflow: "hidden"
|
|
714
|
+
} }, /* @__PURE__ */ import_react13.default.createElement("div", { style: {
|
|
715
|
+
height: "100%",
|
|
716
|
+
borderRadius: "99px",
|
|
717
|
+
background: accent,
|
|
718
|
+
width: `${progress}%`,
|
|
719
|
+
transition: "width 0.03s linear"
|
|
720
|
+
} })), labelEl);
|
|
721
|
+
if (type === "ring") return /* @__PURE__ */ import_react13.default.createElement("div", { style: wrapStyle }, /* @__PURE__ */ import_react13.default.createElement("div", { style: {
|
|
722
|
+
width: size,
|
|
723
|
+
height: size,
|
|
724
|
+
borderRadius: "50%",
|
|
725
|
+
border: `4px solid ${alpha(accent, 0.15)}`,
|
|
726
|
+
borderTop: `4px solid ${accent}`,
|
|
727
|
+
borderRight: `4px solid ${accent}`,
|
|
728
|
+
animation: `spin ${dur} linear infinite`
|
|
729
|
+
} }), /* @__PURE__ */ import_react13.default.createElement("style", null, `@keyframes spin { to { transform: rotate(360deg); } }`), labelEl);
|
|
730
|
+
return null;
|
|
628
731
|
};
|
|
629
732
|
|
|
630
733
|
// src/components/Avatar/Avatar.jsx
|
package/dist/index.mjs
CHANGED
|
@@ -569,9 +569,112 @@ var FileUpload = ({ bg = "#1e293b", textColor = "#f1f5f9", accent = "#7c3aed", r
|
|
|
569
569
|
};
|
|
570
570
|
|
|
571
571
|
// src/components/Loader/Loader.jsx
|
|
572
|
-
import React13 from "react";
|
|
573
|
-
var Loader = ({
|
|
574
|
-
|
|
572
|
+
import React13, { useEffect as useEffect4, useState as useState10 } from "react";
|
|
573
|
+
var Loader = ({
|
|
574
|
+
type = "spinner",
|
|
575
|
+
size = 48,
|
|
576
|
+
accent = "#6366f1",
|
|
577
|
+
bg = "transparent",
|
|
578
|
+
label = "",
|
|
579
|
+
speed = 1
|
|
580
|
+
}) => {
|
|
581
|
+
const [dots, setDots] = useState10(0);
|
|
582
|
+
const [progress, setProgress] = useState10(0);
|
|
583
|
+
const alpha = (hex, op) => {
|
|
584
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
585
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
586
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
587
|
+
return `rgba(${r},${g},${b},${op})`;
|
|
588
|
+
};
|
|
589
|
+
useEffect4(() => {
|
|
590
|
+
if (type === "dots") {
|
|
591
|
+
const t = setInterval(() => setDots((d) => (d + 1) % 4), 400 / speed);
|
|
592
|
+
return () => clearInterval(t);
|
|
593
|
+
}
|
|
594
|
+
if (type === "bar") {
|
|
595
|
+
const t = setInterval(() => setProgress((p) => p >= 100 ? 0 : p + 2), 30 / speed);
|
|
596
|
+
return () => clearInterval(t);
|
|
597
|
+
}
|
|
598
|
+
}, [type, speed]);
|
|
599
|
+
const dur = `${1 / speed}s`;
|
|
600
|
+
const wrapStyle = {
|
|
601
|
+
display: "inline-flex",
|
|
602
|
+
flexDirection: "column",
|
|
603
|
+
alignItems: "center",
|
|
604
|
+
justifyContent: "center",
|
|
605
|
+
gap: "12px",
|
|
606
|
+
background: bg,
|
|
607
|
+
padding: bg !== "transparent" ? "24px" : "0",
|
|
608
|
+
borderRadius: "16px",
|
|
609
|
+
fontFamily: "system-ui, sans-serif"
|
|
610
|
+
};
|
|
611
|
+
const labelEl = label ? /* @__PURE__ */ React13.createElement("span", { style: { fontSize: "13px", color: "rgba(255,255,255,0.45)", letterSpacing: "0.3px" } }, label) : null;
|
|
612
|
+
if (type === "spinner") return /* @__PURE__ */ React13.createElement("div", { style: wrapStyle }, /* @__PURE__ */ React13.createElement("svg", { width: size, height: size, viewBox: "0 0 48 48" }, /* @__PURE__ */ React13.createElement(
|
|
613
|
+
"circle",
|
|
614
|
+
{
|
|
615
|
+
cx: "24",
|
|
616
|
+
cy: "24",
|
|
617
|
+
r: "20",
|
|
618
|
+
fill: "none",
|
|
619
|
+
stroke: alpha(accent, 0.15),
|
|
620
|
+
strokeWidth: "4"
|
|
621
|
+
}
|
|
622
|
+
), /* @__PURE__ */ React13.createElement(
|
|
623
|
+
"circle",
|
|
624
|
+
{
|
|
625
|
+
cx: "24",
|
|
626
|
+
cy: "24",
|
|
627
|
+
r: "20",
|
|
628
|
+
fill: "none",
|
|
629
|
+
stroke: accent,
|
|
630
|
+
strokeWidth: "4",
|
|
631
|
+
strokeLinecap: "round",
|
|
632
|
+
strokeDasharray: "31.4 94.2",
|
|
633
|
+
style: { transformOrigin: "center", animation: `spin ${dur} linear infinite` }
|
|
634
|
+
}
|
|
635
|
+
), /* @__PURE__ */ React13.createElement("style", null, `@keyframes spin { to { transform: rotate(360deg); } }`)), labelEl);
|
|
636
|
+
if (type === "pulse") return /* @__PURE__ */ React13.createElement("div", { style: wrapStyle }, /* @__PURE__ */ React13.createElement("div", { style: { position: "relative", width: size, height: size } }, /* @__PURE__ */ React13.createElement("div", { style: {
|
|
637
|
+
position: "absolute",
|
|
638
|
+
inset: 0,
|
|
639
|
+
borderRadius: "50%",
|
|
640
|
+
background: alpha(accent, 0.2),
|
|
641
|
+
animation: `pulse ${dur} ease-out infinite`
|
|
642
|
+
} }), /* @__PURE__ */ React13.createElement("div", { style: {
|
|
643
|
+
position: "absolute",
|
|
644
|
+
inset: "25%",
|
|
645
|
+
borderRadius: "50%",
|
|
646
|
+
background: accent
|
|
647
|
+
} }), /* @__PURE__ */ React13.createElement("style", null, `@keyframes pulse { 0%{transform:scale(1);opacity:1} 100%{transform:scale(2);opacity:0} }`)), labelEl);
|
|
648
|
+
if (type === "dots") return /* @__PURE__ */ React13.createElement("div", { style: wrapStyle }, /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", gap: "8px", alignItems: "center" } }, [0, 1, 2].map((i) => /* @__PURE__ */ React13.createElement("div", { key: i, style: {
|
|
649
|
+
width: size / 5,
|
|
650
|
+
height: size / 5,
|
|
651
|
+
borderRadius: "50%",
|
|
652
|
+
background: dots === i ? accent : alpha(accent, 0.25),
|
|
653
|
+
transition: "background 0.2s"
|
|
654
|
+
} }))), labelEl);
|
|
655
|
+
if (type === "bar") return /* @__PURE__ */ React13.createElement("div", { style: wrapStyle }, /* @__PURE__ */ React13.createElement("div", { style: {
|
|
656
|
+
width: size * 3,
|
|
657
|
+
height: size / 8,
|
|
658
|
+
background: alpha(accent, 0.15),
|
|
659
|
+
borderRadius: "99px",
|
|
660
|
+
overflow: "hidden"
|
|
661
|
+
} }, /* @__PURE__ */ React13.createElement("div", { style: {
|
|
662
|
+
height: "100%",
|
|
663
|
+
borderRadius: "99px",
|
|
664
|
+
background: accent,
|
|
665
|
+
width: `${progress}%`,
|
|
666
|
+
transition: "width 0.03s linear"
|
|
667
|
+
} })), labelEl);
|
|
668
|
+
if (type === "ring") return /* @__PURE__ */ React13.createElement("div", { style: wrapStyle }, /* @__PURE__ */ React13.createElement("div", { style: {
|
|
669
|
+
width: size,
|
|
670
|
+
height: size,
|
|
671
|
+
borderRadius: "50%",
|
|
672
|
+
border: `4px solid ${alpha(accent, 0.15)}`,
|
|
673
|
+
borderTop: `4px solid ${accent}`,
|
|
674
|
+
borderRight: `4px solid ${accent}`,
|
|
675
|
+
animation: `spin ${dur} linear infinite`
|
|
676
|
+
} }), /* @__PURE__ */ React13.createElement("style", null, `@keyframes spin { to { transform: rotate(360deg); } }`), labelEl);
|
|
677
|
+
return null;
|
|
575
678
|
};
|
|
576
679
|
|
|
577
680
|
// src/components/Avatar/Avatar.jsx
|
|
@@ -615,7 +718,7 @@ var DividerLine = ({
|
|
|
615
718
|
};
|
|
616
719
|
|
|
617
720
|
// src/components/Tabs/Tabs.jsx
|
|
618
|
-
import React16, { useState as
|
|
721
|
+
import React16, { useState as useState11 } from "react";
|
|
619
722
|
var Tabs = ({
|
|
620
723
|
tabs = [
|
|
621
724
|
{ label: "Tab 1", content: "Content for Tab 1" },
|
|
@@ -627,7 +730,7 @@ var Tabs = ({
|
|
|
627
730
|
textColor = "#f1f5f9",
|
|
628
731
|
radius = "8px"
|
|
629
732
|
}) => {
|
|
630
|
-
const [activeTab, setActiveTab] =
|
|
733
|
+
const [activeTab, setActiveTab] = useState11(0);
|
|
631
734
|
return /* @__PURE__ */ React16.createElement("div", { style: { background: bg, borderRadius: radius, padding: "16px", boxShadow: "0 4px 20px rgba(0,0,0,0.5)", fontFamily: "system-ui, sans-serif" } }, /* @__PURE__ */ React16.createElement("div", { style: { display: "flex", borderBottom: `2px solid ${accent}` } }, tabs.map((tab, index) => /* @__PURE__ */ React16.createElement(
|
|
632
735
|
"button",
|
|
633
736
|
{
|
|
@@ -649,7 +752,7 @@ var Tabs = ({
|
|
|
649
752
|
};
|
|
650
753
|
|
|
651
754
|
// src/components/NotificationToast/NotificationToast.jsx
|
|
652
|
-
import React17, { useState as
|
|
755
|
+
import React17, { useState as useState12, useEffect as useEffect5 } from "react";
|
|
653
756
|
var NotificationToast = ({
|
|
654
757
|
title = "New Message",
|
|
655
758
|
message = "You have a new notification from the team.",
|
|
@@ -660,8 +763,8 @@ var NotificationToast = ({
|
|
|
660
763
|
radius = "14px",
|
|
661
764
|
showProgress = true
|
|
662
765
|
}) => {
|
|
663
|
-
const [visible, setVisible] =
|
|
664
|
-
const [progress, setProgress] =
|
|
766
|
+
const [visible, setVisible] = useState12(true);
|
|
767
|
+
const [progress, setProgress] = useState12(100);
|
|
665
768
|
const typeColors = {
|
|
666
769
|
success: "#10b981",
|
|
667
770
|
error: "#ef4444",
|
|
@@ -675,7 +778,7 @@ var NotificationToast = ({
|
|
|
675
778
|
info: "M13 16h-1v-4h-1m1-4h.01M12 2a10 10 0 100 20A10 10 0 0012 2z"
|
|
676
779
|
};
|
|
677
780
|
const color = typeColors[type] || accent;
|
|
678
|
-
|
|
781
|
+
useEffect5(() => {
|
|
679
782
|
if (!showProgress) return;
|
|
680
783
|
const step = 100 / (duration / 50);
|
|
681
784
|
const timer = setInterval(() => {
|
|
@@ -769,7 +872,7 @@ var NotificationToast = ({
|
|
|
769
872
|
};
|
|
770
873
|
|
|
771
874
|
// src/components/AvatarCard/AvatarCard.jsx
|
|
772
|
-
import React18, { useState as
|
|
875
|
+
import React18, { useState as useState13 } from "react";
|
|
773
876
|
var AvatarCard = ({
|
|
774
877
|
name = "Aryan Sharma",
|
|
775
878
|
role = "Frontend Developer",
|
|
@@ -782,7 +885,7 @@ var AvatarCard = ({
|
|
|
782
885
|
bg = "#0f172a",
|
|
783
886
|
radius = "20px"
|
|
784
887
|
}) => {
|
|
785
|
-
const [followed, setFollowed] =
|
|
888
|
+
const [followed, setFollowed] = useState13(false);
|
|
786
889
|
const alpha = (hex, op) => {
|
|
787
890
|
const r = parseInt(hex.slice(1, 3), 16);
|
|
788
891
|
const g = parseInt(hex.slice(3, 5), 16);
|