@geomak/ui 1.3.0 → 1.4.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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { colors_default } from './chunk-DNQSZOYD.js';
2
- export { colors_default as COLORS, PALETTE as palette, semanticTokens, vars } from './chunk-DNQSZOYD.js';
1
+ import { colors_default } from './chunk-OSWZRIGC.js';
2
+ export { colors_default as COLORS, PALETTE as palette, semanticTokens, vars } from './chunk-OSWZRIGC.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import React9, { createContext, useMemo, useState, useEffect, useContext, useRef, useCallback, useId } from 'react';
5
5
  import * as Dialog from '@radix-ui/react-dialog';
@@ -435,23 +435,49 @@ function Drawer({
435
435
  ) }) })
436
436
  ] }) });
437
437
  }
438
+ var ANIMATION = {
439
+ top: "data-[state=delayed-open]:animate-tooltip-in-top",
440
+ bottom: "data-[state=delayed-open]:animate-tooltip-in-bottom",
441
+ left: "data-[state=delayed-open]:animate-tooltip-in-left",
442
+ right: "data-[state=delayed-open]:animate-tooltip-in-right"
443
+ };
438
444
  function Tooltip({
439
445
  children,
440
446
  title,
441
- placement = "left",
442
- delayDuration = 400
447
+ placement = "top",
448
+ delayDuration = 300,
449
+ sideOffset = 8
443
450
  }) {
444
451
  return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { delayDuration, children: /* @__PURE__ */ jsxs(TooltipPrimitive.Root, { children: [
445
- /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "h-max w-max", children }) }),
452
+ /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children }) }),
446
453
  /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
447
454
  TooltipPrimitive.Content,
448
455
  {
449
456
  side: placement,
450
- sideOffset: 8,
451
- className: "pointer-events-none z-[500000000] rounded-lg bg-prussian-blue dark:bg-rich-black-fogra px-2 py-1.5 text-white text-sm w-max max-w-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
457
+ sideOffset,
458
+ className: [
459
+ // Layout + typography
460
+ "pointer-events-none z-[500000] max-w-[220px] px-2.5 py-1.5",
461
+ "text-xs font-medium leading-snug text-white",
462
+ // Background + border — slightly translucent for depth
463
+ "bg-foreground/95 rounded-md border border-white/5",
464
+ // Shadow
465
+ "shadow-md",
466
+ // Out animation (always the same — just fade)
467
+ "data-[state=closed]:animate-tooltip-out",
468
+ // In animation — direction-aware
469
+ ANIMATION[placement]
470
+ ].join(" "),
452
471
  children: [
453
472
  title,
454
- /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "fill-prussian-blue dark:fill-rich-black-fogra" })
473
+ /* @__PURE__ */ jsx(
474
+ TooltipPrimitive.Arrow,
475
+ {
476
+ width: 10,
477
+ height: 5,
478
+ className: "fill-foreground/95"
479
+ }
480
+ )
455
481
  ]
456
482
  }
457
483
  ) })
@@ -709,44 +735,74 @@ var TYPE_BG = {
709
735
  warning: "bg-status-warning",
710
736
  danger: "bg-status-error"
711
737
  };
738
+ var VIEWPORT_CLASSES = {
739
+ "top-right": "fixed top-14 right-0 flex flex-col items-end",
740
+ "top-left": "fixed top-14 left-0 flex flex-col items-start",
741
+ "top-center": "fixed top-14 left-1/2 flex flex-col items-center -translate-x-1/2",
742
+ "bottom-right": "fixed bottom-4 right-0 flex flex-col-reverse items-end",
743
+ "bottom-left": "fixed bottom-4 left-0 flex flex-col-reverse items-start",
744
+ "bottom-center": "fixed bottom-4 left-1/2 flex flex-col-reverse items-center -translate-x-1/2"
745
+ };
746
+ function getInitialMotion(pos, reduced) {
747
+ if (reduced) return { opacity: 0, x: 0, y: 0, scale: 1 };
748
+ const right = pos.endsWith("right");
749
+ const left = pos.endsWith("left");
750
+ const center = pos.endsWith("center");
751
+ const bottom = pos.startsWith("bottom");
752
+ return {
753
+ opacity: 0,
754
+ x: right ? 40 : left ? -40 : 0,
755
+ y: center ? bottom ? 12 : -12 : 0,
756
+ scale: center ? 0.96 : 1
757
+ };
758
+ }
712
759
  function TypeIcon({ type }) {
713
760
  if (type === "success") {
714
- return /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
715
- "path",
716
- {
717
- fillRule: "evenodd",
718
- clipRule: "evenodd",
719
- d: "M14 0.25C6.40625 0.25 0.25 6.40625 0.25 14C0.25 21.5937 6.40625 27.75 14 27.75C21.5937 27.75 27.75 21.5937 27.75 14C27.75 6.40625 21.5937 0.25 14 0.25ZM19.96 11.675C20.0697 11.5496 20.1533 11.4034 20.2057 11.2452C20.2582 11.087 20.2784 10.9199 20.2653 10.7537C20.2522 10.5876 20.206 10.4257 20.1295 10.2777C20.0529 10.1296 19.9475 9.99838 19.8194 9.89168C19.6914 9.78497 19.5433 9.70495 19.3839 9.65633C19.2244 9.6077 19.0569 9.59145 18.8911 9.60853C18.7253 9.62562 18.5646 9.67568 18.4184 9.75579C18.2723 9.8359 18.1436 9.94443 18.04 10.075L12.665 16.5237L9.88375 13.7412C9.648 13.5136 9.33224 13.3876 9.0045 13.3904C8.67675 13.3933 8.36324 13.5247 8.13148 13.7565C7.89972 13.9882 7.76825 14.3018 7.76541 14.6295C7.76256 14.9572 7.88855 15.273 8.11625 15.5087L11.8662 19.2587C11.9891 19.3815 12.1361 19.4773 12.298 19.5401C12.4599 19.6028 12.6331 19.6312 12.8066 19.6233C12.98 19.6154 13.15 19.5715 13.3055 19.4943C13.4611 19.4171 13.5988 19.3084 13.71 19.175L19.96 11.675Z",
720
- fill: "#fff"
721
- }
722
- ) });
761
+ return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) });
723
762
  }
724
763
  if (type === "info") {
725
- return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#fff", className: "w-5 h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 01.67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 11-.671-1.34l.041-.022zM12 9a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" }) });
764
+ return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
765
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
766
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
767
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
768
+ ] });
726
769
  }
727
770
  if (type === "warning") {
728
- return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#fff", className: "w-5 h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" }) });
771
+ return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
772
+ /* @__PURE__ */ jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }),
773
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
774
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
775
+ ] });
729
776
  }
730
- return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#fff", className: "w-5 h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm11.378-3.917c-.89-.777-2.366-.777-3.255 0a.75.75 0 01-.988-1.129c1.454-1.272 3.776-1.272 5.23 0 1.513 1.324 1.513 3.518 0 4.842a3.75 3.75 0 01-.837.552c-.676.328-1.028.774-1.028 1.152v.75a.75.75 0 01-1.5 0v-.75c0-1.279 1.06-2.107 1.875-2.502.182-.088.351-.199.503-.331.83-.727.83-1.857 0-2.584zM12 18a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" }) });
777
+ return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
778
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
779
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
780
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
781
+ ] });
731
782
  }
732
783
  function NotificationItem({
733
784
  n,
785
+ pos,
734
786
  onClose,
735
787
  reduced
736
788
  }) {
789
+ const initial = getInitialMotion(pos, reduced);
790
+ const center = pos.endsWith("center");
737
791
  return /* @__PURE__ */ jsx(
738
792
  motion.div,
739
793
  {
740
794
  layout: true,
741
- initial: { opacity: 0, x: reduced ? 0 : 56, scale: reduced ? 0.97 : 1 },
742
- animate: { opacity: 1, x: 0, scale: 1 },
743
- exit: { opacity: 0, x: reduced ? 0 : 40, scale: reduced ? 0.97 : 1 },
795
+ initial,
796
+ animate: { opacity: 1, x: 0, y: 0, scale: 1 },
797
+ exit: { ...initial, opacity: 0 },
744
798
  transition: reduced ? { duration: 0 } : {
745
- opacity: { duration: 0.15 },
799
+ opacity: { duration: 0.14 },
746
800
  x: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
747
- layout: { duration: 0.2 }
801
+ y: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
802
+ scale: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
803
+ layout: { duration: 0.18 }
748
804
  },
749
- children: /* @__PURE__ */ jsxs(
805
+ children: /* @__PURE__ */ jsx(
750
806
  Toast.Root,
751
807
  {
752
808
  open: true,
@@ -755,32 +811,36 @@ function NotificationItem({
755
811
  if (!o) onClose(n.id);
756
812
  },
757
813
  className: [
758
- "rounded-xl shadow-md p-3 w-[300px] text-white",
759
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60",
814
+ "w-[300px] rounded-md shadow-lg overflow-hidden",
815
+ center ? "mx-auto" : "",
816
+ "focus:outline-none",
760
817
  TYPE_BG[n.type ?? "info"]
761
818
  ].join(" "),
762
- children: [
763
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
764
- /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(TypeIcon, { type: n.type ?? "info" }) }),
765
- /* @__PURE__ */ jsx(Toast.Title, { className: "font-semibold text-sm leading-snug flex-1", children: n.title }),
766
- /* @__PURE__ */ jsx(Toast.Action, { asChild: true, altText: "Close", children: /* @__PURE__ */ jsx(
767
- "button",
768
- {
769
- "aria-label": "Close notification",
770
- onClick: () => onClose(n.id),
771
- className: "flex-shrink-0 rounded-md p-1 hover:bg-white/20 transition-colors duration-150 focus:outline-none focus-visible:ring-1 focus-visible:ring-white/60",
772
- children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
773
- }
774
- ) })
819
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-3 pr-2.5", children: [
820
+ /* @__PURE__ */ jsx("span", { className: "mt-0.5 flex-shrink-0 text-white/90", children: /* @__PURE__ */ jsx(TypeIcon, { type: n.type ?? "info" }) }),
821
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
822
+ /* @__PURE__ */ jsx(Toast.Title, { className: "text-sm font-semibold text-white leading-snug", children: n.title }),
823
+ n.description && /* @__PURE__ */ jsx(Toast.Description, { className: "mt-0.5 text-xs text-white/75 leading-relaxed", children: n.description })
775
824
  ] }),
776
- n.description && /* @__PURE__ */ jsx(Toast.Description, { className: "mt-1.5 text-xs text-white/80 leading-relaxed pl-7", children: n.description })
777
- ]
825
+ /* @__PURE__ */ jsx(Toast.Action, { asChild: true, altText: "Close", children: /* @__PURE__ */ jsx(
826
+ "button",
827
+ {
828
+ "aria-label": "Close",
829
+ onClick: () => onClose(n.id),
830
+ className: "flex-shrink-0 mt-0.5 rounded p-1 text-white/60 hover:text-white hover:bg-white/15 transition-colors duration-100 focus:outline-none focus-visible:ring-1 focus-visible:ring-white/50",
831
+ children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) })
832
+ }
833
+ ) })
834
+ ] })
778
835
  }
779
836
  )
780
837
  }
781
838
  );
782
839
  }
783
- function NotificationProvider({ children }) {
840
+ function NotificationProvider({
841
+ children,
842
+ position = "top-right"
843
+ }) {
784
844
  const [notifications, setNotifications] = useState([]);
785
845
  const reduced = useReducedMotion();
786
846
  const open = (payload) => {
@@ -792,17 +852,21 @@ function NotificationProvider({ children }) {
792
852
  const close = (id) => {
793
853
  setNotifications((prev) => prev.filter((n) => n.id !== id));
794
854
  };
795
- return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: { open, close }, children: /* @__PURE__ */ jsxs(Toast.Provider, { swipeDirection: "right", children: [
855
+ return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: { open, close }, children: /* @__PURE__ */ jsxs(Toast.Provider, { swipeDirection: position.endsWith("right") ? "right" : position.endsWith("left") ? "left" : "up", children: [
796
856
  children,
797
857
  /* @__PURE__ */ jsx(
798
858
  Toast.Viewport,
799
859
  {
800
860
  asChild: true,
801
- className: "fixed top-[56px] right-0 z-[500000] flex flex-col gap-2 w-[350px] p-4 outline-none",
861
+ className: [
862
+ VIEWPORT_CLASSES[position],
863
+ "z-[500000] gap-2 w-[332px] p-4 outline-none"
864
+ ].join(" "),
802
865
  children: /* @__PURE__ */ jsx("ul", { children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: notifications.map((n) => /* @__PURE__ */ jsx(
803
866
  NotificationItem,
804
867
  {
805
868
  n,
869
+ pos: position,
806
870
  onClose: close,
807
871
  reduced
808
872
  },
@@ -1858,6 +1922,248 @@ function TopBar({
1858
1922
  }
1859
1923
  );
1860
1924
  }
1925
+ function NavItem({
1926
+ item,
1927
+ isExpanded
1928
+ }) {
1929
+ const btn = /* @__PURE__ */ jsxs(
1930
+ "button",
1931
+ {
1932
+ type: "button",
1933
+ onClick: item.onClick,
1934
+ className: [
1935
+ "group relative flex w-full items-center gap-2.5 rounded-md",
1936
+ "px-2.5 py-2 transition-colors duration-100",
1937
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset",
1938
+ item.isActive ? "bg-accent/10 text-accent" : "text-foreground-secondary hover:bg-surface-raised hover:text-foreground"
1939
+ ].join(" "),
1940
+ children: [
1941
+ /* @__PURE__ */ jsxs("span", { className: "relative flex h-5 w-5 flex-shrink-0 items-center justify-center", children: [
1942
+ item.icon,
1943
+ item.badge !== void 0 && item.badge > 0 && /* @__PURE__ */ jsx("span", { className: "absolute -right-1 -top-1 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-status-error text-[9px] font-bold text-white leading-none", children: item.badge > 99 ? "99+" : item.badge })
1944
+ ] }),
1945
+ isExpanded && /* @__PURE__ */ jsx(
1946
+ motion.span,
1947
+ {
1948
+ initial: false,
1949
+ animate: { opacity: 1 },
1950
+ className: "truncate text-sm font-medium",
1951
+ children: item.label
1952
+ }
1953
+ ),
1954
+ item.isActive && /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 left-0 w-[3px] rounded-r-full bg-accent" })
1955
+ ]
1956
+ }
1957
+ );
1958
+ if (isExpanded) return btn;
1959
+ return /* @__PURE__ */ jsx(Tooltip, { title: item.label, placement: "right", delayDuration: 200, children: btn });
1960
+ }
1961
+ function Sidebar({
1962
+ sections,
1963
+ isExpanded,
1964
+ onToggle,
1965
+ expandedWidth = 220,
1966
+ collapsedWidth = 52,
1967
+ footer
1968
+ }) {
1969
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(
1970
+ motion.aside,
1971
+ {
1972
+ initial: false,
1973
+ animate: { width: isExpanded ? expandedWidth : collapsedWidth },
1974
+ transition: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
1975
+ className: "relative flex h-full flex-col border-r border-border bg-surface overflow-hidden flex-shrink-0",
1976
+ children: [
1977
+ /* @__PURE__ */ jsxs("div", { className: [
1978
+ "flex h-14 flex-shrink-0 items-center border-b border-border",
1979
+ isExpanded ? "justify-between px-3" : "justify-center px-1.5"
1980
+ ].join(" "), children: [
1981
+ isExpanded && /* @__PURE__ */ jsx(
1982
+ motion.span,
1983
+ {
1984
+ initial: { opacity: 0 },
1985
+ animate: { opacity: 1 },
1986
+ transition: { delay: 0.08 },
1987
+ className: "text-xs font-semibold uppercase tracking-widest text-foreground-muted select-none",
1988
+ children: "Menu"
1989
+ }
1990
+ ),
1991
+ /* @__PURE__ */ jsx(Tooltip, { title: isExpanded ? "Collapse menu" : "Expand menu", placement: "right", delayDuration: 500, children: /* @__PURE__ */ jsx(
1992
+ "button",
1993
+ {
1994
+ type: "button",
1995
+ onClick: onToggle,
1996
+ "aria-label": isExpanded ? "Collapse sidebar" : "Expand sidebar",
1997
+ className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md text-foreground-muted hover:bg-surface-raised hover:text-foreground transition-colors duration-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
1998
+ children: /* @__PURE__ */ jsx(
1999
+ motion.svg,
2000
+ {
2001
+ viewBox: "0 0 20 20",
2002
+ fill: "none",
2003
+ stroke: "currentColor",
2004
+ strokeWidth: "1.8",
2005
+ strokeLinecap: "round",
2006
+ strokeLinejoin: "round",
2007
+ className: "h-4 w-4",
2008
+ animate: { rotate: isExpanded ? 0 : 180 },
2009
+ transition: { type: "tween", duration: 0.22 },
2010
+ children: /* @__PURE__ */ jsx("path", { d: "M13 5l-5 5 5 5" })
2011
+ }
2012
+ )
2013
+ }
2014
+ ) })
2015
+ ] }),
2016
+ /* @__PURE__ */ jsx("nav", { className: "flex-1 overflow-y-auto overflow-x-hidden py-2 px-1.5 space-y-0.5", children: sections.map((section, si) => /* @__PURE__ */ jsxs("div", { className: si > 0 ? "pt-3" : "", children: [
2017
+ section.title && isExpanded && /* @__PURE__ */ jsx(
2018
+ motion.p,
2019
+ {
2020
+ initial: { opacity: 0 },
2021
+ animate: { opacity: 1 },
2022
+ transition: { delay: 0.06 },
2023
+ className: "px-2.5 pb-1 text-[10px] font-semibold uppercase tracking-widest text-foreground-muted select-none",
2024
+ children: section.title
2025
+ }
2026
+ ),
2027
+ section.items.map((item) => /* @__PURE__ */ jsx(NavItem, { item, isExpanded }, item.key))
2028
+ ] }, section.key)) }),
2029
+ footer && /* @__PURE__ */ jsx("div", { className: [
2030
+ "flex flex-shrink-0 items-center border-t border-border py-2",
2031
+ isExpanded ? "px-3 gap-2" : "justify-center px-1.5"
2032
+ ].join(" "), children: footer })
2033
+ ]
2034
+ }
2035
+ ) });
2036
+ }
2037
+ function AppShell({
2038
+ topBar,
2039
+ sidebarSections = [],
2040
+ sidebarExpandedWidth = 220,
2041
+ sidebarCollapsedWidth = 52,
2042
+ sidebarDefaultExpanded = false,
2043
+ sidebarFooter,
2044
+ children,
2045
+ className = ""
2046
+ }) {
2047
+ const [expanded, setExpanded] = useState(sidebarDefaultExpanded);
2048
+ return /* @__PURE__ */ jsxs("div", { className: `flex flex-col h-screen bg-background ${className}`, children: [
2049
+ topBar && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 z-[200]", children: topBar }),
2050
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
2051
+ sidebarSections.length > 0 && /* @__PURE__ */ jsx(
2052
+ Sidebar,
2053
+ {
2054
+ sections: sidebarSections,
2055
+ isExpanded: expanded,
2056
+ onToggle: () => setExpanded((e) => !e),
2057
+ expandedWidth: sidebarExpandedWidth,
2058
+ collapsedWidth: sidebarCollapsedWidth,
2059
+ footer: sidebarFooter
2060
+ }
2061
+ ),
2062
+ /* @__PURE__ */ jsx(
2063
+ motion.main,
2064
+ {
2065
+ className: "flex-1 overflow-y-auto overflow-x-hidden",
2066
+ animate: { marginLeft: 0 },
2067
+ transition: { type: "tween", duration: 0.22, ease: [0.16, 1, 0.3, 1] },
2068
+ children: /* @__PURE__ */ jsx("div", { className: "h-full p-6", children })
2069
+ }
2070
+ )
2071
+ ] })
2072
+ ] });
2073
+ }
2074
+ var SHIMMER = [
2075
+ "animate-shimmer rounded-sm",
2076
+ "bg-[length:400%_100%]",
2077
+ "bg-gradient-to-r",
2078
+ "from-border via-border-strong/40 to-border"
2079
+ ].join(" ");
2080
+ function SkeletonBox({ width, height = 16, radius, className = "", style }) {
2081
+ return /* @__PURE__ */ jsx(
2082
+ "span",
2083
+ {
2084
+ role: "presentation",
2085
+ "aria-hidden": "true",
2086
+ className: `block ${SHIMMER} ${className}`,
2087
+ style: {
2088
+ width: width ?? "100%",
2089
+ height,
2090
+ borderRadius: radius ?? "var(--radius-md)",
2091
+ ...style
2092
+ }
2093
+ }
2094
+ );
2095
+ }
2096
+ function SkeletonText({
2097
+ lines = 3,
2098
+ lastLineWidth = 60,
2099
+ lineHeight = 14,
2100
+ gap = 8,
2101
+ className = "",
2102
+ style
2103
+ }) {
2104
+ return /* @__PURE__ */ jsx(
2105
+ "div",
2106
+ {
2107
+ role: "presentation",
2108
+ "aria-hidden": "true",
2109
+ className: `flex flex-col ${className}`,
2110
+ style: { gap, ...style },
2111
+ children: Array.from({ length: lines }).map((_, i) => {
2112
+ const isLast = i === lines - 1;
2113
+ const width = isLast && lines > 1 ? `${lastLineWidth}%` : "100%";
2114
+ return /* @__PURE__ */ jsx(
2115
+ "span",
2116
+ {
2117
+ className: `block ${SHIMMER}`,
2118
+ style: { height: lineHeight, width, borderRadius: "var(--radius-sm)" }
2119
+ },
2120
+ i
2121
+ );
2122
+ })
2123
+ }
2124
+ );
2125
+ }
2126
+ function SkeletonCircle({ size = 40, className = "", style }) {
2127
+ return /* @__PURE__ */ jsx(
2128
+ "span",
2129
+ {
2130
+ role: "presentation",
2131
+ "aria-hidden": "true",
2132
+ className: `block flex-shrink-0 ${SHIMMER} ${className}`,
2133
+ style: {
2134
+ width: size,
2135
+ height: size,
2136
+ borderRadius: "50%",
2137
+ ...style
2138
+ }
2139
+ }
2140
+ );
2141
+ }
2142
+ function SkeletonCard({ hasAvatar = true, lines = 3, className = "", style }) {
2143
+ return /* @__PURE__ */ jsxs(
2144
+ "div",
2145
+ {
2146
+ role: "presentation",
2147
+ "aria-hidden": "true",
2148
+ className: `rounded-lg border border-border bg-surface p-4 ${className}`,
2149
+ style,
2150
+ children: [
2151
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-4", children: [
2152
+ hasAvatar && /* @__PURE__ */ jsx(SkeletonCircle, { size: 36 }),
2153
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
2154
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 12, width: "55%" }),
2155
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 10, width: "35%" })
2156
+ ] })
2157
+ ] }),
2158
+ /* @__PURE__ */ jsx(SkeletonText, { lines, lastLineWidth: 55 }),
2159
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex gap-2", children: [
2160
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 28, width: 72 }),
2161
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 28, width: 56 })
2162
+ ] })
2163
+ ]
2164
+ }
2165
+ );
2166
+ }
1861
2167
  function TextInput({
1862
2168
  value,
1863
2169
  onChange,
@@ -2081,56 +2387,82 @@ function Password({
2081
2387
  ] });
2082
2388
  }
2083
2389
  function Checkbox({
2084
- layout = "vertical",
2085
- labelPosition = "left",
2390
+ checked,
2391
+ value,
2392
+ // legacy alias
2393
+ onChange,
2086
2394
  label,
2087
2395
  name,
2088
2396
  htmlFor,
2089
2397
  errorMessage,
2090
- value = false,
2091
- onChange
2398
+ disabled = false
2092
2399
  }) {
2093
- return /* @__PURE__ */ jsxs("div", { className: "p-2", children: [
2400
+ const isChecked = checked ?? value ?? false;
2401
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
2094
2402
  /* @__PURE__ */ jsxs(
2095
- "div",
2403
+ "label",
2096
2404
  {
2097
- className: `flex ${layout === "vertical" ? "flex-col" : labelPosition === "left" ? "flex-row" : "flex-row-reverse"} gap-2`,
2405
+ htmlFor,
2406
+ className: [
2407
+ "inline-flex items-center gap-2.5",
2408
+ disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
2409
+ ].join(" "),
2098
2410
  children: [
2099
- /* @__PURE__ */ jsx(
2100
- "label",
2101
- {
2102
- htmlFor,
2103
- className: "font-bold text-md text-prussian-blue dark:text-white cursor-pointer",
2104
- children: label
2105
- }
2106
- ),
2107
2411
  /* @__PURE__ */ jsx(
2108
2412
  CheckboxPrimitive.Root,
2109
2413
  {
2110
2414
  id: htmlFor,
2111
2415
  name,
2112
- checked: value,
2113
- onCheckedChange: (checked) => onChange?.({
2114
- target: { value: !!checked, id: htmlFor, name }
2115
- }),
2116
- className: "border-2 border-prussian-blue dark:border-independence rounded-md w-6 h-6 flex items-center justify-center cursor-pointer transition-colors duration-150 data-[state=checked]:bg-prussian-blue dark:data-[state=checked]:bg-independence focus:outline-none focus-visible:ring-2 focus-visible:ring-usafa-blue",
2416
+ checked: isChecked,
2417
+ disabled,
2418
+ onCheckedChange: (c) => onChange?.({ target: { checked: !!c, id: htmlFor, name } }),
2419
+ className: [
2420
+ // Box
2421
+ "relative flex h-[18px] w-[18px] flex-shrink-0 items-center justify-center",
2422
+ "rounded-sm border transition-colors duration-150",
2423
+ // Unchecked
2424
+ "border-border-strong bg-surface",
2425
+ // Checked
2426
+ "data-[state=checked]:bg-accent data-[state=checked]:border-accent",
2427
+ // Focus
2428
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1",
2429
+ // Disabled
2430
+ "disabled:cursor-not-allowed"
2431
+ ].join(" "),
2117
2432
  "aria-label": typeof label === "string" ? label : void 0,
2118
- children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, { className: "transition-transform duration-150 scale-100", children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(
2119
- "path",
2433
+ children: /* @__PURE__ */ jsx(
2434
+ CheckboxPrimitive.Indicator,
2120
2435
  {
2121
- d: "M4 10l4.5 4.5L16 6",
2122
- stroke: "#fff",
2123
- strokeWidth: "2",
2124
- strokeLinecap: "round",
2125
- strokeLinejoin: "round"
2436
+ className: "flex items-center justify-center data-[state=checked]:animate-check-pop",
2437
+ children: /* @__PURE__ */ jsx(
2438
+ "svg",
2439
+ {
2440
+ width: "11",
2441
+ height: "9",
2442
+ viewBox: "0 0 11 9",
2443
+ fill: "none",
2444
+ "aria-hidden": "true",
2445
+ children: /* @__PURE__ */ jsx(
2446
+ "path",
2447
+ {
2448
+ d: "M1 4.5L4 7.5L10 1",
2449
+ stroke: "white",
2450
+ strokeWidth: "1.8",
2451
+ strokeLinecap: "round",
2452
+ strokeLinejoin: "round"
2453
+ }
2454
+ )
2455
+ }
2456
+ )
2126
2457
  }
2127
- ) }) })
2458
+ )
2128
2459
  }
2129
- )
2460
+ ),
2461
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm text-foreground-secondary select-none leading-snug", children: label })
2130
2462
  ]
2131
2463
  }
2132
2464
  ),
2133
- /* @__PURE__ */ jsx("div", { className: "text-error text-center", children: errorMessage })
2465
+ errorMessage && /* @__PURE__ */ jsx("span", { className: "text-xs text-status-error pl-[26px]", children: errorMessage })
2134
2466
  ] });
2135
2467
  }
2136
2468
  function Switch({
@@ -2733,6 +3065,6 @@ Temporal.DatePicker = DatePickerBase;
2733
3065
  Temporal.TemporalPicker = TemporalPickerBase;
2734
3066
  var DatePicker_default = Temporal;
2735
3067
 
2736
- export { AutoComplete, Button, Catalog, CatalogCarousel, CatalogGrid, Checkbox, ContextMenu, Drawer, Dropdown, DropdownPill, FadingBase, FileInput, GridCard, icons_default as Icon, IconButton, List2 as List, LoadingSpinner, MenuBar, MenuBarItem, Modal, NotificationProvider, NumberInput, OpaqueGridCard, Password, ScalableContainer, SearchInput_default as SearchInput, Switch, Table, Tabs, DatePicker_default as Temporal, TextInput, ThemeSwitch, ToggleButton, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Wizard, useNotification };
3068
+ export { AppShell, AutoComplete, Button, Catalog, CatalogCarousel, CatalogGrid, Checkbox, ContextMenu, Drawer, Dropdown, DropdownPill, FadingBase, FileInput, GridCard, icons_default as Icon, IconButton, List2 as List, LoadingSpinner, MenuBar, MenuBarItem, Modal, NotificationProvider, NumberInput, OpaqueGridCard, Password, ScalableContainer, SearchInput_default as SearchInput, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, Switch, Table, Tabs, DatePicker_default as Temporal, TextInput, ThemeSwitch, ToggleButton, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Wizard, useNotification };
2737
3069
  //# sourceMappingURL=index.js.map
2738
3070
  //# sourceMappingURL=index.js.map