virtual-ui-lib 1.0.33 → 1.0.35

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
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
32
  AlertBanner: () => AlertBanner,
33
+ AnimatedNavbar: () => AnimatedNavbar,
33
34
  AnimatedProgressBar: () => AnimatedProgressBar,
34
35
  Button: () => Button,
35
36
  Card: () => Card,
@@ -46,6 +47,7 @@ __export(index_exports, {
46
47
  MultiStepProgress: () => MultiStepProgress,
47
48
  Navbar: () => Navbar,
48
49
  OTPInput: () => OTPInput,
50
+ Rating: () => Rating,
49
51
  RatingStars: () => RatingStars,
50
52
  UserAvatar: () => UserAvatar,
51
53
  WishlistButton: () => WishlistButton
@@ -1019,9 +1021,116 @@ var LoadingSkeleton = ({
1019
1021
  };
1020
1022
  return /* @__PURE__ */ import_react20.default.createElement("div", { style: { width, height, borderRadius: radius, position: "relative", overflow: "hidden", background: bg } }, /* @__PURE__ */ import_react20.default.createElement("div", { style: { width: "100%", height: "100%", ...shimmer } }), /* @__PURE__ */ import_react20.default.createElement("style", null, `@keyframes shimmer { 0% { background-position: 200% 0%; } 100% { background-position: 0% 0%; } }`));
1021
1023
  };
1024
+
1025
+ // src/components/Rating/Rating.jsx
1026
+ var import_react21 = __toESM(require("react"));
1027
+ var Rating = ({
1028
+ value = 3.5,
1029
+ count = 5,
1030
+ size = 24,
1031
+ activeColor = "#fbbf24",
1032
+ inactiveColor = "#374151",
1033
+ spacing = 4,
1034
+ onSelect
1035
+ }) => {
1036
+ const [hoverValue, setHoverValue] = (0, import_react21.useState)(null);
1037
+ const [selectedValue, setSelectedValue] = (0, import_react21.useState)(value);
1038
+ const handleClick = (val) => {
1039
+ setSelectedValue(val);
1040
+ if (onSelect) onSelect(val);
1041
+ };
1042
+ return /* @__PURE__ */ import_react21.default.createElement("div", { style: { display: "flex", gap: spacing } }, [...Array(count)].map((_, i) => {
1043
+ const starValue = i + 1;
1044
+ const isActive = hoverValue ? hoverValue >= starValue : selectedValue >= starValue;
1045
+ const isHalf = hoverValue === null && selectedValue + 0.5 >= starValue && selectedValue < starValue;
1046
+ return /* @__PURE__ */ import_react21.default.createElement(
1047
+ "div",
1048
+ {
1049
+ key: i,
1050
+ style: { position: "relative", cursor: "pointer" },
1051
+ onClick: () => handleClick(starValue),
1052
+ onMouseEnter: () => setHoverValue(starValue),
1053
+ onMouseLeave: () => setHoverValue(null)
1054
+ },
1055
+ /* @__PURE__ */ import_react21.default.createElement(
1056
+ "svg",
1057
+ {
1058
+ xmlns: "http://www.w3.org/2000/svg",
1059
+ viewBox: "0 0 24 24",
1060
+ fill: isActive ? activeColor : inactiveColor,
1061
+ width: size,
1062
+ height: size
1063
+ },
1064
+ /* @__PURE__ */ import_react21.default.createElement("path", { d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
1065
+ ),
1066
+ isHalf && /* @__PURE__ */ import_react21.default.createElement("div", { style: { position: "absolute", top: 0, left: 0, width: size / 2, height: size, overflow: "hidden" } }, /* @__PURE__ */ import_react21.default.createElement(
1067
+ "svg",
1068
+ {
1069
+ xmlns: "http://www.w3.org/2000/svg",
1070
+ viewBox: "0 0 24 24",
1071
+ fill: activeColor,
1072
+ width: size,
1073
+ height: size
1074
+ },
1075
+ /* @__PURE__ */ import_react21.default.createElement("path", { d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
1076
+ ))
1077
+ );
1078
+ }));
1079
+ };
1080
+
1081
+ // src/components/AnimatedNavbar/AnimatedNavbar.jsx
1082
+ var import_react22 = __toESM(require("react"));
1083
+ var AnimatedNavbar = ({
1084
+ logo = "https://via.placeholder.com/100",
1085
+ links = [{ text: "Home", href: "#" }, { text: "About", href: "#" }, { text: "Services", href: "#" }, { text: "Contact", href: "#" }],
1086
+ bgColor = "#0f172a",
1087
+ textColor = "#f1f5f9",
1088
+ accentColor = "#7c3aed",
1089
+ radius = "8px"
1090
+ }) => {
1091
+ const [isOpen, setIsOpen] = import_react22.default.useState(false);
1092
+ return /* @__PURE__ */ import_react22.default.createElement("nav", { style: {
1093
+ background: bgColor,
1094
+ display: "flex",
1095
+ justifyContent: "space-between",
1096
+ alignItems: "center",
1097
+ padding: "10px 20px",
1098
+ borderRadius: radius,
1099
+ position: "relative",
1100
+ boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
1101
+ transition: "background 0.3s"
1102
+ } }, /* @__PURE__ */ import_react22.default.createElement("img", { src: logo, alt: "Logo", style: { width: "100px" } }), /* @__PURE__ */ import_react22.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: "15px" } }, /* @__PURE__ */ import_react22.default.createElement("button", { onClick: () => setIsOpen(!isOpen), style: {
1103
+ background: accentColor,
1104
+ color: textColor,
1105
+ border: "none",
1106
+ borderRadius: radius,
1107
+ padding: "8px 16px",
1108
+ fontWeight: "600",
1109
+ transition: "background 0.3s"
1110
+ } }, "Menu")), isOpen && /* @__PURE__ */ import_react22.default.createElement("div", { style: {
1111
+ position: "absolute",
1112
+ top: "100%",
1113
+ right: "0",
1114
+ background: bgColor,
1115
+ borderRadius: radius,
1116
+ boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
1117
+ zIndex: 10,
1118
+ display: "flex",
1119
+ flexDirection: "column",
1120
+ gap: "10px",
1121
+ padding: "10px"
1122
+ } }, links.map((link) => /* @__PURE__ */ import_react22.default.createElement("a", { key: link.text, href: link.href, style: {
1123
+ color: textColor,
1124
+ textDecoration: "none",
1125
+ padding: "8px 12px",
1126
+ borderRadius: radius,
1127
+ transition: "background 0.3s"
1128
+ }, onMouseEnter: (e) => e.currentTarget.style.background = accentColor, onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, link.text))));
1129
+ };
1022
1130
  // Annotate the CommonJS export names for ESM import in node:
1023
1131
  0 && (module.exports = {
1024
1132
  AlertBanner,
1133
+ AnimatedNavbar,
1025
1134
  AnimatedProgressBar,
1026
1135
  Button,
1027
1136
  Card,
@@ -1038,6 +1147,7 @@ var LoadingSkeleton = ({
1038
1147
  MultiStepProgress,
1039
1148
  Navbar,
1040
1149
  OTPInput,
1150
+ Rating,
1041
1151
  RatingStars,
1042
1152
  UserAvatar,
1043
1153
  WishlistButton
package/dist/index.mjs CHANGED
@@ -965,8 +965,115 @@ var LoadingSkeleton = ({
965
965
  };
966
966
  return /* @__PURE__ */ React20.createElement("div", { style: { width, height, borderRadius: radius, position: "relative", overflow: "hidden", background: bg } }, /* @__PURE__ */ React20.createElement("div", { style: { width: "100%", height: "100%", ...shimmer } }), /* @__PURE__ */ React20.createElement("style", null, `@keyframes shimmer { 0% { background-position: 200% 0%; } 100% { background-position: 0% 0%; } }`));
967
967
  };
968
+
969
+ // src/components/Rating/Rating.jsx
970
+ import React21, { useState as useState14 } from "react";
971
+ var Rating = ({
972
+ value = 3.5,
973
+ count = 5,
974
+ size = 24,
975
+ activeColor = "#fbbf24",
976
+ inactiveColor = "#374151",
977
+ spacing = 4,
978
+ onSelect
979
+ }) => {
980
+ const [hoverValue, setHoverValue] = useState14(null);
981
+ const [selectedValue, setSelectedValue] = useState14(value);
982
+ const handleClick = (val) => {
983
+ setSelectedValue(val);
984
+ if (onSelect) onSelect(val);
985
+ };
986
+ return /* @__PURE__ */ React21.createElement("div", { style: { display: "flex", gap: spacing } }, [...Array(count)].map((_, i) => {
987
+ const starValue = i + 1;
988
+ const isActive = hoverValue ? hoverValue >= starValue : selectedValue >= starValue;
989
+ const isHalf = hoverValue === null && selectedValue + 0.5 >= starValue && selectedValue < starValue;
990
+ return /* @__PURE__ */ React21.createElement(
991
+ "div",
992
+ {
993
+ key: i,
994
+ style: { position: "relative", cursor: "pointer" },
995
+ onClick: () => handleClick(starValue),
996
+ onMouseEnter: () => setHoverValue(starValue),
997
+ onMouseLeave: () => setHoverValue(null)
998
+ },
999
+ /* @__PURE__ */ React21.createElement(
1000
+ "svg",
1001
+ {
1002
+ xmlns: "http://www.w3.org/2000/svg",
1003
+ viewBox: "0 0 24 24",
1004
+ fill: isActive ? activeColor : inactiveColor,
1005
+ width: size,
1006
+ height: size
1007
+ },
1008
+ /* @__PURE__ */ React21.createElement("path", { d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
1009
+ ),
1010
+ isHalf && /* @__PURE__ */ React21.createElement("div", { style: { position: "absolute", top: 0, left: 0, width: size / 2, height: size, overflow: "hidden" } }, /* @__PURE__ */ React21.createElement(
1011
+ "svg",
1012
+ {
1013
+ xmlns: "http://www.w3.org/2000/svg",
1014
+ viewBox: "0 0 24 24",
1015
+ fill: activeColor,
1016
+ width: size,
1017
+ height: size
1018
+ },
1019
+ /* @__PURE__ */ React21.createElement("path", { d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
1020
+ ))
1021
+ );
1022
+ }));
1023
+ };
1024
+
1025
+ // src/components/AnimatedNavbar/AnimatedNavbar.jsx
1026
+ import React22 from "react";
1027
+ var AnimatedNavbar = ({
1028
+ logo = "https://via.placeholder.com/100",
1029
+ links = [{ text: "Home", href: "#" }, { text: "About", href: "#" }, { text: "Services", href: "#" }, { text: "Contact", href: "#" }],
1030
+ bgColor = "#0f172a",
1031
+ textColor = "#f1f5f9",
1032
+ accentColor = "#7c3aed",
1033
+ radius = "8px"
1034
+ }) => {
1035
+ const [isOpen, setIsOpen] = React22.useState(false);
1036
+ return /* @__PURE__ */ React22.createElement("nav", { style: {
1037
+ background: bgColor,
1038
+ display: "flex",
1039
+ justifyContent: "space-between",
1040
+ alignItems: "center",
1041
+ padding: "10px 20px",
1042
+ borderRadius: radius,
1043
+ position: "relative",
1044
+ boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
1045
+ transition: "background 0.3s"
1046
+ } }, /* @__PURE__ */ React22.createElement("img", { src: logo, alt: "Logo", style: { width: "100px" } }), /* @__PURE__ */ React22.createElement("div", { style: { display: "flex", alignItems: "center", gap: "15px" } }, /* @__PURE__ */ React22.createElement("button", { onClick: () => setIsOpen(!isOpen), style: {
1047
+ background: accentColor,
1048
+ color: textColor,
1049
+ border: "none",
1050
+ borderRadius: radius,
1051
+ padding: "8px 16px",
1052
+ fontWeight: "600",
1053
+ transition: "background 0.3s"
1054
+ } }, "Menu")), isOpen && /* @__PURE__ */ React22.createElement("div", { style: {
1055
+ position: "absolute",
1056
+ top: "100%",
1057
+ right: "0",
1058
+ background: bgColor,
1059
+ borderRadius: radius,
1060
+ boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
1061
+ zIndex: 10,
1062
+ display: "flex",
1063
+ flexDirection: "column",
1064
+ gap: "10px",
1065
+ padding: "10px"
1066
+ } }, links.map((link) => /* @__PURE__ */ React22.createElement("a", { key: link.text, href: link.href, style: {
1067
+ color: textColor,
1068
+ textDecoration: "none",
1069
+ padding: "8px 12px",
1070
+ borderRadius: radius,
1071
+ transition: "background 0.3s"
1072
+ }, onMouseEnter: (e) => e.currentTarget.style.background = accentColor, onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, link.text))));
1073
+ };
968
1074
  export {
969
1075
  AlertBanner,
1076
+ AnimatedNavbar,
970
1077
  AnimatedProgressBar,
971
1078
  Button,
972
1079
  Card,
@@ -983,6 +1090,7 @@ export {
983
1090
  MultiStepProgress,
984
1091
  Navbar,
985
1092
  OTPInput,
1093
+ Rating,
986
1094
  RatingStars,
987
1095
  UserAvatar,
988
1096
  WishlistButton
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-ui-lib",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "Virtual UI React Component Library",
5
5
  "author": "Ankush",
6
6
  "license": "ISC",