virtual-ui-lib 1.0.35 → 1.0.36

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 CHANGED
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  OTPInput: () => OTPInput,
50
50
  Rating: () => Rating,
51
51
  RatingStars: () => RatingStars,
52
+ StatCard: () => StatCard,
52
53
  UserAvatar: () => UserAvatar,
53
54
  WishlistButton: () => WishlistButton
54
55
  });
@@ -1127,6 +1128,46 @@ var AnimatedNavbar = ({
1127
1128
  transition: "background 0.3s"
1128
1129
  }, onMouseEnter: (e) => e.currentTarget.style.background = accentColor, onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, link.text))));
1129
1130
  };
1131
+
1132
+ // src/components/StatCard/StatCard.jsx
1133
+ var import_react23 = __toESM(require("react"));
1134
+ var StatCard = ({
1135
+ title = "Total Sales",
1136
+ value = 1e3,
1137
+ change = 5,
1138
+ bg = "#0f172a",
1139
+ accent = "#0f766e",
1140
+ negativeAccent = "#dc2626",
1141
+ radius = "16px"
1142
+ }) => {
1143
+ const [count, setCount] = (0, import_react23.useState)(0);
1144
+ (0, import_react23.useEffect)(() => {
1145
+ let start = 0;
1146
+ const end = value;
1147
+ const duration = 2;
1148
+ const increment = end / (duration * 60);
1149
+ const timer = setInterval(() => {
1150
+ start += increment;
1151
+ if (start >= end) {
1152
+ clearInterval(timer);
1153
+ setCount(end);
1154
+ } else {
1155
+ setCount(Math.floor(start));
1156
+ }
1157
+ }, 1e3 / 60);
1158
+ return () => clearInterval(timer);
1159
+ }, [value]);
1160
+ return /* @__PURE__ */ import_react23.default.createElement("div", { style: { background: bg, borderRadius: radius, padding: "24px", width: "280px", fontFamily: "system-ui, sans-serif", color: "#f1f5f9", position: "relative", boxShadow: "0 10px 30px rgba(0,0,0,0.5)" } }, /* @__PURE__ */ import_react23.default.createElement("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: "600" } }, title), /* @__PURE__ */ import_react23.default.createElement("div", { style: { fontSize: "40px", fontWeight: "700", margin: "0 0 8px" } }, count), /* @__PURE__ */ import_react23.default.createElement("span", { style: {
1161
+ background: change >= 0 ? accent : negativeAccent,
1162
+ color: "white",
1163
+ padding: "4px 8px",
1164
+ borderRadius: "12px",
1165
+ fontSize: "12px",
1166
+ position: "absolute",
1167
+ top: "24px",
1168
+ right: "24px"
1169
+ } }, change >= 0 ? "+" + change + "%" : change + "%"), /* @__PURE__ */ import_react23.default.createElement("svg", { width: "100%", height: "20", viewBox: "0 0 100 20", style: { marginTop: "10px" } }, /* @__PURE__ */ import_react23.default.createElement("polyline", { points: "0,15 20,10 40,12 60,5 80,8 100,0", stroke: accent, fill: "none", strokeWidth: "2" })));
1170
+ };
1130
1171
  // Annotate the CommonJS export names for ESM import in node:
1131
1172
  0 && (module.exports = {
1132
1173
  AlertBanner,
@@ -1149,6 +1190,7 @@ var AnimatedNavbar = ({
1149
1190
  OTPInput,
1150
1191
  Rating,
1151
1192
  RatingStars,
1193
+ StatCard,
1152
1194
  UserAvatar,
1153
1195
  WishlistButton
1154
1196
  });
package/dist/index.mjs CHANGED
@@ -1071,6 +1071,46 @@ var AnimatedNavbar = ({
1071
1071
  transition: "background 0.3s"
1072
1072
  }, onMouseEnter: (e) => e.currentTarget.style.background = accentColor, onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, link.text))));
1073
1073
  };
1074
+
1075
+ // src/components/StatCard/StatCard.jsx
1076
+ import React23, { useEffect as useEffect7, useState as useState15 } from "react";
1077
+ var StatCard = ({
1078
+ title = "Total Sales",
1079
+ value = 1e3,
1080
+ change = 5,
1081
+ bg = "#0f172a",
1082
+ accent = "#0f766e",
1083
+ negativeAccent = "#dc2626",
1084
+ radius = "16px"
1085
+ }) => {
1086
+ const [count, setCount] = useState15(0);
1087
+ useEffect7(() => {
1088
+ let start = 0;
1089
+ const end = value;
1090
+ const duration = 2;
1091
+ const increment = end / (duration * 60);
1092
+ const timer = setInterval(() => {
1093
+ start += increment;
1094
+ if (start >= end) {
1095
+ clearInterval(timer);
1096
+ setCount(end);
1097
+ } else {
1098
+ setCount(Math.floor(start));
1099
+ }
1100
+ }, 1e3 / 60);
1101
+ return () => clearInterval(timer);
1102
+ }, [value]);
1103
+ return /* @__PURE__ */ React23.createElement("div", { style: { background: bg, borderRadius: radius, padding: "24px", width: "280px", fontFamily: "system-ui, sans-serif", color: "#f1f5f9", position: "relative", boxShadow: "0 10px 30px rgba(0,0,0,0.5)" } }, /* @__PURE__ */ React23.createElement("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: "600" } }, title), /* @__PURE__ */ React23.createElement("div", { style: { fontSize: "40px", fontWeight: "700", margin: "0 0 8px" } }, count), /* @__PURE__ */ React23.createElement("span", { style: {
1104
+ background: change >= 0 ? accent : negativeAccent,
1105
+ color: "white",
1106
+ padding: "4px 8px",
1107
+ borderRadius: "12px",
1108
+ fontSize: "12px",
1109
+ position: "absolute",
1110
+ top: "24px",
1111
+ right: "24px"
1112
+ } }, change >= 0 ? "+" + change + "%" : change + "%"), /* @__PURE__ */ React23.createElement("svg", { width: "100%", height: "20", viewBox: "0 0 100 20", style: { marginTop: "10px" } }, /* @__PURE__ */ React23.createElement("polyline", { points: "0,15 20,10 40,12 60,5 80,8 100,0", stroke: accent, fill: "none", strokeWidth: "2" })));
1113
+ };
1074
1114
  export {
1075
1115
  AlertBanner,
1076
1116
  AnimatedNavbar,
@@ -1092,6 +1132,7 @@ export {
1092
1132
  OTPInput,
1093
1133
  Rating,
1094
1134
  RatingStars,
1135
+ StatCard,
1095
1136
  UserAvatar,
1096
1137
  WishlistButton
1097
1138
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-ui-lib",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "Virtual UI React Component Library",
5
5
  "author": "Ankush",
6
6
  "license": "ISC",