@geomak/ui 1.3.0 → 1.5.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-GKXP6OJJ.js';
2
+ export { colors_default as COLORS, PALETTE as palette, semanticTokens, vars } from './chunk-GKXP6OJJ.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,373 @@ 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
+ function px(v) {
2075
+ return typeof v === "number" ? `${v}px` : v;
2076
+ }
2077
+ function str(v) {
2078
+ return v == null ? void 0 : String(v);
2079
+ }
2080
+ function toCssVars(theme) {
2081
+ if (!theme) return {};
2082
+ const out = {};
2083
+ if (theme.colors) {
2084
+ for (const [k, v] of Object.entries(theme.colors)) {
2085
+ if (v != null) out[`--color-${k}`] = v;
2086
+ }
2087
+ }
2088
+ if (theme.radius) {
2089
+ for (const [k, v] of Object.entries(theme.radius)) {
2090
+ if (v != null) out[`--radius-${k}`] = px(v);
2091
+ }
2092
+ }
2093
+ if (theme.shadows) {
2094
+ for (const [k, v] of Object.entries(theme.shadows)) {
2095
+ if (v != null) out[`--shadow-${k}`] = v;
2096
+ }
2097
+ }
2098
+ if (theme.typography) {
2099
+ const t = theme.typography;
2100
+ const map = [
2101
+ ["--font-family-sans", t.fontFamily],
2102
+ ["--font-size-xs", t.fontSizeXs],
2103
+ ["--font-size-sm", t.fontSizeSm],
2104
+ ["--font-size-base", t.fontSizeBase],
2105
+ ["--font-size-lg", t.fontSizeLg],
2106
+ ["--font-size-xl", t.fontSizeXl],
2107
+ ["--font-size-2xl", t.fontSize2xl],
2108
+ ["--font-size-3xl", t.fontSize3xl],
2109
+ ["--font-weight-normal", t.fontWeightNormal],
2110
+ ["--font-weight-medium", t.fontWeightMedium],
2111
+ ["--font-weight-semibold", t.fontWeightSemibold],
2112
+ ["--font-weight-bold", t.fontWeightBold],
2113
+ ["--line-height-tight", t.lineHeightTight],
2114
+ ["--line-height-snug", t.lineHeightSnug],
2115
+ ["--line-height-normal", t.lineHeightNormal],
2116
+ ["--line-height-relaxed", t.lineHeightRelaxed]
2117
+ ];
2118
+ for (const [cssVar, val] of map) {
2119
+ const s = str(val);
2120
+ if (s != null) out[cssVar] = s;
2121
+ }
2122
+ }
2123
+ if (theme.density) {
2124
+ const d = theme.density;
2125
+ const map = [
2126
+ ["--height-control-xs", d.controlXs],
2127
+ ["--height-control-sm", d.controlSm],
2128
+ ["--height-control-md", d.controlMd],
2129
+ ["--height-control-lg", d.controlLg],
2130
+ ["--height-topbar", d.topbar]
2131
+ ];
2132
+ for (const [cssVar, val] of map) {
2133
+ if (val != null) out[cssVar] = px(val);
2134
+ }
2135
+ }
2136
+ if (theme.motion) {
2137
+ const m = theme.motion;
2138
+ const map = [
2139
+ ["--duration-fast", m.durationFast],
2140
+ ["--duration-normal", m.durationNormal],
2141
+ ["--duration-slow", m.durationSlow],
2142
+ ["--duration-gentle", m.durationGentle]
2143
+ ];
2144
+ for (const [cssVar, val] of map) {
2145
+ if (val != null) out[cssVar] = val;
2146
+ }
2147
+ }
2148
+ return out;
2149
+ }
2150
+ function varsToStyleString(vars2) {
2151
+ return Object.entries(vars2).map(([k, v]) => `${k}: ${v};`).join(" ");
2152
+ }
2153
+ function ThemeProvider({
2154
+ theme,
2155
+ darkTheme,
2156
+ colorScheme = "auto",
2157
+ children,
2158
+ className = "",
2159
+ style
2160
+ }) {
2161
+ const id = React9.useId().replace(/:/g, "");
2162
+ const scopeClass = `geo-th-${id}`;
2163
+ const divRef = useRef(null);
2164
+ useEffect(() => {
2165
+ const el = divRef.current;
2166
+ if (!el) return;
2167
+ if (colorScheme === "auto") return;
2168
+ if (colorScheme === "system") {
2169
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
2170
+ const apply = (e) => {
2171
+ el.classList.toggle("dark", e.matches);
2172
+ };
2173
+ apply(mq);
2174
+ mq.addEventListener("change", apply);
2175
+ return () => mq.removeEventListener("change", apply);
2176
+ }
2177
+ el.classList.toggle("dark", colorScheme === "dark");
2178
+ }, [colorScheme]);
2179
+ const lightVars = useMemo(() => toCssVars(theme), [theme]);
2180
+ const darkVarStr = useMemo(() => {
2181
+ if (!darkTheme) return "";
2182
+ const dvars = toCssVars(darkTheme);
2183
+ if (!Object.keys(dvars).length) return "";
2184
+ return `.${scopeClass}.dark { ${varsToStyleString(dvars)} }`;
2185
+ }, [darkTheme]);
2186
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2187
+ darkVarStr && /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: darkVarStr } }),
2188
+ /* @__PURE__ */ jsx(
2189
+ "div",
2190
+ {
2191
+ ref: divRef,
2192
+ className: `${scopeClass} ${className}`.trim(),
2193
+ style: { ...lightVars, ...style },
2194
+ children
2195
+ }
2196
+ )
2197
+ ] });
2198
+ }
2199
+ var SHIMMER = [
2200
+ "animate-shimmer rounded-sm",
2201
+ "bg-[length:400%_100%]",
2202
+ "bg-gradient-to-r",
2203
+ "from-border via-border-strong/40 to-border"
2204
+ ].join(" ");
2205
+ function SkeletonBox({ width, height = 16, radius, className = "", style }) {
2206
+ return /* @__PURE__ */ jsx(
2207
+ "span",
2208
+ {
2209
+ role: "presentation",
2210
+ "aria-hidden": "true",
2211
+ className: `block ${SHIMMER} ${className}`,
2212
+ style: {
2213
+ width: width ?? "100%",
2214
+ height,
2215
+ borderRadius: radius ?? "var(--radius-md)",
2216
+ ...style
2217
+ }
2218
+ }
2219
+ );
2220
+ }
2221
+ function SkeletonText({
2222
+ lines = 3,
2223
+ lastLineWidth = 60,
2224
+ lineHeight = 14,
2225
+ gap = 8,
2226
+ className = "",
2227
+ style
2228
+ }) {
2229
+ return /* @__PURE__ */ jsx(
2230
+ "div",
2231
+ {
2232
+ role: "presentation",
2233
+ "aria-hidden": "true",
2234
+ className: `flex flex-col ${className}`,
2235
+ style: { gap, ...style },
2236
+ children: Array.from({ length: lines }).map((_, i) => {
2237
+ const isLast = i === lines - 1;
2238
+ const width = isLast && lines > 1 ? `${lastLineWidth}%` : "100%";
2239
+ return /* @__PURE__ */ jsx(
2240
+ "span",
2241
+ {
2242
+ className: `block ${SHIMMER}`,
2243
+ style: { height: lineHeight, width, borderRadius: "var(--radius-sm)" }
2244
+ },
2245
+ i
2246
+ );
2247
+ })
2248
+ }
2249
+ );
2250
+ }
2251
+ function SkeletonCircle({ size = 40, className = "", style }) {
2252
+ return /* @__PURE__ */ jsx(
2253
+ "span",
2254
+ {
2255
+ role: "presentation",
2256
+ "aria-hidden": "true",
2257
+ className: `block flex-shrink-0 ${SHIMMER} ${className}`,
2258
+ style: {
2259
+ width: size,
2260
+ height: size,
2261
+ borderRadius: "50%",
2262
+ ...style
2263
+ }
2264
+ }
2265
+ );
2266
+ }
2267
+ function SkeletonCard({ hasAvatar = true, lines = 3, className = "", style }) {
2268
+ return /* @__PURE__ */ jsxs(
2269
+ "div",
2270
+ {
2271
+ role: "presentation",
2272
+ "aria-hidden": "true",
2273
+ className: `rounded-lg border border-border bg-surface p-4 ${className}`,
2274
+ style,
2275
+ children: [
2276
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-4", children: [
2277
+ hasAvatar && /* @__PURE__ */ jsx(SkeletonCircle, { size: 36 }),
2278
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
2279
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 12, width: "55%" }),
2280
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 10, width: "35%" })
2281
+ ] })
2282
+ ] }),
2283
+ /* @__PURE__ */ jsx(SkeletonText, { lines, lastLineWidth: 55 }),
2284
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex gap-2", children: [
2285
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 28, width: 72 }),
2286
+ /* @__PURE__ */ jsx(SkeletonBox, { height: 28, width: 56 })
2287
+ ] })
2288
+ ]
2289
+ }
2290
+ );
2291
+ }
1861
2292
  function TextInput({
1862
2293
  value,
1863
2294
  onChange,
@@ -2081,56 +2512,82 @@ function Password({
2081
2512
  ] });
2082
2513
  }
2083
2514
  function Checkbox({
2084
- layout = "vertical",
2085
- labelPosition = "left",
2515
+ checked,
2516
+ value,
2517
+ // legacy alias
2518
+ onChange,
2086
2519
  label,
2087
2520
  name,
2088
2521
  htmlFor,
2089
2522
  errorMessage,
2090
- value = false,
2091
- onChange
2523
+ disabled = false
2092
2524
  }) {
2093
- return /* @__PURE__ */ jsxs("div", { className: "p-2", children: [
2525
+ const isChecked = checked ?? value ?? false;
2526
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
2094
2527
  /* @__PURE__ */ jsxs(
2095
- "div",
2528
+ "label",
2096
2529
  {
2097
- className: `flex ${layout === "vertical" ? "flex-col" : labelPosition === "left" ? "flex-row" : "flex-row-reverse"} gap-2`,
2530
+ htmlFor,
2531
+ className: [
2532
+ "inline-flex items-center gap-2.5",
2533
+ disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
2534
+ ].join(" "),
2098
2535
  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
2536
  /* @__PURE__ */ jsx(
2108
2537
  CheckboxPrimitive.Root,
2109
2538
  {
2110
2539
  id: htmlFor,
2111
2540
  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",
2541
+ checked: isChecked,
2542
+ disabled,
2543
+ onCheckedChange: (c) => onChange?.({ target: { checked: !!c, id: htmlFor, name } }),
2544
+ className: [
2545
+ // Box
2546
+ "relative flex h-[18px] w-[18px] flex-shrink-0 items-center justify-center",
2547
+ "rounded-sm border transition-colors duration-150",
2548
+ // Unchecked
2549
+ "border-border-strong bg-surface",
2550
+ // Checked
2551
+ "data-[state=checked]:bg-accent data-[state=checked]:border-accent",
2552
+ // Focus
2553
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1",
2554
+ // Disabled
2555
+ "disabled:cursor-not-allowed"
2556
+ ].join(" "),
2117
2557
  "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",
2558
+ children: /* @__PURE__ */ jsx(
2559
+ CheckboxPrimitive.Indicator,
2120
2560
  {
2121
- d: "M4 10l4.5 4.5L16 6",
2122
- stroke: "#fff",
2123
- strokeWidth: "2",
2124
- strokeLinecap: "round",
2125
- strokeLinejoin: "round"
2561
+ className: "flex items-center justify-center data-[state=checked]:animate-check-pop",
2562
+ children: /* @__PURE__ */ jsx(
2563
+ "svg",
2564
+ {
2565
+ width: "11",
2566
+ height: "9",
2567
+ viewBox: "0 0 11 9",
2568
+ fill: "none",
2569
+ "aria-hidden": "true",
2570
+ children: /* @__PURE__ */ jsx(
2571
+ "path",
2572
+ {
2573
+ d: "M1 4.5L4 7.5L10 1",
2574
+ stroke: "white",
2575
+ strokeWidth: "1.8",
2576
+ strokeLinecap: "round",
2577
+ strokeLinejoin: "round"
2578
+ }
2579
+ )
2580
+ }
2581
+ )
2126
2582
  }
2127
- ) }) })
2583
+ )
2128
2584
  }
2129
- )
2585
+ ),
2586
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm text-foreground-secondary select-none leading-snug", children: label })
2130
2587
  ]
2131
2588
  }
2132
2589
  ),
2133
- /* @__PURE__ */ jsx("div", { className: "text-error text-center", children: errorMessage })
2590
+ errorMessage && /* @__PURE__ */ jsx("span", { className: "text-xs text-status-error pl-[26px]", children: errorMessage })
2134
2591
  ] });
2135
2592
  }
2136
2593
  function Switch({
@@ -2733,6 +3190,6 @@ Temporal.DatePicker = DatePickerBase;
2733
3190
  Temporal.TemporalPicker = TemporalPickerBase;
2734
3191
  var DatePicker_default = Temporal;
2735
3192
 
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 };
3193
+ 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, ThemeProvider, ThemeSwitch, ToggleButton, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Wizard, useNotification };
2737
3194
  //# sourceMappingURL=index.js.map
2738
3195
  //# sourceMappingURL=index.js.map