@wealthx/shadcn 1.5.33 → 1.5.35

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.
@@ -9,7 +9,7 @@ import {
9
9
  ConversationStatusChip,
10
10
  ConversationsPage,
11
11
  LeadInfoPanel
12
- } from "../../../chunk-EEI4FLEE.mjs";
12
+ } from "../../../chunk-WLELT6L7.mjs";
13
13
  import "../../../chunk-3S6KVFF5.mjs";
14
14
  import "../../../chunk-WE4YKBDE.mjs";
15
15
  import "../../../chunk-T5FRVEJQ.mjs";
@@ -559,42 +559,53 @@ function CollapsibleNavItem({
559
559
  function SidebarNav({
560
560
  items,
561
561
  userName = "Anonymous User",
562
- collapsed = false,
563
562
  logo,
564
563
  logoCollapsed,
565
564
  metricsGroups,
566
565
  onNavigate,
567
566
  onLogout,
568
- onCollapsedChange,
567
+ defaultLocked = false,
568
+ onLockedChange,
569
569
  className
570
570
  }) {
571
+ const [isLocked, setIsLocked] = React3.useState(defaultLocked);
572
+ const [isHovered, setIsHovered] = React3.useState(false);
573
+ const isExpanded = isLocked || isHovered;
571
574
  const [userMenuOpen, setUserMenuOpen] = React3.useState(false);
572
575
  const navScrollRef = React3.useRef(null);
573
576
  const expandedScrollRef = React3.useRef(0);
577
+ const handleLockToggle = () => {
578
+ const next = !isLocked;
579
+ setIsLocked(next);
580
+ onLockedChange == null ? void 0 : onLockedChange(next);
581
+ };
574
582
  React3.useEffect(() => {
575
- if (collapsed) setUserMenuOpen(false);
576
- }, [collapsed]);
583
+ if (!isExpanded) setUserMenuOpen(false);
584
+ }, [isExpanded]);
577
585
  React3.useLayoutEffect(() => {
578
586
  const nav = navScrollRef.current;
579
587
  if (!nav) return;
580
- if (!collapsed) {
588
+ if (isExpanded) {
581
589
  nav.scrollTop = expandedScrollRef.current;
582
590
  }
583
591
  return () => {
584
- if (!collapsed && nav) {
592
+ if (isExpanded && nav) {
585
593
  expandedScrollRef.current = nav.scrollTop;
586
594
  }
587
595
  };
588
- }, [collapsed]);
596
+ }, [isExpanded]);
589
597
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
590
598
  "nav",
591
599
  {
592
600
  "data-slot": "sidebar-nav",
593
- "data-collapsed": collapsed,
601
+ "data-expanded": isExpanded,
602
+ "data-locked": isLocked,
603
+ onMouseEnter: () => setIsHovered(true),
604
+ onMouseLeave: () => setIsHovered(false),
594
605
  className: cn(
595
606
  "flex h-full flex-col bg-brand-secondary text-brand-secondary-foreground",
596
607
  "transition-all duration-200 ease-in-out",
597
- collapsed ? "w-14" : "w-[279px]",
608
+ isExpanded ? "w-[279px]" : "w-14",
598
609
  className
599
610
  ),
600
611
  children: [
@@ -606,7 +617,7 @@ function SidebarNav({
606
617
  alt: "Logo",
607
618
  className: cn(
608
619
  "h-8 w-auto object-contain object-left px-5 transition-opacity duration-200",
609
- collapsed ? "opacity-0" : "opacity-100"
620
+ !isExpanded ? "opacity-0" : "opacity-100"
610
621
  )
611
622
  }
612
623
  ),
@@ -617,7 +628,7 @@ function SidebarNav({
617
628
  alt: "Logo",
618
629
  className: cn(
619
630
  "absolute inset-y-0 left-0 right-0 m-auto h-8 w-8 object-contain transition-opacity duration-200",
620
- collapsed ? "opacity-100" : "opacity-0"
631
+ !isExpanded ? "opacity-100" : "opacity-0"
621
632
  )
622
633
  }
623
634
  )
@@ -627,7 +638,7 @@ function SidebarNav({
627
638
  "div",
628
639
  {
629
640
  className: cn(
630
- collapsed ? "opacity-0 pointer-events-none" : "opacity-100"
641
+ !isExpanded ? "opacity-0 pointer-events-none" : "opacity-100"
631
642
  ),
632
643
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
633
644
  Accordion,
@@ -684,12 +695,12 @@ function SidebarNav({
684
695
  )
685
696
  }
686
697
  ),
687
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NavTooltip, { label: userName, collapsed, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
698
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NavTooltip, { label: userName, collapsed: !isExpanded, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
688
699
  "div",
689
700
  {
690
701
  className: cn(
691
702
  "absolute inset-0 flex items-center justify-center transition-opacity duration-200",
692
- collapsed ? "opacity-100" : "opacity-0 pointer-events-none"
703
+ !isExpanded ? "opacity-100" : "opacity-0 pointer-events-none"
693
704
  ),
694
705
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center font-semibold text-xs bg-primary text-primary-foreground", children: getInitials(userName) })
695
706
  }
@@ -698,7 +709,7 @@ function SidebarNav({
698
709
  !!(metricsGroups == null ? void 0 : metricsGroups.length) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
699
710
  Accordion,
700
711
  {
701
- value: !collapsed ? ["metrics"] : [],
712
+ value: isExpanded ? ["metrics"] : [],
702
713
  onValueChange: () => {
703
714
  },
704
715
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AccordionItem, { className: "border-none", value: "metrics", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AccordionContent, { className: "p-0 text-inherit", children: metricsGroups.map((group, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MetricsGroup, { group }, i)) }) })
@@ -709,7 +720,7 @@ function SidebarNav({
709
720
  CollapsibleNavItem,
710
721
  {
711
722
  item,
712
- collapsed,
723
+ collapsed: !isExpanded,
713
724
  onNavigate
714
725
  },
715
726
  item.href
@@ -717,45 +728,39 @@ function SidebarNav({
717
728
  SidebarNavItemView,
718
729
  {
719
730
  item,
720
- collapsed,
731
+ collapsed: !isExpanded,
721
732
  onNavigate
722
733
  },
723
734
  item.href
724
735
  )
725
736
  ) }),
726
- onCollapsedChange && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mt-auto border-t border-white/15 bg-white/8", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
737
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mt-auto border-t border-white/15 bg-white/10", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
727
738
  NavTooltip,
728
739
  {
729
- label: collapsed ? "Expand" : "Collapse",
730
- collapsed,
740
+ label: isLocked ? "Unpin sidebar" : "Pin sidebar open",
741
+ collapsed: !isExpanded,
731
742
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
732
743
  Button,
733
744
  {
734
745
  type: "button",
735
746
  variant: "ghost",
736
- onClick: () => onCollapsedChange(!collapsed),
747
+ onClick: handleLockToggle,
737
748
  className: cn(
738
- "h-12 w-full justify-start gap-3 px-3 py-3 transition-colors",
749
+ "h-12 w-full items-center gap-3 py-3 transition-colors",
739
750
  "text-brand-secondary-foreground/80 hover:bg-white/10 hover:text-brand-secondary-foreground",
740
- collapsed && "justify-center px-2"
751
+ isExpanded ? "justify-start px-3" : "justify-center px-2",
752
+ isLocked && "text-primary"
741
753
  ),
742
754
  children: [
743
- collapsed ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
744
- import_lucide_react3.PanelLeftOpen,
745
- {
746
- size: 24,
747
- strokeWidth: 1.75,
748
- className: "shrink-0"
749
- }
750
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
751
- import_lucide_react3.PanelLeftClose,
755
+ isLocked ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Pin, { size: 24, strokeWidth: 1.75, className: "shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
756
+ import_lucide_react3.PinOff,
752
757
  {
753
758
  size: 24,
754
759
  strokeWidth: 1.75,
755
- className: "shrink-0"
760
+ className: "shrink-0 opacity-60"
756
761
  }
757
762
  ),
758
- !collapsed && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm", children: "Collapse" })
763
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm", children: isLocked ? "Pinned" : "Pin sidebar" })
759
764
  ]
760
765
  }
761
766
  )
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SidebarNav
3
- } from "../../chunk-RSEVIQEO.mjs";
3
+ } from "../../chunk-E432NK23.mjs";
4
4
  import "../../chunk-3S6KVFF5.mjs";
5
5
  import "../../chunk-XYSRRDBH.mjs";
6
6
  import "../../chunk-FRCTOAKZ.mjs";