@geomak/ui 1.6.2 → 1.7.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
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk255PCZIW_cjs = require('./chunk-255PCZIW.cjs');
4
+ var React10 = require('react');
5
+ var reactDom = require('react-dom');
4
6
  var jsxRuntime = require('react/jsx-runtime');
5
- var React9 = require('react');
6
7
  var Dialog = require('@radix-ui/react-dialog');
7
8
  var framerMotion = require('framer-motion');
8
9
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
@@ -34,7 +35,7 @@ function _interopNamespace(e) {
34
35
  return Object.freeze(n);
35
36
  }
36
37
 
37
- var React9__default = /*#__PURE__*/_interopDefault(React9);
38
+ var React10__default = /*#__PURE__*/_interopDefault(React10);
38
39
  var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
39
40
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
40
41
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
@@ -45,6 +46,18 @@ var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
45
46
  var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
46
47
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
47
48
 
49
+ function Portal({ children, target }) {
50
+ const [resolved, setResolved] = React10.useState(null);
51
+ React10.useEffect(() => {
52
+ if (target === null) {
53
+ setResolved(null);
54
+ return;
55
+ }
56
+ const node = typeof target === "function" ? target() : target ?? document.body;
57
+ setResolved(node ?? null);
58
+ }, [target]);
59
+ return resolved ? reactDom.createPortal(children, resolved) : null;
60
+ }
48
61
  var Moon = ({ color = "gray" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" }) });
49
62
  var Sun = ({ color = "yellow" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" }) });
50
63
  var CheckCircle = ({ color = "#fff", size = 28 }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M14 0.25C6.40625 0.25 0.25 6.40625 0.25 14C0.25 21.5937 6.40625 27.75 14 27.75C21.5937 27.75 27.75 21.5937 27.75 14C27.75 6.40625 21.5937 0.25 14 0.25ZM19.96 11.675C20.0697 11.5496 20.1533 11.4034 20.2057 11.2452C20.2582 11.087 20.2784 10.9199 20.2653 10.7537C20.2522 10.5876 20.206 10.4257 20.1295 10.2777C20.0529 10.1296 19.9475 9.99838 19.8194 9.89168C19.6914 9.78497 19.5433 9.70495 19.3839 9.65633C19.2244 9.6077 19.0569 9.59145 18.8911 9.60853C18.7253 9.62562 18.5646 9.67568 18.4184 9.75579C18.2723 9.8359 18.1436 9.94443 18.04 10.075L12.665 16.5237L9.88375 13.7412C9.648 13.5136 9.33224 13.3876 9.0045 13.3904C8.67675 13.3933 8.36324 13.5247 8.13148 13.7565C7.89972 13.9882 7.76825 14.3018 7.76541 14.6295C7.76256 14.9572 7.88855 15.273 8.11625 15.5087L11.8662 19.2587C11.9891 19.3815 12.1361 19.4773 12.298 19.5401C12.4599 19.6028 12.6331 19.6312 12.8066 19.6233C12.98 19.6154 13.15 19.5715 13.3055 19.4943C13.4611 19.4171 13.5988 19.3084 13.71 19.175L19.96 11.675Z", fill: color }) });
@@ -214,7 +227,7 @@ function IconButton({
214
227
  loading = false,
215
228
  loadingIcon
216
229
  }) {
217
- const colorScheme = React9.useMemo(() => {
230
+ const colorScheme = React10.useMemo(() => {
218
231
  if (type === "primary") {
219
232
  return "hover:bg-true-blue bg-usafa-blue dark:bg-independence dark:hover:bg-black-coral";
220
233
  }
@@ -523,11 +536,11 @@ function Tabs({
523
536
  tabsClosable = true,
524
537
  defaultActiveTab
525
538
  }) {
526
- const [value, setValue] = React9.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
527
- React9.useEffect(() => {
539
+ const [value, setValue] = React10.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
540
+ React10.useEffect(() => {
528
541
  if (defaultActiveTab) setValue(defaultActiveTab);
529
542
  }, [defaultActiveTab]);
530
- React9.useEffect(() => {
543
+ React10.useEffect(() => {
531
544
  if (tabs.length === 0) {
532
545
  setValue("");
533
546
  return;
@@ -756,7 +769,7 @@ function ToggleButton({ items, onChange, activeKey }) {
756
769
  }
757
770
  );
758
771
  }
759
- var NotificationContext = React9.createContext({
772
+ var NotificationContext = React10.createContext({
760
773
  open: () => void 0,
761
774
  close: () => void 0
762
775
  });
@@ -767,9 +780,9 @@ var TYPE_BG = {
767
780
  danger: "bg-status-error"
768
781
  };
769
782
  var VIEWPORT_CLASSES = {
770
- "top-right": "fixed top-14 right-4 flex flex-col items-end",
771
- "top-left": "fixed top-14 left-4 flex flex-col items-start",
772
- "top-center": "fixed top-14 left-1/2 flex flex-col items-center -translate-x-1/2",
783
+ "top-right": "fixed top-4 right-4 flex flex-col items-end",
784
+ "top-left": "fixed top-4 left-4 flex flex-col items-start",
785
+ "top-center": "fixed top-4 left-1/2 flex flex-col items-center -translate-x-1/2",
773
786
  "bottom-right": "fixed bottom-4 right-4 flex flex-col-reverse items-end",
774
787
  "bottom-left": "fixed bottom-4 left-4 flex flex-col-reverse items-start",
775
788
  "bottom-center": "fixed bottom-4 left-1/2 flex flex-col-reverse items-center -translate-x-1/2"
@@ -814,7 +827,7 @@ function NotificationItem({
814
827
  onClose,
815
828
  reduced
816
829
  }) {
817
- const [hovered, setHovered] = React9.useState(false);
830
+ const [hovered, setHovered] = React10.useState(false);
818
831
  const initial = getInitialMotion(pos, reduced);
819
832
  const center = pos.endsWith("center");
820
833
  const duration = n.duration ?? 4e3;
@@ -822,6 +835,7 @@ function NotificationItem({
822
835
  return /* @__PURE__ */ jsxRuntime.jsx(
823
836
  framerMotion.motion.div,
824
837
  {
838
+ className: "pointer-events-auto",
825
839
  initial,
826
840
  animate: { opacity: 1, y: 0, scale: 1 },
827
841
  exit: {
@@ -894,7 +908,7 @@ function NotificationProvider({
894
908
  children,
895
909
  position = "top-right"
896
910
  }) {
897
- const [notifications, setNotifications] = React9.useState([]);
911
+ const [notifications, setNotifications] = React10.useState([]);
898
912
  const reduced = framerMotion.useReducedMotion();
899
913
  const open = (payload) => {
900
914
  setNotifications((prev) => [
@@ -907,13 +921,13 @@ function NotificationProvider({
907
921
  };
908
922
  return /* @__PURE__ */ jsxRuntime.jsx(NotificationContext.Provider, { value: { open, close }, children: /* @__PURE__ */ jsxRuntime.jsxs(Toast__namespace.Provider, { swipeDirection: position.endsWith("right") ? "right" : position.endsWith("left") ? "left" : "up", children: [
909
923
  children,
910
- /* @__PURE__ */ jsxRuntime.jsx(
924
+ /* @__PURE__ */ jsxRuntime.jsx(Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
911
925
  Toast__namespace.Viewport,
912
926
  {
913
927
  asChild: true,
914
928
  className: [
915
929
  VIEWPORT_CLASSES[position],
916
- "z-[500000] gap-2 w-[340px] p-4 outline-none overflow-hidden"
930
+ "z-[500000] gap-2 w-[332px] outline-none pointer-events-none"
917
931
  ].join(" "),
918
932
  children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: notifications.map((n) => /* @__PURE__ */ jsxRuntime.jsx(
919
933
  NotificationItem,
@@ -926,11 +940,11 @@ function NotificationProvider({
926
940
  n.id
927
941
  )) }) })
928
942
  }
929
- )
943
+ ) })
930
944
  ] }) });
931
945
  }
932
946
  function useNotification() {
933
- const { open } = React9.useContext(NotificationContext);
947
+ const { open } = React10.useContext(NotificationContext);
934
948
  return {
935
949
  info: (props) => open({ type: "info", ...props }),
936
950
  success: (props) => open({ type: "success", ...props }),
@@ -939,9 +953,9 @@ function useNotification() {
939
953
  };
940
954
  }
941
955
  function LoadingSpinner({ prompt }) {
942
- const letterRefs = React9.useMemo(() => [], []);
956
+ const letterRefs = React10.useMemo(() => [], []);
943
957
  const letters = prompt.split("");
944
- React9.useEffect(() => {
958
+ React10.useEffect(() => {
945
959
  const timeouts = [];
946
960
  if (letterRefs.length === letters.length) {
947
961
  letterRefs.forEach((ref, index) => {
@@ -953,30 +967,34 @@ function LoadingSpinner({ prompt }) {
953
967
  }
954
968
  return () => timeouts.forEach(clearTimeout);
955
969
  }, [letterRefs, letters.length]);
956
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed top-0 bottom-0 right-0 left-0 bg-oxford-blue-700-opaque z-[8000000] flex flex-col gap-5 items-center justify-start pt-80", children: [
957
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-r-prussian-blue border-l-prussian-blue border-t-white border-b-white border-[10px] w-[80px] h-[80px] rounded-xl shapeshift" }),
958
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-prussian-blue dark:text-white text-3xl font-bold", children: letters.map((letter, index) => /* @__PURE__ */ jsxRuntime.jsx(
959
- "span",
960
- {
961
- className: "select-none",
962
- ref: (ref) => {
963
- letterRefs[index] = ref;
970
+ return (
971
+ // Portaled so the full-screen overlay always covers the real viewport,
972
+ // not whatever container the consumer renders LoadingSpinner inside.
973
+ /* @__PURE__ */ jsxRuntime.jsx(Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed top-0 bottom-0 right-0 left-0 bg-oxford-blue-700-opaque z-[8000000] flex flex-col gap-5 items-center justify-start pt-80", children: [
974
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-r-prussian-blue border-l-prussian-blue border-t-white border-b-white border-[10px] w-[80px] h-[80px] rounded-xl shapeshift" }),
975
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-prussian-blue dark:text-white text-3xl font-bold", children: letters.map((letter, index) => /* @__PURE__ */ jsxRuntime.jsx(
976
+ "span",
977
+ {
978
+ className: "select-none",
979
+ ref: (ref) => {
980
+ letterRefs[index] = ref;
981
+ },
982
+ children: letter
964
983
  },
965
- children: letter
966
- },
967
- index
968
- )) })
969
- ] });
984
+ index
985
+ )) })
986
+ ] }) })
987
+ );
970
988
  }
971
989
  function FadingBase({
972
990
  className = "",
973
991
  isMounted = false,
974
992
  children
975
993
  }) {
976
- const [shouldRender, setShouldRender] = React9.useState(isMounted);
977
- const [visible, setVisible] = React9.useState(false);
978
- const timerRef = React9.useRef(null);
979
- React9.useEffect(() => {
994
+ const [shouldRender, setShouldRender] = React10.useState(isMounted);
995
+ const [visible, setVisible] = React10.useState(false);
996
+ const timerRef = React10.useRef(null);
997
+ React10.useEffect(() => {
980
998
  if (isMounted) {
981
999
  setShouldRender(true);
982
1000
  const rafId = requestAnimationFrame(() => setVisible(true));
@@ -1017,9 +1035,9 @@ function ScalableContainer({
1017
1035
  children,
1018
1036
  assignClassOnClick
1019
1037
  }) {
1020
- const containerRef = React9.useRef(null);
1021
- const [isScaled, setScaled] = React9.useState(false);
1022
- const [wrapperClass, setWrapperClass] = React9.useState("");
1038
+ const containerRef = React10.useRef(null);
1039
+ const [isScaled, setScaled] = React10.useState(false);
1040
+ const [wrapperClass, setWrapperClass] = React10.useState("");
1023
1041
  const onClick = () => {
1024
1042
  const next = !isScaled;
1025
1043
  setScaled(next);
@@ -1129,17 +1147,17 @@ function CatalogGrid({ items, buttonText, onOpen }) {
1129
1147
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(GridCard, { item, buttonText, onOpen }, item.key)) });
1130
1148
  }
1131
1149
  function CatalogCarousel({ items, buttonText, onOpen }) {
1132
- const [activeIndex, setActiveIndex] = React9.useState(0);
1133
- const [indexPool, setIndexPool] = React9.useState([]);
1134
- const cardRefs = React9.useRef([]);
1135
- const getIndexes = React9.useMemo(() => {
1150
+ const [activeIndex, setActiveIndex] = React10.useState(0);
1151
+ const [indexPool, setIndexPool] = React10.useState([]);
1152
+ const cardRefs = React10.useRef([]);
1153
+ const getIndexes = React10.useMemo(() => {
1136
1154
  let nextIndex = activeIndex + 1;
1137
1155
  let previousIndex = activeIndex - 1;
1138
1156
  if (activeIndex === 0) previousIndex = items.length - 1;
1139
1157
  if (activeIndex === items.length - 1) nextIndex = 0;
1140
1158
  return { previousIndex, nextIndex };
1141
1159
  }, [activeIndex, items.length]);
1142
- React9.useEffect(() => {
1160
+ React10.useEffect(() => {
1143
1161
  const { nextIndex, previousIndex } = getIndexes;
1144
1162
  let indexes = [previousIndex, activeIndex, nextIndex];
1145
1163
  if (activeIndex !== 0 && activeIndex !== items.length - 1) {
@@ -1253,14 +1271,14 @@ function MenuBar({ items }) {
1253
1271
  );
1254
1272
  }
1255
1273
  function ContextMenu({ items, position, visible, onClose }) {
1256
- const contextRef = React9.useRef(null);
1257
- const childMenuRef = React9.useRef(null);
1258
- const [hasArrowUp, setHasArrowUp] = React9.useState(true);
1259
- const [childArrowUp, setChildArrowUp] = React9.useState(false);
1260
- const [hoveredItem, setHoveredItem] = React9.useState(-1);
1261
- const [hoveredChild, setHoveredChild] = React9.useState(-1);
1262
- const [activeChildren, setActiveChildren] = React9.useState([]);
1263
- React9.useEffect(() => {
1274
+ const contextRef = React10.useRef(null);
1275
+ const childMenuRef = React10.useRef(null);
1276
+ const [hasArrowUp, setHasArrowUp] = React10.useState(true);
1277
+ const [childArrowUp, setChildArrowUp] = React10.useState(false);
1278
+ const [hoveredItem, setHoveredItem] = React10.useState(-1);
1279
+ const [hoveredChild, setHoveredChild] = React10.useState(-1);
1280
+ const [activeChildren, setActiveChildren] = React10.useState([]);
1281
+ React10.useEffect(() => {
1264
1282
  const clickAway = ({ target }) => {
1265
1283
  if (contextRef.current && !contextRef.current.contains(target)) {
1266
1284
  if (childMenuRef.current) {
@@ -1275,7 +1293,7 @@ function ContextMenu({ items, position, visible, onClose }) {
1275
1293
  window.addEventListener("click", clickAway);
1276
1294
  return () => window.removeEventListener("click", clickAway);
1277
1295
  }, [onClose]);
1278
- React9.useEffect(() => {
1296
+ React10.useEffect(() => {
1279
1297
  const current = contextRef.current;
1280
1298
  const child = childMenuRef.current;
1281
1299
  if (!current || !child) return;
@@ -1371,18 +1389,18 @@ function ContextMenu({ items, position, visible, onClose }) {
1371
1389
  );
1372
1390
  }
1373
1391
  function Wizard({ children, steps, storageKey = "po_wizard" }) {
1374
- const wizardRef = React9.useRef(null);
1375
- const [activeStep, setActiveStep] = React9.useState(0);
1376
- const [targetBbox, setTargetBbox] = React9.useState(null);
1377
- const HIGHLIGHTED = React9.useMemo(
1392
+ const wizardRef = React10.useRef(null);
1393
+ const [activeStep, setActiveStep] = React10.useState(0);
1394
+ const [targetBbox, setTargetBbox] = React10.useState(null);
1395
+ const HIGHLIGHTED = React10.useMemo(
1378
1396
  () => ["border", "border-4", "border-prussian-blue", "pointer-events-none"],
1379
1397
  []
1380
1398
  );
1381
- const closeWizard = React9.useCallback(() => {
1399
+ const closeWizard = React10.useCallback(() => {
1382
1400
  steps[activeStep]?.stepRef.current?.classList.remove(...HIGHLIGHTED);
1383
1401
  if (wizardRef.current) wizardRef.current.style.display = "none";
1384
1402
  }, [HIGHLIGHTED, steps, activeStep]);
1385
- React9.useEffect(() => {
1403
+ React10.useEffect(() => {
1386
1404
  const visited = JSON.parse(localStorage.getItem(storageKey) ?? "false");
1387
1405
  if (visited) {
1388
1406
  closeWizard();
@@ -1436,7 +1454,7 @@ function Wizard({ children, steps, storageKey = "po_wizard" }) {
1436
1454
  children
1437
1455
  ] });
1438
1456
  }
1439
- var SearchInput = React9__default.default.forwardRef(function SearchInput2({
1457
+ var SearchInput = React10__default.default.forwardRef(function SearchInput2({
1440
1458
  value,
1441
1459
  onChange,
1442
1460
  disabled,
@@ -1503,15 +1521,15 @@ function Dropdown({
1503
1521
  labelStyle = {},
1504
1522
  placeholder
1505
1523
  }) {
1506
- const [open, setOpen] = React9.useState(false);
1507
- const [selectedItems, setSelectedItems] = React9.useState([]);
1508
- const [hoveredItem, setHoveredItem] = React9.useState(null);
1509
- const [searchTerm, setSearchTerm] = React9.useState("");
1510
- const [innerItems, setInnerItems] = React9.useState([]);
1511
- React9.useEffect(() => {
1524
+ const [open, setOpen] = React10.useState(false);
1525
+ const [selectedItems, setSelectedItems] = React10.useState([]);
1526
+ const [hoveredItem, setHoveredItem] = React10.useState(null);
1527
+ const [searchTerm, setSearchTerm] = React10.useState("");
1528
+ const [innerItems, setInnerItems] = React10.useState([]);
1529
+ React10.useEffect(() => {
1512
1530
  setInnerItems(items);
1513
1531
  }, [items]);
1514
- React9.useEffect(() => {
1532
+ React10.useEffect(() => {
1515
1533
  if (isMultiselect && Array.isArray(value)) {
1516
1534
  setSelectedItems(value);
1517
1535
  }
@@ -1684,14 +1702,14 @@ function TableBody({
1684
1702
  rows,
1685
1703
  expandRow
1686
1704
  }) {
1687
- const [visibleRows, setVisibleRows] = React9.useState({});
1705
+ const [visibleRows, setVisibleRows] = React10.useState({});
1688
1706
  const toggleRow = (rowKey) => {
1689
1707
  setVisibleRows((prev) => ({
1690
1708
  ...prev,
1691
1709
  [rowKey]: { visible: !prev[rowKey]?.visible }
1692
1710
  }));
1693
1711
  };
1694
- React9.useEffect(() => {
1712
+ React10.useEffect(() => {
1695
1713
  if (rows.length && Object.keys(visibleRows).length === 0) {
1696
1714
  const initial = {};
1697
1715
  rows.forEach((row) => {
@@ -1700,7 +1718,7 @@ function TableBody({
1700
1718
  setVisibleRows(initial);
1701
1719
  }
1702
1720
  }, [rows]);
1703
- return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs(React9__default.default.Fragment, { children: [
1721
+ return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs(React10__default.default.Fragment, { children: [
1704
1722
  /* @__PURE__ */ jsxRuntime.jsxs(
1705
1723
  "tr",
1706
1724
  {
@@ -1754,9 +1772,9 @@ function Pagination({
1754
1772
  const matchedOption = picker.find(
1755
1773
  (o) => o.label === options.perPage || o.value === options.perPage
1756
1774
  );
1757
- const [perPageKey, setPerPageKey] = React9.useState(() => matchedOption?.key ?? picker[0]?.key);
1775
+ const [perPageKey, setPerPageKey] = React10.useState(() => matchedOption?.key ?? picker[0]?.key);
1758
1776
  const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
1759
- React9.useEffect(() => {
1777
+ React10.useEffect(() => {
1760
1778
  if (serverSide && options.perPage != null) {
1761
1779
  const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
1762
1780
  if (next) setPerPageKey(next.key);
@@ -1816,35 +1834,35 @@ function Table({
1816
1834
  footer = null,
1817
1835
  header = null
1818
1836
  }) {
1819
- const searchRef = React9.useRef(null);
1820
- const [searchTerm, setSearchTerm] = React9.useState("");
1821
- const [perPage, setPerPage] = React9.useState(
1837
+ const searchRef = React10.useRef(null);
1838
+ const [searchTerm, setSearchTerm] = React10.useState("");
1839
+ const [perPage, setPerPage] = React10.useState(
1822
1840
  typeof pagination.perPage === "number" ? pagination.perPage : 15
1823
1841
  );
1824
- const [activePage, setActivePage] = React9.useState(0);
1825
- const [datasets, setDatasets] = React9.useState([]);
1842
+ const [activePage, setActivePage] = React10.useState(0);
1843
+ const [datasets, setDatasets] = React10.useState([]);
1826
1844
  const isServerSide = !!(pagination.enabled && pagination.serverSide);
1827
- const MAX_PAGE = React9.useMemo(() => {
1845
+ const MAX_PAGE = React10.useMemo(() => {
1828
1846
  if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
1829
1847
  if (isServerSide && typeof pagination.totalCount === "number")
1830
1848
  return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
1831
1849
  return datasets.length ? datasets.length - 1 : 0;
1832
1850
  }, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
1833
- const currentPageRows = React9.useMemo(() => {
1851
+ const currentPageRows = React10.useMemo(() => {
1834
1852
  if (isServerSide) return rows;
1835
1853
  return datasets.length ? datasets[activePage] ?? [] : [];
1836
1854
  }, [isServerSide, rows, datasets, activePage]);
1837
- React9.useEffect(() => {
1855
+ React10.useEffect(() => {
1838
1856
  if (pagination.enabled && !isServerSide) setPerPage(pagination.perPage ?? 15);
1839
1857
  }, [pagination, isServerSide]);
1840
- React9.useEffect(() => {
1858
+ React10.useEffect(() => {
1841
1859
  if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
1842
1860
  }, [isServerSide, pagination.perPage]);
1843
- React9.useEffect(() => {
1861
+ React10.useEffect(() => {
1844
1862
  if (isServerSide) return;
1845
1863
  setDatasets(createDatasets(rows, pagination.enabled ? perPage : null));
1846
1864
  }, [rows, perPage, pagination, isServerSide]);
1847
- React9.useEffect(() => {
1865
+ React10.useEffect(() => {
1848
1866
  if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
1849
1867
  setActivePage(pagination.page - 1);
1850
1868
  }, [isServerSide, pagination.page]);
@@ -1904,7 +1922,7 @@ function Table({
1904
1922
  ] });
1905
1923
  }
1906
1924
  function ThemeSwitch({ checked, onChange, label = "Toggle dark mode" }) {
1907
- const id = React9.useId();
1925
+ const id = React10.useId();
1908
1926
  return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center gap-2 cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
1909
1927
  SwitchPrimitive__namespace.Root,
1910
1928
  {
@@ -2097,17 +2115,17 @@ function AppShell({
2097
2115
  children,
2098
2116
  className = ""
2099
2117
  }) {
2100
- const [expanded, setExpanded] = React9.useState(sidebarDefaultExpanded);
2101
- const [isMobile, setIsMobile] = React9.useState(false);
2102
- const [mobileOpen, setMobileOpen] = React9.useState(false);
2103
- React9.useEffect(() => {
2118
+ const [expanded, setExpanded] = React10.useState(sidebarDefaultExpanded);
2119
+ const [isMobile, setIsMobile] = React10.useState(false);
2120
+ const [mobileOpen, setMobileOpen] = React10.useState(false);
2121
+ React10.useEffect(() => {
2104
2122
  const mq = window.matchMedia("(max-width: 767px)");
2105
2123
  const update = (e) => setIsMobile(e.matches);
2106
2124
  update(mq);
2107
2125
  mq.addEventListener("change", update);
2108
2126
  return () => mq.removeEventListener("change", update);
2109
2127
  }, []);
2110
- React9.useEffect(() => {
2128
+ React10.useEffect(() => {
2111
2129
  if (!isMobile) setMobileOpen(false);
2112
2130
  }, [isMobile]);
2113
2131
  const hasSidebar = sidebarSections.length > 0;
@@ -2150,7 +2168,7 @@ function AppShell({
2150
2168
  footer: sidebarFooter
2151
2169
  }
2152
2170
  ),
2153
- hasSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2171
+ hasSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsxs(Portal, { children: [
2154
2172
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: mobileOpen && /* @__PURE__ */ jsxRuntime.jsx(
2155
2173
  framerMotion.motion.div,
2156
2174
  {
@@ -2281,10 +2299,10 @@ function ThemeProvider({
2281
2299
  className = "",
2282
2300
  style
2283
2301
  }) {
2284
- const id = React9__default.default.useId().replace(/:/g, "");
2302
+ const id = React10__default.default.useId().replace(/:/g, "");
2285
2303
  const scopeClass = `geo-th-${id}`;
2286
- const divRef = React9.useRef(null);
2287
- React9.useEffect(() => {
2304
+ const divRef = React10.useRef(null);
2305
+ React10.useEffect(() => {
2288
2306
  const el = divRef.current;
2289
2307
  if (!el) return;
2290
2308
  if (colorScheme === "auto") return;
@@ -2299,8 +2317,8 @@ function ThemeProvider({
2299
2317
  }
2300
2318
  el.classList.toggle("dark", colorScheme === "dark");
2301
2319
  }, [colorScheme]);
2302
- const lightVars = React9.useMemo(() => toCssVars(theme), [theme]);
2303
- const darkVarStr = React9.useMemo(() => {
2320
+ const lightVars = React10.useMemo(() => toCssVars(theme), [theme]);
2321
+ const darkVarStr = React10.useMemo(() => {
2304
2322
  if (!darkTheme) return "";
2305
2323
  const dvars = toCssVars(darkTheme);
2306
2324
  if (!Object.keys(dvars).length) return "";
@@ -2576,7 +2594,7 @@ function Password({
2576
2594
  labelColor,
2577
2595
  iconColor
2578
2596
  }) {
2579
- const [passwordVisible, setPasswordVisible] = React9.useState(false);
2597
+ const [passwordVisible, setPasswordVisible] = React10.useState(false);
2580
2598
  const color = iconColor ?? chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"];
2581
2599
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
2582
2600
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
@@ -2719,7 +2737,7 @@ function Switch({
2719
2737
  checkedIcon,
2720
2738
  uncheckedIcon
2721
2739
  }) {
2722
- const id = React9.useId();
2740
+ const id = React10.useId();
2723
2741
  return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer mr-12 select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
2724
2742
  SwitchPrimitive__namespace.Root,
2725
2743
  {
@@ -2749,8 +2767,8 @@ function AutoComplete({
2749
2767
  onItemClick,
2750
2768
  emptyText = "No results found"
2751
2769
  }) {
2752
- const [term, setTerm] = React9.useState("");
2753
- const [open, setOpen] = React9.useState(false);
2770
+ const [term, setTerm] = React10.useState("");
2771
+ const [open, setOpen] = React10.useState(false);
2754
2772
  const foundItems = term.trim() ? items.filter(
2755
2773
  ({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
2756
2774
  ) : [];
@@ -2835,10 +2853,10 @@ function TreeSelect({
2835
2853
  htmlFor,
2836
2854
  items = []
2837
2855
  }) {
2838
- const [open, setOpen] = React9.useState(false);
2839
- const [hoveredItem, setHoveredItem] = React9.useState(null);
2840
- const [innerItems, setInnerItems] = React9.useState([]);
2841
- React9.useEffect(() => {
2856
+ const [open, setOpen] = React10.useState(false);
2857
+ const [hoveredItem, setHoveredItem] = React10.useState(null);
2858
+ const [innerItems, setInnerItems] = React10.useState([]);
2859
+ React10.useEffect(() => {
2842
2860
  setInnerItems(items);
2843
2861
  }, [items]);
2844
2862
  const selectItem = (key) => {
@@ -2937,8 +2955,8 @@ function FileInput({
2937
2955
  name,
2938
2956
  accept = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx"
2939
2957
  }) {
2940
- const fileInput = React9.useRef(null);
2941
- const [files, setFiles] = React9.useState([]);
2958
+ const fileInput = React10.useRef(null);
2959
+ const [files, setFiles] = React10.useState([]);
2942
2960
  const openPicker = () => {
2943
2961
  fileInput.current?.dispatchEvent(new MouseEvent("click", { bubbles: false }));
2944
2962
  };
@@ -3072,12 +3090,12 @@ function DatePickerBase({
3072
3090
  disableAfter,
3073
3091
  disabled
3074
3092
  }) {
3075
- const pickerRef = React9.useRef(null);
3076
- const calendarRef = React9.useRef(null);
3077
- const [isExpanded, setExpanded] = React9.useState(false);
3078
- const [isCloseToBottom, setCloseToBottom] = React9.useState(false);
3079
- const [currentYear, setCurrentYear] = React9.useState(value.getFullYear());
3080
- const [currentMonth, setCurrentMonth] = React9.useState(value.getMonth() + 1);
3093
+ const pickerRef = React10.useRef(null);
3094
+ const calendarRef = React10.useRef(null);
3095
+ const [isExpanded, setExpanded] = React10.useState(false);
3096
+ const [isCloseToBottom, setCloseToBottom] = React10.useState(false);
3097
+ const [currentYear, setCurrentYear] = React10.useState(value.getFullYear());
3098
+ const [currentMonth, setCurrentMonth] = React10.useState(value.getMonth() + 1);
3081
3099
  const toggle = () => {
3082
3100
  if (!disabled) setExpanded((p) => !p);
3083
3101
  };
@@ -3121,14 +3139,14 @@ function DatePickerBase({
3121
3139
  }
3122
3140
  return ordered;
3123
3141
  };
3124
- React9.useEffect(() => {
3142
+ React10.useEffect(() => {
3125
3143
  const clickAway = (e) => {
3126
3144
  if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
3127
3145
  };
3128
3146
  document.addEventListener("mousedown", clickAway);
3129
3147
  return () => document.removeEventListener("mousedown", clickAway);
3130
3148
  }, []);
3131
- React9.useEffect(() => {
3149
+ React10.useEffect(() => {
3132
3150
  const bbox = pickerRef.current?.getBoundingClientRect();
3133
3151
  if (bbox && (bbox.y > window.innerHeight - 220 || bbox.bottom > window.innerHeight - 400)) {
3134
3152
  setCloseToBottom(true);
@@ -3221,29 +3239,29 @@ function TemporalPickerBase({
3221
3239
  layout,
3222
3240
  style = {}
3223
3241
  }) {
3224
- const pickerRef = React9.useRef(null);
3225
- const calendarRef = React9.useRef(null);
3226
- const valueRefs = React9.useRef([]);
3227
- const [isExpanded, setExpanded] = React9.useState(false);
3228
- const [isCloseToBottom, setCloseToBottom] = React9.useState(false);
3229
- const innerValues = React9.useMemo(() => {
3242
+ const pickerRef = React10.useRef(null);
3243
+ const calendarRef = React10.useRef(null);
3244
+ const valueRefs = React10.useRef([]);
3245
+ const [isExpanded, setExpanded] = React10.useState(false);
3246
+ const [isCloseToBottom, setCloseToBottom] = React10.useState(false);
3247
+ const innerValues = React10.useMemo(() => {
3230
3248
  const vals = [];
3231
3249
  for (let i = lowerLimit; i <= upperLimit; i++) vals.push(i);
3232
3250
  return vals;
3233
3251
  }, [lowerLimit, upperLimit]);
3234
- React9.useEffect(() => {
3252
+ React10.useEffect(() => {
3235
3253
  const clickAway = (e) => {
3236
3254
  if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
3237
3255
  };
3238
3256
  document.addEventListener("mousedown", clickAway);
3239
3257
  return () => document.removeEventListener("mousedown", clickAway);
3240
3258
  }, []);
3241
- React9.useEffect(() => {
3259
+ React10.useEffect(() => {
3242
3260
  const bbox = pickerRef.current?.getBoundingClientRect();
3243
3261
  if (bbox && bbox.y > window.innerHeight - 220) setCloseToBottom(true);
3244
3262
  else setCloseToBottom(false);
3245
3263
  }, []);
3246
- React9.useEffect(() => {
3264
+ React10.useEffect(() => {
3247
3265
  if (!isExpanded) return;
3248
3266
  const t = setTimeout(() => {
3249
3267
  const node = valueRefs.current.find((n) => n.value === value);
@@ -3354,6 +3372,7 @@ exports.NotificationProvider = NotificationProvider;
3354
3372
  exports.NumberInput = NumberInput;
3355
3373
  exports.OpaqueGridCard = OpaqueGridCard;
3356
3374
  exports.Password = Password;
3375
+ exports.Portal = Portal;
3357
3376
  exports.ScalableContainer = ScalableContainer;
3358
3377
  exports.SearchInput = SearchInput_default;
3359
3378
  exports.Sidebar = Sidebar;