virtuo-ui-library 1.0.0

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 ADDED
@@ -0,0 +1,267 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ Button: () => Button,
33
+ Card: () => Card
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/components/Button/Button.jsx
38
+ var import_react = __toESM(require("react"));
39
+ var Button = ({
40
+ text = "Click me",
41
+ onClick = () => {
42
+ },
43
+ color = "#6366f1",
44
+ textColor = "#ffffff",
45
+ size = "md",
46
+ variant = "filled",
47
+ disabled = false,
48
+ fullWidth = false,
49
+ icon = null
50
+ }) => {
51
+ const [hovered, setHovered] = (0, import_react.useState)(false);
52
+ const [pressed, setPressed] = (0, import_react.useState)(false);
53
+ const sizes = {
54
+ sm: { padding: "7px 14px", fontSize: "13px", borderRadius: "7px" },
55
+ md: { padding: "10px 22px", fontSize: "15px", borderRadius: "9px" },
56
+ lg: { padding: "14px 30px", fontSize: "17px", borderRadius: "11px" }
57
+ };
58
+ const getVariantStyle = () => {
59
+ if (variant === "outline") {
60
+ return {
61
+ background: hovered ? color + "12" : "transparent",
62
+ color,
63
+ border: `2px solid ${color}`
64
+ };
65
+ }
66
+ if (variant === "ghost") {
67
+ return {
68
+ background: hovered ? color + "18" : "transparent",
69
+ color,
70
+ border: "none"
71
+ };
72
+ }
73
+ return {
74
+ background: hovered ? shadeColor(color, -15) : color,
75
+ color: textColor,
76
+ border: "none"
77
+ };
78
+ };
79
+ const style = {
80
+ display: "inline-flex",
81
+ alignItems: "center",
82
+ justifyContent: "center",
83
+ gap: "8px",
84
+ fontFamily: "system-ui, sans-serif",
85
+ fontWeight: 600,
86
+ cursor: disabled ? "not-allowed" : "pointer",
87
+ opacity: disabled ? 0.45 : 1,
88
+ width: fullWidth ? "100%" : "auto",
89
+ boxShadow: variant === "filled" && !disabled && !pressed ? `0 4px 14px ${color}44` : "none",
90
+ transform: pressed && !disabled ? "scale(0.96)" : "scale(1)",
91
+ transition: "all 0.15s ease",
92
+ ...sizes[size],
93
+ ...getVariantStyle()
94
+ };
95
+ return /* @__PURE__ */ import_react.default.createElement(
96
+ "button",
97
+ {
98
+ style,
99
+ onClick: !disabled ? onClick : void 0,
100
+ onMouseEnter: () => setHovered(true),
101
+ onMouseLeave: () => {
102
+ setHovered(false);
103
+ setPressed(false);
104
+ },
105
+ onMouseDown: () => !disabled && setPressed(true),
106
+ onMouseUp: () => setPressed(false),
107
+ disabled
108
+ },
109
+ icon && /* @__PURE__ */ import_react.default.createElement("span", { style: { display: "flex", alignItems: "center" } }, icon),
110
+ text
111
+ );
112
+ };
113
+ function shadeColor(hex, percent) {
114
+ const num = parseInt(hex.replace("#", ""), 16);
115
+ const r = Math.min(255, Math.max(0, (num >> 16) + percent));
116
+ const g = Math.min(255, Math.max(0, (num >> 8 & 255) + percent));
117
+ const b = Math.min(255, Math.max(0, (num & 255) + percent));
118
+ return `rgb(${r},${g},${b})`;
119
+ }
120
+
121
+ // src/components/Card/Card.jsx
122
+ var import_react2 = __toESM(require("react"));
123
+ var Card = ({
124
+ title = "Card Title",
125
+ description = "This is a simple, reusable card component you can customize with props.",
126
+ image = null,
127
+ badge = null,
128
+ badgeColor = "#6366f1",
129
+ accentColor = "#6366f1",
130
+ actions = [],
131
+ footer = null,
132
+ width = "320px",
133
+ onClick = null
134
+ }) => {
135
+ const [hovered, setHovered] = (0, import_react2.useState)(false);
136
+ const [liked, setLiked] = (0, import_react2.useState)(false);
137
+ const style = {
138
+ width,
139
+ borderRadius: "16px",
140
+ background: "#ffffff",
141
+ boxShadow: hovered ? "0 16px 48px rgba(0,0,0,0.13)" : "0 4px 20px rgba(0,0,0,0.07)",
142
+ transform: hovered ? "translateY(-4px)" : "translateY(0)",
143
+ transition: "all 0.22s ease",
144
+ overflow: "hidden",
145
+ fontFamily: "system-ui, sans-serif",
146
+ cursor: onClick ? "pointer" : "default",
147
+ border: "1px solid #f1f5f9"
148
+ };
149
+ return /* @__PURE__ */ import_react2.default.createElement(
150
+ "div",
151
+ {
152
+ style,
153
+ onMouseEnter: () => setHovered(true),
154
+ onMouseLeave: () => setHovered(false),
155
+ onClick
156
+ },
157
+ image && /* @__PURE__ */ import_react2.default.createElement("div", { style: { width: "100%", height: "180px", overflow: "hidden", position: "relative" } }, /* @__PURE__ */ import_react2.default.createElement(
158
+ "img",
159
+ {
160
+ src: image,
161
+ alt: title,
162
+ style: {
163
+ width: "100%",
164
+ height: "100%",
165
+ objectFit: "cover",
166
+ transform: hovered ? "scale(1.04)" : "scale(1)",
167
+ transition: "transform 0.35s ease"
168
+ }
169
+ }
170
+ ), badge && /* @__PURE__ */ import_react2.default.createElement("span", { style: {
171
+ position: "absolute",
172
+ top: "12px",
173
+ left: "12px",
174
+ background: badgeColor,
175
+ color: "#fff",
176
+ fontSize: "11px",
177
+ fontWeight: 700,
178
+ letterSpacing: "0.06em",
179
+ textTransform: "uppercase",
180
+ padding: "4px 10px",
181
+ borderRadius: "99px"
182
+ } }, badge)),
183
+ /* @__PURE__ */ import_react2.default.createElement("div", { style: { padding: "20px 20px 16px" } }, !image && badge && /* @__PURE__ */ import_react2.default.createElement("span", { style: {
184
+ display: "inline-block",
185
+ background: badgeColor + "18",
186
+ color: badgeColor,
187
+ fontSize: "11px",
188
+ fontWeight: 700,
189
+ letterSpacing: "0.06em",
190
+ textTransform: "uppercase",
191
+ padding: "3px 10px",
192
+ borderRadius: "99px",
193
+ marginBottom: "10px"
194
+ } }, badge), /* @__PURE__ */ import_react2.default.createElement("h3", { style: { margin: "0 0 8px", fontSize: "17px", fontWeight: 700, color: "#0f172a", lineHeight: 1.3 } }, title), /* @__PURE__ */ import_react2.default.createElement("p", { style: { margin: 0, fontSize: "14px", color: "#64748b", lineHeight: 1.6 } }, description)),
195
+ (actions.length > 0 || true) && /* @__PURE__ */ import_react2.default.createElement("div", { style: { padding: "0 20px 18px", display: "flex", alignItems: "center", gap: "10px" } }, actions.map((action, i) => /* @__PURE__ */ import_react2.default.createElement(ActionButton, { key: i, ...action, accentColor, primary: i === 0 })), /* @__PURE__ */ import_react2.default.createElement(
196
+ "button",
197
+ {
198
+ onClick: (e) => {
199
+ e.stopPropagation();
200
+ setLiked(!liked);
201
+ },
202
+ style: {
203
+ marginLeft: "auto",
204
+ background: liked ? "#fef2f2" : "#f8fafc",
205
+ border: "none",
206
+ borderRadius: "8px",
207
+ padding: "8px 10px",
208
+ cursor: "pointer",
209
+ fontSize: "16px",
210
+ transition: "all 0.15s",
211
+ transform: liked ? "scale(1.15)" : "scale(1)"
212
+ },
213
+ title: liked ? "Unlike" : "Like"
214
+ },
215
+ liked ? "\u2764\uFE0F" : "\u{1F90D}"
216
+ )),
217
+ footer && /* @__PURE__ */ import_react2.default.createElement("div", { style: {
218
+ borderTop: "1px solid #f1f5f9",
219
+ padding: "12px 20px",
220
+ fontSize: "12px",
221
+ color: "#94a3b8",
222
+ display: "flex",
223
+ alignItems: "center",
224
+ gap: "6px"
225
+ } }, footer)
226
+ );
227
+ };
228
+ var ActionButton = ({ label = "Action", onClick = () => {
229
+ }, accentColor = "#6366f1", primary = false }) => {
230
+ const [hovered, setHovered] = (0, import_react2.useState)(false);
231
+ return /* @__PURE__ */ import_react2.default.createElement(
232
+ "button",
233
+ {
234
+ onClick: (e) => {
235
+ e.stopPropagation();
236
+ onClick();
237
+ },
238
+ onMouseEnter: () => setHovered(true),
239
+ onMouseLeave: () => setHovered(false),
240
+ style: {
241
+ padding: "8px 18px",
242
+ borderRadius: "8px",
243
+ fontSize: "13px",
244
+ fontWeight: 600,
245
+ cursor: "pointer",
246
+ transition: "all 0.15s",
247
+ background: primary ? hovered ? shadeColor2(accentColor, -15) : accentColor : hovered ? accentColor + "12" : "transparent",
248
+ color: primary ? "#fff" : accentColor,
249
+ border: primary ? "none" : `1.5px solid ${accentColor}`,
250
+ boxShadow: primary && !hovered ? `0 3px 10px ${accentColor}40` : "none"
251
+ }
252
+ },
253
+ label
254
+ );
255
+ };
256
+ function shadeColor2(hex, percent) {
257
+ const num = parseInt(hex.replace("#", ""), 16);
258
+ const r = Math.min(255, Math.max(0, (num >> 16) + percent));
259
+ const g = Math.min(255, Math.max(0, (num >> 8 & 255) + percent));
260
+ const b = Math.min(255, Math.max(0, (num & 255) + percent));
261
+ return `rgb(${r},${g},${b})`;
262
+ }
263
+ // Annotate the CommonJS export names for ESM import in node:
264
+ 0 && (module.exports = {
265
+ Button,
266
+ Card
267
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,230 @@
1
+ // src/components/Button/Button.jsx
2
+ import React, { useState } from "react";
3
+ var Button = ({
4
+ text = "Click me",
5
+ onClick = () => {
6
+ },
7
+ color = "#6366f1",
8
+ textColor = "#ffffff",
9
+ size = "md",
10
+ variant = "filled",
11
+ disabled = false,
12
+ fullWidth = false,
13
+ icon = null
14
+ }) => {
15
+ const [hovered, setHovered] = useState(false);
16
+ const [pressed, setPressed] = useState(false);
17
+ const sizes = {
18
+ sm: { padding: "7px 14px", fontSize: "13px", borderRadius: "7px" },
19
+ md: { padding: "10px 22px", fontSize: "15px", borderRadius: "9px" },
20
+ lg: { padding: "14px 30px", fontSize: "17px", borderRadius: "11px" }
21
+ };
22
+ const getVariantStyle = () => {
23
+ if (variant === "outline") {
24
+ return {
25
+ background: hovered ? color + "12" : "transparent",
26
+ color,
27
+ border: `2px solid ${color}`
28
+ };
29
+ }
30
+ if (variant === "ghost") {
31
+ return {
32
+ background: hovered ? color + "18" : "transparent",
33
+ color,
34
+ border: "none"
35
+ };
36
+ }
37
+ return {
38
+ background: hovered ? shadeColor(color, -15) : color,
39
+ color: textColor,
40
+ border: "none"
41
+ };
42
+ };
43
+ const style = {
44
+ display: "inline-flex",
45
+ alignItems: "center",
46
+ justifyContent: "center",
47
+ gap: "8px",
48
+ fontFamily: "system-ui, sans-serif",
49
+ fontWeight: 600,
50
+ cursor: disabled ? "not-allowed" : "pointer",
51
+ opacity: disabled ? 0.45 : 1,
52
+ width: fullWidth ? "100%" : "auto",
53
+ boxShadow: variant === "filled" && !disabled && !pressed ? `0 4px 14px ${color}44` : "none",
54
+ transform: pressed && !disabled ? "scale(0.96)" : "scale(1)",
55
+ transition: "all 0.15s ease",
56
+ ...sizes[size],
57
+ ...getVariantStyle()
58
+ };
59
+ return /* @__PURE__ */ React.createElement(
60
+ "button",
61
+ {
62
+ style,
63
+ onClick: !disabled ? onClick : void 0,
64
+ onMouseEnter: () => setHovered(true),
65
+ onMouseLeave: () => {
66
+ setHovered(false);
67
+ setPressed(false);
68
+ },
69
+ onMouseDown: () => !disabled && setPressed(true),
70
+ onMouseUp: () => setPressed(false),
71
+ disabled
72
+ },
73
+ icon && /* @__PURE__ */ React.createElement("span", { style: { display: "flex", alignItems: "center" } }, icon),
74
+ text
75
+ );
76
+ };
77
+ function shadeColor(hex, percent) {
78
+ const num = parseInt(hex.replace("#", ""), 16);
79
+ const r = Math.min(255, Math.max(0, (num >> 16) + percent));
80
+ const g = Math.min(255, Math.max(0, (num >> 8 & 255) + percent));
81
+ const b = Math.min(255, Math.max(0, (num & 255) + percent));
82
+ return `rgb(${r},${g},${b})`;
83
+ }
84
+
85
+ // src/components/Card/Card.jsx
86
+ import React2, { useState as useState2 } from "react";
87
+ var Card = ({
88
+ title = "Card Title",
89
+ description = "This is a simple, reusable card component you can customize with props.",
90
+ image = null,
91
+ badge = null,
92
+ badgeColor = "#6366f1",
93
+ accentColor = "#6366f1",
94
+ actions = [],
95
+ footer = null,
96
+ width = "320px",
97
+ onClick = null
98
+ }) => {
99
+ const [hovered, setHovered] = useState2(false);
100
+ const [liked, setLiked] = useState2(false);
101
+ const style = {
102
+ width,
103
+ borderRadius: "16px",
104
+ background: "#ffffff",
105
+ boxShadow: hovered ? "0 16px 48px rgba(0,0,0,0.13)" : "0 4px 20px rgba(0,0,0,0.07)",
106
+ transform: hovered ? "translateY(-4px)" : "translateY(0)",
107
+ transition: "all 0.22s ease",
108
+ overflow: "hidden",
109
+ fontFamily: "system-ui, sans-serif",
110
+ cursor: onClick ? "pointer" : "default",
111
+ border: "1px solid #f1f5f9"
112
+ };
113
+ return /* @__PURE__ */ React2.createElement(
114
+ "div",
115
+ {
116
+ style,
117
+ onMouseEnter: () => setHovered(true),
118
+ onMouseLeave: () => setHovered(false),
119
+ onClick
120
+ },
121
+ image && /* @__PURE__ */ React2.createElement("div", { style: { width: "100%", height: "180px", overflow: "hidden", position: "relative" } }, /* @__PURE__ */ React2.createElement(
122
+ "img",
123
+ {
124
+ src: image,
125
+ alt: title,
126
+ style: {
127
+ width: "100%",
128
+ height: "100%",
129
+ objectFit: "cover",
130
+ transform: hovered ? "scale(1.04)" : "scale(1)",
131
+ transition: "transform 0.35s ease"
132
+ }
133
+ }
134
+ ), badge && /* @__PURE__ */ React2.createElement("span", { style: {
135
+ position: "absolute",
136
+ top: "12px",
137
+ left: "12px",
138
+ background: badgeColor,
139
+ color: "#fff",
140
+ fontSize: "11px",
141
+ fontWeight: 700,
142
+ letterSpacing: "0.06em",
143
+ textTransform: "uppercase",
144
+ padding: "4px 10px",
145
+ borderRadius: "99px"
146
+ } }, badge)),
147
+ /* @__PURE__ */ React2.createElement("div", { style: { padding: "20px 20px 16px" } }, !image && badge && /* @__PURE__ */ React2.createElement("span", { style: {
148
+ display: "inline-block",
149
+ background: badgeColor + "18",
150
+ color: badgeColor,
151
+ fontSize: "11px",
152
+ fontWeight: 700,
153
+ letterSpacing: "0.06em",
154
+ textTransform: "uppercase",
155
+ padding: "3px 10px",
156
+ borderRadius: "99px",
157
+ marginBottom: "10px"
158
+ } }, badge), /* @__PURE__ */ React2.createElement("h3", { style: { margin: "0 0 8px", fontSize: "17px", fontWeight: 700, color: "#0f172a", lineHeight: 1.3 } }, title), /* @__PURE__ */ React2.createElement("p", { style: { margin: 0, fontSize: "14px", color: "#64748b", lineHeight: 1.6 } }, description)),
159
+ (actions.length > 0 || true) && /* @__PURE__ */ React2.createElement("div", { style: { padding: "0 20px 18px", display: "flex", alignItems: "center", gap: "10px" } }, actions.map((action, i) => /* @__PURE__ */ React2.createElement(ActionButton, { key: i, ...action, accentColor, primary: i === 0 })), /* @__PURE__ */ React2.createElement(
160
+ "button",
161
+ {
162
+ onClick: (e) => {
163
+ e.stopPropagation();
164
+ setLiked(!liked);
165
+ },
166
+ style: {
167
+ marginLeft: "auto",
168
+ background: liked ? "#fef2f2" : "#f8fafc",
169
+ border: "none",
170
+ borderRadius: "8px",
171
+ padding: "8px 10px",
172
+ cursor: "pointer",
173
+ fontSize: "16px",
174
+ transition: "all 0.15s",
175
+ transform: liked ? "scale(1.15)" : "scale(1)"
176
+ },
177
+ title: liked ? "Unlike" : "Like"
178
+ },
179
+ liked ? "\u2764\uFE0F" : "\u{1F90D}"
180
+ )),
181
+ footer && /* @__PURE__ */ React2.createElement("div", { style: {
182
+ borderTop: "1px solid #f1f5f9",
183
+ padding: "12px 20px",
184
+ fontSize: "12px",
185
+ color: "#94a3b8",
186
+ display: "flex",
187
+ alignItems: "center",
188
+ gap: "6px"
189
+ } }, footer)
190
+ );
191
+ };
192
+ var ActionButton = ({ label = "Action", onClick = () => {
193
+ }, accentColor = "#6366f1", primary = false }) => {
194
+ const [hovered, setHovered] = useState2(false);
195
+ return /* @__PURE__ */ React2.createElement(
196
+ "button",
197
+ {
198
+ onClick: (e) => {
199
+ e.stopPropagation();
200
+ onClick();
201
+ },
202
+ onMouseEnter: () => setHovered(true),
203
+ onMouseLeave: () => setHovered(false),
204
+ style: {
205
+ padding: "8px 18px",
206
+ borderRadius: "8px",
207
+ fontSize: "13px",
208
+ fontWeight: 600,
209
+ cursor: "pointer",
210
+ transition: "all 0.15s",
211
+ background: primary ? hovered ? shadeColor2(accentColor, -15) : accentColor : hovered ? accentColor + "12" : "transparent",
212
+ color: primary ? "#fff" : accentColor,
213
+ border: primary ? "none" : `1.5px solid ${accentColor}`,
214
+ boxShadow: primary && !hovered ? `0 3px 10px ${accentColor}40` : "none"
215
+ }
216
+ },
217
+ label
218
+ );
219
+ };
220
+ function shadeColor2(hex, percent) {
221
+ const num = parseInt(hex.replace("#", ""), 16);
222
+ const r = Math.min(255, Math.max(0, (num >> 16) + percent));
223
+ const g = Math.min(255, Math.max(0, (num >> 8 & 255) + percent));
224
+ const b = Math.min(255, Math.max(0, (num & 255) + percent));
225
+ return `rgb(${r},${g},${b})`;
226
+ }
227
+ export {
228
+ Button,
229
+ Card
230
+ };
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "virtuo-ui-library",
3
+ "version": "1.0.0",
4
+ "description": "Virtual UI React Component Library",
5
+ "license": "ISC",
6
+ "author": "Ritik Saini",
7
+ "main": "dist/index.js",
8
+ "module" : "dist/index.mjs",
9
+ "files": ["dist"],
10
+
11
+ "scripts": {
12
+ "build": "tsup"
13
+ },
14
+ "peerDependencies": {
15
+ "react": ">=18"
16
+ },
17
+ "devDependencies": {
18
+ "tsup": "^8.5.1",
19
+ "typescript": "^7.0.2"
20
+ }
21
+ }