@yomologic/react-ui 0.2.6 → 0.2.7

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.mjs CHANGED
@@ -1028,6 +1028,7 @@ var Nav = React9.forwardRef(
1028
1028
  orientation = "horizontal",
1029
1029
  size = "md",
1030
1030
  mobileBreakpoint = "md",
1031
+ mobileMenuDirection = "top",
1031
1032
  logo,
1032
1033
  actions,
1033
1034
  sticky = false,
@@ -1061,9 +1062,12 @@ var Nav = React9.forwardRef(
1061
1062
  document.removeEventListener("keydown", handleEscape);
1062
1063
  };
1063
1064
  }, []);
1065
+ useEffect2(() => {
1066
+ setIsMobileMenuOpen(false);
1067
+ }, [mobileMenuDirection]);
1064
1068
  const baseStyles = cn(
1065
1069
  "bg-[var(--color-background)] border-b border-[var(--color-border)]",
1066
- sticky && "sticky top-0 z-50"
1070
+ sticky && "sticky top-0 [z-index:var(--z-index-nav)]"
1067
1071
  );
1068
1072
  const containerStyles = cn(
1069
1073
  "[min-height:var(--nav-height)]",
@@ -1253,32 +1257,66 @@ var Nav = React9.forwardRef(
1253
1257
  children: isMobileMenuOpen ? /* @__PURE__ */ jsx13(X, { className: "w-6 h-6" }) : /* @__PURE__ */ jsx13(Menu, { className: "w-6 h-6" })
1254
1258
  }
1255
1259
  ),
1256
- isMobileMenuOpen && /* @__PURE__ */ jsxs11(Fragment2, { children: [
1257
- /* @__PURE__ */ jsx13(
1258
- "div",
1259
- {
1260
- className: "fixed inset-0 bg-black/20 z-40",
1261
- onClick: () => setIsMobileMenuOpen(false)
1262
- }
1263
- ),
1264
- /* @__PURE__ */ jsx13("div", { className: "fixed top-[var(--nav-height)] left-0 right-0 bg-[var(--color-background)] border-b border-[var(--color-border)] shadow-lg z-50 max-h-[calc(100vh-var(--nav-height))] overflow-y-auto", children: /* @__PURE__ */ jsx13("div", { className: "flex flex-col py-2", children: items.map((item) => renderNavItem(item, true)) }) })
1265
- ] })
1260
+ isMobileMenuOpen && /* @__PURE__ */ jsx13(
1261
+ "div",
1262
+ {
1263
+ className: cn(
1264
+ "fixed inset-0 bg-black/50 [z-index:var(--z-index-nav-mobile-overlay)]",
1265
+ breakpointClasses[mobileBreakpoint]
1266
+ ),
1267
+ onClick: () => setIsMobileMenuOpen(false)
1268
+ }
1269
+ ),
1270
+ /* @__PURE__ */ jsx13(
1271
+ "div",
1272
+ {
1273
+ className: cn(
1274
+ "fixed bg-[var(--color-background)] shadow-lg [z-index:var(--z-index-nav-mobile-menu)] overflow-y-auto transition-transform duration-300 ease-in-out",
1275
+ breakpointClasses[mobileBreakpoint],
1276
+ // Always hide when closed
1277
+ !isMobileMenuOpen && "invisible",
1278
+ // Direction-specific positioning and animation
1279
+ mobileMenuDirection === "top" && [
1280
+ "top-0 left-0 right-0 border-b border-[var(--color-border)] max-h-screen",
1281
+ isMobileMenuOpen ? "translate-y-0" : "-translate-y-full"
1282
+ ],
1283
+ mobileMenuDirection === "left" && [
1284
+ "top-0 left-0 bottom-0 w-64 border-r border-[var(--color-border)]",
1285
+ isMobileMenuOpen ? "translate-x-0" : "-translate-x-full"
1286
+ ],
1287
+ mobileMenuDirection === "right" && [
1288
+ "top-0 right-0 bottom-0 w-64 border-l border-[var(--color-border)]",
1289
+ isMobileMenuOpen ? "translate-x-0" : "translate-x-full"
1290
+ ]
1291
+ ),
1292
+ children: /* @__PURE__ */ jsx13(
1293
+ "div",
1294
+ {
1295
+ className: cn(
1296
+ "flex flex-col",
1297
+ mobileMenuDirection === "top" ? "py-2" : "space-y-1 px-2 pt-2"
1298
+ ),
1299
+ children: items.map((item) => renderNavItem(item, true))
1300
+ }
1301
+ )
1302
+ }
1303
+ )
1266
1304
  ] });
1267
1305
  return /* @__PURE__ */ jsx13("nav", { ref, className: cn(baseStyles, className), ...props, children: /* @__PURE__ */ jsxs11("div", { className: containerStyles, children: [
1268
- logo && /* @__PURE__ */ jsx13("div", { className: "flex-shrink-0", children: logo }),
1306
+ logo && /* @__PURE__ */ jsx13("div", { className: "shrink-0", children: logo }),
1269
1307
  desktopNav,
1270
- actions && /* @__PURE__ */ jsx13("div", { className: "flex-shrink-0 flex items-center gap-2", children: actions }),
1308
+ actions && /* @__PURE__ */ jsx13("div", { className: "shrink-0 flex items-center gap-2", children: actions }),
1271
1309
  mobileNav
1272
1310
  ] }) });
1273
1311
  }
1274
1312
  );
1275
1313
  Nav.displayName = "Nav";
1276
1314
 
1277
- // src/layout/sidebar-nav.tsx
1315
+ // src/layout/drawer.tsx
1278
1316
  import { useState as useState4 } from "react";
1279
1317
  import { Menu as Menu2, X as X2 } from "lucide-react";
1280
1318
  import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
1281
- function SidebarNav({
1319
+ function Drawer({
1282
1320
  title,
1283
1321
  subtitle,
1284
1322
  items,
@@ -1296,7 +1334,7 @@ function SidebarNav({
1296
1334
  };
1297
1335
  const useSections = sections || (items ? [{ title: "", items }] : []);
1298
1336
  return /* @__PURE__ */ jsxs12(Fragment3, { children: [
1299
- /* @__PURE__ */ jsx14("div", { className: "lg:hidden fixed top-0 left-0 right-0 z-50 bg-white border-b border-gray-200 px-4 py-3", children: /* @__PURE__ */ jsxs12(
1337
+ /* @__PURE__ */ jsx14("div", { className: "lg:hidden fixed top-0 left-0 right-0 bg-white border-b border-gray-200 px-4 py-3 [z-index:var(--z-index-drawer-header)]", children: /* @__PURE__ */ jsxs12(
1300
1338
  "div",
1301
1339
  {
1302
1340
  className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
@@ -1305,7 +1343,7 @@ function SidebarNav({
1305
1343
  "button",
1306
1344
  {
1307
1345
  onClick: () => setMobileMenuOpen(!mobileMenuOpen),
1308
- className: "p-2 rounded-lg hover:bg-gray-100 transition-colors",
1346
+ className: "p-2 rounded-lg hover:bg-gray-100 transition-colors relative [z-index:var(--z-index-drawer-button)]",
1309
1347
  "aria-label": "Toggle menu",
1310
1348
  children: mobileMenuOpen ? /* @__PURE__ */ jsx14(X2, { className: "w-6 h-6 text-gray-700" }) : /* @__PURE__ */ jsx14(Menu2, { className: "w-6 h-6 text-gray-700" })
1311
1349
  }
@@ -1321,7 +1359,7 @@ function SidebarNav({
1321
1359
  "div",
1322
1360
  {
1323
1361
  className: "fixed inset-0 bg-black/50 lg:hidden",
1324
- style: { zIndex: 35 },
1362
+ style: { zIndex: 9998 },
1325
1363
  onClick: () => setMobileMenuOpen(false)
1326
1364
  }
1327
1365
  ),
@@ -1329,18 +1367,33 @@ function SidebarNav({
1329
1367
  "aside",
1330
1368
  {
1331
1369
  className: `
1332
- fixed top-0 h-screen w-64 bg-white z-40
1370
+ fixed top-0 bottom-0 w-64 bg-white
1333
1371
  transition-transform duration-300 ease-in-out overflow-y-auto
1334
1372
  ${isLeft ? "left-0 border-r" : "right-0 border-l"} border-gray-200
1335
- lg:translate-x-0
1336
- ${mobileMenuOpen ? "translate-x-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} lg:translate-x-0`}
1373
+ lg:translate-x-0 lg:top-0
1374
+ ${mobileMenuOpen ? "translate-x-0 top-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} top-0`}
1337
1375
  `,
1376
+ style: mobileMenuOpen && typeof window !== "undefined" && window.innerWidth < 1024 ? { zIndex: 9999 } : void 0,
1338
1377
  children: [
1339
1378
  /* @__PURE__ */ jsxs12("div", { className: "hidden lg:block p-6 border-b border-gray-200", children: [
1340
1379
  /* @__PURE__ */ jsx14("h1", { className: "text-xl font-bold text-gray-900", children: title }),
1341
1380
  subtitle && /* @__PURE__ */ jsx14("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
1342
1381
  ] }),
1343
- /* @__PURE__ */ jsx14("div", { className: "lg:hidden h-[57px]", "aria-hidden": "true" }),
1382
+ /* @__PURE__ */ jsxs12("div", { className: "lg:hidden p-4 border-b border-gray-200 flex items-center justify-between", children: [
1383
+ /* @__PURE__ */ jsxs12("div", { children: [
1384
+ /* @__PURE__ */ jsx14("h1", { className: "text-lg font-bold text-gray-900", children: title }),
1385
+ subtitle && /* @__PURE__ */ jsx14("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
1386
+ ] }),
1387
+ /* @__PURE__ */ jsx14(
1388
+ "button",
1389
+ {
1390
+ onClick: () => setMobileMenuOpen(false),
1391
+ className: "p-2 rounded-lg hover:bg-gray-100 transition-colors",
1392
+ "aria-label": "Close menu",
1393
+ children: /* @__PURE__ */ jsx14(X2, { className: "w-5 h-5 text-gray-700" })
1394
+ }
1395
+ )
1396
+ ] }),
1344
1397
  /* @__PURE__ */ jsx14("nav", { className: "p-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs12("div", { className: sectionIndex > 0 ? "mt-6" : "", children: [
1345
1398
  section.title && /* @__PURE__ */ jsx14("h3", { className: "px-4 mb-2 text-xs font-semibold text-gray-500 uppercase tracking-wider", children: section.title }),
1346
1399
  /* @__PURE__ */ jsx14("ul", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ jsx14("li", { children: /* @__PURE__ */ jsxs12(
@@ -1365,12 +1418,103 @@ function SidebarNav({
1365
1418
  ] });
1366
1419
  }
1367
1420
 
1421
+ // src/layout/sidebar-nav.tsx
1422
+ import { useState as useState5 } from "react";
1423
+ import { Menu as Menu3, X as X3 } from "lucide-react";
1424
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
1425
+ function SidebarNav({
1426
+ title,
1427
+ subtitle,
1428
+ items,
1429
+ sections,
1430
+ activeItem,
1431
+ onItemClick,
1432
+ footer,
1433
+ position = "right"
1434
+ }) {
1435
+ const [mobileMenuOpen, setMobileMenuOpen] = useState5(false);
1436
+ const isLeft = position === "left";
1437
+ const handleItemClick = (itemId) => {
1438
+ onItemClick(itemId);
1439
+ setMobileMenuOpen(false);
1440
+ };
1441
+ const useSections = sections || (items ? [{ title: "", items }] : []);
1442
+ return /* @__PURE__ */ jsxs13(Fragment4, { children: [
1443
+ /* @__PURE__ */ jsx15("div", { className: "lg:hidden fixed top-0 left-0 right-0 z-50 bg-white border-b border-gray-200 px-4 py-3", children: /* @__PURE__ */ jsxs13(
1444
+ "div",
1445
+ {
1446
+ className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
1447
+ children: [
1448
+ /* @__PURE__ */ jsx15(
1449
+ "button",
1450
+ {
1451
+ onClick: () => setMobileMenuOpen(!mobileMenuOpen),
1452
+ className: "p-2 rounded-lg hover:bg-gray-100 transition-colors",
1453
+ "aria-label": "Toggle menu",
1454
+ children: mobileMenuOpen ? /* @__PURE__ */ jsx15(X3, { className: "w-6 h-6 text-gray-700" }) : /* @__PURE__ */ jsx15(Menu3, { className: "w-6 h-6 text-gray-700" })
1455
+ }
1456
+ ),
1457
+ /* @__PURE__ */ jsxs13("div", { children: [
1458
+ /* @__PURE__ */ jsx15("h1", { className: "text-lg font-bold text-gray-900", children: title }),
1459
+ subtitle && /* @__PURE__ */ jsx15("p", { className: "text-xs text-gray-500", children: subtitle })
1460
+ ] })
1461
+ ]
1462
+ }
1463
+ ) }),
1464
+ mobileMenuOpen && /* @__PURE__ */ jsx15(
1465
+ "div",
1466
+ {
1467
+ className: "fixed inset-0 bg-black/50 lg:hidden",
1468
+ style: { zIndex: 35 },
1469
+ onClick: () => setMobileMenuOpen(false)
1470
+ }
1471
+ ),
1472
+ /* @__PURE__ */ jsxs13(
1473
+ "aside",
1474
+ {
1475
+ className: `
1476
+ fixed top-0 h-screen w-64 bg-white z-40
1477
+ transition-transform duration-300 ease-in-out overflow-y-auto
1478
+ ${isLeft ? "left-0 border-r" : "right-0 border-l"} border-gray-200
1479
+ lg:translate-x-0
1480
+ ${mobileMenuOpen ? "translate-x-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} lg:translate-x-0`}
1481
+ `,
1482
+ children: [
1483
+ /* @__PURE__ */ jsxs13("div", { className: "hidden lg:block p-6 border-b border-gray-200", children: [
1484
+ /* @__PURE__ */ jsx15("h1", { className: "text-xl font-bold text-gray-900", children: title }),
1485
+ subtitle && /* @__PURE__ */ jsx15("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
1486
+ ] }),
1487
+ /* @__PURE__ */ jsx15("div", { className: "lg:hidden h-[57px]", "aria-hidden": "true" }),
1488
+ /* @__PURE__ */ jsx15("nav", { className: "p-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs13("div", { className: sectionIndex > 0 ? "mt-6" : "", children: [
1489
+ section.title && /* @__PURE__ */ jsx15("h3", { className: "px-4 mb-2 text-xs font-semibold text-gray-500 uppercase tracking-wider", children: section.title }),
1490
+ /* @__PURE__ */ jsx15("ul", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ jsx15("li", { children: /* @__PURE__ */ jsxs13(
1491
+ "button",
1492
+ {
1493
+ onClick: () => handleItemClick(item.id),
1494
+ className: `
1495
+ w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-colors
1496
+ ${activeItem === item.id ? "bg-blue-50 text-blue-700" : "text-gray-700 hover:bg-gray-50"}
1497
+ `,
1498
+ children: [
1499
+ item.icon && /* @__PURE__ */ jsx15("span", { className: "shrink-0", children: item.icon }),
1500
+ /* @__PURE__ */ jsx15("span", { children: item.label })
1501
+ ]
1502
+ }
1503
+ ) }, item.id)) })
1504
+ ] }, sectionIndex)) }),
1505
+ footer && /* @__PURE__ */ jsx15("div", { className: "p-4 border-t border-gray-200 mt-auto", children: footer })
1506
+ ]
1507
+ }
1508
+ )
1509
+ ] });
1510
+ }
1511
+
1368
1512
  // src/shared/empty-state.tsx
1369
- import React11 from "react";
1370
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
1371
- var EmptyState = React11.forwardRef(
1513
+ import React12 from "react";
1514
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
1515
+ var EmptyState = React12.forwardRef(
1372
1516
  ({ className, icon, title, description, action, ...props }, ref) => {
1373
- return /* @__PURE__ */ jsxs13(
1517
+ return /* @__PURE__ */ jsxs14(
1374
1518
  "div",
1375
1519
  {
1376
1520
  ref,
@@ -1380,10 +1524,10 @@ var EmptyState = React11.forwardRef(
1380
1524
  ),
1381
1525
  ...props,
1382
1526
  children: [
1383
- icon && /* @__PURE__ */ jsx15("div", { className: "mb-4 text-gray-400", children: icon }),
1384
- /* @__PURE__ */ jsx15("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: title }),
1385
- description && /* @__PURE__ */ jsx15("p", { className: "text-sm text-gray-500 mb-6 max-w-sm", children: description }),
1386
- action && /* @__PURE__ */ jsx15("div", { children: action })
1527
+ icon && /* @__PURE__ */ jsx16("div", { className: "mb-4 text-gray-400", children: icon }),
1528
+ /* @__PURE__ */ jsx16("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: title }),
1529
+ description && /* @__PURE__ */ jsx16("p", { className: "text-sm text-gray-500 mb-6 max-w-sm", children: description }),
1530
+ action && /* @__PURE__ */ jsx16("div", { children: action })
1387
1531
  ]
1388
1532
  }
1389
1533
  );
@@ -1395,7 +1539,7 @@ EmptyState.displayName = "EmptyState";
1395
1539
  import {
1396
1540
  createContext,
1397
1541
  useContext,
1398
- useState as useState5,
1542
+ useState as useState6,
1399
1543
  useEffect as useEffect3
1400
1544
  } from "react";
1401
1545
 
@@ -1502,6 +1646,23 @@ var default_default = {
1502
1646
  bold: "700"
1503
1647
  }
1504
1648
  },
1649
+ zIndex: {
1650
+ dropdown: 1e3,
1651
+ popover: 1100,
1652
+ tooltip: 1500,
1653
+ overlay: 1200,
1654
+ nav: 50,
1655
+ navMobileOverlay: 60,
1656
+ navMobileMenu: 70,
1657
+ drawerHeader: 100,
1658
+ drawerButton: 101,
1659
+ drawerOverlay: 90,
1660
+ drawerPanel: 95,
1661
+ modalBackdrop: 1300,
1662
+ modal: 1400,
1663
+ snackbar: 1600,
1664
+ toast: 1700
1665
+ },
1505
1666
  components: {
1506
1667
  button: {
1507
1668
  padding: {
@@ -1662,10 +1823,10 @@ var default_default = {
1662
1823
  };
1663
1824
 
1664
1825
  // src/shared/contexts/ThemeContext.tsx
1665
- import { jsx as jsx16 } from "react/jsx-runtime";
1826
+ import { jsx as jsx17 } from "react/jsx-runtime";
1666
1827
  var ThemeContext = createContext(void 0);
1667
1828
  function ThemeProvider({ children }) {
1668
- const [theme, setThemeState] = useState5(default_default);
1829
+ const [theme, setThemeState] = useState6(default_default);
1669
1830
  const applyTheme = (newTheme) => {
1670
1831
  const root = document.documentElement;
1671
1832
  const colors = newTheme.colors;
@@ -1792,6 +1953,9 @@ function ThemeProvider({ children }) {
1792
1953
  });
1793
1954
  root.style.setProperty("--nav-border-radius", nav.borderRadius);
1794
1955
  root.style.setProperty("--nav-gap", nav.gap);
1956
+ Object.entries(newTheme.zIndex).forEach(([key, value]) => {
1957
+ root.style.setProperty(`--z-index-${key}`, value.toString());
1958
+ });
1795
1959
  setThemeState(newTheme);
1796
1960
  };
1797
1961
  const setTheme = (newTheme) => {
@@ -1822,7 +1986,7 @@ function ThemeProvider({ children }) {
1822
1986
  }
1823
1987
  }
1824
1988
  }, []);
1825
- return /* @__PURE__ */ jsx16(ThemeContext.Provider, { value: { theme, setTheme, applyTheme, resetTheme }, children });
1989
+ return /* @__PURE__ */ jsx17(ThemeContext.Provider, { value: { theme, setTheme, applyTheme, resetTheme }, children });
1826
1990
  }
1827
1991
  function useTheme() {
1828
1992
  const context = useContext(ThemeContext);
@@ -1845,6 +2009,7 @@ export {
1845
2009
  CheckboxGroup,
1846
2010
  CodeSnippet,
1847
2011
  Container,
2012
+ Drawer,
1848
2013
  Dropdown,
1849
2014
  EmptyState,
1850
2015
  Input,