@geomak/ui 1.9.0 → 2.0.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.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 React9 = require('react');
5
+ var React8 = require('react');
6
6
  var reactDom = require('react-dom');
7
7
  var Dialog = require('@radix-ui/react-dialog');
8
8
  var framerMotion = require('framer-motion');
@@ -11,6 +11,7 @@ var TabsPrimitive = require('@radix-ui/react-tabs');
11
11
  var Accordion = require('@radix-ui/react-accordion');
12
12
  var ToggleGroup = require('@radix-ui/react-toggle-group');
13
13
  var Toast = require('@radix-ui/react-toast');
14
+ var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
14
15
  var Popover = require('@radix-ui/react-popover');
15
16
  var SwitchPrimitive = require('@radix-ui/react-switch');
16
17
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
@@ -35,13 +36,14 @@ function _interopNamespace(e) {
35
36
  return Object.freeze(n);
36
37
  }
37
38
 
38
- var React9__default = /*#__PURE__*/_interopDefault(React9);
39
+ var React8__default = /*#__PURE__*/_interopDefault(React8);
39
40
  var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
40
41
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
41
42
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
42
43
  var Accordion__namespace = /*#__PURE__*/_interopNamespace(Accordion);
43
44
  var ToggleGroup__namespace = /*#__PURE__*/_interopNamespace(ToggleGroup);
44
45
  var Toast__namespace = /*#__PURE__*/_interopNamespace(Toast);
46
+ var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenuPrimitive);
45
47
  var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
46
48
  var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
47
49
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
@@ -206,8 +208,8 @@ Icon.Copy = Copy;
206
208
  Icon.CircleStack = CircleStack;
207
209
  var icons_default = Icon;
208
210
  function Portal({ children, target }) {
209
- const [resolved, setResolved] = React9.useState(null);
210
- React9.useEffect(() => {
211
+ const [resolved, setResolved] = React8.useState(null);
212
+ React8.useEffect(() => {
211
213
  if (target === null) {
212
214
  setResolved(null);
213
215
  return;
@@ -227,7 +229,7 @@ function IconButton({
227
229
  loading = false,
228
230
  loadingIcon
229
231
  }) {
230
- const colorScheme = React9.useMemo(() => {
232
+ const colorScheme = React8.useMemo(() => {
231
233
  if (type === "primary") {
232
234
  return "bg-accent text-accent-fg hover:bg-accent-hover";
233
235
  }
@@ -540,11 +542,11 @@ function Tabs({
540
542
  tabsClosable = true,
541
543
  defaultActiveTab
542
544
  }) {
543
- const [value, setValue] = React9.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
544
- React9.useEffect(() => {
545
+ const [value, setValue] = React8.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
546
+ React8.useEffect(() => {
545
547
  if (defaultActiveTab) setValue(defaultActiveTab);
546
548
  }, [defaultActiveTab]);
547
- React9.useEffect(() => {
549
+ React8.useEffect(() => {
548
550
  if (tabs.length === 0) {
549
551
  setValue("");
550
552
  return;
@@ -793,7 +795,7 @@ function ToggleButton({ items, onChange, activeKey }) {
793
795
  }
794
796
  );
795
797
  }
796
- var NotificationContext = React9.createContext({
798
+ var NotificationContext = React8.createContext({
797
799
  open: () => void 0,
798
800
  close: () => void 0
799
801
  });
@@ -851,7 +853,7 @@ function NotificationItem({
851
853
  onClose,
852
854
  reduced
853
855
  }) {
854
- const [hovered, setHovered] = React9.useState(false);
856
+ const [hovered, setHovered] = React8.useState(false);
855
857
  const initial = getInitialMotion(pos, reduced);
856
858
  const center = pos.endsWith("center");
857
859
  const duration = n.duration ?? 4e3;
@@ -932,7 +934,7 @@ function NotificationProvider({
932
934
  children,
933
935
  position = "top-right"
934
936
  }) {
935
- const [notifications, setNotifications] = React9.useState([]);
937
+ const [notifications, setNotifications] = React8.useState([]);
936
938
  const reduced = framerMotion.useReducedMotion();
937
939
  const open = (payload) => {
938
940
  setNotifications((prev) => [
@@ -968,7 +970,7 @@ function NotificationProvider({
968
970
  ] }) });
969
971
  }
970
972
  function useNotification() {
971
- const { open } = React9.useContext(NotificationContext);
973
+ const { open } = React8.useContext(NotificationContext);
972
974
  return {
973
975
  info: (props) => open({ type: "info", ...props }),
974
976
  success: (props) => open({ type: "success", ...props }),
@@ -1081,10 +1083,10 @@ function FadingBase({
1081
1083
  isMounted = false,
1082
1084
  children
1083
1085
  }) {
1084
- const [shouldRender, setShouldRender] = React9.useState(isMounted);
1085
- const [visible, setVisible] = React9.useState(false);
1086
- const timerRef = React9.useRef(null);
1087
- React9.useEffect(() => {
1086
+ const [shouldRender, setShouldRender] = React8.useState(isMounted);
1087
+ const [visible, setVisible] = React8.useState(false);
1088
+ const timerRef = React8.useRef(null);
1089
+ React8.useEffect(() => {
1088
1090
  if (isMounted) {
1089
1091
  setShouldRender(true);
1090
1092
  const rafId = requestAnimationFrame(() => setVisible(true));
@@ -1143,9 +1145,9 @@ function ScalableContainer({
1143
1145
  children,
1144
1146
  assignClassOnClick
1145
1147
  }) {
1146
- const containerRef = React9.useRef(null);
1147
- const [isScaled, setScaled] = React9.useState(false);
1148
- const [wrapperClass, setWrapperClass] = React9.useState("");
1148
+ const containerRef = React8.useRef(null);
1149
+ const [isScaled, setScaled] = React8.useState(false);
1150
+ const [wrapperClass, setWrapperClass] = React8.useState("");
1149
1151
  const onClick = () => {
1150
1152
  const next = !isScaled;
1151
1153
  setScaled(next);
@@ -1255,17 +1257,17 @@ function CatalogGrid({ items, buttonText, onOpen }) {
1255
1257
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(GridCard, { item, buttonText, onOpen }, item.key)) });
1256
1258
  }
1257
1259
  function CatalogCarousel({ items, buttonText, onOpen }) {
1258
- const [activeIndex, setActiveIndex] = React9.useState(0);
1259
- const [indexPool, setIndexPool] = React9.useState([]);
1260
- const cardRefs = React9.useRef([]);
1261
- const getIndexes = React9.useMemo(() => {
1260
+ const [activeIndex, setActiveIndex] = React8.useState(0);
1261
+ const [indexPool, setIndexPool] = React8.useState([]);
1262
+ const cardRefs = React8.useRef([]);
1263
+ const getIndexes = React8.useMemo(() => {
1262
1264
  let nextIndex = activeIndex + 1;
1263
1265
  let previousIndex = activeIndex - 1;
1264
1266
  if (activeIndex === 0) previousIndex = items.length - 1;
1265
1267
  if (activeIndex === items.length - 1) nextIndex = 0;
1266
1268
  return { previousIndex, nextIndex };
1267
1269
  }, [activeIndex, items.length]);
1268
- React9.useEffect(() => {
1270
+ React8.useEffect(() => {
1269
1271
  const { nextIndex, previousIndex } = getIndexes;
1270
1272
  let indexes = [previousIndex, activeIndex, nextIndex];
1271
1273
  if (activeIndex !== 0 && activeIndex !== items.length - 1) {
@@ -1387,137 +1389,95 @@ function MenuBar({ items }) {
1387
1389
  )
1388
1390
  );
1389
1391
  }
1390
- function ContextMenu({ items, position, visible, onClose }) {
1391
- const contextRef = React9.useRef(null);
1392
- const childMenuRef = React9.useRef(null);
1393
- const [hasArrowUp, setHasArrowUp] = React9.useState(true);
1394
- const [childArrowUp, setChildArrowUp] = React9.useState(false);
1395
- const [hoveredItem, setHoveredItem] = React9.useState(-1);
1396
- const [hoveredChild, setHoveredChild] = React9.useState(-1);
1397
- const [activeChildren, setActiveChildren] = React9.useState([]);
1398
- React9.useEffect(() => {
1399
- const clickAway = ({ target }) => {
1400
- if (contextRef.current && !contextRef.current.contains(target)) {
1401
- if (childMenuRef.current) {
1402
- childMenuRef.current.classList.add("opacity-0");
1403
- childMenuRef.current.style.left = "0px";
1404
- childMenuRef.current.style.top = "0px";
1405
- }
1406
- setActiveChildren([]);
1407
- onClose();
1408
- }
1409
- };
1410
- window.addEventListener("click", clickAway);
1411
- return () => window.removeEventListener("click", clickAway);
1412
- }, [onClose]);
1413
- React9.useEffect(() => {
1414
- const current = contextRef.current;
1415
- const child = childMenuRef.current;
1416
- if (!current || !child) return;
1417
- const { height, width } = current.getBoundingClientRect();
1418
- if (position.y + height >= window.innerHeight) {
1419
- current.style.top = `${position.y - (height - 40)}px`;
1420
- setHasArrowUp(false);
1421
- } else {
1422
- current.style.top = `${position.y}px`;
1423
- setHasArrowUp(true);
1424
- }
1425
- current.style.left = `${position.x}px`;
1426
- child.style.width = `${width}px`;
1427
- child.classList.add("opacity-0");
1428
- }, [position]);
1429
- const onItemClick = (e, item) => {
1430
- if (item.onClick) {
1431
- if (childMenuRef.current) {
1432
- childMenuRef.current.classList.add("opacity-0");
1433
- childMenuRef.current.style.left = "0px";
1434
- childMenuRef.current.style.top = "0px";
1435
- }
1436
- setActiveChildren([]);
1437
- item.onClick(item.path, item.reportType);
1438
- } else if (item.children?.length) {
1439
- const targetBbox = e.target.getBoundingClientRect();
1440
- const childHeight = childMenuRef.current?.getBoundingClientRect().height ?? 0;
1441
- const contextBbox = contextRef.current?.getBoundingClientRect() ?? { y: 0, width: 0};
1442
- const contextWidth = contextBbox.width;
1443
- if (targetBbox.y + childHeight >= window.innerHeight) {
1444
- setChildArrowUp(false);
1445
- if (childMenuRef.current) childMenuRef.current.style.top = `${targetBbox.y - childHeight}px`;
1446
- } else {
1447
- setChildArrowUp(true);
1448
- if (childMenuRef.current)
1449
- childMenuRef.current.style.top = `${targetBbox.y - contextBbox.y + targetBbox.height / 2 - 10}px`;
1450
- }
1451
- setActiveChildren(item.children);
1452
- if (childMenuRef.current) {
1453
- childMenuRef.current.classList.remove("opacity-0");
1454
- childMenuRef.current.style.left = `${Math.round(contextWidth + 10)}px`;
1392
+ function ContextMenu({ items, children }) {
1393
+ return /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuPrimitive__namespace.Root, { children: [
1394
+ /* @__PURE__ */ jsxRuntime.jsx(ContextMenuPrimitive__namespace.Trigger, { asChild: true, children }),
1395
+ /* @__PURE__ */ jsxRuntime.jsx(ContextMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
1396
+ ContextMenuPrimitive__namespace.Content,
1397
+ {
1398
+ className: CONTENT_CLASSNAME,
1399
+ collisionPadding: 8,
1400
+ children: items.map((item) => renderItem(item))
1455
1401
  }
1456
- }
1457
- };
1458
- if (!visible) return null;
1459
- return /* @__PURE__ */ jsxRuntime.jsxs(
1460
- "div",
1402
+ ) })
1403
+ ] });
1404
+ }
1405
+ var CONTENT_CLASSNAME = [
1406
+ // Surface — semantic tokens, both modes covered
1407
+ "min-w-[180px] rounded-lg border border-border bg-surface shadow-lg",
1408
+ "p-1 z-[500000] text-sm text-foreground",
1409
+ // Entry animation matches the Tooltip / Dropdown style
1410
+ "animate-in fade-in-0 zoom-in-95",
1411
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
1412
+ // Outline reset — Radix handles focus internally
1413
+ "focus:outline-none"
1414
+ ].join(" ");
1415
+ var ITEM_CLASSNAME = [
1416
+ "flex items-center justify-between gap-3 rounded-md px-2 py-1.5 cursor-pointer select-none",
1417
+ "transition-colors duration-100",
1418
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-fg",
1419
+ "data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed data-[disabled]:bg-transparent data-[disabled]:text-foreground-muted",
1420
+ "focus:outline-none"
1421
+ ].join(" ");
1422
+ function renderItem(item) {
1423
+ if (item.children && item.children.length > 0) {
1424
+ return /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuPrimitive__namespace.Sub, { children: [
1425
+ /* @__PURE__ */ jsxRuntime.jsxs(
1426
+ ContextMenuPrimitive__namespace.SubTrigger,
1427
+ {
1428
+ disabled: item.disabled,
1429
+ className: ITEM_CLASSNAME,
1430
+ children: [
1431
+ /* @__PURE__ */ jsxRuntime.jsx(ContextMenuLabel, { icon: item.icon, value: item.value }),
1432
+ /* @__PURE__ */ jsxRuntime.jsx(ChevronRight2, {})
1433
+ ]
1434
+ }
1435
+ ),
1436
+ /* @__PURE__ */ jsxRuntime.jsx(ContextMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
1437
+ ContextMenuPrimitive__namespace.SubContent,
1438
+ {
1439
+ className: CONTENT_CLASSNAME,
1440
+ sideOffset: 2,
1441
+ alignOffset: -4,
1442
+ collisionPadding: 8,
1443
+ children: item.children.map((sub) => renderItem(sub))
1444
+ }
1445
+ ) })
1446
+ ] }, item.key);
1447
+ }
1448
+ return /* @__PURE__ */ jsxRuntime.jsx(
1449
+ ContextMenuPrimitive__namespace.Item,
1461
1450
  {
1462
- ref: contextRef,
1463
- className: `transition-all duration-150 absolute rounded-lg bg-ice text-prussian-blue z-30 flex ${hasArrowUp && hoveredItem === 0 ? "context-arrow-up context-arrow-hovered" : !hasArrowUp && hoveredItem === items.length - 1 ? "context-arrow-down context-arrow-hovered" : hasArrowUp ? "context-arrow-up" : "context-arrow-down"}`,
1464
- children: [
1465
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "z-50", children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
1466
- "li",
1467
- {
1468
- onContextMenu: (e) => e.preventDefault(),
1469
- onMouseEnter: () => setHoveredItem(index),
1470
- onMouseLeave: () => setHoveredItem(-1),
1471
- className: `flex items-center justify-between transition-all duration-300 p-2 cursor-pointer hover:bg-ice-dark ${index === 0 ? "rounded-tl-lg rounded-tr-lg" : ""} ${index === items.length - 1 ? "rounded-bl-lg rounded-br-lg" : ""}`,
1472
- onClick: (e) => onItemClick(e, item),
1473
- children: [
1474
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 pointer-events-none", children: [
1475
- item.icon,
1476
- item.value
1477
- ] }),
1478
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none", children: item.children && /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"], strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) }) })
1479
- ]
1480
- },
1481
- item.key
1482
- )) }),
1483
- /* @__PURE__ */ jsxRuntime.jsx(
1484
- "div",
1485
- {
1486
- ref: childMenuRef,
1487
- className: `transition-all duration-150 absolute rounded-lg bg-ice text-prussian-blue ${childArrowUp && hoveredChild === 0 ? "context-arrow-up context-arrow-hovered" : !childArrowUp && hoveredChild === activeChildren.length - 1 ? "context-arrow-down context-arrow-hovered" : childArrowUp ? "context-arrow-up" : "context-arrow-down"}`,
1488
- children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: activeChildren.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
1489
- "li",
1490
- {
1491
- className: `flex items-center gap-2 p-2 cursor-pointer transition-all duration-150 hover:bg-ice-dark ${index === 0 ? "rounded-tl-lg rounded-tr-lg" : ""} ${index === activeChildren.length - 1 ? "rounded-bl-lg rounded-br-lg" : ""}`,
1492
- onClick: () => item.onClick?.(item.path, item.reportType),
1493
- onMouseEnter: () => setHoveredChild(index),
1494
- onMouseLeave: () => setHoveredChild(-1),
1495
- children: [
1496
- item.icon,
1497
- item.value
1498
- ]
1499
- },
1500
- index
1501
- )) })
1502
- }
1503
- )
1504
- ]
1505
- }
1451
+ disabled: item.disabled,
1452
+ onSelect: () => item.onClick?.(),
1453
+ className: ITEM_CLASSNAME,
1454
+ children: /* @__PURE__ */ jsxRuntime.jsx(ContextMenuLabel, { icon: item.icon, value: item.value })
1455
+ },
1456
+ item.key
1506
1457
  );
1507
1458
  }
1459
+ function ContextMenuLabel({ icon, value }) {
1460
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
1461
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: icon }),
1462
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: value })
1463
+ ] });
1464
+ }
1465
+ function ChevronRight2() {
1466
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4 flex-shrink-0", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
1467
+ }
1508
1468
  function Wizard({ children, steps, storageKey = "po_wizard" }) {
1509
- const wizardRef = React9.useRef(null);
1510
- const [activeStep, setActiveStep] = React9.useState(0);
1511
- const [targetBbox, setTargetBbox] = React9.useState(null);
1512
- const HIGHLIGHTED = React9.useMemo(
1469
+ const wizardRef = React8.useRef(null);
1470
+ const [activeStep, setActiveStep] = React8.useState(0);
1471
+ const [targetBbox, setTargetBbox] = React8.useState(null);
1472
+ const HIGHLIGHTED = React8.useMemo(
1513
1473
  () => ["border", "border-4", "border-prussian-blue", "pointer-events-none"],
1514
1474
  []
1515
1475
  );
1516
- const closeWizard = React9.useCallback(() => {
1476
+ const closeWizard = React8.useCallback(() => {
1517
1477
  steps[activeStep]?.stepRef.current?.classList.remove(...HIGHLIGHTED);
1518
1478
  if (wizardRef.current) wizardRef.current.style.display = "none";
1519
1479
  }, [HIGHLIGHTED, steps, activeStep]);
1520
- React9.useEffect(() => {
1480
+ React8.useEffect(() => {
1521
1481
  const visited = JSON.parse(localStorage.getItem(storageKey) ?? "false");
1522
1482
  if (visited) {
1523
1483
  closeWizard();
@@ -1571,7 +1531,7 @@ function Wizard({ children, steps, storageKey = "po_wizard" }) {
1571
1531
  children
1572
1532
  ] });
1573
1533
  }
1574
- var SearchInput = React9__default.default.forwardRef(function SearchInput2({
1534
+ var SearchInput = React8__default.default.forwardRef(function SearchInput2({
1575
1535
  value,
1576
1536
  onChange,
1577
1537
  disabled,
@@ -1639,16 +1599,16 @@ function Dropdown({
1639
1599
  labelStyle = {},
1640
1600
  placeholder
1641
1601
  }) {
1642
- const [open, setOpen] = React9.useState(false);
1643
- const [selectedItems, setSelectedItems] = React9.useState([]);
1644
- const [searchTerm, setSearchTerm] = React9.useState("");
1645
- const [innerItems, setInnerItems] = React9.useState([]);
1646
- const errorId = React9.useId();
1602
+ const [open, setOpen] = React8.useState(false);
1603
+ const [selectedItems, setSelectedItems] = React8.useState([]);
1604
+ const [searchTerm, setSearchTerm] = React8.useState("");
1605
+ const [innerItems, setInnerItems] = React8.useState([]);
1606
+ const errorId = React8.useId();
1647
1607
  const hasError = errorMessage != null;
1648
- React9.useEffect(() => {
1608
+ React8.useEffect(() => {
1649
1609
  setInnerItems(items);
1650
1610
  }, [items]);
1651
- React9.useEffect(() => {
1611
+ React8.useEffect(() => {
1652
1612
  if (isMultiselect && Array.isArray(value)) {
1653
1613
  setSelectedItems(value);
1654
1614
  }
@@ -1872,7 +1832,7 @@ function TableBody({
1872
1832
  expandRow,
1873
1833
  getRowKey
1874
1834
  }) {
1875
- const [expanded, setExpanded] = React9.useState(() => /* @__PURE__ */ new Set());
1835
+ const [expanded, setExpanded] = React8.useState(() => /* @__PURE__ */ new Set());
1876
1836
  const toggleRow = (rowKey) => {
1877
1837
  setExpanded((prev) => {
1878
1838
  const next = new Set(prev);
@@ -1886,7 +1846,7 @@ function TableBody({
1886
1846
  return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
1887
1847
  const rowKey = getRowKey(row, i);
1888
1848
  const isExpanded = expanded.has(rowKey);
1889
- return /* @__PURE__ */ jsxRuntime.jsxs(React9__default.default.Fragment, { children: [
1849
+ return /* @__PURE__ */ jsxRuntime.jsxs(React8__default.default.Fragment, { children: [
1890
1850
  /* @__PURE__ */ jsxRuntime.jsxs(
1891
1851
  "tr",
1892
1852
  {
@@ -1930,9 +1890,9 @@ function Pagination({
1930
1890
  const matchedOption = picker.find(
1931
1891
  (o) => o.label === options.perPage || o.value === options.perPage
1932
1892
  );
1933
- const [perPageKey, setPerPageKey] = React9.useState(() => matchedOption?.key ?? picker[0]?.key);
1893
+ const [perPageKey, setPerPageKey] = React8.useState(() => matchedOption?.key ?? picker[0]?.key);
1934
1894
  const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
1935
- React9.useEffect(() => {
1895
+ React8.useEffect(() => {
1936
1896
  if (serverSide && options.perPage != null) {
1937
1897
  const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
1938
1898
  if (next) setPerPageKey(next.key);
@@ -1992,14 +1952,14 @@ function Table({
1992
1952
  footer = null,
1993
1953
  header = null
1994
1954
  }) {
1995
- const searchRef = React9.useRef(null);
1996
- const [searchTerm, setSearchTerm] = React9.useState("");
1997
- const [perPage, setPerPage] = React9.useState(
1955
+ const searchRef = React8.useRef(null);
1956
+ const [searchTerm, setSearchTerm] = React8.useState("");
1957
+ const [perPage, setPerPage] = React8.useState(
1998
1958
  typeof pagination.perPage === "number" ? pagination.perPage : 15
1999
1959
  );
2000
- const [activePage, setActivePage] = React9.useState(0);
1960
+ const [activePage, setActivePage] = React8.useState(0);
2001
1961
  const isServerSide = !!(pagination.enabled && pagination.serverSide);
2002
- const filteredRows = React9.useMemo(() => {
1962
+ const filteredRows = React8.useMemo(() => {
2003
1963
  if (isServerSide || !searchTerm) return rows;
2004
1964
  const term = searchTerm.toLowerCase();
2005
1965
  return rows.filter(
@@ -2008,29 +1968,29 @@ function Table({
2008
1968
  )
2009
1969
  );
2010
1970
  }, [rows, searchTerm, isServerSide]);
2011
- const datasets = React9.useMemo(() => {
1971
+ const datasets = React8.useMemo(() => {
2012
1972
  if (isServerSide) return [rows];
2013
1973
  return createDatasets(filteredRows, pagination.enabled ? perPage : null);
2014
1974
  }, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
2015
- const MAX_PAGE = React9.useMemo(() => {
1975
+ const MAX_PAGE = React8.useMemo(() => {
2016
1976
  if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
2017
1977
  if (isServerSide && typeof pagination.totalCount === "number")
2018
1978
  return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
2019
1979
  return datasets.length ? datasets.length - 1 : 0;
2020
1980
  }, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
2021
- const currentPageRows = React9.useMemo(() => {
1981
+ const currentPageRows = React8.useMemo(() => {
2022
1982
  if (isServerSide) return rows;
2023
1983
  return datasets[activePage] ?? [];
2024
1984
  }, [isServerSide, rows, datasets, activePage]);
2025
- React9.useEffect(() => {
1985
+ React8.useEffect(() => {
2026
1986
  if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
2027
1987
  setPerPage(pagination.perPage);
2028
1988
  }
2029
1989
  }, [pagination.enabled, pagination.perPage, isServerSide]);
2030
- React9.useEffect(() => {
1990
+ React8.useEffect(() => {
2031
1991
  if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
2032
1992
  }, [isServerSide, pagination.perPage]);
2033
- React9.useEffect(() => {
1993
+ React8.useEffect(() => {
2034
1994
  if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
2035
1995
  setActivePage(pagination.page - 1);
2036
1996
  }, [isServerSide, pagination.page]);
@@ -2090,7 +2050,7 @@ function Table({
2090
2050
  ] });
2091
2051
  }
2092
2052
  function ThemeSwitch({ checked, onChange, label = "Toggle dark mode" }) {
2093
- const id = React9.useId();
2053
+ const id = React8.useId();
2094
2054
  return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center gap-2 cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
2095
2055
  SwitchPrimitive__namespace.Root,
2096
2056
  {
@@ -2283,17 +2243,17 @@ function AppShell({
2283
2243
  children,
2284
2244
  className = ""
2285
2245
  }) {
2286
- const [expanded, setExpanded] = React9.useState(sidebarDefaultExpanded);
2287
- const [isMobile, setIsMobile] = React9.useState(false);
2288
- const [mobileOpen, setMobileOpen] = React9.useState(false);
2289
- React9.useEffect(() => {
2246
+ const [expanded, setExpanded] = React8.useState(sidebarDefaultExpanded);
2247
+ const [isMobile, setIsMobile] = React8.useState(false);
2248
+ const [mobileOpen, setMobileOpen] = React8.useState(false);
2249
+ React8.useEffect(() => {
2290
2250
  const mq = window.matchMedia("(max-width: 767px)");
2291
2251
  const update = (e) => setIsMobile(e.matches);
2292
2252
  update(mq);
2293
2253
  mq.addEventListener("change", update);
2294
2254
  return () => mq.removeEventListener("change", update);
2295
2255
  }, []);
2296
- React9.useEffect(() => {
2256
+ React8.useEffect(() => {
2297
2257
  if (!isMobile) setMobileOpen(false);
2298
2258
  }, [isMobile]);
2299
2259
  const hasSidebar = sidebarSections.length > 0;
@@ -2483,10 +2443,10 @@ function ThemeProvider({
2483
2443
  className = "",
2484
2444
  style
2485
2445
  }) {
2486
- const id = React9__default.default.useId().replace(/:/g, "");
2446
+ const id = React8__default.default.useId().replace(/:/g, "");
2487
2447
  const scopeClass = `geo-th-${id}`;
2488
- const divRef = React9.useRef(null);
2489
- React9.useEffect(() => {
2448
+ const divRef = React8.useRef(null);
2449
+ React8.useEffect(() => {
2490
2450
  const el = divRef.current;
2491
2451
  if (!el) return;
2492
2452
  if (colorScheme === "auto") return;
@@ -2501,8 +2461,8 @@ function ThemeProvider({
2501
2461
  }
2502
2462
  el.classList.toggle("dark", colorScheme === "dark");
2503
2463
  }, [colorScheme]);
2504
- const lightVars = React9.useMemo(() => toCssVars(theme), [theme]);
2505
- const darkVarStr = React9.useMemo(() => {
2464
+ const lightVars = React8.useMemo(() => toCssVars(theme), [theme]);
2465
+ const darkVarStr = React8.useMemo(() => {
2506
2466
  if (!darkTheme) return "";
2507
2467
  const dvars = toCssVars(darkTheme);
2508
2468
  if (!Object.keys(dvars).length) return "";
@@ -2629,7 +2589,7 @@ function TextInput({
2629
2589
  errorMessage,
2630
2590
  labelColor
2631
2591
  }) {
2632
- const errorId = React9.useId();
2592
+ const errorId = React8.useId();
2633
2593
  const hasError = errorMessage != null;
2634
2594
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", children: [
2635
2595
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2693,7 +2653,7 @@ function NumberInput({
2693
2653
  readOnly = false,
2694
2654
  precision
2695
2655
  }) {
2696
- const errorId = React9.useId();
2656
+ const errorId = React8.useId();
2697
2657
  const hasError = errorMessage != null;
2698
2658
  const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
2699
2659
  const round = (n) => {
@@ -2811,8 +2771,8 @@ function Password({
2811
2771
  labelColor,
2812
2772
  iconColor
2813
2773
  }) {
2814
- const [passwordVisible, setPasswordVisible] = React9.useState(false);
2815
- const errorId = React9.useId();
2774
+ const [passwordVisible, setPasswordVisible] = React8.useState(false);
2775
+ const errorId = React8.useId();
2816
2776
  const hasError = errorMessage != null;
2817
2777
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
2818
2778
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
@@ -2958,7 +2918,7 @@ function Switch({
2958
2918
  checkedIcon,
2959
2919
  uncheckedIcon
2960
2920
  }) {
2961
- const id = React9.useId();
2921
+ const id = React8.useId();
2962
2922
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2963
2923
  "// mr-12 was a hardcoded right margin that broke layouts; spacing // is the parent's responsibility now.",
2964
2924
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2991,8 +2951,8 @@ function AutoComplete({
2991
2951
  onItemClick,
2992
2952
  emptyText = "No results found"
2993
2953
  }) {
2994
- const [term, setTerm] = React9.useState("");
2995
- const [open, setOpen] = React9.useState(false);
2954
+ const [term, setTerm] = React8.useState("");
2955
+ const [open, setOpen] = React8.useState(false);
2996
2956
  const foundItems = term.trim() ? items.filter(
2997
2957
  ({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
2998
2958
  ) : [];
@@ -3090,10 +3050,10 @@ function TreeSelect({
3090
3050
  htmlFor,
3091
3051
  items = []
3092
3052
  }) {
3093
- const [open, setOpen] = React9.useState(false);
3094
- const [hoveredItem, setHoveredItem] = React9.useState(null);
3095
- const [innerItems, setInnerItems] = React9.useState([]);
3096
- React9.useEffect(() => {
3053
+ const [open, setOpen] = React8.useState(false);
3054
+ const [hoveredItem, setHoveredItem] = React8.useState(null);
3055
+ const [innerItems, setInnerItems] = React8.useState([]);
3056
+ React8.useEffect(() => {
3097
3057
  setInnerItems(items);
3098
3058
  }, [items]);
3099
3059
  const selectItem = (key) => {
@@ -3192,8 +3152,8 @@ function FileInput({
3192
3152
  name,
3193
3153
  accept = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx"
3194
3154
  }) {
3195
- const fileInput = React9.useRef(null);
3196
- const [files, setFiles] = React9.useState([]);
3155
+ const fileInput = React8.useRef(null);
3156
+ const [files, setFiles] = React8.useState([]);
3197
3157
  const openPicker = () => {
3198
3158
  fileInput.current?.click();
3199
3159
  };
@@ -3325,7 +3285,7 @@ function getMonthDays(year, month) {
3325
3285
  }
3326
3286
  return days;
3327
3287
  }
3328
- var ChevronRight2 = ({ color = chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"] }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
3288
+ var ChevronRight3 = ({ color = chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"] }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
3329
3289
  var DoubleChevronRight2 = ({ color = chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"] }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 5l7 7-7 7M5 5l7 7-7 7" }) });
3330
3290
  var ChevronDown2 = ({ color = chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"] }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) });
3331
3291
  function DatePickerBase({
@@ -3341,12 +3301,12 @@ function DatePickerBase({
3341
3301
  disableAfter,
3342
3302
  disabled
3343
3303
  }) {
3344
- const pickerRef = React9.useRef(null);
3345
- const calendarRef = React9.useRef(null);
3346
- const [isExpanded, setExpanded] = React9.useState(false);
3347
- const [isCloseToBottom, setCloseToBottom] = React9.useState(false);
3348
- const [currentYear, setCurrentYear] = React9.useState(value.getFullYear());
3349
- const [currentMonth, setCurrentMonth] = React9.useState(value.getMonth() + 1);
3304
+ const pickerRef = React8.useRef(null);
3305
+ const calendarRef = React8.useRef(null);
3306
+ const [isExpanded, setExpanded] = React8.useState(false);
3307
+ const [isCloseToBottom, setCloseToBottom] = React8.useState(false);
3308
+ const [currentYear, setCurrentYear] = React8.useState(value.getFullYear());
3309
+ const [currentMonth, setCurrentMonth] = React8.useState(value.getMonth() + 1);
3350
3310
  const toggle = () => {
3351
3311
  if (!disabled) setExpanded((p) => !p);
3352
3312
  };
@@ -3390,14 +3350,14 @@ function DatePickerBase({
3390
3350
  }
3391
3351
  return ordered;
3392
3352
  };
3393
- React9.useEffect(() => {
3353
+ React8.useEffect(() => {
3394
3354
  const clickAway = (e) => {
3395
3355
  if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
3396
3356
  };
3397
3357
  document.addEventListener("mousedown", clickAway);
3398
3358
  return () => document.removeEventListener("mousedown", clickAway);
3399
3359
  }, []);
3400
- React9.useEffect(() => {
3360
+ React8.useEffect(() => {
3401
3361
  const bbox = pickerRef.current?.getBoundingClientRect();
3402
3362
  if (bbox && (bbox.y > window.innerHeight - 220 || bbox.bottom > window.innerHeight - 400)) {
3403
3363
  setCloseToBottom(true);
@@ -3440,13 +3400,13 @@ function DatePickerBase({
3440
3400
  children: isExpanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pt-3", children: [
3441
3401
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mx-auto w-max", children: [
3442
3402
  /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => setCurrentYear((y) => y - 1), className: "cursor-pointer rotate-180 p-1 rounded-lg hover:bg-ice-dark transition-all duration-300", children: /* @__PURE__ */ jsxRuntime.jsx(DoubleChevronRight2, {}) }),
3443
- /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: toPrevMonth, className: "cursor-pointer rotate-180 p-1 rounded-lg hover:bg-ice-dark transition-all duration-300", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight2, {}) }),
3403
+ /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: toPrevMonth, className: "cursor-pointer rotate-180 p-1 rounded-lg hover:bg-ice-dark transition-all duration-300", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight3, {}) }),
3444
3404
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-bold text-prussian-blue select-none w-[130px] text-center", children: [
3445
3405
  currentYear,
3446
3406
  " ",
3447
3407
  MONTHS[currentMonth]
3448
3408
  ] }),
3449
- /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: toNextMonth, className: "cursor-pointer p-1 rounded-lg hover:bg-ice-dark transition-all duration-300", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight2, {}) }),
3409
+ /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: toNextMonth, className: "cursor-pointer p-1 rounded-lg hover:bg-ice-dark transition-all duration-300", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight3, {}) }),
3450
3410
  /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => setCurrentYear((y) => y + 1), className: "cursor-pointer p-1 rounded-lg hover:bg-ice-dark transition-all duration-300", children: /* @__PURE__ */ jsxRuntime.jsx(DoubleChevronRight2, {}) })
3451
3411
  ] }),
3452
3412
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3 p-2", children: renderCalendar().map((weekDay, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
@@ -3490,29 +3450,29 @@ function TemporalPickerBase({
3490
3450
  layout,
3491
3451
  style = {}
3492
3452
  }) {
3493
- const pickerRef = React9.useRef(null);
3494
- const calendarRef = React9.useRef(null);
3495
- const valueRefs = React9.useRef([]);
3496
- const [isExpanded, setExpanded] = React9.useState(false);
3497
- const [isCloseToBottom, setCloseToBottom] = React9.useState(false);
3498
- const innerValues = React9.useMemo(() => {
3453
+ const pickerRef = React8.useRef(null);
3454
+ const calendarRef = React8.useRef(null);
3455
+ const valueRefs = React8.useRef([]);
3456
+ const [isExpanded, setExpanded] = React8.useState(false);
3457
+ const [isCloseToBottom, setCloseToBottom] = React8.useState(false);
3458
+ const innerValues = React8.useMemo(() => {
3499
3459
  const vals = [];
3500
3460
  for (let i = lowerLimit; i <= upperLimit; i++) vals.push(i);
3501
3461
  return vals;
3502
3462
  }, [lowerLimit, upperLimit]);
3503
- React9.useEffect(() => {
3463
+ React8.useEffect(() => {
3504
3464
  const clickAway = (e) => {
3505
3465
  if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
3506
3466
  };
3507
3467
  document.addEventListener("mousedown", clickAway);
3508
3468
  return () => document.removeEventListener("mousedown", clickAway);
3509
3469
  }, []);
3510
- React9.useEffect(() => {
3470
+ React8.useEffect(() => {
3511
3471
  const bbox = pickerRef.current?.getBoundingClientRect();
3512
3472
  if (bbox && bbox.y > window.innerHeight - 220) setCloseToBottom(true);
3513
3473
  else setCloseToBottom(false);
3514
3474
  }, []);
3515
- React9.useEffect(() => {
3475
+ React8.useEffect(() => {
3516
3476
  if (!isExpanded) return;
3517
3477
  const t = setTimeout(() => {
3518
3478
  const node = valueRefs.current.find((n) => n.value === value);