virtual-ui-lib 1.0.19 → 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 +79 -2
- package/dist/index.mjs +77 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,8 @@ __export(index_exports, {
|
|
|
35
35
|
Dropdown: () => Dropdown,
|
|
36
36
|
EmptyState: () => EmptyState,
|
|
37
37
|
FormInput: () => FormInput,
|
|
38
|
-
GridLayout: () => GridLayout
|
|
38
|
+
GridLayout: () => GridLayout,
|
|
39
|
+
Navbar: () => Navbar
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(index_exports);
|
|
41
42
|
|
|
@@ -399,6 +400,81 @@ var GridLayout = ({
|
|
|
399
400
|
}
|
|
400
401
|
return /* @__PURE__ */ import_react7.default.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, items.map(renderItem));
|
|
401
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
|
+
};
|
|
402
478
|
// Annotate the CommonJS export names for ESM import in node:
|
|
403
479
|
0 && (module.exports = {
|
|
404
480
|
AlertBanner,
|
|
@@ -407,5 +483,6 @@ var GridLayout = ({
|
|
|
407
483
|
Dropdown,
|
|
408
484
|
EmptyState,
|
|
409
485
|
FormInput,
|
|
410
|
-
GridLayout
|
|
486
|
+
GridLayout,
|
|
487
|
+
Navbar
|
|
411
488
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -358,6 +358,81 @@ var GridLayout = ({
|
|
|
358
358
|
}
|
|
359
359
|
return /* @__PURE__ */ React7.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, items.map(renderItem));
|
|
360
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
|
+
};
|
|
361
436
|
export {
|
|
362
437
|
AlertBanner,
|
|
363
438
|
Button,
|
|
@@ -365,5 +440,6 @@ export {
|
|
|
365
440
|
Dropdown,
|
|
366
441
|
EmptyState,
|
|
367
442
|
FormInput,
|
|
368
|
-
GridLayout
|
|
443
|
+
GridLayout,
|
|
444
|
+
Navbar
|
|
369
445
|
};
|