@geomak/ui 6.2.1 → 6.2.3

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.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var chunk255PCZIW_cjs = require('./chunk-255PCZIW.cjs');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
- var React8 = require('react');
5
+ var React12 = require('react');
6
6
  var reactDom = require('react-dom');
7
7
  var AvatarPrimitive = require('@radix-ui/react-avatar');
8
8
  var Dialog = require('@radix-ui/react-dialog');
@@ -39,7 +39,7 @@ function _interopNamespace(e) {
39
39
  return Object.freeze(n);
40
40
  }
41
41
 
42
- var React8__default = /*#__PURE__*/_interopDefault(React8);
42
+ var React12__default = /*#__PURE__*/_interopDefault(React12);
43
43
  var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
44
44
  var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
45
45
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
@@ -214,8 +214,8 @@ Icon.Copy = Copy;
214
214
  Icon.CircleStack = CircleStack;
215
215
  var icons_default = Icon;
216
216
  function Portal({ children, target }) {
217
- const [resolved, setResolved] = React8.useState(null);
218
- React8.useEffect(() => {
217
+ const [resolved, setResolved] = React12.useState(null);
218
+ React12.useEffect(() => {
219
219
  if (target === null) {
220
220
  setResolved(null);
221
221
  return;
@@ -648,7 +648,7 @@ function IconButton({
648
648
  className = "",
649
649
  style
650
650
  }) {
651
- const colorScheme = React8.useMemo(() => {
651
+ const colorScheme = React12.useMemo(() => {
652
652
  if (type === "primary") {
653
653
  return "bg-accent text-accent-fg hover:bg-accent-hover";
654
654
  }
@@ -960,9 +960,9 @@ function Tooltip({
960
960
  ] }) });
961
961
  }
962
962
  var TooltipProvider = TooltipPrimitive__namespace.Provider;
963
- var TabsContext = React8.createContext(null);
963
+ var TabsContext = React12.createContext(null);
964
964
  function useTabsContext() {
965
- const ctx = React8.useContext(TabsContext);
965
+ const ctx = React12.useContext(TabsContext);
966
966
  if (!ctx) throw new Error("Tabs.List / Tabs.Trigger / Tabs.Panel must be rendered inside <Tabs>.");
967
967
  return ctx;
968
968
  }
@@ -984,26 +984,26 @@ function Tabs({
984
984
  children
985
985
  }) {
986
986
  const isControlled = value !== void 0;
987
- const [internal, setInternal] = React8.useState(defaultValue);
987
+ const [internal, setInternal] = React12.useState(defaultValue);
988
988
  const current = isControlled ? value : internal;
989
989
  const reduced = !!framerMotion.useReducedMotion();
990
- const indicatorId = React8.useId();
991
- const select = React8.useCallback((next) => {
990
+ const indicatorId = React12.useId();
991
+ const select = React12.useCallback((next) => {
992
992
  if (!isControlled) setInternal(next);
993
993
  onValueChange?.(next);
994
994
  }, [isControlled, onValueChange]);
995
- const registry = React8.useRef(/* @__PURE__ */ new Map());
996
- const orderRef = React8.useRef(0);
997
- const [, bump] = React8.useState(0);
998
- const registerTab = React8.useCallback((val, meta) => {
995
+ const registry = React12.useRef(/* @__PURE__ */ new Map());
996
+ const orderRef = React12.useRef(0);
997
+ const [, bump] = React12.useState(0);
998
+ const registerTab = React12.useCallback((val, meta) => {
999
999
  const existing = registry.current.get(val);
1000
1000
  registry.current.set(val, { ...meta, order: existing?.order ?? orderRef.current++ });
1001
1001
  if (!existing) bump((v) => v + 1);
1002
1002
  }, []);
1003
- const unregisterTab = React8.useCallback((val) => {
1003
+ const unregisterTab = React12.useCallback((val) => {
1004
1004
  if (registry.current.delete(val)) bump((v) => v + 1);
1005
1005
  }, []);
1006
- const getTabs = React8.useCallback(() => [...registry.current.entries()].sort((a, b) => a[1].order - b[1].order).map(([val, m]) => ({ value: val, label: m.label, icon: m.icon, disabled: m.disabled })), []);
1006
+ const getTabs = React12.useCallback(() => [...registry.current.entries()].sort((a, b) => a[1].order - b[1].order).map(([val, m]) => ({ value: val, label: m.label, icon: m.icon, disabled: m.disabled })), []);
1007
1007
  return /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: { value: current, variant, size, orientation, indicatorId, reduced, select, registerTab, unregisterTab, getTabs }, children: /* @__PURE__ */ jsxRuntime.jsx(
1008
1008
  TabsPrimitive__namespace.Root,
1009
1009
  {
@@ -1023,10 +1023,10 @@ function Tabs({
1023
1023
  function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
1024
1024
  const { variant, orientation, reduced, value } = useTabsContext();
1025
1025
  const horizontal = orientation === "horizontal";
1026
- const scrollRef = React8.useRef(null);
1027
- const [edges, setEdges] = React8.useState({ start: false, end: false });
1026
+ const scrollRef = React12.useRef(null);
1027
+ const [edges, setEdges] = React12.useState({ start: false, end: false });
1028
1028
  const scrollable = variant !== "segmented";
1029
- React8.useLayoutEffect(() => {
1029
+ React12.useLayoutEffect(() => {
1030
1030
  const el = scrollRef.current;
1031
1031
  if (!el || !scrollable) return;
1032
1032
  const update = () => {
@@ -1051,13 +1051,13 @@ function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
1051
1051
  ro.disconnect();
1052
1052
  };
1053
1053
  }, [horizontal, scrollable, children]);
1054
- const nudge = React8.useCallback((dir) => {
1054
+ const nudge = React12.useCallback((dir) => {
1055
1055
  const el = scrollRef.current;
1056
1056
  if (!el) return;
1057
1057
  const amount = (horizontal ? el.clientWidth : el.clientHeight) * 0.7 * dir;
1058
1058
  el.scrollBy({ [horizontal ? "left" : "top"]: amount, behavior: reduced ? "auto" : "smooth" });
1059
1059
  }, [horizontal, reduced]);
1060
- React8.useLayoutEffect(() => {
1060
+ React12.useLayoutEffect(() => {
1061
1061
  const el = scrollRef.current;
1062
1062
  if (!el || !scrollable) return;
1063
1063
  const active = el.querySelector("[role=tab][data-state=active]");
@@ -1115,9 +1115,9 @@ function Chevron({ side, orientation, onClick }) {
1115
1115
  function OverflowMenu() {
1116
1116
  const { getTabs, value, select, orientation } = useTabsContext();
1117
1117
  const horizontal = orientation === "horizontal";
1118
- const [open, setOpen] = React8.useState(false);
1119
- const wrapRef = React8.useRef(null);
1120
- const timer = React8.useRef(null);
1118
+ const [open, setOpen] = React12.useState(false);
1119
+ const wrapRef = React12.useRef(null);
1120
+ const timer = React12.useRef(null);
1121
1121
  const openNow = () => {
1122
1122
  if (timer.current) clearTimeout(timer.current);
1123
1123
  setOpen(true);
@@ -1125,7 +1125,7 @@ function OverflowMenu() {
1125
1125
  const closeSoon = () => {
1126
1126
  timer.current = setTimeout(() => setOpen(false), 160);
1127
1127
  };
1128
- React8.useLayoutEffect(() => {
1128
+ React12.useLayoutEffect(() => {
1129
1129
  if (!open) return;
1130
1130
  const onDoc = (e) => {
1131
1131
  if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
@@ -1206,7 +1206,7 @@ function TabsTrigger({ value, icon, badge, closeable, onClose, disabled, classNa
1206
1206
  const isActive = active === value;
1207
1207
  const horizontal = orientation === "horizontal";
1208
1208
  const sz = SIZE[size];
1209
- React8.useLayoutEffect(() => {
1209
+ React12.useLayoutEffect(() => {
1210
1210
  registerTab(value, { label: children, icon, disabled });
1211
1211
  return () => unregisterTab(value);
1212
1212
  }, [value, children, icon, disabled, registerTab, unregisterTab]);
@@ -1404,7 +1404,7 @@ function Tree({
1404
1404
  item.key
1405
1405
  )) });
1406
1406
  }
1407
- var NotificationContext = React8.createContext({
1407
+ var NotificationContext = React12.createContext({
1408
1408
  open: () => void 0,
1409
1409
  close: () => void 0
1410
1410
  });
@@ -1462,26 +1462,26 @@ function NotificationItem({
1462
1462
  onClose,
1463
1463
  reduced
1464
1464
  }) {
1465
- const [paused, setPaused] = React8.useState(false);
1465
+ const [paused, setPaused] = React12.useState(false);
1466
1466
  const duration = n.duration ?? 4e3;
1467
1467
  const isAutoDismissing = isFinite(duration) && duration > 0;
1468
1468
  const showProgress = !reduced && isAutoDismissing;
1469
- const timerRef = React8.useRef(null);
1470
- const startTimeRef = React8.useRef(0);
1471
- const remainingRef = React8.useRef(duration);
1472
- const clearTimer = React8.useCallback(() => {
1469
+ const timerRef = React12.useRef(null);
1470
+ const startTimeRef = React12.useRef(0);
1471
+ const remainingRef = React12.useRef(duration);
1472
+ const clearTimer = React12.useCallback(() => {
1473
1473
  if (timerRef.current !== null) {
1474
1474
  clearTimeout(timerRef.current);
1475
1475
  timerRef.current = null;
1476
1476
  }
1477
1477
  }, []);
1478
- const scheduleDismiss = React8.useCallback((ms) => {
1478
+ const scheduleDismiss = React12.useCallback((ms) => {
1479
1479
  clearTimer();
1480
1480
  if (!isAutoDismissing) return;
1481
1481
  startTimeRef.current = Date.now();
1482
1482
  timerRef.current = setTimeout(() => onClose(n.id), ms);
1483
1483
  }, [clearTimer, isAutoDismissing, n.id, onClose]);
1484
- React8.useEffect(() => {
1484
+ React12.useEffect(() => {
1485
1485
  if (paused || !isAutoDismissing) return;
1486
1486
  scheduleDismiss(remainingRef.current);
1487
1487
  return clearTimer;
@@ -1564,15 +1564,15 @@ function NotificationProvider({
1564
1564
  children,
1565
1565
  position = "top-right"
1566
1566
  }) {
1567
- const [notifications, setNotifications] = React8.useState([]);
1567
+ const [notifications, setNotifications] = React12.useState([]);
1568
1568
  const reduced = framerMotion.useReducedMotion();
1569
- const open = React8.useCallback((payload) => {
1569
+ const open = React12.useCallback((payload) => {
1570
1570
  setNotifications((prev) => [
1571
1571
  ...prev,
1572
1572
  { duration: 4e3, ...payload, id: Date.now() + Math.random() }
1573
1573
  ]);
1574
1574
  }, []);
1575
- const close = React8.useCallback((id) => {
1575
+ const close = React12.useCallback((id) => {
1576
1576
  setNotifications((prev) => prev.filter((n) => n.id !== id));
1577
1577
  }, []);
1578
1578
  return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
@@ -1601,7 +1601,7 @@ function NotificationProvider({
1601
1601
  ] });
1602
1602
  }
1603
1603
  function useNotification() {
1604
- const { open } = React8.useContext(NotificationContext);
1604
+ const { open } = React12.useContext(NotificationContext);
1605
1605
  return {
1606
1606
  info: (props) => open({ type: "info", ...props }),
1607
1607
  success: (props) => open({ type: "success", ...props }),
@@ -1718,10 +1718,10 @@ function FadingBase({
1718
1718
  isMounted = false,
1719
1719
  children
1720
1720
  }) {
1721
- const [shouldRender, setShouldRender] = React8.useState(isMounted);
1722
- const [visible, setVisible] = React8.useState(false);
1723
- const timerRef = React8.useRef(null);
1724
- React8.useEffect(() => {
1721
+ const [shouldRender, setShouldRender] = React12.useState(isMounted);
1722
+ const [visible, setVisible] = React12.useState(false);
1723
+ const timerRef = React12.useRef(null);
1724
+ React12.useEffect(() => {
1725
1725
  if (isMounted) {
1726
1726
  setShouldRender(true);
1727
1727
  const rafId = requestAnimationFrame(() => setVisible(true));
@@ -1819,8 +1819,8 @@ function ScalableContainer({
1819
1819
  togglePosition = "top-right",
1820
1820
  className = ""
1821
1821
  }) {
1822
- const containerRef = React8.useRef(null);
1823
- const [internalScaled, setInternalScaled] = React8.useState(false);
1822
+ const containerRef = React12.useRef(null);
1823
+ const [internalScaled, setInternalScaled] = React12.useState(false);
1824
1824
  const isScaled = expanded ?? internalScaled;
1825
1825
  const reduced = framerMotion.useReducedMotion();
1826
1826
  const onToggle = () => {
@@ -1958,17 +1958,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
1958
1958
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex flex-wrap gap-2 ${className}`.trim(), children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(GridCard, { item, buttonText, onOpen }, item.key)) });
1959
1959
  }
1960
1960
  function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
1961
- const [activeIndex, setActiveIndex] = React8.useState(0);
1962
- const [indexPool, setIndexPool] = React8.useState([]);
1963
- const cardRefs = React8.useRef([]);
1964
- const getIndexes = React8.useMemo(() => {
1961
+ const [activeIndex, setActiveIndex] = React12.useState(0);
1962
+ const [indexPool, setIndexPool] = React12.useState([]);
1963
+ const cardRefs = React12.useRef([]);
1964
+ const getIndexes = React12.useMemo(() => {
1965
1965
  let nextIndex = activeIndex + 1;
1966
1966
  let previousIndex = activeIndex - 1;
1967
1967
  if (activeIndex === 0) previousIndex = items.length - 1;
1968
1968
  if (activeIndex === items.length - 1) nextIndex = 0;
1969
1969
  return { previousIndex, nextIndex };
1970
1970
  }, [activeIndex, items.length]);
1971
- React8.useEffect(() => {
1971
+ React12.useEffect(() => {
1972
1972
  const { nextIndex, previousIndex } = getIndexes;
1973
1973
  let indexes = [previousIndex, activeIndex, nextIndex];
1974
1974
  if (activeIndex !== 0 && activeIndex !== items.length - 1) {
@@ -2141,8 +2141,8 @@ function writeDismissed(key) {
2141
2141
  }
2142
2142
  }
2143
2143
  function useTargetBbox(ref) {
2144
- const [bbox, setBbox] = React8.useState(null);
2145
- React8.useLayoutEffect(() => {
2144
+ const [bbox, setBbox] = React12.useState(null);
2145
+ React12.useLayoutEffect(() => {
2146
2146
  const el = ref?.current;
2147
2147
  if (!el) {
2148
2148
  setBbox(null);
@@ -2172,7 +2172,7 @@ function tooltipStyleFor(bbox, placement) {
2172
2172
  return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
2173
2173
  }
2174
2174
  function useFocusTrap(containerRef, active) {
2175
- React8.useEffect(() => {
2175
+ React12.useEffect(() => {
2176
2176
  if (!active) return;
2177
2177
  const el = containerRef.current;
2178
2178
  if (!el) return;
@@ -2211,16 +2211,16 @@ function Wizard({
2211
2211
  onComplete,
2212
2212
  onSkip
2213
2213
  }) {
2214
- const tooltipRef = React8.useRef(null);
2215
- const tooltipTitleId = React8.useId();
2216
- const tooltipBodyId = React8.useId();
2214
+ const tooltipRef = React12.useRef(null);
2215
+ const tooltipTitleId = React12.useId();
2216
+ const tooltipBodyId = React12.useId();
2217
2217
  const reduced = framerMotion.useReducedMotion();
2218
- const [open, setOpen] = React8.useState(() => steps.length > 0 && !readDismissed(storageKey));
2219
- const [activeIndex, setActiveIndex] = React8.useState(0);
2218
+ const [open, setOpen] = React12.useState(() => steps.length > 0 && !readDismissed(storageKey));
2219
+ const [activeIndex, setActiveIndex] = React12.useState(0);
2220
2220
  const step = steps[activeIndex];
2221
2221
  const bbox = useTargetBbox(step?.stepRef);
2222
2222
  useFocusTrap(tooltipRef, open);
2223
- React8.useEffect(() => {
2223
+ React12.useEffect(() => {
2224
2224
  if (!open || !dismissible) return;
2225
2225
  const onKey = (e) => {
2226
2226
  if (e.key === "Escape") {
@@ -2231,12 +2231,12 @@ function Wizard({
2231
2231
  document.addEventListener("keydown", onKey);
2232
2232
  return () => document.removeEventListener("keydown", onKey);
2233
2233
  }, [open, dismissible]);
2234
- const handleSkip = React8.useCallback(() => {
2234
+ const handleSkip = React12.useCallback(() => {
2235
2235
  writeDismissed(storageKey);
2236
2236
  setOpen(false);
2237
2237
  onSkip?.();
2238
2238
  }, [storageKey, onSkip]);
2239
- const handleComplete = React8.useCallback(() => {
2239
+ const handleComplete = React12.useCallback(() => {
2240
2240
  writeDismissed(storageKey);
2241
2241
  setOpen(false);
2242
2242
  onComplete?.();
@@ -2507,7 +2507,7 @@ function Field({
2507
2507
  );
2508
2508
  }
2509
2509
  var SearchIcon = /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-4 h-4", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) });
2510
- var SearchInput = React8__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
2510
+ var SearchInput = React12__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
2511
2511
  return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
2512
2512
  "div",
2513
2513
  {
@@ -2561,11 +2561,11 @@ function MultiTagRow({
2561
2561
  labelFor,
2562
2562
  onRemove
2563
2563
  }) {
2564
- const wrapRef = React8.useRef(null);
2565
- const measureRef = React8.useRef(null);
2566
- const [visibleCount, setVisibleCount] = React8.useState(values.length);
2564
+ const wrapRef = React12.useRef(null);
2565
+ const measureRef = React12.useRef(null);
2566
+ const [visibleCount, setVisibleCount] = React12.useState(values.length);
2567
2567
  const key = values.map(String).join("|");
2568
- React8.useLayoutEffect(() => {
2568
+ React12.useLayoutEffect(() => {
2569
2569
  const wrap = wrapRef.current;
2570
2570
  const measure = measureRef.current;
2571
2571
  if (!wrap || !measure) return;
@@ -2659,16 +2659,16 @@ function Dropdown({
2659
2659
  size = "md",
2660
2660
  className = ""
2661
2661
  }) {
2662
- const [open, setOpen] = React8.useState(false);
2663
- const [selectedItems, setSelectedItems] = React8.useState([]);
2664
- const [searchTerm, setSearchTerm] = React8.useState("");
2665
- const [innerItems, setInnerItems] = React8.useState([]);
2666
- const errorId = React8.useId();
2662
+ const [open, setOpen] = React12.useState(false);
2663
+ const [selectedItems, setSelectedItems] = React12.useState([]);
2664
+ const [searchTerm, setSearchTerm] = React12.useState("");
2665
+ const [innerItems, setInnerItems] = React12.useState([]);
2666
+ const errorId = React12.useId();
2667
2667
  const hasError = errorMessage != null;
2668
- React8.useEffect(() => {
2668
+ React12.useEffect(() => {
2669
2669
  setInnerItems(items);
2670
2670
  }, [items]);
2671
- React8.useEffect(() => {
2671
+ React12.useEffect(() => {
2672
2672
  if (isMultiselect && Array.isArray(value)) {
2673
2673
  setSelectedItems(value);
2674
2674
  }
@@ -2993,7 +2993,8 @@ function TableBody({
2993
2993
  expandRow,
2994
2994
  getRowKey
2995
2995
  }) {
2996
- const [expanded, setExpanded] = React8.useState(() => /* @__PURE__ */ new Set());
2996
+ const [expanded, setExpanded] = React12.useState(() => /* @__PURE__ */ new Set());
2997
+ const reduced = framerMotion.useReducedMotion();
2997
2998
  const toggleRow = (rowKey) => {
2998
2999
  setExpanded((prev) => {
2999
3000
  const next = new Set(prev);
@@ -3007,7 +3008,7 @@ function TableBody({
3007
3008
  return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
3008
3009
  const rowKey = getRowKey(row, i);
3009
3010
  const isExpanded = expanded.has(rowKey);
3010
- return /* @__PURE__ */ jsxRuntime.jsxs(React8__default.default.Fragment, { children: [
3011
+ return /* @__PURE__ */ jsxRuntime.jsxs(React12__default.default.Fragment, { children: [
3011
3012
  /* @__PURE__ */ jsxRuntime.jsxs(
3012
3013
  "tr",
3013
3014
  {
@@ -3035,7 +3036,19 @@ function TableBody({
3035
3036
  ]
3036
3037
  }
3037
3038
  ),
3038
- hasExpand && isExpanded && /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "bg-surface", children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: expandColCount, className: "p-0 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3", children: expandRow.expandComponent?.(row) }) }) })
3039
+ hasExpand && /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "bg-surface", children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: expandColCount, className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: isExpanded && /* @__PURE__ */ jsxRuntime.jsx(
3040
+ framerMotion.motion.div,
3041
+ {
3042
+ initial: { height: 0, opacity: 0 },
3043
+ animate: { height: "auto", opacity: 1 },
3044
+ exit: { height: 0, opacity: 0 },
3045
+ transition: reduced ? { duration: 0 } : { height: { duration: 0.28, ease: [0.16, 1, 0.3, 1] }, opacity: { duration: 0.2 } },
3046
+ style: { overflow: "hidden" },
3047
+ className: "border-b border-border",
3048
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3", children: expandRow.expandComponent?.(row) })
3049
+ },
3050
+ "expand"
3051
+ ) }) }) })
3039
3052
  ] }, rowKey);
3040
3053
  }) });
3041
3054
  }
@@ -3051,9 +3064,9 @@ function Pagination({
3051
3064
  const matchedOption = picker.find(
3052
3065
  (o) => o.label === options.perPage || o.value === options.perPage
3053
3066
  );
3054
- const [perPageKey, setPerPageKey] = React8.useState(() => matchedOption?.key ?? picker[0]?.key);
3067
+ const [perPageKey, setPerPageKey] = React12.useState(() => matchedOption?.key ?? picker[0]?.key);
3055
3068
  const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
3056
- React8.useEffect(() => {
3069
+ React12.useEffect(() => {
3057
3070
  if (serverSide && options.perPage != null) {
3058
3071
  const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
3059
3072
  if (next) setPerPageKey(next.key);
@@ -3117,14 +3130,14 @@ function Table({
3117
3130
  className = "",
3118
3131
  style
3119
3132
  }) {
3120
- const searchRef = React8.useRef(null);
3121
- const [searchTerm, setSearchTerm] = React8.useState("");
3122
- const [perPage, setPerPage] = React8.useState(
3133
+ const searchRef = React12.useRef(null);
3134
+ const [searchTerm, setSearchTerm] = React12.useState("");
3135
+ const [perPage, setPerPage] = React12.useState(
3123
3136
  typeof pagination.perPage === "number" ? pagination.perPage : 15
3124
3137
  );
3125
- const [activePage, setActivePage] = React8.useState(0);
3138
+ const [activePage, setActivePage] = React12.useState(0);
3126
3139
  const isServerSide = !!(pagination.enabled && pagination.serverSide);
3127
- const filteredRows = React8.useMemo(() => {
3140
+ const filteredRows = React12.useMemo(() => {
3128
3141
  if (isServerSide || !searchTerm) return rows;
3129
3142
  const term = searchTerm.toLowerCase();
3130
3143
  return rows.filter(
@@ -3133,29 +3146,29 @@ function Table({
3133
3146
  )
3134
3147
  );
3135
3148
  }, [rows, searchTerm, isServerSide]);
3136
- const datasets = React8.useMemo(() => {
3149
+ const datasets = React12.useMemo(() => {
3137
3150
  if (isServerSide) return [rows];
3138
3151
  return createDatasets(filteredRows, pagination.enabled ? perPage : null);
3139
3152
  }, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
3140
- const MAX_PAGE = React8.useMemo(() => {
3153
+ const MAX_PAGE = React12.useMemo(() => {
3141
3154
  if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
3142
3155
  if (isServerSide && typeof pagination.totalCount === "number")
3143
3156
  return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
3144
3157
  return datasets.length ? datasets.length - 1 : 0;
3145
3158
  }, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
3146
- const currentPageRows = React8.useMemo(() => {
3159
+ const currentPageRows = React12.useMemo(() => {
3147
3160
  if (isServerSide) return rows;
3148
3161
  return datasets[activePage] ?? [];
3149
3162
  }, [isServerSide, rows, datasets, activePage]);
3150
- React8.useEffect(() => {
3163
+ React12.useEffect(() => {
3151
3164
  if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
3152
3165
  setPerPage(pagination.perPage);
3153
3166
  }
3154
3167
  }, [pagination.enabled, pagination.perPage, isServerSide]);
3155
- React8.useEffect(() => {
3168
+ React12.useEffect(() => {
3156
3169
  if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
3157
3170
  }, [isServerSide, pagination.perPage]);
3158
- React8.useEffect(() => {
3171
+ React12.useEffect(() => {
3159
3172
  if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
3160
3173
  setActivePage(pagination.page - 1);
3161
3174
  }, [isServerSide, pagination.page]);
@@ -3239,7 +3252,7 @@ function TableSkeletonBody({
3239
3252
  )) });
3240
3253
  }
3241
3254
  function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
3242
- const id = React8.useId();
3255
+ const id = React12.useId();
3243
3256
  return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
3244
3257
  SwitchPrimitive__namespace.Root,
3245
3258
  {
@@ -3423,22 +3436,38 @@ function Sidebar({
3423
3436
  }
3424
3437
  ) });
3425
3438
  }
3426
- var MegaMenuContext = React8.createContext({ align: "start" });
3427
- function MegaMenu({ children, align = "start", delayDuration = 200, className = "", style, "aria-label": ariaLabel }) {
3428
- return /* @__PURE__ */ jsxRuntime.jsx(MegaMenuContext.Provider, { value: { align }, children: /* @__PURE__ */ jsxRuntime.jsx(
3429
- NavigationMenu__namespace.Root,
3430
- {
3431
- delayDuration,
3432
- "aria-label": ariaLabel,
3433
- className: ["relative z-10 flex w-full", className].filter(Boolean).join(" "),
3434
- style,
3435
- children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.List, { className: "flex items-center gap-1", children })
3436
- }
3437
- ) });
3439
+ var MegaMenuContext = React12.createContext({ align: "start" });
3440
+ function MegaMenu({
3441
+ children,
3442
+ align = "start",
3443
+ delayDuration = 200,
3444
+ responsive = true,
3445
+ mobileLabel = "Menu",
3446
+ className = "",
3447
+ style,
3448
+ "aria-label": ariaLabel
3449
+ }) {
3450
+ return /* @__PURE__ */ jsxRuntime.jsxs(MegaMenuContext.Provider, { value: { align }, children: [
3451
+ /* @__PURE__ */ jsxRuntime.jsx(
3452
+ NavigationMenu__namespace.Root,
3453
+ {
3454
+ delayDuration,
3455
+ "aria-label": ariaLabel,
3456
+ className: [
3457
+ "relative z-10 w-full",
3458
+ responsive ? "hidden md:flex" : "flex",
3459
+ className
3460
+ ].filter(Boolean).join(" "),
3461
+ style,
3462
+ children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.List, { className: "flex items-center gap-1", children })
3463
+ }
3464
+ ),
3465
+ responsive && /* @__PURE__ */ jsxRuntime.jsx(MegaMenuMobile, { label: mobileLabel, children })
3466
+ ] });
3438
3467
  }
3439
3468
  var TOP_ITEM = "group/top inline-flex items-center gap-1.5 h-10 px-3 rounded-md text-sm font-medium select-none text-foreground-secondary hover:text-foreground hover:bg-surface-raised data-[state=open]:text-accent data-[active]:text-accent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent";
3440
3469
  function MegaMenuItem({ label, icon, href, children, className = "" }) {
3441
- const { align } = React8.useContext(MegaMenuContext);
3470
+ const { align } = React12.useContext(MegaMenuContext);
3442
3471
  const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
3443
3472
  if (!children) {
3444
3473
  return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
@@ -3475,18 +3504,24 @@ function MegaMenuItem({ label, icon, href, children, className = "" }) {
3475
3504
  ] });
3476
3505
  }
3477
3506
  function MegaMenuPanel({ children, columns, className = "", style }) {
3478
- const maxWidth = columns ? `${columns * 248}px` : "min(92vw, 880px)";
3507
+ const layout = columns ? {
3508
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
3509
+ width: `min(92vw, ${columns * 272}px)`
3510
+ } : {
3511
+ gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))",
3512
+ width: "min(92vw, 760px)"
3513
+ };
3479
3514
  return /* @__PURE__ */ jsxRuntime.jsx(
3480
3515
  "div",
3481
3516
  {
3482
- className: ["flex flex-wrap gap-6 p-6", className].filter(Boolean).join(" "),
3483
- style: { maxWidth, ...style },
3517
+ className: ["grid gap-6 p-6", className].filter(Boolean).join(" "),
3518
+ style: { ...layout, maxWidth: "min(92vw, 960px)", ...style },
3484
3519
  children
3485
3520
  }
3486
3521
  );
3487
3522
  }
3488
3523
  function MegaMenuSection({ title, children, className = "" }) {
3489
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["min-w-[200px] flex flex-col", className].filter(Boolean).join(" "), children: [
3524
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["min-w-0 flex flex-col", className].filter(Boolean).join(" "), children: [
3490
3525
  title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 pb-1.5 text-[11px] font-semibold uppercase tracking-widest text-foreground-muted select-none", children: title }),
3491
3526
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children })
3492
3527
  ] });
@@ -3515,7 +3550,124 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
3515
3550
  );
3516
3551
  }
3517
3552
  function MegaMenuFeatured({ children, className = "" }) {
3518
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["min-w-[220px] rounded-lg bg-surface-raised border border-border p-4 flex flex-col", className].filter(Boolean).join(" "), children });
3553
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["min-w-0 rounded-lg bg-surface-raised border border-border p-4 flex flex-col", className].filter(Boolean).join(" "), children });
3554
+ }
3555
+ var elementsOfType = (children, type) => React12__default.default.Children.toArray(children).filter(
3556
+ (c) => React12__default.default.isValidElement(c) && c.type === type
3557
+ );
3558
+ var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
3559
+ "svg",
3560
+ {
3561
+ viewBox: "0 0 24 24",
3562
+ fill: "none",
3563
+ stroke: "currentColor",
3564
+ strokeWidth: 2,
3565
+ "aria-hidden": "true",
3566
+ className: "h-4 w-4 flex-shrink-0 text-foreground-muted transition-transform duration-200",
3567
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
3568
+ }
3569
+ );
3570
+ function MobileLinkRow({ link, onNavigate }) {
3571
+ const { href, icon, description, active, onClick, children } = link.props;
3572
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3573
+ "a",
3574
+ {
3575
+ href,
3576
+ onClick: (e) => {
3577
+ onClick?.(e);
3578
+ onNavigate();
3579
+ },
3580
+ "data-active": active ? "" : void 0,
3581
+ className: "flex items-start gap-3 rounded-md p-2.5 transition-colors select-none\n hover:bg-surface-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-accent\n data-[active]:bg-surface-raised",
3582
+ children: [
3583
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md bg-surface-raised text-accent", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-[17px] w-[17px] inline-flex items-center justify-center", children: icon }) }),
3584
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col min-w-0", children: [
3585
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground data-[active]:text-accent", children }),
3586
+ description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-foreground-muted leading-snug mt-0.5", children: description })
3587
+ ] })
3588
+ ]
3589
+ }
3590
+ );
3591
+ }
3592
+ function MobilePanel({ panel, onNavigate }) {
3593
+ const nodes = React12__default.default.Children.toArray(panel.props.children);
3594
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
3595
+ if (!React12__default.default.isValidElement(node)) return null;
3596
+ const el = node;
3597
+ if (el.type === MegaMenuSection) {
3598
+ const { title, children } = el.props;
3599
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
3600
+ title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2.5 pb-1 text-[11px] font-semibold uppercase tracking-widest text-foreground-muted select-none", children: title }),
3601
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children: elementsOfType(children, MegaMenuLink).map((lnk, j) => /* @__PURE__ */ jsxRuntime.jsx(MobileLinkRow, { link: lnk, onNavigate }, j)) })
3602
+ ] }, i);
3603
+ }
3604
+ if (el.type === MegaMenuFeatured) {
3605
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg bg-surface-raised border border-border p-3 flex flex-col", children: el.props.children }, i);
3606
+ }
3607
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: node }, i);
3608
+ }) });
3609
+ }
3610
+ function MegaMenuMobile({
3611
+ children,
3612
+ label
3613
+ }) {
3614
+ const [open, setOpen] = React12.useState(false);
3615
+ const [expanded, setExpanded] = React12.useState(null);
3616
+ const items = elementsOfType(children, MegaMenuItem);
3617
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
3618
+ /* @__PURE__ */ jsxRuntime.jsxs(
3619
+ "button",
3620
+ {
3621
+ type: "button",
3622
+ onClick: () => setOpen((o) => !o),
3623
+ "aria-expanded": open,
3624
+ className: "inline-flex items-center gap-2 h-10 px-3 rounded-md text-sm font-medium\n text-foreground-secondary hover:text-foreground hover:bg-surface-raised\n focus:outline-none focus-visible:ring-2 focus-visible:ring-accent transition-colors",
3625
+ children: [
3626
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", className: "h-5 w-5", children: open ? /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) : /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 7h16M4 12h16M4 17h16" }) }),
3627
+ label
3628
+ ]
3629
+ }
3630
+ ),
3631
+ open && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 overflow-hidden rounded-lg border border-border bg-surface shadow-lg", children: items.map((item, i) => {
3632
+ const { label: itemLabel, icon, href, children: panel } = item.props;
3633
+ const hasPanel = panel != null;
3634
+ const isOpen = expanded === i;
3635
+ const rowBase = "flex w-full items-center gap-2 px-3 h-11 text-sm font-medium text-foreground-secondary hover:bg-surface-raised hover:text-foreground transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent";
3636
+ const divider = i > 0 ? "border-t border-border" : "";
3637
+ if (!hasPanel) {
3638
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3639
+ "a",
3640
+ {
3641
+ href,
3642
+ onClick: () => setOpen(false),
3643
+ className: [rowBase, divider].filter(Boolean).join(" "),
3644
+ children: [
3645
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-4 w-4 flex-shrink-0 items-center justify-center", children: icon }),
3646
+ itemLabel
3647
+ ]
3648
+ },
3649
+ i
3650
+ );
3651
+ }
3652
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: divider || void 0, children: [
3653
+ /* @__PURE__ */ jsxRuntime.jsxs(
3654
+ "button",
3655
+ {
3656
+ type: "button",
3657
+ onClick: () => setExpanded(isOpen ? null : i),
3658
+ "aria-expanded": isOpen,
3659
+ className: [rowBase, isOpen ? "text-accent" : ""].filter(Boolean).join(" "),
3660
+ children: [
3661
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-4 w-4 flex-shrink-0 items-center justify-center", children: icon }),
3662
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-left", children: itemLabel }),
3663
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: isOpen ? "rotate-180" : "", children: MOBILE_CHEVRON })
3664
+ ]
3665
+ }
3666
+ ),
3667
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx(MobilePanel, { panel, onNavigate: () => setOpen(false) })
3668
+ ] }, i);
3669
+ }) })
3670
+ ] });
3519
3671
  }
3520
3672
  MegaMenu.Item = MegaMenuItem;
3521
3673
  MegaMenu.Panel = MegaMenuPanel;
@@ -3533,17 +3685,17 @@ function AppShell({
3533
3685
  children,
3534
3686
  className = ""
3535
3687
  }) {
3536
- const [expanded, setExpanded] = React8.useState(sidebarDefaultExpanded);
3537
- const [isMobile, setIsMobile] = React8.useState(false);
3538
- const [mobileOpen, setMobileOpen] = React8.useState(false);
3539
- React8.useEffect(() => {
3688
+ const [expanded, setExpanded] = React12.useState(sidebarDefaultExpanded);
3689
+ const [isMobile, setIsMobile] = React12.useState(false);
3690
+ const [mobileOpen, setMobileOpen] = React12.useState(false);
3691
+ React12.useEffect(() => {
3540
3692
  const mq = window.matchMedia("(max-width: 767px)");
3541
3693
  const update = (e) => setIsMobile(e.matches);
3542
3694
  update(mq);
3543
3695
  mq.addEventListener("change", update);
3544
3696
  return () => mq.removeEventListener("change", update);
3545
3697
  }, []);
3546
- React8.useEffect(() => {
3698
+ React12.useEffect(() => {
3547
3699
  if (!isMobile) setMobileOpen(false);
3548
3700
  }, [isMobile]);
3549
3701
  const hasSidebar = sidebarSections.length > 0;
@@ -3733,10 +3885,10 @@ function ThemeProvider({
3733
3885
  className = "",
3734
3886
  style
3735
3887
  }) {
3736
- const id = React8__default.default.useId().replace(/:/g, "");
3888
+ const id = React12__default.default.useId().replace(/:/g, "");
3737
3889
  const scopeClass = `geo-th-${id}`;
3738
- const divRef = React8.useRef(null);
3739
- React8.useEffect(() => {
3890
+ const divRef = React12.useRef(null);
3891
+ React12.useEffect(() => {
3740
3892
  const el = divRef.current;
3741
3893
  if (!el) return;
3742
3894
  if (colorScheme === "auto") return;
@@ -3751,8 +3903,8 @@ function ThemeProvider({
3751
3903
  }
3752
3904
  el.classList.toggle("dark", colorScheme === "dark");
3753
3905
  }, [colorScheme]);
3754
- const lightVars = React8.useMemo(() => toCssVars(theme), [theme]);
3755
- const darkVarStr = React8.useMemo(() => {
3906
+ const lightVars = React12.useMemo(() => toCssVars(theme), [theme]);
3907
+ const darkVarStr = React12.useMemo(() => {
3756
3908
  if (!darkTheme) return "";
3757
3909
  const dvars = toCssVars(darkTheme);
3758
3910
  if (!Object.keys(dvars).length) return "";
@@ -3792,7 +3944,7 @@ function TextInput({
3792
3944
  prefix,
3793
3945
  suffix
3794
3946
  }) {
3795
- const errorId = React8.useId();
3947
+ const errorId = React12.useId();
3796
3948
  const hasError = errorMessage != null;
3797
3949
  const hasAdornment = prefix != null || suffix != null;
3798
3950
  const input = /* @__PURE__ */ jsxRuntime.jsx(
@@ -3862,7 +4014,7 @@ function NumberInput({
3862
4014
  readOnly = false,
3863
4015
  precision
3864
4016
  }) {
3865
- const errorId = React8.useId();
4017
+ const errorId = React12.useId();
3866
4018
  const hasError = errorMessage != null;
3867
4019
  const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
3868
4020
  const round = (n) => {
@@ -3993,8 +4145,8 @@ function Password({
3993
4145
  showIcon,
3994
4146
  hideIcon
3995
4147
  }) {
3996
- const [visible, setVisible] = React8.useState(false);
3997
- const errorId = React8.useId();
4148
+ const [visible, setVisible] = React12.useState(false);
4149
+ const errorId = React12.useId();
3998
4150
  const hasError = errorMessage != null;
3999
4151
  return /* @__PURE__ */ jsxRuntime.jsx(
4000
4152
  Field,
@@ -4067,7 +4219,7 @@ function Checkbox({
4067
4219
  }) {
4068
4220
  const isChecked = checked ?? value ?? false;
4069
4221
  const labelFirst = labelPosition === "left";
4070
- const errorId = React8.useId();
4222
+ const errorId = React12.useId();
4071
4223
  const hasError = errorMessage != null;
4072
4224
  const box = /* @__PURE__ */ jsxRuntime.jsx(
4073
4225
  CheckboxPrimitive__namespace.Root,
@@ -4175,8 +4327,8 @@ function RadioGroup({
4175
4327
  className,
4176
4328
  errorMessage
4177
4329
  }) {
4178
- const errorId = React8.useId();
4179
- const groupId = React8.useId();
4330
+ const errorId = React12.useId();
4331
+ const groupId = React12.useId();
4180
4332
  const hasError = errorMessage != null;
4181
4333
  const labelFirst = labelPosition === "left";
4182
4334
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4276,11 +4428,11 @@ function Switch({
4276
4428
  disabled,
4277
4429
  errorMessage
4278
4430
  }) {
4279
- const id = React8.useId();
4280
- const errorId = React8.useId();
4431
+ const id = React12.useId();
4432
+ const errorId = React12.useId();
4281
4433
  const hasError = errorMessage != null;
4282
4434
  const isControlled = checked !== void 0;
4283
- const [internal, setInternal] = React8.useState(defaultChecked);
4435
+ const [internal, setInternal] = React12.useState(defaultChecked);
4284
4436
  const isOn = isControlled ? checked : internal;
4285
4437
  const handle = (c) => {
4286
4438
  if (!isControlled) setInternal(c);
@@ -4353,19 +4505,19 @@ function AutoComplete({
4353
4505
  required,
4354
4506
  htmlFor
4355
4507
  }) {
4356
- const errorId = React8.useId();
4508
+ const errorId = React12.useId();
4357
4509
  const hasError = errorMessage != null;
4358
- const [term, setTerm] = React8.useState("");
4359
- const [open, setOpen] = React8.useState(false);
4360
- const [asyncItems, setAsyncItems] = React8.useState([]);
4361
- const [loading, setLoading] = React8.useState(false);
4510
+ const [term, setTerm] = React12.useState("");
4511
+ const [open, setOpen] = React12.useState(false);
4512
+ const [asyncItems, setAsyncItems] = React12.useState([]);
4513
+ const [loading, setLoading] = React12.useState(false);
4362
4514
  const isAsync = typeof onSearch === "function";
4363
- const debounceRef = React8.useRef(null);
4364
- const requestIdRef = React8.useRef(0);
4515
+ const debounceRef = React12.useRef(null);
4516
+ const requestIdRef = React12.useRef(0);
4365
4517
  const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
4366
4518
  ({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
4367
4519
  ) : [];
4368
- React8.useEffect(() => {
4520
+ React12.useEffect(() => {
4369
4521
  if (!isAsync) return;
4370
4522
  if (debounceRef.current) clearTimeout(debounceRef.current);
4371
4523
  if (!term.trim()) {
@@ -4521,15 +4673,15 @@ function TreeSelect({
4521
4673
  defaultExpandedKeys = [],
4522
4674
  size = "md"
4523
4675
  }) {
4524
- const errorId = React8.useId();
4676
+ const errorId = React12.useId();
4525
4677
  const hasError = errorMessage != null;
4526
- const [open, setOpen] = React8.useState(false);
4527
- const [expanded, setExpanded] = React8.useState(() => new Set(defaultExpandedKeys));
4528
- const [activeIndex, setActiveIndex] = React8.useState(0);
4529
- const listRef = React8.useRef(null);
4530
- const visible = React8.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
4531
- const didSyncOnOpenRef = React8.useRef(false);
4532
- React8.useEffect(() => {
4678
+ const [open, setOpen] = React12.useState(false);
4679
+ const [expanded, setExpanded] = React12.useState(() => new Set(defaultExpandedKeys));
4680
+ const [activeIndex, setActiveIndex] = React12.useState(0);
4681
+ const listRef = React12.useRef(null);
4682
+ const visible = React12.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
4683
+ const didSyncOnOpenRef = React12.useRef(false);
4684
+ React12.useEffect(() => {
4533
4685
  if (!open) {
4534
4686
  didSyncOnOpenRef.current = false;
4535
4687
  return;
@@ -4539,7 +4691,7 @@ function TreeSelect({
4539
4691
  setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
4540
4692
  didSyncOnOpenRef.current = true;
4541
4693
  }, [open, value]);
4542
- const selectedNode = React8.useMemo(
4694
+ const selectedNode = React12.useMemo(
4543
4695
  () => value != null ? findNodeByKey(items, value) : null,
4544
4696
  [items, value]
4545
4697
  );
@@ -4770,11 +4922,11 @@ function FileInput({
4770
4922
  required,
4771
4923
  icon
4772
4924
  }) {
4773
- const inputRef = React8.useRef(null);
4774
- const errorId = React8.useId();
4775
- const [files, setFiles] = React8.useState([]);
4776
- const [dragging, setDragging] = React8.useState(false);
4777
- const [sizeError, setSizeError] = React8.useState(null);
4925
+ const inputRef = React12.useRef(null);
4926
+ const errorId = React12.useId();
4927
+ const [files, setFiles] = React12.useState([]);
4928
+ const [dragging, setDragging] = React12.useState(false);
4929
+ const [sizeError, setSizeError] = React12.useState(null);
4778
4930
  const effectiveError = errorMessage ?? sizeError ?? void 0;
4779
4931
  const openPicker = () => {
4780
4932
  if (!disabled) inputRef.current?.click();
@@ -4965,30 +5117,30 @@ function DatePicker({
4965
5117
  size = "md",
4966
5118
  className = ""
4967
5119
  }) {
4968
- const errorId = React8.useId();
5120
+ const errorId = React12.useId();
4969
5121
  const hasError = errorMessage != null;
4970
- const [open, setOpen] = React8.useState(false);
4971
- const [viewMonth, setViewMonth] = React8.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
4972
- const [focusDate, setFocusDate] = React8.useState(() => value ?? /* @__PURE__ */ new Date());
4973
- const [view, setView] = React8.useState("days");
4974
- const gridRef = React8.useRef(null);
4975
- React8.useEffect(() => {
5122
+ const [open, setOpen] = React12.useState(false);
5123
+ const [viewMonth, setViewMonth] = React12.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
5124
+ const [focusDate, setFocusDate] = React12.useState(() => value ?? /* @__PURE__ */ new Date());
5125
+ const [view, setView] = React12.useState("days");
5126
+ const gridRef = React12.useRef(null);
5127
+ React12.useEffect(() => {
4976
5128
  if (!open) return;
4977
5129
  const target = value ?? /* @__PURE__ */ new Date();
4978
5130
  setViewMonth(startOfMonth(target));
4979
5131
  setFocusDate(target);
4980
5132
  setView("days");
4981
5133
  }, [open, value]);
4982
- React8.useEffect(() => {
5134
+ React12.useEffect(() => {
4983
5135
  if (!open) return;
4984
5136
  const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat(focusDate)}"]`);
4985
5137
  cell?.focus();
4986
5138
  }, [open, focusDate]);
4987
- const weekdays = React8.useMemo(() => {
5139
+ const weekdays = React12.useMemo(() => {
4988
5140
  const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
4989
5141
  return ordered;
4990
5142
  }, [weekStartsOn]);
4991
- const grid = React8.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
5143
+ const grid = React12.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
4992
5144
  const isDisabled = (d) => {
4993
5145
  if (min && d < min) return true;
4994
5146
  if (max && d > max) return true;
@@ -5278,10 +5430,10 @@ function TextArea({
5278
5430
  style,
5279
5431
  inputStyle
5280
5432
  }) {
5281
- const errorId = React8.useId();
5433
+ const errorId = React12.useId();
5282
5434
  const hasError = errorMessage != null;
5283
- const ref = React8.useRef(null);
5284
- React8.useLayoutEffect(() => {
5435
+ const ref = React12.useRef(null);
5436
+ React12.useLayoutEffect(() => {
5285
5437
  if (!autoGrow) return;
5286
5438
  const el = ref.current;
5287
5439
  if (!el) return;
@@ -5351,11 +5503,11 @@ function SegmentedControl({
5351
5503
  "aria-label": ariaLabel
5352
5504
  }) {
5353
5505
  const sz = SIZE2[size];
5354
- const groupId = React8.useId();
5355
- const errorId = React8.useId();
5506
+ const groupId = React12.useId();
5507
+ const errorId = React12.useId();
5356
5508
  const hasError = errorMessage != null;
5357
5509
  const isControlled = value !== void 0;
5358
- const [internal, setInternal] = React8.useState(defaultValue);
5510
+ const [internal, setInternal] = React12.useState(defaultValue);
5359
5511
  const current = isControlled ? value : internal;
5360
5512
  const handle = (v) => {
5361
5513
  if (!v) return;
@@ -5449,14 +5601,14 @@ function Slider({
5449
5601
  name,
5450
5602
  htmlFor
5451
5603
  }) {
5452
- const errorId = React8.useId();
5604
+ const errorId = React12.useId();
5453
5605
  const hasError = errorMessage != null;
5454
5606
  const isRange = Array.isArray(value ?? defaultValue);
5455
- const [internal, setInternal] = React8.useState(
5607
+ const [internal, setInternal] = React12.useState(
5456
5608
  () => toArray(value) ?? toArray(defaultValue) ?? [min]
5457
5609
  );
5458
5610
  const current = toArray(value) ?? internal;
5459
- const [dragging, setDragging] = React8.useState(false);
5611
+ const [dragging, setDragging] = React12.useState(false);
5460
5612
  const emit = (arr) => {
5461
5613
  setInternal(arr);
5462
5614
  const next = isRange ? [arr[0], arr[1]] : arr[0];
@@ -5551,11 +5703,11 @@ function TagsInput({
5551
5703
  validate,
5552
5704
  separators = ["Enter", ","]
5553
5705
  }) {
5554
- const errorId = React8.useId();
5555
- const inputRef = React8.useRef(null);
5556
- const [internal, setInternal] = React8.useState(defaultValue ?? []);
5557
- const [draft, setDraft] = React8.useState("");
5558
- const [localError, setLocalError] = React8.useState(null);
5706
+ const errorId = React12.useId();
5707
+ const inputRef = React12.useRef(null);
5708
+ const [internal, setInternal] = React12.useState(defaultValue ?? []);
5709
+ const [draft, setDraft] = React12.useState("");
5710
+ const [localError, setLocalError] = React12.useState(null);
5559
5711
  const tags = value ?? internal;
5560
5712
  const hasError = errorMessage != null || localError != null;
5561
5713
  const errorText = errorMessage ?? localError ?? void 0;
@@ -5686,9 +5838,9 @@ function OtpInput({
5686
5838
  className,
5687
5839
  groupAfter
5688
5840
  }) {
5689
- const errorId = React8.useId();
5841
+ const errorId = React12.useId();
5690
5842
  const hasError = errorMessage != null;
5691
- const refs = React8.useRef([]);
5843
+ const refs = React12.useRef([]);
5692
5844
  const chars = Array.from({ length }, (_, i) => value[i] ?? "");
5693
5845
  const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
5694
5846
  const emit = (next) => {
@@ -5737,7 +5889,7 @@ function OtpInput({
5737
5889
  emit(valid.join(""));
5738
5890
  focusBox(valid.length);
5739
5891
  };
5740
- return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React8__default.default.Fragment, { children: [
5892
+ return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React12__default.default.Fragment, { children: [
5741
5893
  /* @__PURE__ */ jsxRuntime.jsx(
5742
5894
  "input",
5743
5895
  {
@@ -5795,9 +5947,9 @@ function Rating({
5795
5947
  className,
5796
5948
  required
5797
5949
  }) {
5798
- const errorId = React8.useId();
5799
- const [internal, setInternal] = React8.useState(defaultValue);
5800
- const [hover, setHover] = React8.useState(null);
5950
+ const errorId = React12.useId();
5951
+ const [internal, setInternal] = React12.useState(defaultValue);
5952
+ const [hover, setHover] = React12.useState(null);
5801
5953
  const current = value ?? internal;
5802
5954
  const display2 = hover ?? current;
5803
5955
  const interactive = !readOnly && !disabled;
@@ -5920,9 +6072,9 @@ function TimePicker({
5920
6072
  required,
5921
6073
  style
5922
6074
  }) {
5923
- const errorId = React8.useId();
6075
+ const errorId = React12.useId();
5924
6076
  const hasError = errorMessage != null;
5925
- const [open, setOpen] = React8.useState(false);
6077
+ const [open, setOpen] = React12.useState(false);
5926
6078
  const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
5927
6079
  const update = (next) => {
5928
6080
  const merged = { ...parsed, ...next };
@@ -6046,13 +6198,13 @@ function DateRangePicker({
6046
6198
  required,
6047
6199
  style
6048
6200
  }) {
6049
- const errorId = React8.useId();
6201
+ const errorId = React12.useId();
6050
6202
  const hasError = errorMessage != null;
6051
- const [open, setOpen] = React8.useState(false);
6052
- const [leftMonth, setLeftMonth] = React8.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
6053
- const [pendingStart, setPendingStart] = React8.useState(null);
6054
- const [hoverDate, setHoverDate] = React8.useState(null);
6055
- const weekdays = React8.useMemo(
6203
+ const [open, setOpen] = React12.useState(false);
6204
+ const [leftMonth, setLeftMonth] = React12.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
6205
+ const [pendingStart, setPendingStart] = React12.useState(null);
6206
+ const [hoverDate, setHoverDate] = React12.useState(null);
6207
+ const weekdays = React12.useMemo(
6056
6208
  () => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
6057
6209
  [weekStartsOn]
6058
6210
  );
@@ -6228,10 +6380,10 @@ function ColorPicker({
6228
6380
  required,
6229
6381
  placeholder = "Pick a colour\u2026"
6230
6382
  }) {
6231
- const errorId = React8.useId();
6383
+ const errorId = React12.useId();
6232
6384
  const hasError = errorMessage != null;
6233
- const [open, setOpen] = React8.useState(false);
6234
- const [draft, setDraft] = React8.useState(value);
6385
+ const [open, setOpen] = React12.useState(false);
6386
+ const [draft, setDraft] = React12.useState(value);
6235
6387
  const valid = HEX_RE.test(value);
6236
6388
  const pick = (hex) => {
6237
6389
  onChange?.(hex);
@@ -6618,11 +6770,11 @@ function buildBindings(store, name, kind, snap) {
6618
6770
 
6619
6771
  // src/form/useForm.ts
6620
6772
  function useForm(options = {}) {
6621
- const ref = React8.useRef(null);
6773
+ const ref = React12.useRef(null);
6622
6774
  if (ref.current === null) ref.current = new FormStore(options);
6623
6775
  const store = ref.current;
6624
- React8.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
6625
- const make = React8.useCallback(
6776
+ React12.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
6777
+ const make = React12.useCallback(
6626
6778
  (kind) => (name, rules) => {
6627
6779
  if (rules !== void 0) store.setRule(name, rules);
6628
6780
  return buildBindings(store, name, kind, store.getFieldSnapshot(name));
@@ -6651,9 +6803,9 @@ function useForm(options = {}) {
6651
6803
  fieldTarget: make("target")
6652
6804
  };
6653
6805
  }
6654
- var FormContext = React8.createContext(null);
6806
+ var FormContext = React12.createContext(null);
6655
6807
  function useFormStore() {
6656
- const store = React8.useContext(FormContext);
6808
+ const store = React12.useContext(FormContext);
6657
6809
  if (!store) {
6658
6810
  throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
6659
6811
  }
@@ -6667,8 +6819,8 @@ function Form({
6667
6819
  children,
6668
6820
  ...rest
6669
6821
  }) {
6670
- const ref = React8.useRef(null);
6671
- const bypass = React8.useRef(false);
6822
+ const ref = React12.useRef(null);
6823
+ const bypass = React12.useRef(false);
6672
6824
  const handleSubmit = async (e) => {
6673
6825
  if (bypass.current) {
6674
6826
  bypass.current = false;
@@ -6720,12 +6872,12 @@ function useFormField(name, options = {}) {
6720
6872
  const store = useFormStore();
6721
6873
  const { kind = "value", rules } = options;
6722
6874
  if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
6723
- React8.useEffect(() => {
6875
+ React12.useEffect(() => {
6724
6876
  return () => {
6725
6877
  if (rules !== void 0) store.removeRule(name);
6726
6878
  };
6727
6879
  }, [store, name]);
6728
- const snap = React8.useSyncExternalStore(
6880
+ const snap = React12.useSyncExternalStore(
6729
6881
  store.subscribe,
6730
6882
  () => store.getFieldSnapshot(name)
6731
6883
  );
@@ -6737,7 +6889,7 @@ function FormField({ name, kind, rules, children }) {
6737
6889
  }
6738
6890
  function useFieldArray(name) {
6739
6891
  const store = useFormStore();
6740
- React8.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
6892
+ React12.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
6741
6893
  const arr = store.getValue(name) ?? [];
6742
6894
  const keys = store.getKeys(name);
6743
6895
  return {
@@ -6860,7 +7012,7 @@ function CreditCardForm({
6860
7012
  className = "",
6861
7013
  style
6862
7014
  }) {
6863
- const initial = React8.useRef({
7015
+ const initial = React12.useRef({
6864
7016
  number: formatCardNumber(defaultValue?.number ?? ""),
6865
7017
  name: defaultValue?.name ?? "",
6866
7018
  expiry: formatExpiry(defaultValue?.expiry ?? ""),
@@ -6869,7 +7021,7 @@ function CreditCardForm({
6869
7021
  const form = useForm({ initialValues: initial });
6870
7022
  const numberStr = String(form.values.number ?? "");
6871
7023
  const brand = detectBrand(numberStr);
6872
- React8.useEffect(() => {
7024
+ React12.useEffect(() => {
6873
7025
  onChange?.(toCard(form.values));
6874
7026
  }, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
6875
7027
  const numberBind = form.fieldNative("number", {