virtual-ui-lib 1.0.14 → 1.0.16

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,7 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
32
  AlertBanner: () => AlertBanner,
33
- Button: () => Button
33
+ Button: () => Button,
34
+ Card: () => Card,
35
+ Dropdown: () => Dropdown
34
36
  });
35
37
  module.exports = __toCommonJS(index_exports);
36
38
 
@@ -130,8 +132,150 @@ var Button = ({
130
132
  loading ? "Loading..." : /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, iconLeft, text, iconRight))
131
133
  );
132
134
  };
135
+
136
+ // src/components/Card/Card.jsx
137
+ var import_react3 = __toESM(require("react"));
138
+ var Card = ({
139
+ image = "https://via.placeholder.com/300x200",
140
+ title = "Card Title",
141
+ description = "This is a description of the card content. It should be concise and informative.",
142
+ onClick,
143
+ loading = false,
144
+ disabled = false,
145
+ bg = "#f9fafb",
146
+ textColor = "#0f172a",
147
+ hoverBg = "#e5e7eb",
148
+ radius = "12px",
149
+ shadow = "0 4px 14px rgba(0,0,0,0.1)",
150
+ hoverShadow = "0 8px 28px rgba(0,0,0,0.2)",
151
+ transition = "transform 0.3s, box-shadow 0.3s"
152
+ }) => {
153
+ return /* @__PURE__ */ import_react3.default.createElement(
154
+ "div",
155
+ {
156
+ style: {
157
+ background: bg,
158
+ borderRadius: radius,
159
+ boxShadow: shadow,
160
+ padding: "16px",
161
+ transition,
162
+ cursor: disabled ? "not-allowed" : "pointer",
163
+ opacity: disabled ? 0.6 : 1,
164
+ position: "relative",
165
+ overflow: "hidden"
166
+ },
167
+ onClick: disabled ? null : onClick,
168
+ onMouseEnter: (e) => {
169
+ e.currentTarget.style.boxShadow = hoverShadow;
170
+ e.currentTarget.style.transform = "translateY(-4px)";
171
+ },
172
+ onMouseLeave: (e) => {
173
+ e.currentTarget.style.boxShadow = shadow;
174
+ e.currentTarget.style.transform = "translateY(0)";
175
+ }
176
+ },
177
+ loading ? /* @__PURE__ */ import_react3.default.createElement("div", { style: {
178
+ background: "#e0e0e0",
179
+ height: "200px",
180
+ borderRadius: radius,
181
+ marginBottom: "12px"
182
+ } }) : /* @__PURE__ */ import_react3.default.createElement("img", { src: image, alt: title, style: { width: "100%", borderRadius: radius } }),
183
+ /* @__PURE__ */ import_react3.default.createElement("h3", { style: { margin: "12px 0 4px", fontSize: "16px", color: textColor } }, title),
184
+ /* @__PURE__ */ import_react3.default.createElement("p", { style: { margin: "0 0 12px", fontSize: "14px", color: "#374151" } }, description),
185
+ /* @__PURE__ */ import_react3.default.createElement(
186
+ "button",
187
+ {
188
+ style: {
189
+ padding: "10px 16px",
190
+ background: "#2563eb",
191
+ color: "white",
192
+ border: "none",
193
+ borderRadius: "8px",
194
+ cursor: "pointer",
195
+ fontWeight: "600",
196
+ transition: "background 0.3s"
197
+ },
198
+ onClick,
199
+ disabled
200
+ },
201
+ "Action"
202
+ )
203
+ );
204
+ };
205
+
206
+ // src/components/Dropdown/Dropdown.jsx
207
+ var import_react4 = __toESM(require("react"));
208
+ var Dropdown = ({
209
+ options = ["Option 1", "Option 2", "Option 3"],
210
+ defaultValue = "Option 1",
211
+ bg = "#1e293b",
212
+ accent = "#7c3aed",
213
+ textColor = "#f1f5f9",
214
+ borderColor = "rgba(255,255,255,0.1)",
215
+ radius = "10px",
216
+ onSelect
217
+ }) => {
218
+ const [open, setOpen] = (0, import_react4.useState)(false);
219
+ const [selected, setSelected] = (0, import_react4.useState)(defaultValue);
220
+ const dropdownRef = (0, import_react4.useRef)(null);
221
+ const handleClickOutside = (event) => {
222
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
223
+ setOpen(false);
224
+ }
225
+ };
226
+ const handleKeyDown = (event) => {
227
+ if (event.key === "ArrowDown") {
228
+ }
229
+ };
230
+ (0, import_react4.useEffect)(() => {
231
+ document.addEventListener("mousedown", handleClickOutside);
232
+ document.addEventListener("keydown", handleKeyDown);
233
+ return () => {
234
+ document.removeEventListener("mousedown", handleClickOutside);
235
+ document.removeEventListener("keydown", handleKeyDown);
236
+ };
237
+ });
238
+ const handleOptionSelect = (option) => {
239
+ setSelected(option);
240
+ onSelect && onSelect(option);
241
+ setOpen(false);
242
+ };
243
+ return /* @__PURE__ */ import_react4.default.createElement("div", { style: { position: "relative", display: "inline-block", fontFamily: "system-ui, sans-serif" }, ref: dropdownRef }, /* @__PURE__ */ import_react4.default.createElement("button", { onClick: () => setOpen((prev) => !prev), style: {
244
+ background: bg,
245
+ color: textColor,
246
+ border: `1px solid ${borderColor}`,
247
+ borderRadius: radius,
248
+ padding: "10px 16px",
249
+ cursor: "pointer",
250
+ fontSize: "16px",
251
+ display: "flex",
252
+ alignItems: "center",
253
+ gap: "5px"
254
+ } }, selected, " ", /* @__PURE__ */ import_react4.default.createElement("span", { style: { marginLeft: "auto" } }, "\u25BC")), open && /* @__PURE__ */ import_react4.default.createElement("div", { style: {
255
+ position: "absolute",
256
+ top: "100%",
257
+ left: 0,
258
+ right: 0,
259
+ background: bg,
260
+ border: `1px solid ${borderColor}`,
261
+ borderRadius: radius,
262
+ boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
263
+ zIndex: 100,
264
+ marginTop: "4px",
265
+ animation: "fadeIn 0.3s ease, slideDown 0.3s ease"
266
+ } }, options.map((option) => /* @__PURE__ */ import_react4.default.createElement("div", { key: option, onClick: () => handleOptionSelect(option), style: {
267
+ padding: "10px 15px",
268
+ color: option === selected ? accent : textColor,
269
+ background: option === selected ? "rgba(124,58,237,0.1)" : "transparent",
270
+ borderRadius: radius,
271
+ cursor: "pointer",
272
+ transition: "background 0.2s"
273
+ }, onMouseEnter: (e) => e.currentTarget.style.background = "rgba(124,58,237,0.05)", onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, option))));
274
+ };
133
275
  // Annotate the CommonJS export names for ESM import in node:
134
276
  0 && (module.exports = {
135
277
  AlertBanner,
136
- Button
278
+ Button,
279
+ Card,
280
+ Dropdown
137
281
  });
package/dist/index.mjs CHANGED
@@ -94,7 +94,149 @@ var Button = ({
94
94
  loading ? "Loading..." : /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(React2.Fragment, null, iconLeft, text, iconRight))
95
95
  );
96
96
  };
97
+
98
+ // src/components/Card/Card.jsx
99
+ import React3 from "react";
100
+ var Card = ({
101
+ image = "https://via.placeholder.com/300x200",
102
+ title = "Card Title",
103
+ description = "This is a description of the card content. It should be concise and informative.",
104
+ onClick,
105
+ loading = false,
106
+ disabled = false,
107
+ bg = "#f9fafb",
108
+ textColor = "#0f172a",
109
+ hoverBg = "#e5e7eb",
110
+ radius = "12px",
111
+ shadow = "0 4px 14px rgba(0,0,0,0.1)",
112
+ hoverShadow = "0 8px 28px rgba(0,0,0,0.2)",
113
+ transition = "transform 0.3s, box-shadow 0.3s"
114
+ }) => {
115
+ return /* @__PURE__ */ React3.createElement(
116
+ "div",
117
+ {
118
+ style: {
119
+ background: bg,
120
+ borderRadius: radius,
121
+ boxShadow: shadow,
122
+ padding: "16px",
123
+ transition,
124
+ cursor: disabled ? "not-allowed" : "pointer",
125
+ opacity: disabled ? 0.6 : 1,
126
+ position: "relative",
127
+ overflow: "hidden"
128
+ },
129
+ onClick: disabled ? null : onClick,
130
+ onMouseEnter: (e) => {
131
+ e.currentTarget.style.boxShadow = hoverShadow;
132
+ e.currentTarget.style.transform = "translateY(-4px)";
133
+ },
134
+ onMouseLeave: (e) => {
135
+ e.currentTarget.style.boxShadow = shadow;
136
+ e.currentTarget.style.transform = "translateY(0)";
137
+ }
138
+ },
139
+ loading ? /* @__PURE__ */ React3.createElement("div", { style: {
140
+ background: "#e0e0e0",
141
+ height: "200px",
142
+ borderRadius: radius,
143
+ marginBottom: "12px"
144
+ } }) : /* @__PURE__ */ React3.createElement("img", { src: image, alt: title, style: { width: "100%", borderRadius: radius } }),
145
+ /* @__PURE__ */ React3.createElement("h3", { style: { margin: "12px 0 4px", fontSize: "16px", color: textColor } }, title),
146
+ /* @__PURE__ */ React3.createElement("p", { style: { margin: "0 0 12px", fontSize: "14px", color: "#374151" } }, description),
147
+ /* @__PURE__ */ React3.createElement(
148
+ "button",
149
+ {
150
+ style: {
151
+ padding: "10px 16px",
152
+ background: "#2563eb",
153
+ color: "white",
154
+ border: "none",
155
+ borderRadius: "8px",
156
+ cursor: "pointer",
157
+ fontWeight: "600",
158
+ transition: "background 0.3s"
159
+ },
160
+ onClick,
161
+ disabled
162
+ },
163
+ "Action"
164
+ )
165
+ );
166
+ };
167
+
168
+ // src/components/Dropdown/Dropdown.jsx
169
+ import React4, { useRef, useState as useState2, useEffect as useEffect2 } from "react";
170
+ var Dropdown = ({
171
+ options = ["Option 1", "Option 2", "Option 3"],
172
+ defaultValue = "Option 1",
173
+ bg = "#1e293b",
174
+ accent = "#7c3aed",
175
+ textColor = "#f1f5f9",
176
+ borderColor = "rgba(255,255,255,0.1)",
177
+ radius = "10px",
178
+ onSelect
179
+ }) => {
180
+ const [open, setOpen] = useState2(false);
181
+ const [selected, setSelected] = useState2(defaultValue);
182
+ const dropdownRef = useRef(null);
183
+ const handleClickOutside = (event) => {
184
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
185
+ setOpen(false);
186
+ }
187
+ };
188
+ const handleKeyDown = (event) => {
189
+ if (event.key === "ArrowDown") {
190
+ }
191
+ };
192
+ useEffect2(() => {
193
+ document.addEventListener("mousedown", handleClickOutside);
194
+ document.addEventListener("keydown", handleKeyDown);
195
+ return () => {
196
+ document.removeEventListener("mousedown", handleClickOutside);
197
+ document.removeEventListener("keydown", handleKeyDown);
198
+ };
199
+ });
200
+ const handleOptionSelect = (option) => {
201
+ setSelected(option);
202
+ onSelect && onSelect(option);
203
+ setOpen(false);
204
+ };
205
+ return /* @__PURE__ */ React4.createElement("div", { style: { position: "relative", display: "inline-block", fontFamily: "system-ui, sans-serif" }, ref: dropdownRef }, /* @__PURE__ */ React4.createElement("button", { onClick: () => setOpen((prev) => !prev), style: {
206
+ background: bg,
207
+ color: textColor,
208
+ border: `1px solid ${borderColor}`,
209
+ borderRadius: radius,
210
+ padding: "10px 16px",
211
+ cursor: "pointer",
212
+ fontSize: "16px",
213
+ display: "flex",
214
+ alignItems: "center",
215
+ gap: "5px"
216
+ } }, selected, " ", /* @__PURE__ */ React4.createElement("span", { style: { marginLeft: "auto" } }, "\u25BC")), open && /* @__PURE__ */ React4.createElement("div", { style: {
217
+ position: "absolute",
218
+ top: "100%",
219
+ left: 0,
220
+ right: 0,
221
+ background: bg,
222
+ border: `1px solid ${borderColor}`,
223
+ borderRadius: radius,
224
+ boxShadow: "0 4px 10px rgba(0,0,0,0.2)",
225
+ zIndex: 100,
226
+ marginTop: "4px",
227
+ animation: "fadeIn 0.3s ease, slideDown 0.3s ease"
228
+ } }, options.map((option) => /* @__PURE__ */ React4.createElement("div", { key: option, onClick: () => handleOptionSelect(option), style: {
229
+ padding: "10px 15px",
230
+ color: option === selected ? accent : textColor,
231
+ background: option === selected ? "rgba(124,58,237,0.1)" : "transparent",
232
+ borderRadius: radius,
233
+ cursor: "pointer",
234
+ transition: "background 0.2s"
235
+ }, onMouseEnter: (e) => e.currentTarget.style.background = "rgba(124,58,237,0.05)", onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, option))));
236
+ };
97
237
  export {
98
238
  AlertBanner,
99
- Button
239
+ Button,
240
+ Card,
241
+ Dropdown
100
242
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-ui-lib",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Virtual UI React Component Library",
5
5
  "author": "Ankush",
6
6
  "license": "ISC",