virtual-ui-lib 1.0.18 → 1.0.20
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 +119 -2
- package/dist/index.mjs +116 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,9 @@ __export(index_exports, {
|
|
|
34
34
|
Card: () => Card,
|
|
35
35
|
Dropdown: () => Dropdown,
|
|
36
36
|
EmptyState: () => EmptyState,
|
|
37
|
-
FormInput: () => FormInput
|
|
37
|
+
FormInput: () => FormInput,
|
|
38
|
+
GridLayout: () => GridLayout,
|
|
39
|
+
Navbar: () => Navbar
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(index_exports);
|
|
40
42
|
|
|
@@ -360,6 +362,119 @@ var FormInput = ({
|
|
|
360
362
|
}
|
|
361
363
|
), isError && /* @__PURE__ */ import_react6.default.createElement("p", { style: { marginTop: "8px", color: "#ef4444", fontSize: "12px", opacity: 0, animation: "fadeIn 0.3s forwards" } }, errorMessage), isSuccess && /* @__PURE__ */ import_react6.default.createElement("p", { style: { marginTop: "8px", color: "#22c55e", fontSize: "12px" } }, "Input is valid!"), /* @__PURE__ */ import_react6.default.createElement("style", null, `@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }`));
|
|
362
364
|
};
|
|
365
|
+
|
|
366
|
+
// src/components/GridLayout/GridLayout.jsx
|
|
367
|
+
var import_react7 = __toESM(require("react"));
|
|
368
|
+
var GridLayout = ({
|
|
369
|
+
items = [],
|
|
370
|
+
cols = 3,
|
|
371
|
+
loading = false,
|
|
372
|
+
emptyMessage = "No items available",
|
|
373
|
+
itemBg = "#1f2937",
|
|
374
|
+
itemColor = "#f1f5f9",
|
|
375
|
+
spacing = "16px",
|
|
376
|
+
radius = "8px"
|
|
377
|
+
}) => {
|
|
378
|
+
const renderItem = (item, index) => /* @__PURE__ */ import_react7.default.createElement("div", { key: index, style: {
|
|
379
|
+
background: itemBg,
|
|
380
|
+
color: itemColor,
|
|
381
|
+
borderRadius: radius,
|
|
382
|
+
padding: "16px",
|
|
383
|
+
margin: spacing,
|
|
384
|
+
transition: "transform 0.3s, box-shadow 0.3s",
|
|
385
|
+
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.15)",
|
|
386
|
+
display: "flex",
|
|
387
|
+
justifyContent: "center",
|
|
388
|
+
alignItems: "center",
|
|
389
|
+
cursor: "pointer"
|
|
390
|
+
}, onMouseEnter: (e) => {
|
|
391
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
392
|
+
}, onMouseLeave: (e) => {
|
|
393
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
394
|
+
} }, item);
|
|
395
|
+
if (loading) {
|
|
396
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, Array.from({ length: cols * 3 }).map((_, index) => /* @__PURE__ */ import_react7.default.createElement("div", { key: index, style: { background: "#334155", height: "100px", borderRadius: radius } })));
|
|
397
|
+
}
|
|
398
|
+
if (items.length === 0) {
|
|
399
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { style: { color: itemColor, textAlign: "center", padding: "20px" } }, emptyMessage);
|
|
400
|
+
}
|
|
401
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, items.map(renderItem));
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// src/components/Navbar/Navbar.jsx
|
|
405
|
+
var import_react8 = __toESM(require("react"));
|
|
406
|
+
var Navbar = ({
|
|
407
|
+
logo = "Logo",
|
|
408
|
+
links = [{ name: "Home", href: "#" }, { name: "About", href: "#" }, { name: "Services", href: "#" }, { name: "Contact", href: "#" }],
|
|
409
|
+
bgColor = "#0f172a",
|
|
410
|
+
linkColor = "#f1f5f9",
|
|
411
|
+
hoverColor = "#7c3aed",
|
|
412
|
+
stickyColor = "#1e293b",
|
|
413
|
+
radius = "8px"
|
|
414
|
+
}) => {
|
|
415
|
+
const [isMobileMenuOpen, setMobileMenuOpen] = (0, import_react8.useState)(false);
|
|
416
|
+
const [isSticky, setSticky] = (0, import_react8.useState)(false);
|
|
417
|
+
(0, import_react8.useEffect)(() => {
|
|
418
|
+
const handleScroll = () => {
|
|
419
|
+
setSticky(window.scrollY > 50);
|
|
420
|
+
};
|
|
421
|
+
window.addEventListener("scroll", handleScroll);
|
|
422
|
+
return () => window.removeEventListener("scroll", handleScroll);
|
|
423
|
+
}, []);
|
|
424
|
+
return /* @__PURE__ */ import_react8.default.createElement("nav", { style: {
|
|
425
|
+
background: isSticky ? stickyColor : bgColor,
|
|
426
|
+
position: isSticky ? "fixed" : "relative",
|
|
427
|
+
width: "100%",
|
|
428
|
+
padding: "10px 20px",
|
|
429
|
+
boxShadow: isSticky ? "0 2px 10px rgba(0,0,0,0.2)" : "none",
|
|
430
|
+
transition: "background 0.3s ease"
|
|
431
|
+
} }, /* @__PURE__ */ import_react8.default.createElement("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ import_react8.default.createElement("div", { style: { color: linkColor, fontSize: "20px", fontWeight: "600" } }, logo), /* @__PURE__ */ import_react8.default.createElement("div", { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ import_react8.default.createElement("ul", { style: { display: "flex", listStyle: "none", gap: "20px", margin: 0, padding: 0 } }, links.map((link) => /* @__PURE__ */ import_react8.default.createElement("li", { key: link.name }, /* @__PURE__ */ import_react8.default.createElement("a", { href: link.href, style: {
|
|
432
|
+
textDecoration: "none",
|
|
433
|
+
color: linkColor,
|
|
434
|
+
position: "relative",
|
|
435
|
+
fontSize: "16px",
|
|
436
|
+
transition: "color 0.3s"
|
|
437
|
+
}, onMouseOver: (e) => e.currentTarget.style.color = hoverColor, onMouseOut: (e) => e.currentTarget.style.color = linkColor }, link.name, /* @__PURE__ */ import_react8.default.createElement("span", { style: {
|
|
438
|
+
position: "absolute",
|
|
439
|
+
bottom: "-3px",
|
|
440
|
+
left: 0,
|
|
441
|
+
width: "100%",
|
|
442
|
+
height: "2px",
|
|
443
|
+
background: hoverColor,
|
|
444
|
+
transform: "scaleX(0)",
|
|
445
|
+
transition: "transform 0.3s ease"
|
|
446
|
+
}, className: "underline" }))))), /* @__PURE__ */ import_react8.default.createElement("button", { onClick: () => setMobileMenuOpen(true), style: {
|
|
447
|
+
background: "transparent",
|
|
448
|
+
color: linkColor,
|
|
449
|
+
border: "none",
|
|
450
|
+
cursor: "pointer",
|
|
451
|
+
fontSize: "16px",
|
|
452
|
+
marginLeft: "20px"
|
|
453
|
+
} }, "\u2630"))), isMobileMenuOpen && /* @__PURE__ */ import_react8.default.createElement("div", { style: {
|
|
454
|
+
position: "fixed",
|
|
455
|
+
top: 0,
|
|
456
|
+
right: 0,
|
|
457
|
+
width: "250px",
|
|
458
|
+
height: "100%",
|
|
459
|
+
background: bgColor,
|
|
460
|
+
boxShadow: "-4px 0 10px rgba(0,0,0,0.5)",
|
|
461
|
+
padding: "20px",
|
|
462
|
+
transform: "translateX(0)",
|
|
463
|
+
transition: "transform 0.3s ease"
|
|
464
|
+
} }, /* @__PURE__ */ import_react8.default.createElement("button", { onClick: () => setMobileMenuOpen(false), style: {
|
|
465
|
+
background: "transparent",
|
|
466
|
+
color: linkColor,
|
|
467
|
+
border: "none",
|
|
468
|
+
cursor: "pointer",
|
|
469
|
+
fontSize: "16px",
|
|
470
|
+
marginBottom: "20px"
|
|
471
|
+
} }, "\u2716"), /* @__PURE__ */ import_react8.default.createElement("ul", { style: { listStyle: "none", padding: 0 } }, links.map((link) => /* @__PURE__ */ import_react8.default.createElement("li", { key: link.name, style: { margin: "10px 0" } }, /* @__PURE__ */ import_react8.default.createElement("a", { href: link.href, style: {
|
|
472
|
+
textDecoration: "none",
|
|
473
|
+
color: linkColor,
|
|
474
|
+
fontSize: "18px",
|
|
475
|
+
transition: "color 0.3s"
|
|
476
|
+
}, onMouseOver: (e) => e.currentTarget.style.color = hoverColor, onMouseOut: (e) => e.currentTarget.style.color = linkColor }, link.name))))));
|
|
477
|
+
};
|
|
363
478
|
// Annotate the CommonJS export names for ESM import in node:
|
|
364
479
|
0 && (module.exports = {
|
|
365
480
|
AlertBanner,
|
|
@@ -367,5 +482,7 @@ var FormInput = ({
|
|
|
367
482
|
Card,
|
|
368
483
|
Dropdown,
|
|
369
484
|
EmptyState,
|
|
370
|
-
FormInput
|
|
485
|
+
FormInput,
|
|
486
|
+
GridLayout,
|
|
487
|
+
Navbar
|
|
371
488
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -320,11 +320,126 @@ var FormInput = ({
|
|
|
320
320
|
}
|
|
321
321
|
), isError && /* @__PURE__ */ React6.createElement("p", { style: { marginTop: "8px", color: "#ef4444", fontSize: "12px", opacity: 0, animation: "fadeIn 0.3s forwards" } }, errorMessage), isSuccess && /* @__PURE__ */ React6.createElement("p", { style: { marginTop: "8px", color: "#22c55e", fontSize: "12px" } }, "Input is valid!"), /* @__PURE__ */ React6.createElement("style", null, `@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }`));
|
|
322
322
|
};
|
|
323
|
+
|
|
324
|
+
// src/components/GridLayout/GridLayout.jsx
|
|
325
|
+
import React7 from "react";
|
|
326
|
+
var GridLayout = ({
|
|
327
|
+
items = [],
|
|
328
|
+
cols = 3,
|
|
329
|
+
loading = false,
|
|
330
|
+
emptyMessage = "No items available",
|
|
331
|
+
itemBg = "#1f2937",
|
|
332
|
+
itemColor = "#f1f5f9",
|
|
333
|
+
spacing = "16px",
|
|
334
|
+
radius = "8px"
|
|
335
|
+
}) => {
|
|
336
|
+
const renderItem = (item, index) => /* @__PURE__ */ React7.createElement("div", { key: index, style: {
|
|
337
|
+
background: itemBg,
|
|
338
|
+
color: itemColor,
|
|
339
|
+
borderRadius: radius,
|
|
340
|
+
padding: "16px",
|
|
341
|
+
margin: spacing,
|
|
342
|
+
transition: "transform 0.3s, box-shadow 0.3s",
|
|
343
|
+
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.15)",
|
|
344
|
+
display: "flex",
|
|
345
|
+
justifyContent: "center",
|
|
346
|
+
alignItems: "center",
|
|
347
|
+
cursor: "pointer"
|
|
348
|
+
}, onMouseEnter: (e) => {
|
|
349
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
350
|
+
}, onMouseLeave: (e) => {
|
|
351
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
352
|
+
} }, item);
|
|
353
|
+
if (loading) {
|
|
354
|
+
return /* @__PURE__ */ React7.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, Array.from({ length: cols * 3 }).map((_, index) => /* @__PURE__ */ React7.createElement("div", { key: index, style: { background: "#334155", height: "100px", borderRadius: radius } })));
|
|
355
|
+
}
|
|
356
|
+
if (items.length === 0) {
|
|
357
|
+
return /* @__PURE__ */ React7.createElement("div", { style: { color: itemColor, textAlign: "center", padding: "20px" } }, emptyMessage);
|
|
358
|
+
}
|
|
359
|
+
return /* @__PURE__ */ React7.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, items.map(renderItem));
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// src/components/Navbar/Navbar.jsx
|
|
363
|
+
import React8, { useState as useState5, useEffect as useEffect4 } from "react";
|
|
364
|
+
var Navbar = ({
|
|
365
|
+
logo = "Logo",
|
|
366
|
+
links = [{ name: "Home", href: "#" }, { name: "About", href: "#" }, { name: "Services", href: "#" }, { name: "Contact", href: "#" }],
|
|
367
|
+
bgColor = "#0f172a",
|
|
368
|
+
linkColor = "#f1f5f9",
|
|
369
|
+
hoverColor = "#7c3aed",
|
|
370
|
+
stickyColor = "#1e293b",
|
|
371
|
+
radius = "8px"
|
|
372
|
+
}) => {
|
|
373
|
+
const [isMobileMenuOpen, setMobileMenuOpen] = useState5(false);
|
|
374
|
+
const [isSticky, setSticky] = useState5(false);
|
|
375
|
+
useEffect4(() => {
|
|
376
|
+
const handleScroll = () => {
|
|
377
|
+
setSticky(window.scrollY > 50);
|
|
378
|
+
};
|
|
379
|
+
window.addEventListener("scroll", handleScroll);
|
|
380
|
+
return () => window.removeEventListener("scroll", handleScroll);
|
|
381
|
+
}, []);
|
|
382
|
+
return /* @__PURE__ */ React8.createElement("nav", { style: {
|
|
383
|
+
background: isSticky ? stickyColor : bgColor,
|
|
384
|
+
position: isSticky ? "fixed" : "relative",
|
|
385
|
+
width: "100%",
|
|
386
|
+
padding: "10px 20px",
|
|
387
|
+
boxShadow: isSticky ? "0 2px 10px rgba(0,0,0,0.2)" : "none",
|
|
388
|
+
transition: "background 0.3s ease"
|
|
389
|
+
} }, /* @__PURE__ */ React8.createElement("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React8.createElement("div", { style: { color: linkColor, fontSize: "20px", fontWeight: "600" } }, logo), /* @__PURE__ */ React8.createElement("div", { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React8.createElement("ul", { style: { display: "flex", listStyle: "none", gap: "20px", margin: 0, padding: 0 } }, links.map((link) => /* @__PURE__ */ React8.createElement("li", { key: link.name }, /* @__PURE__ */ React8.createElement("a", { href: link.href, style: {
|
|
390
|
+
textDecoration: "none",
|
|
391
|
+
color: linkColor,
|
|
392
|
+
position: "relative",
|
|
393
|
+
fontSize: "16px",
|
|
394
|
+
transition: "color 0.3s"
|
|
395
|
+
}, onMouseOver: (e) => e.currentTarget.style.color = hoverColor, onMouseOut: (e) => e.currentTarget.style.color = linkColor }, link.name, /* @__PURE__ */ React8.createElement("span", { style: {
|
|
396
|
+
position: "absolute",
|
|
397
|
+
bottom: "-3px",
|
|
398
|
+
left: 0,
|
|
399
|
+
width: "100%",
|
|
400
|
+
height: "2px",
|
|
401
|
+
background: hoverColor,
|
|
402
|
+
transform: "scaleX(0)",
|
|
403
|
+
transition: "transform 0.3s ease"
|
|
404
|
+
}, className: "underline" }))))), /* @__PURE__ */ React8.createElement("button", { onClick: () => setMobileMenuOpen(true), style: {
|
|
405
|
+
background: "transparent",
|
|
406
|
+
color: linkColor,
|
|
407
|
+
border: "none",
|
|
408
|
+
cursor: "pointer",
|
|
409
|
+
fontSize: "16px",
|
|
410
|
+
marginLeft: "20px"
|
|
411
|
+
} }, "\u2630"))), isMobileMenuOpen && /* @__PURE__ */ React8.createElement("div", { style: {
|
|
412
|
+
position: "fixed",
|
|
413
|
+
top: 0,
|
|
414
|
+
right: 0,
|
|
415
|
+
width: "250px",
|
|
416
|
+
height: "100%",
|
|
417
|
+
background: bgColor,
|
|
418
|
+
boxShadow: "-4px 0 10px rgba(0,0,0,0.5)",
|
|
419
|
+
padding: "20px",
|
|
420
|
+
transform: "translateX(0)",
|
|
421
|
+
transition: "transform 0.3s ease"
|
|
422
|
+
} }, /* @__PURE__ */ React8.createElement("button", { onClick: () => setMobileMenuOpen(false), style: {
|
|
423
|
+
background: "transparent",
|
|
424
|
+
color: linkColor,
|
|
425
|
+
border: "none",
|
|
426
|
+
cursor: "pointer",
|
|
427
|
+
fontSize: "16px",
|
|
428
|
+
marginBottom: "20px"
|
|
429
|
+
} }, "\u2716"), /* @__PURE__ */ React8.createElement("ul", { style: { listStyle: "none", padding: 0 } }, links.map((link) => /* @__PURE__ */ React8.createElement("li", { key: link.name, style: { margin: "10px 0" } }, /* @__PURE__ */ React8.createElement("a", { href: link.href, style: {
|
|
430
|
+
textDecoration: "none",
|
|
431
|
+
color: linkColor,
|
|
432
|
+
fontSize: "18px",
|
|
433
|
+
transition: "color 0.3s"
|
|
434
|
+
}, onMouseOver: (e) => e.currentTarget.style.color = hoverColor, onMouseOut: (e) => e.currentTarget.style.color = linkColor }, link.name))))));
|
|
435
|
+
};
|
|
323
436
|
export {
|
|
324
437
|
AlertBanner,
|
|
325
438
|
Button,
|
|
326
439
|
Card,
|
|
327
440
|
Dropdown,
|
|
328
441
|
EmptyState,
|
|
329
|
-
FormInput
|
|
442
|
+
FormInput,
|
|
443
|
+
GridLayout,
|
|
444
|
+
Navbar
|
|
330
445
|
};
|