@geomak/ui 1.8.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 +270 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -30
- package/dist/index.d.ts +100 -30
- package/dist/index.js +180 -195
- package/dist/index.js.map +1 -1
- package/dist/styles.css +42 -28
- package/package.json +2 -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 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
|
|
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] =
|
|
210
|
-
|
|
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 =
|
|
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] =
|
|
544
|
-
|
|
545
|
+
const [value, setValue] = React8.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
|
|
546
|
+
React8.useEffect(() => {
|
|
545
547
|
if (defaultActiveTab) setValue(defaultActiveTab);
|
|
546
548
|
}, [defaultActiveTab]);
|
|
547
|
-
|
|
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 =
|
|
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] =
|
|
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] =
|
|
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 } =
|
|
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] =
|
|
1085
|
-
const [visible, setVisible] =
|
|
1086
|
-
const timerRef =
|
|
1087
|
-
|
|
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 =
|
|
1147
|
-
const [isScaled, setScaled] =
|
|
1148
|
-
const [wrapperClass, setWrapperClass] =
|
|
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] =
|
|
1259
|
-
const [indexPool, setIndexPool] =
|
|
1260
|
-
const cardRefs =
|
|
1261
|
-
const getIndexes =
|
|
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
|
-
|
|
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,
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
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
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
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
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
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 =
|
|
1510
|
-
const [activeStep, setActiveStep] =
|
|
1511
|
-
const [targetBbox, setTargetBbox] =
|
|
1512
|
-
const HIGHLIGHTED =
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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] =
|
|
1643
|
-
const [selectedItems, setSelectedItems] =
|
|
1644
|
-
const [searchTerm, setSearchTerm] =
|
|
1645
|
-
const [innerItems, setInnerItems] =
|
|
1646
|
-
const errorId =
|
|
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
|
-
|
|
1608
|
+
React8.useEffect(() => {
|
|
1649
1609
|
setInnerItems(items);
|
|
1650
1610
|
}, [items]);
|
|
1651
|
-
|
|
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] =
|
|
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(
|
|
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] =
|
|
1893
|
+
const [perPageKey, setPerPageKey] = React8.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
1934
1894
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
1935
|
-
|
|
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 =
|
|
1996
|
-
const [searchTerm, setSearchTerm] =
|
|
1997
|
-
const [perPage, setPerPage] =
|
|
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] =
|
|
1960
|
+
const [activePage, setActivePage] = React8.useState(0);
|
|
2001
1961
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
2002
|
-
const filteredRows =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1981
|
+
const currentPageRows = React8.useMemo(() => {
|
|
2022
1982
|
if (isServerSide) return rows;
|
|
2023
1983
|
return datasets[activePage] ?? [];
|
|
2024
1984
|
}, [isServerSide, rows, datasets, activePage]);
|
|
2025
|
-
|
|
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
|
-
|
|
1990
|
+
React8.useEffect(() => {
|
|
2031
1991
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
2032
1992
|
}, [isServerSide, pagination.perPage]);
|
|
2033
|
-
|
|
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 =
|
|
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] =
|
|
2287
|
-
const [isMobile, setIsMobile] =
|
|
2288
|
-
const [mobileOpen, setMobileOpen] =
|
|
2289
|
-
|
|
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
|
-
|
|
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 =
|
|
2446
|
+
const id = React8__default.default.useId().replace(/:/g, "");
|
|
2487
2447
|
const scopeClass = `geo-th-${id}`;
|
|
2488
|
-
const divRef =
|
|
2489
|
-
|
|
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 =
|
|
2505
|
-
const darkVarStr =
|
|
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 =
|
|
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(
|
|
@@ -2682,91 +2642,117 @@ function NumberInput({
|
|
|
2682
2642
|
htmlFor,
|
|
2683
2643
|
name,
|
|
2684
2644
|
disabled,
|
|
2685
|
-
layout,
|
|
2645
|
+
layout = "horizontal",
|
|
2686
2646
|
errorMessage,
|
|
2687
2647
|
inputStyle,
|
|
2688
2648
|
labelStyle,
|
|
2689
2649
|
placeholder,
|
|
2690
|
-
style
|
|
2650
|
+
style,
|
|
2691
2651
|
min,
|
|
2692
2652
|
max,
|
|
2693
|
-
readOnly = false
|
|
2653
|
+
readOnly = false,
|
|
2654
|
+
precision
|
|
2694
2655
|
}) {
|
|
2656
|
+
const errorId = React8.useId();
|
|
2657
|
+
const hasError = errorMessage != null;
|
|
2658
|
+
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
2659
|
+
const round = (n) => {
|
|
2660
|
+
if (inferredPrecision === 0) return n;
|
|
2661
|
+
const factor = 10 ** inferredPrecision;
|
|
2662
|
+
return Math.round(n * factor) / factor;
|
|
2663
|
+
};
|
|
2664
|
+
const numeric = typeof value === "number" ? value : 0;
|
|
2695
2665
|
const onIncrement = () => {
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2666
|
+
if (disabled || readOnly) return;
|
|
2667
|
+
const next = round(numeric + step);
|
|
2668
|
+
if (max !== void 0 && next > max) return;
|
|
2669
|
+
onChange?.({ target: { value: next, id: htmlFor, name } });
|
|
2699
2670
|
};
|
|
2700
2671
|
const onDecrement = () => {
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2672
|
+
if (disabled || readOnly) return;
|
|
2673
|
+
const next = round(numeric - step);
|
|
2674
|
+
if (min !== void 0 && next < min) return;
|
|
2675
|
+
onChange?.({ target: { value: next, id: htmlFor, name } });
|
|
2704
2676
|
};
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
{
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2677
|
+
const handleInputChange = (e) => {
|
|
2678
|
+
const raw = e.target.value;
|
|
2679
|
+
if (raw === "") {
|
|
2680
|
+
onChange?.({ target: { value: void 0, id: htmlFor, name } });
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
const parsed = Number(raw);
|
|
2684
|
+
if (Number.isNaN(parsed)) return;
|
|
2685
|
+
onChange?.({ target: { value: round(parsed), id: htmlFor, name } });
|
|
2686
|
+
};
|
|
2687
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2688
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col gap-1" : "flex-row items-center gap-2"}`, children: [
|
|
2689
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2690
|
+
"label",
|
|
2691
|
+
{
|
|
2692
|
+
className: "text-sm font-medium ml-1 max-content select-none text-foreground",
|
|
2693
|
+
style: labelStyle,
|
|
2694
|
+
htmlFor,
|
|
2695
|
+
children: label
|
|
2696
|
+
}
|
|
2697
|
+
),
|
|
2698
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2699
|
+
"div",
|
|
2700
|
+
{
|
|
2701
|
+
style,
|
|
2702
|
+
className: `flex items-center rounded-lg border ${hasError ? "border-status-error" : "border-border"} ${disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : "bg-surface text-foreground"} focus-within:ring-2 focus-within:ring-accent transition-colors`,
|
|
2703
|
+
children: [
|
|
2704
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2705
|
+
"input",
|
|
2706
|
+
{
|
|
2707
|
+
min,
|
|
2708
|
+
max,
|
|
2709
|
+
autoComplete: "off",
|
|
2710
|
+
disabled,
|
|
2711
|
+
name,
|
|
2712
|
+
id: htmlFor,
|
|
2713
|
+
step,
|
|
2714
|
+
value: value ?? "",
|
|
2715
|
+
onChange: handleInputChange,
|
|
2716
|
+
type: "number",
|
|
2717
|
+
"aria-invalid": hasError || void 0,
|
|
2718
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
2719
|
+
className: "bg-transparent focus:outline-none h-9 w-full px-3 disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
2720
|
+
style: inputStyle ?? {},
|
|
2721
|
+
placeholder: placeholder ?? "",
|
|
2722
|
+
readOnly
|
|
2723
|
+
}
|
|
2724
|
+
),
|
|
2725
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col border-l border-border h-9", children: [
|
|
2726
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2727
|
+
"button",
|
|
2728
|
+
{
|
|
2729
|
+
type: "button",
|
|
2730
|
+
tabIndex: -1,
|
|
2731
|
+
onClick: onIncrement,
|
|
2732
|
+
disabled: disabled || readOnly || max !== void 0 && numeric >= max,
|
|
2733
|
+
"aria-label": "Increase value",
|
|
2734
|
+
className: "flex-1 px-1.5 flex items-center justify-center hover:bg-surface-raised disabled:opacity-30 disabled:cursor-not-allowed transition-colors focus:outline-none focus-visible:bg-surface-raised",
|
|
2735
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, className: "h-3 w-3", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 15l7-7 7 7" }) })
|
|
2736
|
+
}
|
|
2737
|
+
),
|
|
2738
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2739
|
+
"button",
|
|
2740
|
+
{
|
|
2741
|
+
type: "button",
|
|
2742
|
+
tabIndex: -1,
|
|
2743
|
+
onClick: onDecrement,
|
|
2744
|
+
disabled: disabled || readOnly || min !== void 0 && numeric <= min,
|
|
2745
|
+
"aria-label": "Decrease value",
|
|
2746
|
+
className: "flex-1 px-1.5 flex items-center justify-center hover:bg-surface-raised disabled:opacity-30 disabled:cursor-not-allowed transition-colors focus:outline-none focus-visible:bg-surface-raised border-t border-border",
|
|
2747
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, className: "h-3 w-3", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
2748
|
+
}
|
|
2749
|
+
)
|
|
2750
|
+
] })
|
|
2751
|
+
]
|
|
2752
|
+
}
|
|
2753
|
+
)
|
|
2754
|
+
] }),
|
|
2755
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-xs text-status-error ml-1", children: errorMessage })
|
|
2770
2756
|
] });
|
|
2771
2757
|
}
|
|
2772
2758
|
function Password({
|
|
@@ -2785,8 +2771,8 @@ function Password({
|
|
|
2785
2771
|
labelColor,
|
|
2786
2772
|
iconColor
|
|
2787
2773
|
}) {
|
|
2788
|
-
const [passwordVisible, setPasswordVisible] =
|
|
2789
|
-
const errorId =
|
|
2774
|
+
const [passwordVisible, setPasswordVisible] = React8.useState(false);
|
|
2775
|
+
const errorId = React8.useId();
|
|
2790
2776
|
const hasError = errorMessage != null;
|
|
2791
2777
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
|
|
2792
2778
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
|
|
@@ -2932,7 +2918,7 @@ function Switch({
|
|
|
2932
2918
|
checkedIcon,
|
|
2933
2919
|
uncheckedIcon
|
|
2934
2920
|
}) {
|
|
2935
|
-
const id =
|
|
2921
|
+
const id = React8.useId();
|
|
2936
2922
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2937
2923
|
"// mr-12 was a hardcoded right margin that broke layouts; spacing // is the parent's responsibility now.",
|
|
2938
2924
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2965,8 +2951,8 @@ function AutoComplete({
|
|
|
2965
2951
|
onItemClick,
|
|
2966
2952
|
emptyText = "No results found"
|
|
2967
2953
|
}) {
|
|
2968
|
-
const [term, setTerm] =
|
|
2969
|
-
const [open, setOpen] =
|
|
2954
|
+
const [term, setTerm] = React8.useState("");
|
|
2955
|
+
const [open, setOpen] = React8.useState(false);
|
|
2970
2956
|
const foundItems = term.trim() ? items.filter(
|
|
2971
2957
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
2972
2958
|
) : [];
|
|
@@ -3064,10 +3050,10 @@ function TreeSelect({
|
|
|
3064
3050
|
htmlFor,
|
|
3065
3051
|
items = []
|
|
3066
3052
|
}) {
|
|
3067
|
-
const [open, setOpen] =
|
|
3068
|
-
const [hoveredItem, setHoveredItem] =
|
|
3069
|
-
const [innerItems, setInnerItems] =
|
|
3070
|
-
|
|
3053
|
+
const [open, setOpen] = React8.useState(false);
|
|
3054
|
+
const [hoveredItem, setHoveredItem] = React8.useState(null);
|
|
3055
|
+
const [innerItems, setInnerItems] = React8.useState([]);
|
|
3056
|
+
React8.useEffect(() => {
|
|
3071
3057
|
setInnerItems(items);
|
|
3072
3058
|
}, [items]);
|
|
3073
3059
|
const selectItem = (key) => {
|
|
@@ -3166,8 +3152,8 @@ function FileInput({
|
|
|
3166
3152
|
name,
|
|
3167
3153
|
accept = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx"
|
|
3168
3154
|
}) {
|
|
3169
|
-
const fileInput =
|
|
3170
|
-
const [files, setFiles] =
|
|
3155
|
+
const fileInput = React8.useRef(null);
|
|
3156
|
+
const [files, setFiles] = React8.useState([]);
|
|
3171
3157
|
const openPicker = () => {
|
|
3172
3158
|
fileInput.current?.click();
|
|
3173
3159
|
};
|
|
@@ -3299,7 +3285,7 @@ function getMonthDays(year, month) {
|
|
|
3299
3285
|
}
|
|
3300
3286
|
return days;
|
|
3301
3287
|
}
|
|
3302
|
-
var
|
|
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" }) });
|
|
3303
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" }) });
|
|
3304
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" }) });
|
|
3305
3291
|
function DatePickerBase({
|
|
@@ -3315,12 +3301,12 @@ function DatePickerBase({
|
|
|
3315
3301
|
disableAfter,
|
|
3316
3302
|
disabled
|
|
3317
3303
|
}) {
|
|
3318
|
-
const pickerRef =
|
|
3319
|
-
const calendarRef =
|
|
3320
|
-
const [isExpanded, setExpanded] =
|
|
3321
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3322
|
-
const [currentYear, setCurrentYear] =
|
|
3323
|
-
const [currentMonth, setCurrentMonth] =
|
|
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);
|
|
3324
3310
|
const toggle = () => {
|
|
3325
3311
|
if (!disabled) setExpanded((p) => !p);
|
|
3326
3312
|
};
|
|
@@ -3364,14 +3350,14 @@ function DatePickerBase({
|
|
|
3364
3350
|
}
|
|
3365
3351
|
return ordered;
|
|
3366
3352
|
};
|
|
3367
|
-
|
|
3353
|
+
React8.useEffect(() => {
|
|
3368
3354
|
const clickAway = (e) => {
|
|
3369
3355
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3370
3356
|
};
|
|
3371
3357
|
document.addEventListener("mousedown", clickAway);
|
|
3372
3358
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3373
3359
|
}, []);
|
|
3374
|
-
|
|
3360
|
+
React8.useEffect(() => {
|
|
3375
3361
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3376
3362
|
if (bbox && (bbox.y > window.innerHeight - 220 || bbox.bottom > window.innerHeight - 400)) {
|
|
3377
3363
|
setCloseToBottom(true);
|
|
@@ -3414,13 +3400,13 @@ function DatePickerBase({
|
|
|
3414
3400
|
children: isExpanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pt-3", children: [
|
|
3415
3401
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mx-auto w-max", children: [
|
|
3416
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, {}) }),
|
|
3417
|
-
/* @__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(
|
|
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, {}) }),
|
|
3418
3404
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-bold text-prussian-blue select-none w-[130px] text-center", children: [
|
|
3419
3405
|
currentYear,
|
|
3420
3406
|
" ",
|
|
3421
3407
|
MONTHS[currentMonth]
|
|
3422
3408
|
] }),
|
|
3423
|
-
/* @__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(
|
|
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, {}) }),
|
|
3424
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, {}) })
|
|
3425
3411
|
] }),
|
|
3426
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: [
|
|
@@ -3464,29 +3450,29 @@ function TemporalPickerBase({
|
|
|
3464
3450
|
layout,
|
|
3465
3451
|
style = {}
|
|
3466
3452
|
}) {
|
|
3467
|
-
const pickerRef =
|
|
3468
|
-
const calendarRef =
|
|
3469
|
-
const valueRefs =
|
|
3470
|
-
const [isExpanded, setExpanded] =
|
|
3471
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3472
|
-
const innerValues =
|
|
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(() => {
|
|
3473
3459
|
const vals = [];
|
|
3474
3460
|
for (let i = lowerLimit; i <= upperLimit; i++) vals.push(i);
|
|
3475
3461
|
return vals;
|
|
3476
3462
|
}, [lowerLimit, upperLimit]);
|
|
3477
|
-
|
|
3463
|
+
React8.useEffect(() => {
|
|
3478
3464
|
const clickAway = (e) => {
|
|
3479
3465
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3480
3466
|
};
|
|
3481
3467
|
document.addEventListener("mousedown", clickAway);
|
|
3482
3468
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3483
3469
|
}, []);
|
|
3484
|
-
|
|
3470
|
+
React8.useEffect(() => {
|
|
3485
3471
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3486
3472
|
if (bbox && bbox.y > window.innerHeight - 220) setCloseToBottom(true);
|
|
3487
3473
|
else setCloseToBottom(false);
|
|
3488
3474
|
}, []);
|
|
3489
|
-
|
|
3475
|
+
React8.useEffect(() => {
|
|
3490
3476
|
if (!isExpanded) return;
|
|
3491
3477
|
const t = setTimeout(() => {
|
|
3492
3478
|
const node = valueRefs.current.find((n) => n.value === value);
|