@geomak/ui 1.7.1 → 1.7.2
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 +155 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -4
- package/dist/index.d.ts +32 -4
- package/dist/index.js +58 -36
- package/dist/index.js.map +1 -1
- package/dist/styles.css +17 -33
- package/package.json +1 -1
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
|
|
5
|
+
var React9 = 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');
|
|
@@ -35,7 +35,7 @@ function _interopNamespace(e) {
|
|
|
35
35
|
return Object.freeze(n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var React9__default = /*#__PURE__*/_interopDefault(React9);
|
|
39
39
|
var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
|
|
40
40
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
41
41
|
var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
@@ -206,8 +206,8 @@ Icon.Copy = Copy;
|
|
|
206
206
|
Icon.CircleStack = CircleStack;
|
|
207
207
|
var icons_default = Icon;
|
|
208
208
|
function Portal({ children, target }) {
|
|
209
|
-
const [resolved, setResolved] =
|
|
210
|
-
|
|
209
|
+
const [resolved, setResolved] = React9.useState(null);
|
|
210
|
+
React9.useEffect(() => {
|
|
211
211
|
if (target === null) {
|
|
212
212
|
setResolved(null);
|
|
213
213
|
return;
|
|
@@ -227,7 +227,7 @@ function IconButton({
|
|
|
227
227
|
loading = false,
|
|
228
228
|
loadingIcon
|
|
229
229
|
}) {
|
|
230
|
-
const colorScheme =
|
|
230
|
+
const colorScheme = React9.useMemo(() => {
|
|
231
231
|
if (type === "primary") {
|
|
232
232
|
return "hover:bg-true-blue bg-usafa-blue dark:bg-independence dark:hover:bg-black-coral";
|
|
233
233
|
}
|
|
@@ -538,11 +538,11 @@ function Tabs({
|
|
|
538
538
|
tabsClosable = true,
|
|
539
539
|
defaultActiveTab
|
|
540
540
|
}) {
|
|
541
|
-
const [value, setValue] =
|
|
542
|
-
|
|
541
|
+
const [value, setValue] = React9.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
|
|
542
|
+
React9.useEffect(() => {
|
|
543
543
|
if (defaultActiveTab) setValue(defaultActiveTab);
|
|
544
544
|
}, [defaultActiveTab]);
|
|
545
|
-
|
|
545
|
+
React9.useEffect(() => {
|
|
546
546
|
if (tabs.length === 0) {
|
|
547
547
|
setValue("");
|
|
548
548
|
return;
|
|
@@ -789,7 +789,7 @@ function ToggleButton({ items, onChange, activeKey }) {
|
|
|
789
789
|
}
|
|
790
790
|
);
|
|
791
791
|
}
|
|
792
|
-
var NotificationContext =
|
|
792
|
+
var NotificationContext = React9.createContext({
|
|
793
793
|
open: () => void 0,
|
|
794
794
|
close: () => void 0
|
|
795
795
|
});
|
|
@@ -847,7 +847,7 @@ function NotificationItem({
|
|
|
847
847
|
onClose,
|
|
848
848
|
reduced
|
|
849
849
|
}) {
|
|
850
|
-
const [hovered, setHovered] =
|
|
850
|
+
const [hovered, setHovered] = React9.useState(false);
|
|
851
851
|
const initial = getInitialMotion(pos, reduced);
|
|
852
852
|
const center = pos.endsWith("center");
|
|
853
853
|
const duration = n.duration ?? 4e3;
|
|
@@ -928,7 +928,7 @@ function NotificationProvider({
|
|
|
928
928
|
children,
|
|
929
929
|
position = "top-right"
|
|
930
930
|
}) {
|
|
931
|
-
const [notifications, setNotifications] =
|
|
931
|
+
const [notifications, setNotifications] = React9.useState([]);
|
|
932
932
|
const reduced = framerMotion.useReducedMotion();
|
|
933
933
|
const open = (payload) => {
|
|
934
934
|
setNotifications((prev) => [
|
|
@@ -964,7 +964,7 @@ function NotificationProvider({
|
|
|
964
964
|
] }) });
|
|
965
965
|
}
|
|
966
966
|
function useNotification() {
|
|
967
|
-
const { open } =
|
|
967
|
+
const { open } = React9.useContext(NotificationContext);
|
|
968
968
|
return {
|
|
969
969
|
info: (props) => open({ type: "info", ...props }),
|
|
970
970
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -972,49 +972,71 @@ function useNotification() {
|
|
|
972
972
|
danger: (props) => open({ type: "danger", ...props })
|
|
973
973
|
};
|
|
974
974
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
975
|
+
var containerVariants = {
|
|
976
|
+
hidden: {},
|
|
977
|
+
visible: { transition: { staggerChildren: 0.06 } }
|
|
978
|
+
};
|
|
979
|
+
var letterVariants = {
|
|
980
|
+
hidden: { opacity: 0, y: 6 },
|
|
981
|
+
visible: { opacity: 1, y: 0, transition: { duration: 0.25, ease: "easeOut" } }
|
|
982
|
+
};
|
|
983
|
+
function LoadingSpinner({
|
|
984
|
+
prompt,
|
|
985
|
+
spinnerColor,
|
|
986
|
+
textColor,
|
|
987
|
+
backdropOpacity = 0.92
|
|
988
|
+
}) {
|
|
989
|
+
const reduced = framerMotion.useReducedMotion();
|
|
990
|
+
const letters = Array.from(prompt);
|
|
991
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
992
|
+
"div",
|
|
993
|
+
{
|
|
994
|
+
role: "status",
|
|
995
|
+
"aria-live": "polite",
|
|
996
|
+
"aria-label": prompt,
|
|
997
|
+
className: "fixed inset-0 z-[8000000] flex flex-col items-center justify-center gap-6 bg-background",
|
|
998
|
+
style: { opacity: backdropOpacity },
|
|
999
|
+
children: [
|
|
1000
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
|
+
"div",
|
|
1002
|
+
{
|
|
1003
|
+
className: "w-20 h-20 rounded-2xl border-[6px] border-transparent border-t-current border-r-current animate-spin",
|
|
1004
|
+
style: { color: spinnerColor ?? "var(--color-accent)" },
|
|
1005
|
+
"aria-hidden": "true"
|
|
1006
|
+
}
|
|
1007
|
+
),
|
|
1008
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1009
|
+
framerMotion.motion.div,
|
|
1010
|
+
{
|
|
1011
|
+
className: "text-3xl font-bold tracking-tight select-none",
|
|
1012
|
+
style: { color: textColor ?? "var(--color-foreground)" },
|
|
1013
|
+
variants: containerVariants,
|
|
1014
|
+
initial: reduced ? "visible" : "hidden",
|
|
1015
|
+
animate: "visible",
|
|
1016
|
+
children: letters.map((letter, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
|
+
framerMotion.motion.span,
|
|
1018
|
+
{
|
|
1019
|
+
className: "inline-block whitespace-pre",
|
|
1020
|
+
variants: letterVariants,
|
|
1021
|
+
children: letter
|
|
1022
|
+
},
|
|
1023
|
+
index
|
|
1024
|
+
))
|
|
1025
|
+
}
|
|
1026
|
+
)
|
|
1027
|
+
]
|
|
987
1028
|
}
|
|
988
|
-
|
|
989
|
-
}, [letterRefs, letters.length]);
|
|
990
|
-
return (
|
|
991
|
-
// Portaled so the full-screen overlay always covers the real viewport,
|
|
992
|
-
// not whatever container the consumer renders LoadingSpinner inside.
|
|
993
|
-
/* @__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: [
|
|
994
|
-
/* @__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" }),
|
|
995
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-prussian-blue dark:text-white text-3xl font-bold", children: letters.map((letter, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
996
|
-
"span",
|
|
997
|
-
{
|
|
998
|
-
className: "select-none",
|
|
999
|
-
ref: (ref) => {
|
|
1000
|
-
letterRefs[index] = ref;
|
|
1001
|
-
},
|
|
1002
|
-
children: letter
|
|
1003
|
-
},
|
|
1004
|
-
index
|
|
1005
|
-
)) })
|
|
1006
|
-
] }) })
|
|
1007
|
-
);
|
|
1029
|
+
) });
|
|
1008
1030
|
}
|
|
1009
1031
|
function FadingBase({
|
|
1010
1032
|
className = "",
|
|
1011
1033
|
isMounted = false,
|
|
1012
1034
|
children
|
|
1013
1035
|
}) {
|
|
1014
|
-
const [shouldRender, setShouldRender] =
|
|
1015
|
-
const [visible, setVisible] =
|
|
1016
|
-
const timerRef =
|
|
1017
|
-
|
|
1036
|
+
const [shouldRender, setShouldRender] = React9.useState(isMounted);
|
|
1037
|
+
const [visible, setVisible] = React9.useState(false);
|
|
1038
|
+
const timerRef = React9.useRef(null);
|
|
1039
|
+
React9.useEffect(() => {
|
|
1018
1040
|
if (isMounted) {
|
|
1019
1041
|
setShouldRender(true);
|
|
1020
1042
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -1055,9 +1077,9 @@ function ScalableContainer({
|
|
|
1055
1077
|
children,
|
|
1056
1078
|
assignClassOnClick
|
|
1057
1079
|
}) {
|
|
1058
|
-
const containerRef =
|
|
1059
|
-
const [isScaled, setScaled] =
|
|
1060
|
-
const [wrapperClass, setWrapperClass] =
|
|
1080
|
+
const containerRef = React9.useRef(null);
|
|
1081
|
+
const [isScaled, setScaled] = React9.useState(false);
|
|
1082
|
+
const [wrapperClass, setWrapperClass] = React9.useState("");
|
|
1061
1083
|
const onClick = () => {
|
|
1062
1084
|
const next = !isScaled;
|
|
1063
1085
|
setScaled(next);
|
|
@@ -1167,17 +1189,17 @@ function CatalogGrid({ items, buttonText, onOpen }) {
|
|
|
1167
1189
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(GridCard, { item, buttonText, onOpen }, item.key)) });
|
|
1168
1190
|
}
|
|
1169
1191
|
function CatalogCarousel({ items, buttonText, onOpen }) {
|
|
1170
|
-
const [activeIndex, setActiveIndex] =
|
|
1171
|
-
const [indexPool, setIndexPool] =
|
|
1172
|
-
const cardRefs =
|
|
1173
|
-
const getIndexes =
|
|
1192
|
+
const [activeIndex, setActiveIndex] = React9.useState(0);
|
|
1193
|
+
const [indexPool, setIndexPool] = React9.useState([]);
|
|
1194
|
+
const cardRefs = React9.useRef([]);
|
|
1195
|
+
const getIndexes = React9.useMemo(() => {
|
|
1174
1196
|
let nextIndex = activeIndex + 1;
|
|
1175
1197
|
let previousIndex = activeIndex - 1;
|
|
1176
1198
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
1177
1199
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
1178
1200
|
return { previousIndex, nextIndex };
|
|
1179
1201
|
}, [activeIndex, items.length]);
|
|
1180
|
-
|
|
1202
|
+
React9.useEffect(() => {
|
|
1181
1203
|
const { nextIndex, previousIndex } = getIndexes;
|
|
1182
1204
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
1183
1205
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -1296,14 +1318,14 @@ function MenuBar({ items }) {
|
|
|
1296
1318
|
);
|
|
1297
1319
|
}
|
|
1298
1320
|
function ContextMenu({ items, position, visible, onClose }) {
|
|
1299
|
-
const contextRef =
|
|
1300
|
-
const childMenuRef =
|
|
1301
|
-
const [hasArrowUp, setHasArrowUp] =
|
|
1302
|
-
const [childArrowUp, setChildArrowUp] =
|
|
1303
|
-
const [hoveredItem, setHoveredItem] =
|
|
1304
|
-
const [hoveredChild, setHoveredChild] =
|
|
1305
|
-
const [activeChildren, setActiveChildren] =
|
|
1306
|
-
|
|
1321
|
+
const contextRef = React9.useRef(null);
|
|
1322
|
+
const childMenuRef = React9.useRef(null);
|
|
1323
|
+
const [hasArrowUp, setHasArrowUp] = React9.useState(true);
|
|
1324
|
+
const [childArrowUp, setChildArrowUp] = React9.useState(false);
|
|
1325
|
+
const [hoveredItem, setHoveredItem] = React9.useState(-1);
|
|
1326
|
+
const [hoveredChild, setHoveredChild] = React9.useState(-1);
|
|
1327
|
+
const [activeChildren, setActiveChildren] = React9.useState([]);
|
|
1328
|
+
React9.useEffect(() => {
|
|
1307
1329
|
const clickAway = ({ target }) => {
|
|
1308
1330
|
if (contextRef.current && !contextRef.current.contains(target)) {
|
|
1309
1331
|
if (childMenuRef.current) {
|
|
@@ -1318,7 +1340,7 @@ function ContextMenu({ items, position, visible, onClose }) {
|
|
|
1318
1340
|
window.addEventListener("click", clickAway);
|
|
1319
1341
|
return () => window.removeEventListener("click", clickAway);
|
|
1320
1342
|
}, [onClose]);
|
|
1321
|
-
|
|
1343
|
+
React9.useEffect(() => {
|
|
1322
1344
|
const current = contextRef.current;
|
|
1323
1345
|
const child = childMenuRef.current;
|
|
1324
1346
|
if (!current || !child) return;
|
|
@@ -1414,18 +1436,18 @@ function ContextMenu({ items, position, visible, onClose }) {
|
|
|
1414
1436
|
);
|
|
1415
1437
|
}
|
|
1416
1438
|
function Wizard({ children, steps, storageKey = "po_wizard" }) {
|
|
1417
|
-
const wizardRef =
|
|
1418
|
-
const [activeStep, setActiveStep] =
|
|
1419
|
-
const [targetBbox, setTargetBbox] =
|
|
1420
|
-
const HIGHLIGHTED =
|
|
1439
|
+
const wizardRef = React9.useRef(null);
|
|
1440
|
+
const [activeStep, setActiveStep] = React9.useState(0);
|
|
1441
|
+
const [targetBbox, setTargetBbox] = React9.useState(null);
|
|
1442
|
+
const HIGHLIGHTED = React9.useMemo(
|
|
1421
1443
|
() => ["border", "border-4", "border-prussian-blue", "pointer-events-none"],
|
|
1422
1444
|
[]
|
|
1423
1445
|
);
|
|
1424
|
-
const closeWizard =
|
|
1446
|
+
const closeWizard = React9.useCallback(() => {
|
|
1425
1447
|
steps[activeStep]?.stepRef.current?.classList.remove(...HIGHLIGHTED);
|
|
1426
1448
|
if (wizardRef.current) wizardRef.current.style.display = "none";
|
|
1427
1449
|
}, [HIGHLIGHTED, steps, activeStep]);
|
|
1428
|
-
|
|
1450
|
+
React9.useEffect(() => {
|
|
1429
1451
|
const visited = JSON.parse(localStorage.getItem(storageKey) ?? "false");
|
|
1430
1452
|
if (visited) {
|
|
1431
1453
|
closeWizard();
|
|
@@ -1479,7 +1501,7 @@ function Wizard({ children, steps, storageKey = "po_wizard" }) {
|
|
|
1479
1501
|
children
|
|
1480
1502
|
] });
|
|
1481
1503
|
}
|
|
1482
|
-
var SearchInput =
|
|
1504
|
+
var SearchInput = React9__default.default.forwardRef(function SearchInput2({
|
|
1483
1505
|
value,
|
|
1484
1506
|
onChange,
|
|
1485
1507
|
disabled,
|
|
@@ -1547,15 +1569,15 @@ function Dropdown({
|
|
|
1547
1569
|
labelStyle = {},
|
|
1548
1570
|
placeholder
|
|
1549
1571
|
}) {
|
|
1550
|
-
const [open, setOpen] =
|
|
1551
|
-
const [selectedItems, setSelectedItems] =
|
|
1552
|
-
const [hoveredItem, setHoveredItem] =
|
|
1553
|
-
const [searchTerm, setSearchTerm] =
|
|
1554
|
-
const [innerItems, setInnerItems] =
|
|
1555
|
-
|
|
1572
|
+
const [open, setOpen] = React9.useState(false);
|
|
1573
|
+
const [selectedItems, setSelectedItems] = React9.useState([]);
|
|
1574
|
+
const [hoveredItem, setHoveredItem] = React9.useState(null);
|
|
1575
|
+
const [searchTerm, setSearchTerm] = React9.useState("");
|
|
1576
|
+
const [innerItems, setInnerItems] = React9.useState([]);
|
|
1577
|
+
React9.useEffect(() => {
|
|
1556
1578
|
setInnerItems(items);
|
|
1557
1579
|
}, [items]);
|
|
1558
|
-
|
|
1580
|
+
React9.useEffect(() => {
|
|
1559
1581
|
if (isMultiselect && Array.isArray(value)) {
|
|
1560
1582
|
setSelectedItems(value);
|
|
1561
1583
|
}
|
|
@@ -1728,14 +1750,14 @@ function TableBody({
|
|
|
1728
1750
|
rows,
|
|
1729
1751
|
expandRow
|
|
1730
1752
|
}) {
|
|
1731
|
-
const [visibleRows, setVisibleRows] =
|
|
1753
|
+
const [visibleRows, setVisibleRows] = React9.useState({});
|
|
1732
1754
|
const toggleRow = (rowKey) => {
|
|
1733
1755
|
setVisibleRows((prev) => ({
|
|
1734
1756
|
...prev,
|
|
1735
1757
|
[rowKey]: { visible: !prev[rowKey]?.visible }
|
|
1736
1758
|
}));
|
|
1737
1759
|
};
|
|
1738
|
-
|
|
1760
|
+
React9.useEffect(() => {
|
|
1739
1761
|
if (rows.length && Object.keys(visibleRows).length === 0) {
|
|
1740
1762
|
const initial = {};
|
|
1741
1763
|
rows.forEach((row) => {
|
|
@@ -1744,7 +1766,7 @@ function TableBody({
|
|
|
1744
1766
|
setVisibleRows(initial);
|
|
1745
1767
|
}
|
|
1746
1768
|
}, [rows]);
|
|
1747
|
-
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1769
|
+
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs(React9__default.default.Fragment, { children: [
|
|
1748
1770
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1749
1771
|
"tr",
|
|
1750
1772
|
{
|
|
@@ -1798,9 +1820,9 @@ function Pagination({
|
|
|
1798
1820
|
const matchedOption = picker.find(
|
|
1799
1821
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
1800
1822
|
);
|
|
1801
|
-
const [perPageKey, setPerPageKey] =
|
|
1823
|
+
const [perPageKey, setPerPageKey] = React9.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
1802
1824
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
1803
|
-
|
|
1825
|
+
React9.useEffect(() => {
|
|
1804
1826
|
if (serverSide && options.perPage != null) {
|
|
1805
1827
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
1806
1828
|
if (next) setPerPageKey(next.key);
|
|
@@ -1860,35 +1882,35 @@ function Table({
|
|
|
1860
1882
|
footer = null,
|
|
1861
1883
|
header = null
|
|
1862
1884
|
}) {
|
|
1863
|
-
const searchRef =
|
|
1864
|
-
const [searchTerm, setSearchTerm] =
|
|
1865
|
-
const [perPage, setPerPage] =
|
|
1885
|
+
const searchRef = React9.useRef(null);
|
|
1886
|
+
const [searchTerm, setSearchTerm] = React9.useState("");
|
|
1887
|
+
const [perPage, setPerPage] = React9.useState(
|
|
1866
1888
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
1867
1889
|
);
|
|
1868
|
-
const [activePage, setActivePage] =
|
|
1869
|
-
const [datasets, setDatasets] =
|
|
1890
|
+
const [activePage, setActivePage] = React9.useState(0);
|
|
1891
|
+
const [datasets, setDatasets] = React9.useState([]);
|
|
1870
1892
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
1871
|
-
const MAX_PAGE =
|
|
1893
|
+
const MAX_PAGE = React9.useMemo(() => {
|
|
1872
1894
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
1873
1895
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
1874
1896
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
1875
1897
|
return datasets.length ? datasets.length - 1 : 0;
|
|
1876
1898
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
1877
|
-
const currentPageRows =
|
|
1899
|
+
const currentPageRows = React9.useMemo(() => {
|
|
1878
1900
|
if (isServerSide) return rows;
|
|
1879
1901
|
return datasets.length ? datasets[activePage] ?? [] : [];
|
|
1880
1902
|
}, [isServerSide, rows, datasets, activePage]);
|
|
1881
|
-
|
|
1903
|
+
React9.useEffect(() => {
|
|
1882
1904
|
if (pagination.enabled && !isServerSide) setPerPage(pagination.perPage ?? 15);
|
|
1883
1905
|
}, [pagination, isServerSide]);
|
|
1884
|
-
|
|
1906
|
+
React9.useEffect(() => {
|
|
1885
1907
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
1886
1908
|
}, [isServerSide, pagination.perPage]);
|
|
1887
|
-
|
|
1909
|
+
React9.useEffect(() => {
|
|
1888
1910
|
if (isServerSide) return;
|
|
1889
1911
|
setDatasets(createDatasets(rows, pagination.enabled ? perPage : null));
|
|
1890
1912
|
}, [rows, perPage, pagination, isServerSide]);
|
|
1891
|
-
|
|
1913
|
+
React9.useEffect(() => {
|
|
1892
1914
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
1893
1915
|
setActivePage(pagination.page - 1);
|
|
1894
1916
|
}, [isServerSide, pagination.page]);
|
|
@@ -1948,7 +1970,7 @@ function Table({
|
|
|
1948
1970
|
] });
|
|
1949
1971
|
}
|
|
1950
1972
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode" }) {
|
|
1951
|
-
const id =
|
|
1973
|
+
const id = React9.useId();
|
|
1952
1974
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center gap-2 cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1953
1975
|
SwitchPrimitive__namespace.Root,
|
|
1954
1976
|
{
|
|
@@ -2141,17 +2163,17 @@ function AppShell({
|
|
|
2141
2163
|
children,
|
|
2142
2164
|
className = ""
|
|
2143
2165
|
}) {
|
|
2144
|
-
const [expanded, setExpanded] =
|
|
2145
|
-
const [isMobile, setIsMobile] =
|
|
2146
|
-
const [mobileOpen, setMobileOpen] =
|
|
2147
|
-
|
|
2166
|
+
const [expanded, setExpanded] = React9.useState(sidebarDefaultExpanded);
|
|
2167
|
+
const [isMobile, setIsMobile] = React9.useState(false);
|
|
2168
|
+
const [mobileOpen, setMobileOpen] = React9.useState(false);
|
|
2169
|
+
React9.useEffect(() => {
|
|
2148
2170
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
2149
2171
|
const update = (e) => setIsMobile(e.matches);
|
|
2150
2172
|
update(mq);
|
|
2151
2173
|
mq.addEventListener("change", update);
|
|
2152
2174
|
return () => mq.removeEventListener("change", update);
|
|
2153
2175
|
}, []);
|
|
2154
|
-
|
|
2176
|
+
React9.useEffect(() => {
|
|
2155
2177
|
if (!isMobile) setMobileOpen(false);
|
|
2156
2178
|
}, [isMobile]);
|
|
2157
2179
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -2325,10 +2347,10 @@ function ThemeProvider({
|
|
|
2325
2347
|
className = "",
|
|
2326
2348
|
style
|
|
2327
2349
|
}) {
|
|
2328
|
-
const id =
|
|
2350
|
+
const id = React9__default.default.useId().replace(/:/g, "");
|
|
2329
2351
|
const scopeClass = `geo-th-${id}`;
|
|
2330
|
-
const divRef =
|
|
2331
|
-
|
|
2352
|
+
const divRef = React9.useRef(null);
|
|
2353
|
+
React9.useEffect(() => {
|
|
2332
2354
|
const el = divRef.current;
|
|
2333
2355
|
if (!el) return;
|
|
2334
2356
|
if (colorScheme === "auto") return;
|
|
@@ -2343,8 +2365,8 @@ function ThemeProvider({
|
|
|
2343
2365
|
}
|
|
2344
2366
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
2345
2367
|
}, [colorScheme]);
|
|
2346
|
-
const lightVars =
|
|
2347
|
-
const darkVarStr =
|
|
2368
|
+
const lightVars = React9.useMemo(() => toCssVars(theme), [theme]);
|
|
2369
|
+
const darkVarStr = React9.useMemo(() => {
|
|
2348
2370
|
if (!darkTheme) return "";
|
|
2349
2371
|
const dvars = toCssVars(darkTheme);
|
|
2350
2372
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -2623,7 +2645,7 @@ function Password({
|
|
|
2623
2645
|
labelColor,
|
|
2624
2646
|
iconColor
|
|
2625
2647
|
}) {
|
|
2626
|
-
const [passwordVisible, setPasswordVisible] =
|
|
2648
|
+
const [passwordVisible, setPasswordVisible] = React9.useState(false);
|
|
2627
2649
|
const color = iconColor ?? chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"];
|
|
2628
2650
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
|
|
2629
2651
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
|
|
@@ -2769,7 +2791,7 @@ function Switch({
|
|
|
2769
2791
|
checkedIcon,
|
|
2770
2792
|
uncheckedIcon
|
|
2771
2793
|
}) {
|
|
2772
|
-
const id =
|
|
2794
|
+
const id = React9.useId();
|
|
2773
2795
|
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(
|
|
2774
2796
|
SwitchPrimitive__namespace.Root,
|
|
2775
2797
|
{
|
|
@@ -2799,8 +2821,8 @@ function AutoComplete({
|
|
|
2799
2821
|
onItemClick,
|
|
2800
2822
|
emptyText = "No results found"
|
|
2801
2823
|
}) {
|
|
2802
|
-
const [term, setTerm] =
|
|
2803
|
-
const [open, setOpen] =
|
|
2824
|
+
const [term, setTerm] = React9.useState("");
|
|
2825
|
+
const [open, setOpen] = React9.useState(false);
|
|
2804
2826
|
const foundItems = term.trim() ? items.filter(
|
|
2805
2827
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
2806
2828
|
) : [];
|
|
@@ -2885,10 +2907,10 @@ function TreeSelect({
|
|
|
2885
2907
|
htmlFor,
|
|
2886
2908
|
items = []
|
|
2887
2909
|
}) {
|
|
2888
|
-
const [open, setOpen] =
|
|
2889
|
-
const [hoveredItem, setHoveredItem] =
|
|
2890
|
-
const [innerItems, setInnerItems] =
|
|
2891
|
-
|
|
2910
|
+
const [open, setOpen] = React9.useState(false);
|
|
2911
|
+
const [hoveredItem, setHoveredItem] = React9.useState(null);
|
|
2912
|
+
const [innerItems, setInnerItems] = React9.useState([]);
|
|
2913
|
+
React9.useEffect(() => {
|
|
2892
2914
|
setInnerItems(items);
|
|
2893
2915
|
}, [items]);
|
|
2894
2916
|
const selectItem = (key) => {
|
|
@@ -2987,8 +3009,8 @@ function FileInput({
|
|
|
2987
3009
|
name,
|
|
2988
3010
|
accept = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx"
|
|
2989
3011
|
}) {
|
|
2990
|
-
const fileInput =
|
|
2991
|
-
const [files, setFiles] =
|
|
3012
|
+
const fileInput = React9.useRef(null);
|
|
3013
|
+
const [files, setFiles] = React9.useState([]);
|
|
2992
3014
|
const openPicker = () => {
|
|
2993
3015
|
fileInput.current?.click();
|
|
2994
3016
|
};
|
|
@@ -3136,12 +3158,12 @@ function DatePickerBase({
|
|
|
3136
3158
|
disableAfter,
|
|
3137
3159
|
disabled
|
|
3138
3160
|
}) {
|
|
3139
|
-
const pickerRef =
|
|
3140
|
-
const calendarRef =
|
|
3141
|
-
const [isExpanded, setExpanded] =
|
|
3142
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3143
|
-
const [currentYear, setCurrentYear] =
|
|
3144
|
-
const [currentMonth, setCurrentMonth] =
|
|
3161
|
+
const pickerRef = React9.useRef(null);
|
|
3162
|
+
const calendarRef = React9.useRef(null);
|
|
3163
|
+
const [isExpanded, setExpanded] = React9.useState(false);
|
|
3164
|
+
const [isCloseToBottom, setCloseToBottom] = React9.useState(false);
|
|
3165
|
+
const [currentYear, setCurrentYear] = React9.useState(value.getFullYear());
|
|
3166
|
+
const [currentMonth, setCurrentMonth] = React9.useState(value.getMonth() + 1);
|
|
3145
3167
|
const toggle = () => {
|
|
3146
3168
|
if (!disabled) setExpanded((p) => !p);
|
|
3147
3169
|
};
|
|
@@ -3185,14 +3207,14 @@ function DatePickerBase({
|
|
|
3185
3207
|
}
|
|
3186
3208
|
return ordered;
|
|
3187
3209
|
};
|
|
3188
|
-
|
|
3210
|
+
React9.useEffect(() => {
|
|
3189
3211
|
const clickAway = (e) => {
|
|
3190
3212
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3191
3213
|
};
|
|
3192
3214
|
document.addEventListener("mousedown", clickAway);
|
|
3193
3215
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3194
3216
|
}, []);
|
|
3195
|
-
|
|
3217
|
+
React9.useEffect(() => {
|
|
3196
3218
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3197
3219
|
if (bbox && (bbox.y > window.innerHeight - 220 || bbox.bottom > window.innerHeight - 400)) {
|
|
3198
3220
|
setCloseToBottom(true);
|
|
@@ -3285,29 +3307,29 @@ function TemporalPickerBase({
|
|
|
3285
3307
|
layout,
|
|
3286
3308
|
style = {}
|
|
3287
3309
|
}) {
|
|
3288
|
-
const pickerRef =
|
|
3289
|
-
const calendarRef =
|
|
3290
|
-
const valueRefs =
|
|
3291
|
-
const [isExpanded, setExpanded] =
|
|
3292
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3293
|
-
const innerValues =
|
|
3310
|
+
const pickerRef = React9.useRef(null);
|
|
3311
|
+
const calendarRef = React9.useRef(null);
|
|
3312
|
+
const valueRefs = React9.useRef([]);
|
|
3313
|
+
const [isExpanded, setExpanded] = React9.useState(false);
|
|
3314
|
+
const [isCloseToBottom, setCloseToBottom] = React9.useState(false);
|
|
3315
|
+
const innerValues = React9.useMemo(() => {
|
|
3294
3316
|
const vals = [];
|
|
3295
3317
|
for (let i = lowerLimit; i <= upperLimit; i++) vals.push(i);
|
|
3296
3318
|
return vals;
|
|
3297
3319
|
}, [lowerLimit, upperLimit]);
|
|
3298
|
-
|
|
3320
|
+
React9.useEffect(() => {
|
|
3299
3321
|
const clickAway = (e) => {
|
|
3300
3322
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3301
3323
|
};
|
|
3302
3324
|
document.addEventListener("mousedown", clickAway);
|
|
3303
3325
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3304
3326
|
}, []);
|
|
3305
|
-
|
|
3327
|
+
React9.useEffect(() => {
|
|
3306
3328
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3307
3329
|
if (bbox && bbox.y > window.innerHeight - 220) setCloseToBottom(true);
|
|
3308
3330
|
else setCloseToBottom(false);
|
|
3309
3331
|
}, []);
|
|
3310
|
-
|
|
3332
|
+
React9.useEffect(() => {
|
|
3311
3333
|
if (!isExpanded) return;
|
|
3312
3334
|
const t = setTimeout(() => {
|
|
3313
3335
|
const node = valueRefs.current.find((n) => n.value === value);
|