@almadar/ui 6.11.0 → 6.13.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.
@@ -24113,6 +24113,18 @@ var init_useAuthContext = __esm({
24113
24113
  "hooks/useAuthContext.ts"() {
24114
24114
  }
24115
24115
  });
24116
+ function resolveActiveNavHref(items, currentPath) {
24117
+ let best;
24118
+ for (const item of items) {
24119
+ for (const href of item.children?.length ? [item.href, ...item.children.map((c) => c.href)] : [item.href]) {
24120
+ if (currentPath === href) return href;
24121
+ if (currentPath.startsWith(href + "/") && (!best || href.length > best.length)) {
24122
+ best = href;
24123
+ }
24124
+ }
24125
+ }
24126
+ return best;
24127
+ }
24116
24128
  exports.DashboardLayout = void 0; var NavLink, NavLinkTopnav, NavLinkBottom;
24117
24129
  var init_DashboardLayout = __esm({
24118
24130
  "components/core/templates/DashboardLayout.tsx"() {
@@ -24184,6 +24196,7 @@ var init_DashboardLayout = __esm({
24184
24196
  const location = reactRouterDom.useLocation();
24185
24197
  const ctxPagePath = providers.useCurrentPagePath();
24186
24198
  const activePath = (currentPath || void 0) ?? ctxPagePath ?? location.pathname;
24199
+ const activeHref = React79.useMemo(() => resolveActiveNavHref(navItems, activePath), [navItems, activePath]);
24187
24200
  const { user: authUser, signOut: authSignOut } = useAuthContext();
24188
24201
  const user = userProp || (authUser ? {
24189
24202
  name: authUser.displayName || authUser.email?.split("@")[0] || "User",
@@ -24280,7 +24293,7 @@ var init_DashboardLayout = __esm({
24280
24293
  NavLink,
24281
24294
  {
24282
24295
  item,
24283
- currentPath: activePath,
24296
+ activeHref,
24284
24297
  compact: isRail
24285
24298
  },
24286
24299
  item.href
@@ -24347,7 +24360,7 @@ var init_DashboardLayout = __esm({
24347
24360
  NavLinkTopnav,
24348
24361
  {
24349
24362
  item,
24350
- currentPath: activePath
24363
+ activeHref
24351
24364
  },
24352
24365
  item.href
24353
24366
  ))
@@ -24523,7 +24536,7 @@ var init_DashboardLayout = __esm({
24523
24536
  NavLinkBottom,
24524
24537
  {
24525
24538
  item,
24526
- currentPath: activePath
24539
+ activeHref
24527
24540
  },
24528
24541
  item.href
24529
24542
  )) })
@@ -24537,15 +24550,71 @@ var init_DashboardLayout = __esm({
24537
24550
  exports.DashboardLayout.displayName = "DashboardLayout";
24538
24551
  NavLink = ({
24539
24552
  item,
24540
- currentPath,
24553
+ activeHref,
24541
24554
  compact = false
24542
24555
  }) => {
24543
- const isActive = currentPath === item.href || currentPath.startsWith(item.href + "/");
24556
+ const hasChildren = !!item.children?.length;
24557
+ const childActive = hasChildren && item.children.some((child) => child.href === activeHref);
24558
+ const isActive = item.href === activeHref || childActive;
24559
+ const [open, setOpen] = React79.useState(childActive);
24544
24560
  const iconClassName = cn(
24545
24561
  "h-5 w-5",
24546
24562
  isActive ? "text-primary-foreground" : "text-muted-foreground"
24547
24563
  );
24548
24564
  if (compact) {
24565
+ if (hasChildren) {
24566
+ return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { className: "relative", children: [
24567
+ /* @__PURE__ */ jsxRuntime.jsx(
24568
+ exports.Button,
24569
+ {
24570
+ variant: "ghost",
24571
+ title: item.label,
24572
+ "aria-label": item.label,
24573
+ "aria-expanded": open,
24574
+ className: cn(
24575
+ "flex items-center justify-center w-full px-2 py-2 rounded-lg transition-colors",
24576
+ isActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24577
+ ),
24578
+ onClick: () => setOpen(!open),
24579
+ children: /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { as: "span", className: "relative inline-flex", children: [
24580
+ item.icon ? typeof item.icon === "string" ? /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: item.icon, className: iconClassName }) : /* @__PURE__ */ jsxRuntime.jsx(item.icon, { className: iconClassName }) : /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", className: "font-semibold", as: "span", children: item.label.charAt(0).toUpperCase() }),
24581
+ item.badge && /* @__PURE__ */ jsxRuntime.jsx(
24582
+ exports.Badge,
24583
+ {
24584
+ variant: isActive ? "primary" : "default",
24585
+ size: "sm",
24586
+ className: "absolute -top-2 -right-2 px-1 py-0 text-[10px] leading-4",
24587
+ children: item.badge
24588
+ }
24589
+ )
24590
+ ] })
24591
+ }
24592
+ ),
24593
+ open && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24594
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "fixed inset-0 z-20", onClick: () => setOpen(false) }),
24595
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "absolute left-full top-0 ml-2 w-48 bg-card dark:bg-card rounded-lg shadow-lg border border-border dark:border-border py-1 z-30", children: item.children.map((child) => {
24596
+ const childIsActive = child.href === activeHref;
24597
+ return /* @__PURE__ */ jsxRuntime.jsxs(
24598
+ reactRouterDom.Link,
24599
+ {
24600
+ to: child.href,
24601
+ onClick: () => setOpen(false),
24602
+ className: cn(
24603
+ "flex items-center gap-2 px-3 py-2 text-sm transition-colors",
24604
+ childIsActive ? "bg-muted text-foreground font-medium" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24605
+ ),
24606
+ children: [
24607
+ child.icon && (typeof child.icon === "string" ? /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: child.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(child.icon, { className: "h-4 w-4" })),
24608
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", className: "flex-1", as: "span", children: child.label }),
24609
+ child.badge && /* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: childIsActive ? "primary" : "default", size: "sm", children: child.badge })
24610
+ ]
24611
+ },
24612
+ child.href
24613
+ );
24614
+ }) })
24615
+ ] })
24616
+ ] });
24617
+ }
24549
24618
  return /* @__PURE__ */ jsxRuntime.jsx(
24550
24619
  reactRouterDom.Link,
24551
24620
  {
@@ -24571,6 +24640,78 @@ var init_DashboardLayout = __esm({
24571
24640
  }
24572
24641
  );
24573
24642
  }
24643
+ if (hasChildren) {
24644
+ return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { children: [
24645
+ /* @__PURE__ */ jsxRuntime.jsxs(
24646
+ exports.Button,
24647
+ {
24648
+ variant: "ghost",
24649
+ "aria-expanded": open,
24650
+ className: cn(
24651
+ "flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm font-medium transition-colors",
24652
+ isActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24653
+ ),
24654
+ onClick: () => setOpen(!open),
24655
+ children: [
24656
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: item.icon, className: iconClassName }) : /* @__PURE__ */ jsxRuntime.jsx(item.icon, { className: iconClassName })),
24657
+ /* @__PURE__ */ jsxRuntime.jsx(
24658
+ exports.Typography,
24659
+ {
24660
+ variant: "small",
24661
+ color: isActive ? "inherit" : "primary",
24662
+ className: "flex-1 text-left",
24663
+ as: "span",
24664
+ children: item.label
24665
+ }
24666
+ ),
24667
+ item.badge && /* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: isActive ? "primary" : "default", size: "sm", children: item.badge }),
24668
+ /* @__PURE__ */ jsxRuntime.jsx(
24669
+ exports.Icon,
24670
+ {
24671
+ name: "chevron-down",
24672
+ className: cn("h-4 w-4 shrink-0 transition-transform", open && "rotate-180")
24673
+ }
24674
+ )
24675
+ ]
24676
+ }
24677
+ ),
24678
+ open && /* @__PURE__ */ jsxRuntime.jsx(
24679
+ exports.VStack,
24680
+ {
24681
+ gap: "none",
24682
+ className: "mt-1 ml-4 pl-4 border-l border-border dark:border-border space-y-1",
24683
+ children: item.children.map((child) => {
24684
+ const childIsActive = child.href === activeHref;
24685
+ return /* @__PURE__ */ jsxRuntime.jsxs(
24686
+ reactRouterDom.Link,
24687
+ {
24688
+ to: child.href,
24689
+ className: cn(
24690
+ "flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",
24691
+ childIsActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24692
+ ),
24693
+ children: [
24694
+ child.icon && (typeof child.icon === "string" ? /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: child.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(child.icon, { className: "h-4 w-4" })),
24695
+ /* @__PURE__ */ jsxRuntime.jsx(
24696
+ exports.Typography,
24697
+ {
24698
+ variant: "small",
24699
+ color: childIsActive ? "inherit" : "primary",
24700
+ className: "flex-1",
24701
+ as: "span",
24702
+ children: child.label
24703
+ }
24704
+ ),
24705
+ child.badge && /* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: childIsActive ? "primary" : "default", size: "sm", children: child.badge })
24706
+ ]
24707
+ },
24708
+ child.href
24709
+ );
24710
+ })
24711
+ }
24712
+ )
24713
+ ] });
24714
+ }
24574
24715
  return /* @__PURE__ */ jsxRuntime.jsxs(
24575
24716
  reactRouterDom.Link,
24576
24717
  {
@@ -24599,9 +24740,63 @@ var init_DashboardLayout = __esm({
24599
24740
  NavLink.displayName = "NavLink";
24600
24741
  NavLinkTopnav = ({
24601
24742
  item,
24602
- currentPath
24743
+ activeHref
24603
24744
  }) => {
24604
- const isActive = currentPath === item.href || currentPath.startsWith(item.href + "/");
24745
+ const hasChildren = !!item.children?.length;
24746
+ const childActive = hasChildren && item.children.some((child) => child.href === activeHref);
24747
+ const isActive = item.href === activeHref || childActive;
24748
+ const [open, setOpen] = React79.useState(false);
24749
+ if (hasChildren) {
24750
+ return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { className: "relative", children: [
24751
+ /* @__PURE__ */ jsxRuntime.jsxs(
24752
+ exports.Button,
24753
+ {
24754
+ variant: "ghost",
24755
+ "aria-expanded": open,
24756
+ className: cn(
24757
+ "flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors whitespace-nowrap",
24758
+ isActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24759
+ ),
24760
+ onClick: () => setOpen(!open),
24761
+ children: [
24762
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: item.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(item.icon, { className: "h-4 w-4" })),
24763
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", color: "inherit", className: "flex-1", as: "span", children: item.label }),
24764
+ item.badge && /* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: isActive ? "primary" : "default", size: "sm", children: item.badge }),
24765
+ /* @__PURE__ */ jsxRuntime.jsx(
24766
+ exports.Icon,
24767
+ {
24768
+ name: "chevron-down",
24769
+ className: cn("h-3.5 w-3.5 shrink-0 transition-transform", open && "rotate-180")
24770
+ }
24771
+ )
24772
+ ]
24773
+ }
24774
+ ),
24775
+ open && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24776
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "fixed inset-0 z-20", onClick: () => setOpen(false) }),
24777
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "absolute left-0 top-full mt-1 w-48 bg-card dark:bg-card rounded-lg shadow-lg border border-border dark:border-border py-1 z-30", children: item.children.map((child) => {
24778
+ const childIsActive = child.href === activeHref;
24779
+ return /* @__PURE__ */ jsxRuntime.jsxs(
24780
+ reactRouterDom.Link,
24781
+ {
24782
+ to: child.href,
24783
+ onClick: () => setOpen(false),
24784
+ className: cn(
24785
+ "flex items-center gap-2 px-3 py-2 text-sm transition-colors",
24786
+ childIsActive ? "bg-muted text-foreground font-medium" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24787
+ ),
24788
+ children: [
24789
+ child.icon && (typeof child.icon === "string" ? /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: child.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(child.icon, { className: "h-4 w-4" })),
24790
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", className: "flex-1", as: "span", children: child.label }),
24791
+ child.badge && /* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: childIsActive ? "primary" : "default", size: "sm", children: child.badge })
24792
+ ]
24793
+ },
24794
+ child.href
24795
+ );
24796
+ }) })
24797
+ ] })
24798
+ ] });
24799
+ }
24605
24800
  return /* @__PURE__ */ jsxRuntime.jsxs(
24606
24801
  reactRouterDom.Link,
24607
24802
  {
@@ -24621,9 +24816,9 @@ var init_DashboardLayout = __esm({
24621
24816
  NavLinkTopnav.displayName = "NavLinkTopnav";
24622
24817
  NavLinkBottom = ({
24623
24818
  item,
24624
- currentPath
24819
+ activeHref
24625
24820
  }) => {
24626
- const isActive = currentPath === item.href || currentPath.startsWith(item.href + "/");
24821
+ const isActive = item.href === activeHref;
24627
24822
  const iconClassName = cn(
24628
24823
  "h-5 w-5",
24629
24824
  isActive ? "text-primary" : "text-muted-foreground"
@@ -24038,6 +24038,18 @@ var init_useAuthContext = __esm({
24038
24038
  "hooks/useAuthContext.ts"() {
24039
24039
  }
24040
24040
  });
24041
+ function resolveActiveNavHref(items, currentPath) {
24042
+ let best;
24043
+ for (const item of items) {
24044
+ for (const href of item.children?.length ? [item.href, ...item.children.map((c) => c.href)] : [item.href]) {
24045
+ if (currentPath === href) return href;
24046
+ if (currentPath.startsWith(href + "/") && (!best || href.length > best.length)) {
24047
+ best = href;
24048
+ }
24049
+ }
24050
+ }
24051
+ return best;
24052
+ }
24041
24053
  var DashboardLayout, NavLink, NavLinkTopnav, NavLinkBottom;
24042
24054
  var init_DashboardLayout = __esm({
24043
24055
  "components/core/templates/DashboardLayout.tsx"() {
@@ -24109,6 +24121,7 @@ var init_DashboardLayout = __esm({
24109
24121
  const location = useLocation();
24110
24122
  const ctxPagePath = useCurrentPagePath();
24111
24123
  const activePath = (currentPath || void 0) ?? ctxPagePath ?? location.pathname;
24124
+ const activeHref = useMemo(() => resolveActiveNavHref(navItems, activePath), [navItems, activePath]);
24112
24125
  const { user: authUser, signOut: authSignOut } = useAuthContext();
24113
24126
  const user = userProp || (authUser ? {
24114
24127
  name: authUser.displayName || authUser.email?.split("@")[0] || "User",
@@ -24205,7 +24218,7 @@ var init_DashboardLayout = __esm({
24205
24218
  NavLink,
24206
24219
  {
24207
24220
  item,
24208
- currentPath: activePath,
24221
+ activeHref,
24209
24222
  compact: isRail
24210
24223
  },
24211
24224
  item.href
@@ -24272,7 +24285,7 @@ var init_DashboardLayout = __esm({
24272
24285
  NavLinkTopnav,
24273
24286
  {
24274
24287
  item,
24275
- currentPath: activePath
24288
+ activeHref
24276
24289
  },
24277
24290
  item.href
24278
24291
  ))
@@ -24448,7 +24461,7 @@ var init_DashboardLayout = __esm({
24448
24461
  NavLinkBottom,
24449
24462
  {
24450
24463
  item,
24451
- currentPath: activePath
24464
+ activeHref
24452
24465
  },
24453
24466
  item.href
24454
24467
  )) })
@@ -24462,15 +24475,71 @@ var init_DashboardLayout = __esm({
24462
24475
  DashboardLayout.displayName = "DashboardLayout";
24463
24476
  NavLink = ({
24464
24477
  item,
24465
- currentPath,
24478
+ activeHref,
24466
24479
  compact = false
24467
24480
  }) => {
24468
- const isActive = currentPath === item.href || currentPath.startsWith(item.href + "/");
24481
+ const hasChildren = !!item.children?.length;
24482
+ const childActive = hasChildren && item.children.some((child) => child.href === activeHref);
24483
+ const isActive = item.href === activeHref || childActive;
24484
+ const [open, setOpen] = useState(childActive);
24469
24485
  const iconClassName = cn(
24470
24486
  "h-5 w-5",
24471
24487
  isActive ? "text-primary-foreground" : "text-muted-foreground"
24472
24488
  );
24473
24489
  if (compact) {
24490
+ if (hasChildren) {
24491
+ return /* @__PURE__ */ jsxs(Box, { className: "relative", children: [
24492
+ /* @__PURE__ */ jsx(
24493
+ Button,
24494
+ {
24495
+ variant: "ghost",
24496
+ title: item.label,
24497
+ "aria-label": item.label,
24498
+ "aria-expanded": open,
24499
+ className: cn(
24500
+ "flex items-center justify-center w-full px-2 py-2 rounded-lg transition-colors",
24501
+ isActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24502
+ ),
24503
+ onClick: () => setOpen(!open),
24504
+ children: /* @__PURE__ */ jsxs(Box, { as: "span", className: "relative inline-flex", children: [
24505
+ item.icon ? typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, className: iconClassName }) : /* @__PURE__ */ jsx(item.icon, { className: iconClassName }) : /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-semibold", as: "span", children: item.label.charAt(0).toUpperCase() }),
24506
+ item.badge && /* @__PURE__ */ jsx(
24507
+ Badge,
24508
+ {
24509
+ variant: isActive ? "primary" : "default",
24510
+ size: "sm",
24511
+ className: "absolute -top-2 -right-2 px-1 py-0 text-[10px] leading-4",
24512
+ children: item.badge
24513
+ }
24514
+ )
24515
+ ] })
24516
+ }
24517
+ ),
24518
+ open && /* @__PURE__ */ jsxs(Fragment, { children: [
24519
+ /* @__PURE__ */ jsx(Box, { className: "fixed inset-0 z-20", onClick: () => setOpen(false) }),
24520
+ /* @__PURE__ */ jsx(Box, { className: "absolute left-full top-0 ml-2 w-48 bg-card dark:bg-card rounded-lg shadow-lg border border-border dark:border-border py-1 z-30", children: item.children.map((child) => {
24521
+ const childIsActive = child.href === activeHref;
24522
+ return /* @__PURE__ */ jsxs(
24523
+ Link,
24524
+ {
24525
+ to: child.href,
24526
+ onClick: () => setOpen(false),
24527
+ className: cn(
24528
+ "flex items-center gap-2 px-3 py-2 text-sm transition-colors",
24529
+ childIsActive ? "bg-muted text-foreground font-medium" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24530
+ ),
24531
+ children: [
24532
+ child.icon && (typeof child.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: child.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsx(child.icon, { className: "h-4 w-4" })),
24533
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "flex-1", as: "span", children: child.label }),
24534
+ child.badge && /* @__PURE__ */ jsx(Badge, { variant: childIsActive ? "primary" : "default", size: "sm", children: child.badge })
24535
+ ]
24536
+ },
24537
+ child.href
24538
+ );
24539
+ }) })
24540
+ ] })
24541
+ ] });
24542
+ }
24474
24543
  return /* @__PURE__ */ jsx(
24475
24544
  Link,
24476
24545
  {
@@ -24496,6 +24565,78 @@ var init_DashboardLayout = __esm({
24496
24565
  }
24497
24566
  );
24498
24567
  }
24568
+ if (hasChildren) {
24569
+ return /* @__PURE__ */ jsxs(Box, { children: [
24570
+ /* @__PURE__ */ jsxs(
24571
+ Button,
24572
+ {
24573
+ variant: "ghost",
24574
+ "aria-expanded": open,
24575
+ className: cn(
24576
+ "flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm font-medium transition-colors",
24577
+ isActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24578
+ ),
24579
+ onClick: () => setOpen(!open),
24580
+ children: [
24581
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, className: iconClassName }) : /* @__PURE__ */ jsx(item.icon, { className: iconClassName })),
24582
+ /* @__PURE__ */ jsx(
24583
+ Typography,
24584
+ {
24585
+ variant: "small",
24586
+ color: isActive ? "inherit" : "primary",
24587
+ className: "flex-1 text-left",
24588
+ as: "span",
24589
+ children: item.label
24590
+ }
24591
+ ),
24592
+ item.badge && /* @__PURE__ */ jsx(Badge, { variant: isActive ? "primary" : "default", size: "sm", children: item.badge }),
24593
+ /* @__PURE__ */ jsx(
24594
+ Icon,
24595
+ {
24596
+ name: "chevron-down",
24597
+ className: cn("h-4 w-4 shrink-0 transition-transform", open && "rotate-180")
24598
+ }
24599
+ )
24600
+ ]
24601
+ }
24602
+ ),
24603
+ open && /* @__PURE__ */ jsx(
24604
+ VStack,
24605
+ {
24606
+ gap: "none",
24607
+ className: "mt-1 ml-4 pl-4 border-l border-border dark:border-border space-y-1",
24608
+ children: item.children.map((child) => {
24609
+ const childIsActive = child.href === activeHref;
24610
+ return /* @__PURE__ */ jsxs(
24611
+ Link,
24612
+ {
24613
+ to: child.href,
24614
+ className: cn(
24615
+ "flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",
24616
+ childIsActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24617
+ ),
24618
+ children: [
24619
+ child.icon && (typeof child.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: child.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsx(child.icon, { className: "h-4 w-4" })),
24620
+ /* @__PURE__ */ jsx(
24621
+ Typography,
24622
+ {
24623
+ variant: "small",
24624
+ color: childIsActive ? "inherit" : "primary",
24625
+ className: "flex-1",
24626
+ as: "span",
24627
+ children: child.label
24628
+ }
24629
+ ),
24630
+ child.badge && /* @__PURE__ */ jsx(Badge, { variant: childIsActive ? "primary" : "default", size: "sm", children: child.badge })
24631
+ ]
24632
+ },
24633
+ child.href
24634
+ );
24635
+ })
24636
+ }
24637
+ )
24638
+ ] });
24639
+ }
24499
24640
  return /* @__PURE__ */ jsxs(
24500
24641
  Link,
24501
24642
  {
@@ -24524,9 +24665,63 @@ var init_DashboardLayout = __esm({
24524
24665
  NavLink.displayName = "NavLink";
24525
24666
  NavLinkTopnav = ({
24526
24667
  item,
24527
- currentPath
24668
+ activeHref
24528
24669
  }) => {
24529
- const isActive = currentPath === item.href || currentPath.startsWith(item.href + "/");
24670
+ const hasChildren = !!item.children?.length;
24671
+ const childActive = hasChildren && item.children.some((child) => child.href === activeHref);
24672
+ const isActive = item.href === activeHref || childActive;
24673
+ const [open, setOpen] = useState(false);
24674
+ if (hasChildren) {
24675
+ return /* @__PURE__ */ jsxs(Box, { className: "relative", children: [
24676
+ /* @__PURE__ */ jsxs(
24677
+ Button,
24678
+ {
24679
+ variant: "ghost",
24680
+ "aria-expanded": open,
24681
+ className: cn(
24682
+ "flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors whitespace-nowrap",
24683
+ isActive ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24684
+ ),
24685
+ onClick: () => setOpen(!open),
24686
+ children: [
24687
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsx(item.icon, { className: "h-4 w-4" })),
24688
+ /* @__PURE__ */ jsx(Typography, { variant: "small", color: "inherit", className: "flex-1", as: "span", children: item.label }),
24689
+ item.badge && /* @__PURE__ */ jsx(Badge, { variant: isActive ? "primary" : "default", size: "sm", children: item.badge }),
24690
+ /* @__PURE__ */ jsx(
24691
+ Icon,
24692
+ {
24693
+ name: "chevron-down",
24694
+ className: cn("h-3.5 w-3.5 shrink-0 transition-transform", open && "rotate-180")
24695
+ }
24696
+ )
24697
+ ]
24698
+ }
24699
+ ),
24700
+ open && /* @__PURE__ */ jsxs(Fragment, { children: [
24701
+ /* @__PURE__ */ jsx(Box, { className: "fixed inset-0 z-20", onClick: () => setOpen(false) }),
24702
+ /* @__PURE__ */ jsx(Box, { className: "absolute left-0 top-full mt-1 w-48 bg-card dark:bg-card rounded-lg shadow-lg border border-border dark:border-border py-1 z-30", children: item.children.map((child) => {
24703
+ const childIsActive = child.href === activeHref;
24704
+ return /* @__PURE__ */ jsxs(
24705
+ Link,
24706
+ {
24707
+ to: child.href,
24708
+ onClick: () => setOpen(false),
24709
+ className: cn(
24710
+ "flex items-center gap-2 px-3 py-2 text-sm transition-colors",
24711
+ childIsActive ? "bg-muted text-foreground font-medium" : "text-muted-foreground hover:bg-muted hover:text-foreground"
24712
+ ),
24713
+ children: [
24714
+ child.icon && (typeof child.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: child.icon, className: "h-4 w-4" }) : /* @__PURE__ */ jsx(child.icon, { className: "h-4 w-4" })),
24715
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "flex-1", as: "span", children: child.label }),
24716
+ child.badge && /* @__PURE__ */ jsx(Badge, { variant: childIsActive ? "primary" : "default", size: "sm", children: child.badge })
24717
+ ]
24718
+ },
24719
+ child.href
24720
+ );
24721
+ }) })
24722
+ ] })
24723
+ ] });
24724
+ }
24530
24725
  return /* @__PURE__ */ jsxs(
24531
24726
  Link,
24532
24727
  {
@@ -24546,9 +24741,9 @@ var init_DashboardLayout = __esm({
24546
24741
  NavLinkTopnav.displayName = "NavLinkTopnav";
24547
24742
  NavLinkBottom = ({
24548
24743
  item,
24549
- currentPath
24744
+ activeHref
24550
24745
  }) => {
24551
- const isActive = currentPath === item.href || currentPath.startsWith(item.href + "/");
24746
+ const isActive = item.href === activeHref;
24552
24747
  const iconClassName = cn(
24553
24748
  "h-5 w-5",
24554
24749
  isActive ? "text-primary" : "text-muted-foreground"