@opencosmos/ui 1.3.3 → 1.3.5

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
@@ -10723,13 +10723,13 @@ var DEFAULT_CONTEXT = {
10723
10723
  function useAppSidebar() {
10724
10724
  return useContext9(AppSidebarContext) ?? DEFAULT_CONTEXT;
10725
10725
  }
10726
- function AppSidebarProvider({ children, defaultOpen = true }) {
10726
+ function AppSidebarProvider({ children, defaultOpen = true, storageKey = STORAGE_KEY }) {
10727
10727
  const [isOpen, setIsOpen] = useState17(defaultOpen);
10728
10728
  useEffect11(() => {
10729
- const stored = localStorage.getItem(STORAGE_KEY);
10729
+ const stored = localStorage.getItem(storageKey);
10730
10730
  if (stored !== null) setIsOpen(stored === "true");
10731
- }, []);
10732
- const persist3 = (value) => localStorage.setItem(STORAGE_KEY, String(value));
10731
+ }, [storageKey]);
10732
+ const persist3 = (value) => localStorage.setItem(storageKey, String(value));
10733
10733
  const toggle = () => setIsOpen((prev) => {
10734
10734
  const next = !prev;
10735
10735
  persist3(next);
@@ -10768,6 +10768,7 @@ function AppSidebar({
10768
10768
  logo,
10769
10769
  title,
10770
10770
  items = [],
10771
+ bottomItems = [],
10771
10772
  children,
10772
10773
  footer,
10773
10774
  className
@@ -10882,6 +10883,40 @@ function AppSidebar({
10882
10883
  children
10883
10884
  }
10884
10885
  ),
10886
+ bottomItems.length > 0 && /* @__PURE__ */ jsx89("nav", { className: "px-2 py-2 space-y-1 shrink-0 border-t border-foreground/8", "aria-label": "Bottom navigation", children: bottomItems.map((item) => /* @__PURE__ */ jsxs56(
10887
+ "a",
10888
+ {
10889
+ href: item.href,
10890
+ target: item.external ? "_blank" : void 0,
10891
+ rel: item.external ? "noopener noreferrer" : void 0,
10892
+ title: !isOpen ? item.label : void 0,
10893
+ "aria-label": !isOpen ? item.label : void 0,
10894
+ className: cn(
10895
+ "flex items-center rounded-lg transition-colors duration-150",
10896
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus)]",
10897
+ isOpen ? "gap-3 px-3 py-3" : "justify-center w-9 h-9 mx-auto",
10898
+ item.active ? "bg-foreground/8 text-foreground font-medium" : "text-[var(--color-text-secondary)] hover:bg-foreground/5 hover:text-[var(--color-text-primary)]"
10899
+ ),
10900
+ children: [
10901
+ /* @__PURE__ */ jsx89("span", { className: "shrink-0 flex items-center justify-center w-4 h-4", children: item.icon }),
10902
+ /* @__PURE__ */ jsx89(
10903
+ "span",
10904
+ {
10905
+ className: "text-sm whitespace-nowrap",
10906
+ style: {
10907
+ opacity: isOpen ? 1 : 0,
10908
+ width: isOpen ? "auto" : 0,
10909
+ overflow: "hidden",
10910
+ pointerEvents: isOpen ? "auto" : "none",
10911
+ transition: shouldAnimate ? `opacity ${Math.round(duration * 0.55)}ms ease-out` : "none"
10912
+ },
10913
+ children: item.label
10914
+ }
10915
+ )
10916
+ ]
10917
+ },
10918
+ item.label
10919
+ )) }),
10885
10920
  footer && /* @__PURE__ */ jsx89(
10886
10921
  "div",
10887
10922
  {