@pattern-stack/frontend-patterns 0.2.0-alpha.14 → 0.2.0-alpha.16

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 CHANGED
@@ -10693,7 +10693,11 @@ const SidebarButton = ({
10693
10693
  }
10694
10694
  );
10695
10695
  };
10696
- const Sidebar = ({ className, footer }) => {
10696
+ const Sidebar = ({
10697
+ className,
10698
+ footer,
10699
+ topOffset = "header"
10700
+ }) => {
10697
10701
  const { isExpanded, toggleSidebar } = useSidebar();
10698
10702
  const { navigation } = useNavigation();
10699
10703
  const location = reactRouterDom.useLocation();
@@ -10713,9 +10717,9 @@ const Sidebar = ({ className, footer }) => {
10713
10717
  "aside",
10714
10718
  {
10715
10719
  className: cn(
10716
- "fixed left-0 top-16 flex flex-col bg-background border-r border-border z-40",
10720
+ "fixed left-0 flex flex-col bg-background border-r border-border z-40",
10717
10721
  "transition-all duration-300 ease-in-out",
10718
- "h-[calc(100vh-4rem)]",
10722
+ topOffset === "none" ? "top-0 h-screen" : "top-16 h-[calc(100vh-4rem)]",
10719
10723
  // Full height minus header (4rem = 64px)
10720
10724
  !isExpanded ? "w-16" : "w-64",
10721
10725
  className
@@ -10723,23 +10727,43 @@ const Sidebar = ({ className, footer }) => {
10723
10727
  "data-component-name": "Sidebar",
10724
10728
  "data-collapsed": !isExpanded,
10725
10729
  children: [
10726
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center p-3 pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
10727
- "button",
10730
+ /* @__PURE__ */ jsxRuntime.jsxs(
10731
+ "div",
10728
10732
  {
10729
- onClick: toggleSidebar,
10730
10733
  className: cn(
10731
- "w-7 h-7 rounded-md",
10732
- "bg-muted/50 text-muted-foreground",
10733
- "flex items-center justify-center",
10734
- "hover:bg-muted hover:text-foreground",
10735
- "active:scale-95",
10736
- "transition-all duration-150 ease-out"
10734
+ "flex items-center p-3 pt-4",
10735
+ isExpanded ? "justify-between gap-2" : "justify-center"
10737
10736
  ),
10738
- "data-component-name": "SidebarToggle",
10739
- title: !isExpanded ? "Expand sidebar" : "Collapse sidebar",
10740
- children: !isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-3.5 h-3.5" })
10737
+ "data-component-name": "SidebarHeader",
10738
+ children: [
10739
+ isExpanded && (navigation == null ? void 0 : navigation.logo) != null && /* @__PURE__ */ jsxRuntime.jsx(
10740
+ "div",
10741
+ {
10742
+ className: "flex-1 min-w-0 flex items-center",
10743
+ "data-component-name": "SidebarLogo",
10744
+ children: typeof navigation.logo === "string" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-foreground truncate", children: navigation.logo }) : navigation.logo
10745
+ }
10746
+ ),
10747
+ /* @__PURE__ */ jsxRuntime.jsx(
10748
+ "button",
10749
+ {
10750
+ onClick: toggleSidebar,
10751
+ className: cn(
10752
+ "w-7 h-7 rounded-md shrink-0",
10753
+ "bg-muted/50 text-muted-foreground",
10754
+ "flex items-center justify-center",
10755
+ "hover:bg-muted hover:text-foreground",
10756
+ "active:scale-95",
10757
+ "transition-all duration-150 ease-out"
10758
+ ),
10759
+ "data-component-name": "SidebarToggle",
10760
+ title: !isExpanded ? "Expand sidebar" : "Collapse sidebar",
10761
+ children: !isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-3.5 h-3.5" })
10762
+ }
10763
+ )
10764
+ ]
10741
10765
  }
10742
- ) }),
10766
+ ),
10743
10767
  /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "flex-1 p-3 space-y-2", "data-component-name": "SidebarNav", children: items.map((item) => {
10744
10768
  const [itemBasePath, itemQuery] = item.path.split("?");
10745
10769
  const currentPath = location.pathname;
@@ -10842,7 +10866,13 @@ const AppLayout = ({ header, sidebar } = {}) => {
10842
10866
  const hideHeader = header === false;
10843
10867
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-background", children: [
10844
10868
  !hideHeader && /* @__PURE__ */ jsxRuntime.jsx(AppHeader, { ...header ?? {} }),
10845
- /* @__PURE__ */ jsxRuntime.jsx(Sidebar, { footer: sidebar == null ? void 0 : sidebar.footer }),
10869
+ /* @__PURE__ */ jsxRuntime.jsx(
10870
+ Sidebar,
10871
+ {
10872
+ footer: sidebar == null ? void 0 : sidebar.footer,
10873
+ topOffset: hideHeader ? "none" : "header"
10874
+ }
10875
+ ),
10846
10876
  /* @__PURE__ */ jsxRuntime.jsx(
10847
10877
  "main",
10848
10878
  {