@geomak/ui 1.7.0 → 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 +323 -255
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -83
- package/dist/index.d.ts +133 -83
- package/dist/index.js +228 -160
- package/dist/index.js.map +1 -1
- package/dist/styles.css +48 -33
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +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');
|
|
6
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React9 = require('react');
|
|
6
|
+
var reactDom = require('react-dom');
|
|
7
7
|
var Dialog = require('@radix-ui/react-dialog');
|
|
8
8
|
var framerMotion = require('framer-motion');
|
|
9
9
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
@@ -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);
|
|
@@ -46,18 +46,6 @@ var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
|
|
|
46
46
|
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
47
47
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
48
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
|
-
}
|
|
61
49
|
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" }) });
|
|
62
50
|
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" }) });
|
|
63
51
|
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 }) });
|
|
@@ -217,6 +205,18 @@ Icon.Save = Save;
|
|
|
217
205
|
Icon.Copy = Copy;
|
|
218
206
|
Icon.CircleStack = CircleStack;
|
|
219
207
|
var icons_default = Icon;
|
|
208
|
+
function Portal({ children, target }) {
|
|
209
|
+
const [resolved, setResolved] = React9.useState(null);
|
|
210
|
+
React9.useEffect(() => {
|
|
211
|
+
if (target === null) {
|
|
212
|
+
setResolved(null);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const node = typeof target === "function" ? target() : target ?? document.body;
|
|
216
|
+
setResolved(node ?? null);
|
|
217
|
+
}, [target]);
|
|
218
|
+
return resolved ? reactDom.createPortal(children, resolved) : null;
|
|
219
|
+
}
|
|
220
220
|
function IconButton({
|
|
221
221
|
icon,
|
|
222
222
|
onClick,
|
|
@@ -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
|
}
|
|
@@ -332,7 +332,8 @@ function Button({
|
|
|
332
332
|
);
|
|
333
333
|
}
|
|
334
334
|
function Modal({
|
|
335
|
-
|
|
335
|
+
width,
|
|
336
|
+
size,
|
|
336
337
|
isOpen = false,
|
|
337
338
|
onClose,
|
|
338
339
|
onOk,
|
|
@@ -344,6 +345,7 @@ function Modal({
|
|
|
344
345
|
children
|
|
345
346
|
}) {
|
|
346
347
|
const reduced = framerMotion.useReducedMotion();
|
|
348
|
+
const maxWidth = width ?? size?.[0] ?? 600;
|
|
347
349
|
return /* @__PURE__ */ jsxRuntime.jsx(Dialog__namespace.Root, { open: isOpen, onOpenChange: (open) => {
|
|
348
350
|
if (!open) onClose?.();
|
|
349
351
|
}, children: /* @__PURE__ */ jsxRuntime.jsxs(Dialog__namespace.Portal, { forceMount: true, children: [
|
|
@@ -362,7 +364,7 @@ function Modal({
|
|
|
362
364
|
{
|
|
363
365
|
className: "fixed left-1/2 top-1/2 z-modal flex flex-col w-[calc(100%-2rem)] max-h-[90dvh] bg-surface rounded-2xl shadow-xl overflow-hidden focus:outline-none",
|
|
364
366
|
style: {
|
|
365
|
-
maxWidth
|
|
367
|
+
maxWidth,
|
|
366
368
|
x: "-50%",
|
|
367
369
|
y: "-50%"
|
|
368
370
|
},
|
|
@@ -387,7 +389,7 @@ function Modal({
|
|
|
387
389
|
}
|
|
388
390
|
) })
|
|
389
391
|
] }),
|
|
390
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-1 overflow-y-auto p-5 ${hasFooter ? "" : "pb-5"}`, children
|
|
392
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-1 overflow-y-auto p-5 ${hasFooter ? "" : "pb-5"}`, children }),
|
|
391
393
|
hasFooter && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-shrink-0 items-center justify-end gap-3 border-t border-border px-5 py-3", children: [
|
|
392
394
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
393
395
|
Button,
|
|
@@ -469,7 +471,7 @@ function Drawer({
|
|
|
469
471
|
}
|
|
470
472
|
) })
|
|
471
473
|
] }),
|
|
472
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto p-5", children
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto p-5", children }),
|
|
473
475
|
hasFooter && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex flex-shrink-0 items-center gap-3 border-t border-border px-5 py-3 ${isRight ? "justify-start" : "justify-end"}`, children: [
|
|
474
476
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { style: { width: 90 }, content: cancelText, onClick: onCancel }),
|
|
475
477
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { style: { width: 90 }, content: okText, onClick: onOk })
|
|
@@ -536,11 +538,11 @@ function Tabs({
|
|
|
536
538
|
tabsClosable = true,
|
|
537
539
|
defaultActiveTab
|
|
538
540
|
}) {
|
|
539
|
-
const [value, setValue] =
|
|
540
|
-
|
|
541
|
+
const [value, setValue] = React9.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
|
|
542
|
+
React9.useEffect(() => {
|
|
541
543
|
if (defaultActiveTab) setValue(defaultActiveTab);
|
|
542
544
|
}, [defaultActiveTab]);
|
|
543
|
-
|
|
545
|
+
React9.useEffect(() => {
|
|
544
546
|
if (tabs.length === 0) {
|
|
545
547
|
setValue("");
|
|
546
548
|
return;
|
|
@@ -588,29 +590,46 @@ function Tabs({
|
|
|
588
590
|
{
|
|
589
591
|
"aria-label": "Tabs",
|
|
590
592
|
className: "flex-1 flex items-center gap-1 overflow-x-auto overflow-y-hidden rounded-lg scroll-smooth snap-x snap-mandatory hidden-scrollbar",
|
|
591
|
-
children: tabs.map((tab) =>
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
593
|
+
children: tabs.map((tab) => (
|
|
594
|
+
// Trigger + close button are SIBLINGS, not nested.
|
|
595
|
+
// Nesting a clickable element inside <button> is invalid
|
|
596
|
+
// HTML and breaks keyboard activation of the inner one.
|
|
597
|
+
// The wrapper carries `group` so the close button can
|
|
598
|
+
// react to the trigger's `data-state=active` for styling.
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
className: "snap-start snap-always relative flex items-center flex-1 min-w-[120px] max-w-[220px] flex-shrink-0 group",
|
|
603
|
+
children: [
|
|
604
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
605
|
+
TabsPrimitive__namespace.Trigger,
|
|
606
|
+
{
|
|
607
|
+
value: tab.key,
|
|
608
|
+
className: `w-full ${tabsClosable ? "pr-8" : "pr-3"} pl-3 py-2 rounded-3xl cursor-pointer transition-all duration-200 select-none h-10 text-left
|
|
609
|
+
text-foreground-secondary bg-surface-raised
|
|
610
|
+
hover:bg-surface hover:text-foreground
|
|
611
|
+
data-[state=active]:bg-accent data-[state=active]:text-accent-foreground
|
|
612
|
+
focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,
|
|
613
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm block", children: tab.title })
|
|
614
|
+
}
|
|
615
|
+
),
|
|
616
|
+
tabsClosable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
617
|
+
"button",
|
|
618
|
+
{
|
|
619
|
+
type: "button",
|
|
620
|
+
"aria-label": `Close ${tab.title}`,
|
|
621
|
+
onClick: (e) => {
|
|
622
|
+
e.stopPropagation();
|
|
623
|
+
onTabClose?.(tab.key);
|
|
624
|
+
},
|
|
625
|
+
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-foreground-secondary group-data-[state=active]:text-accent-foreground hover:bg-black/10 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
626
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
627
|
+
}
|
|
628
|
+
)
|
|
629
|
+
]
|
|
630
|
+
},
|
|
631
|
+
tab.key
|
|
632
|
+
)
|
|
614
633
|
))
|
|
615
634
|
}
|
|
616
635
|
),
|
|
@@ -673,40 +692,41 @@ function TreeNodeItem({
|
|
|
673
692
|
defaultValue: initialOpen,
|
|
674
693
|
style: { paddingLeft: depth * 12 },
|
|
675
694
|
children: /* @__PURE__ */ jsxRuntime.jsxs(Accordion__namespace.Item, { value: item.key, className: "border-none", children: [
|
|
676
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
{
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
695
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
696
|
+
Accordion__namespace.Trigger,
|
|
697
|
+
{
|
|
698
|
+
onClick: () => onNodeClick({
|
|
699
|
+
isParent: true,
|
|
700
|
+
key: item.key,
|
|
701
|
+
label: item.label,
|
|
702
|
+
data: item.nodeData,
|
|
703
|
+
parentLabel: item.parentLabel
|
|
704
|
+
}),
|
|
705
|
+
className: "flex items-center gap-2 cursor-pointer py-1.5 px-2 group focus:outline-none focus-visible:ring-2 focus-visible:ring-accent w-full text-left rounded-md hover:bg-surface-raised transition-colors duration-150",
|
|
706
|
+
children: [
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
708
|
+
"svg",
|
|
687
709
|
{
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
710
|
+
viewBox: "0 0 24 24",
|
|
711
|
+
fill: "none",
|
|
712
|
+
stroke: "currentColor",
|
|
713
|
+
strokeWidth: 2.5,
|
|
714
|
+
className: "h-3.5 w-3.5 flex-shrink-0 text-foreground-muted transition-transform duration-200 group-data-[state=open]:rotate-0 group-data-[state=closed]:-rotate-90",
|
|
715
|
+
"aria-hidden": "true",
|
|
716
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
717
|
+
"path",
|
|
718
|
+
{
|
|
719
|
+
strokeLinecap: "round",
|
|
720
|
+
strokeLinejoin: "round",
|
|
721
|
+
d: "M19 9l-7 7-7-7"
|
|
722
|
+
}
|
|
723
|
+
)
|
|
691
724
|
}
|
|
692
|
-
)
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
{
|
|
698
|
-
className: "text-sm font-semibold text-foreground select-none",
|
|
699
|
-
onClick: () => onNodeClick({
|
|
700
|
-
isParent: true,
|
|
701
|
-
key: item.key,
|
|
702
|
-
label: item.label,
|
|
703
|
-
data: item.nodeData,
|
|
704
|
-
parentLabel: item.parentLabel
|
|
705
|
-
}),
|
|
706
|
-
children: item.label
|
|
707
|
-
}
|
|
708
|
-
)
|
|
709
|
-
] }),
|
|
725
|
+
),
|
|
726
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-foreground select-none", children: item.label })
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
),
|
|
710
730
|
/* @__PURE__ */ jsxRuntime.jsx(Accordion__namespace.Content, { className: "overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-3.5 border-l border-border py-0.5", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
711
731
|
TreeNodeItem,
|
|
712
732
|
{
|
|
@@ -769,7 +789,7 @@ function ToggleButton({ items, onChange, activeKey }) {
|
|
|
769
789
|
}
|
|
770
790
|
);
|
|
771
791
|
}
|
|
772
|
-
var NotificationContext =
|
|
792
|
+
var NotificationContext = React9.createContext({
|
|
773
793
|
open: () => void 0,
|
|
774
794
|
close: () => void 0
|
|
775
795
|
});
|
|
@@ -827,7 +847,7 @@ function NotificationItem({
|
|
|
827
847
|
onClose,
|
|
828
848
|
reduced
|
|
829
849
|
}) {
|
|
830
|
-
const [hovered, setHovered] =
|
|
850
|
+
const [hovered, setHovered] = React9.useState(false);
|
|
831
851
|
const initial = getInitialMotion(pos, reduced);
|
|
832
852
|
const center = pos.endsWith("center");
|
|
833
853
|
const duration = n.duration ?? 4e3;
|
|
@@ -908,7 +928,7 @@ function NotificationProvider({
|
|
|
908
928
|
children,
|
|
909
929
|
position = "top-right"
|
|
910
930
|
}) {
|
|
911
|
-
const [notifications, setNotifications] =
|
|
931
|
+
const [notifications, setNotifications] = React9.useState([]);
|
|
912
932
|
const reduced = framerMotion.useReducedMotion();
|
|
913
933
|
const open = (payload) => {
|
|
914
934
|
setNotifications((prev) => [
|
|
@@ -944,7 +964,7 @@ function NotificationProvider({
|
|
|
944
964
|
] }) });
|
|
945
965
|
}
|
|
946
966
|
function useNotification() {
|
|
947
|
-
const { open } =
|
|
967
|
+
const { open } = React9.useContext(NotificationContext);
|
|
948
968
|
return {
|
|
949
969
|
info: (props) => open({ type: "info", ...props }),
|
|
950
970
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -952,49 +972,71 @@ function useNotification() {
|
|
|
952
972
|
danger: (props) => open({ type: "danger", ...props })
|
|
953
973
|
};
|
|
954
974
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
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
|
+
]
|
|
967
1028
|
}
|
|
968
|
-
|
|
969
|
-
}, [letterRefs, letters.length]);
|
|
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
|
|
983
|
-
},
|
|
984
|
-
index
|
|
985
|
-
)) })
|
|
986
|
-
] }) })
|
|
987
|
-
);
|
|
1029
|
+
) });
|
|
988
1030
|
}
|
|
989
1031
|
function FadingBase({
|
|
990
1032
|
className = "",
|
|
991
1033
|
isMounted = false,
|
|
992
1034
|
children
|
|
993
1035
|
}) {
|
|
994
|
-
const [shouldRender, setShouldRender] =
|
|
995
|
-
const [visible, setVisible] =
|
|
996
|
-
const timerRef =
|
|
997
|
-
|
|
1036
|
+
const [shouldRender, setShouldRender] = React9.useState(isMounted);
|
|
1037
|
+
const [visible, setVisible] = React9.useState(false);
|
|
1038
|
+
const timerRef = React9.useRef(null);
|
|
1039
|
+
React9.useEffect(() => {
|
|
998
1040
|
if (isMounted) {
|
|
999
1041
|
setShouldRender(true);
|
|
1000
1042
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -1035,9 +1077,9 @@ function ScalableContainer({
|
|
|
1035
1077
|
children,
|
|
1036
1078
|
assignClassOnClick
|
|
1037
1079
|
}) {
|
|
1038
|
-
const containerRef =
|
|
1039
|
-
const [isScaled, setScaled] =
|
|
1040
|
-
const [wrapperClass, setWrapperClass] =
|
|
1080
|
+
const containerRef = React9.useRef(null);
|
|
1081
|
+
const [isScaled, setScaled] = React9.useState(false);
|
|
1082
|
+
const [wrapperClass, setWrapperClass] = React9.useState("");
|
|
1041
1083
|
const onClick = () => {
|
|
1042
1084
|
const next = !isScaled;
|
|
1043
1085
|
setScaled(next);
|
|
@@ -1147,17 +1189,17 @@ function CatalogGrid({ items, buttonText, onOpen }) {
|
|
|
1147
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)) });
|
|
1148
1190
|
}
|
|
1149
1191
|
function CatalogCarousel({ items, buttonText, onOpen }) {
|
|
1150
|
-
const [activeIndex, setActiveIndex] =
|
|
1151
|
-
const [indexPool, setIndexPool] =
|
|
1152
|
-
const cardRefs =
|
|
1153
|
-
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(() => {
|
|
1154
1196
|
let nextIndex = activeIndex + 1;
|
|
1155
1197
|
let previousIndex = activeIndex - 1;
|
|
1156
1198
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
1157
1199
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
1158
1200
|
return { previousIndex, nextIndex };
|
|
1159
1201
|
}, [activeIndex, items.length]);
|
|
1160
|
-
|
|
1202
|
+
React9.useEffect(() => {
|
|
1161
1203
|
const { nextIndex, previousIndex } = getIndexes;
|
|
1162
1204
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
1163
1205
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -1246,7 +1288,12 @@ function MenuBarItem({ icon, isActive, title, onClick }) {
|
|
|
1246
1288
|
className: `transition duration-300 hover:bg-prussian-blue ${isActive ? "bg-prussian-blue" : ""} rounded-lg p-2 cursor-pointer`,
|
|
1247
1289
|
onClick,
|
|
1248
1290
|
tabIndex: 0,
|
|
1249
|
-
onKeyDown: (e) =>
|
|
1291
|
+
onKeyDown: (e) => {
|
|
1292
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1293
|
+
e.preventDefault();
|
|
1294
|
+
onClick?.();
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1250
1297
|
children: icon
|
|
1251
1298
|
}
|
|
1252
1299
|
) });
|
|
@@ -1271,14 +1318,14 @@ function MenuBar({ items }) {
|
|
|
1271
1318
|
);
|
|
1272
1319
|
}
|
|
1273
1320
|
function ContextMenu({ items, position, visible, onClose }) {
|
|
1274
|
-
const contextRef =
|
|
1275
|
-
const childMenuRef =
|
|
1276
|
-
const [hasArrowUp, setHasArrowUp] =
|
|
1277
|
-
const [childArrowUp, setChildArrowUp] =
|
|
1278
|
-
const [hoveredItem, setHoveredItem] =
|
|
1279
|
-
const [hoveredChild, setHoveredChild] =
|
|
1280
|
-
const [activeChildren, setActiveChildren] =
|
|
1281
|
-
|
|
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(() => {
|
|
1282
1329
|
const clickAway = ({ target }) => {
|
|
1283
1330
|
if (contextRef.current && !contextRef.current.contains(target)) {
|
|
1284
1331
|
if (childMenuRef.current) {
|
|
@@ -1293,7 +1340,7 @@ function ContextMenu({ items, position, visible, onClose }) {
|
|
|
1293
1340
|
window.addEventListener("click", clickAway);
|
|
1294
1341
|
return () => window.removeEventListener("click", clickAway);
|
|
1295
1342
|
}, [onClose]);
|
|
1296
|
-
|
|
1343
|
+
React9.useEffect(() => {
|
|
1297
1344
|
const current = contextRef.current;
|
|
1298
1345
|
const child = childMenuRef.current;
|
|
1299
1346
|
if (!current || !child) return;
|
|
@@ -1389,18 +1436,18 @@ function ContextMenu({ items, position, visible, onClose }) {
|
|
|
1389
1436
|
);
|
|
1390
1437
|
}
|
|
1391
1438
|
function Wizard({ children, steps, storageKey = "po_wizard" }) {
|
|
1392
|
-
const wizardRef =
|
|
1393
|
-
const [activeStep, setActiveStep] =
|
|
1394
|
-
const [targetBbox, setTargetBbox] =
|
|
1395
|
-
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(
|
|
1396
1443
|
() => ["border", "border-4", "border-prussian-blue", "pointer-events-none"],
|
|
1397
1444
|
[]
|
|
1398
1445
|
);
|
|
1399
|
-
const closeWizard =
|
|
1446
|
+
const closeWizard = React9.useCallback(() => {
|
|
1400
1447
|
steps[activeStep]?.stepRef.current?.classList.remove(...HIGHLIGHTED);
|
|
1401
1448
|
if (wizardRef.current) wizardRef.current.style.display = "none";
|
|
1402
1449
|
}, [HIGHLIGHTED, steps, activeStep]);
|
|
1403
|
-
|
|
1450
|
+
React9.useEffect(() => {
|
|
1404
1451
|
const visited = JSON.parse(localStorage.getItem(storageKey) ?? "false");
|
|
1405
1452
|
if (visited) {
|
|
1406
1453
|
closeWizard();
|
|
@@ -1454,7 +1501,7 @@ function Wizard({ children, steps, storageKey = "po_wizard" }) {
|
|
|
1454
1501
|
children
|
|
1455
1502
|
] });
|
|
1456
1503
|
}
|
|
1457
|
-
var SearchInput =
|
|
1504
|
+
var SearchInput = React9__default.default.forwardRef(function SearchInput2({
|
|
1458
1505
|
value,
|
|
1459
1506
|
onChange,
|
|
1460
1507
|
disabled,
|
|
@@ -1481,7 +1528,8 @@ var SearchInput = React10__default.default.forwardRef(function SearchInput2({
|
|
|
1481
1528
|
disabled,
|
|
1482
1529
|
value,
|
|
1483
1530
|
onChange,
|
|
1484
|
-
type: "
|
|
1531
|
+
type: "search",
|
|
1532
|
+
enterKeyHint: "search",
|
|
1485
1533
|
name,
|
|
1486
1534
|
id: htmlFor,
|
|
1487
1535
|
className: "focus:outline-none pl-2 h-9 w-56 outline-offset-2 text-prussian-blue mt-1 rounded-lg disabled:bg-disabled disabled:cursor-not-allowed",
|
|
@@ -1521,15 +1569,15 @@ function Dropdown({
|
|
|
1521
1569
|
labelStyle = {},
|
|
1522
1570
|
placeholder
|
|
1523
1571
|
}) {
|
|
1524
|
-
const [open, setOpen] =
|
|
1525
|
-
const [selectedItems, setSelectedItems] =
|
|
1526
|
-
const [hoveredItem, setHoveredItem] =
|
|
1527
|
-
const [searchTerm, setSearchTerm] =
|
|
1528
|
-
const [innerItems, setInnerItems] =
|
|
1529
|
-
|
|
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(() => {
|
|
1530
1578
|
setInnerItems(items);
|
|
1531
1579
|
}, [items]);
|
|
1532
|
-
|
|
1580
|
+
React9.useEffect(() => {
|
|
1533
1581
|
if (isMultiselect && Array.isArray(value)) {
|
|
1534
1582
|
setSelectedItems(value);
|
|
1535
1583
|
}
|
|
@@ -1702,14 +1750,14 @@ function TableBody({
|
|
|
1702
1750
|
rows,
|
|
1703
1751
|
expandRow
|
|
1704
1752
|
}) {
|
|
1705
|
-
const [visibleRows, setVisibleRows] =
|
|
1753
|
+
const [visibleRows, setVisibleRows] = React9.useState({});
|
|
1706
1754
|
const toggleRow = (rowKey) => {
|
|
1707
1755
|
setVisibleRows((prev) => ({
|
|
1708
1756
|
...prev,
|
|
1709
1757
|
[rowKey]: { visible: !prev[rowKey]?.visible }
|
|
1710
1758
|
}));
|
|
1711
1759
|
};
|
|
1712
|
-
|
|
1760
|
+
React9.useEffect(() => {
|
|
1713
1761
|
if (rows.length && Object.keys(visibleRows).length === 0) {
|
|
1714
1762
|
const initial = {};
|
|
1715
1763
|
rows.forEach((row) => {
|
|
@@ -1718,7 +1766,7 @@ function TableBody({
|
|
|
1718
1766
|
setVisibleRows(initial);
|
|
1719
1767
|
}
|
|
1720
1768
|
}, [rows]);
|
|
1721
|
-
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: [
|
|
1722
1770
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1723
1771
|
"tr",
|
|
1724
1772
|
{
|
|
@@ -1772,9 +1820,9 @@ function Pagination({
|
|
|
1772
1820
|
const matchedOption = picker.find(
|
|
1773
1821
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
1774
1822
|
);
|
|
1775
|
-
const [perPageKey, setPerPageKey] =
|
|
1823
|
+
const [perPageKey, setPerPageKey] = React9.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
1776
1824
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
1777
|
-
|
|
1825
|
+
React9.useEffect(() => {
|
|
1778
1826
|
if (serverSide && options.perPage != null) {
|
|
1779
1827
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
1780
1828
|
if (next) setPerPageKey(next.key);
|
|
@@ -1834,35 +1882,35 @@ function Table({
|
|
|
1834
1882
|
footer = null,
|
|
1835
1883
|
header = null
|
|
1836
1884
|
}) {
|
|
1837
|
-
const searchRef =
|
|
1838
|
-
const [searchTerm, setSearchTerm] =
|
|
1839
|
-
const [perPage, setPerPage] =
|
|
1885
|
+
const searchRef = React9.useRef(null);
|
|
1886
|
+
const [searchTerm, setSearchTerm] = React9.useState("");
|
|
1887
|
+
const [perPage, setPerPage] = React9.useState(
|
|
1840
1888
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
1841
1889
|
);
|
|
1842
|
-
const [activePage, setActivePage] =
|
|
1843
|
-
const [datasets, setDatasets] =
|
|
1890
|
+
const [activePage, setActivePage] = React9.useState(0);
|
|
1891
|
+
const [datasets, setDatasets] = React9.useState([]);
|
|
1844
1892
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
1845
|
-
const MAX_PAGE =
|
|
1893
|
+
const MAX_PAGE = React9.useMemo(() => {
|
|
1846
1894
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
1847
1895
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
1848
1896
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
1849
1897
|
return datasets.length ? datasets.length - 1 : 0;
|
|
1850
1898
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
1851
|
-
const currentPageRows =
|
|
1899
|
+
const currentPageRows = React9.useMemo(() => {
|
|
1852
1900
|
if (isServerSide) return rows;
|
|
1853
1901
|
return datasets.length ? datasets[activePage] ?? [] : [];
|
|
1854
1902
|
}, [isServerSide, rows, datasets, activePage]);
|
|
1855
|
-
|
|
1903
|
+
React9.useEffect(() => {
|
|
1856
1904
|
if (pagination.enabled && !isServerSide) setPerPage(pagination.perPage ?? 15);
|
|
1857
1905
|
}, [pagination, isServerSide]);
|
|
1858
|
-
|
|
1906
|
+
React9.useEffect(() => {
|
|
1859
1907
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
1860
1908
|
}, [isServerSide, pagination.perPage]);
|
|
1861
|
-
|
|
1909
|
+
React9.useEffect(() => {
|
|
1862
1910
|
if (isServerSide) return;
|
|
1863
1911
|
setDatasets(createDatasets(rows, pagination.enabled ? perPage : null));
|
|
1864
1912
|
}, [rows, perPage, pagination, isServerSide]);
|
|
1865
|
-
|
|
1913
|
+
React9.useEffect(() => {
|
|
1866
1914
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
1867
1915
|
setActivePage(pagination.page - 1);
|
|
1868
1916
|
}, [isServerSide, pagination.page]);
|
|
@@ -1922,7 +1970,7 @@ function Table({
|
|
|
1922
1970
|
] });
|
|
1923
1971
|
}
|
|
1924
1972
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode" }) {
|
|
1925
|
-
const id =
|
|
1973
|
+
const id = React9.useId();
|
|
1926
1974
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center gap-2 cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1927
1975
|
SwitchPrimitive__namespace.Root,
|
|
1928
1976
|
{
|
|
@@ -2115,17 +2163,17 @@ function AppShell({
|
|
|
2115
2163
|
children,
|
|
2116
2164
|
className = ""
|
|
2117
2165
|
}) {
|
|
2118
|
-
const [expanded, setExpanded] =
|
|
2119
|
-
const [isMobile, setIsMobile] =
|
|
2120
|
-
const [mobileOpen, setMobileOpen] =
|
|
2121
|
-
|
|
2166
|
+
const [expanded, setExpanded] = React9.useState(sidebarDefaultExpanded);
|
|
2167
|
+
const [isMobile, setIsMobile] = React9.useState(false);
|
|
2168
|
+
const [mobileOpen, setMobileOpen] = React9.useState(false);
|
|
2169
|
+
React9.useEffect(() => {
|
|
2122
2170
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
2123
2171
|
const update = (e) => setIsMobile(e.matches);
|
|
2124
2172
|
update(mq);
|
|
2125
2173
|
mq.addEventListener("change", update);
|
|
2126
2174
|
return () => mq.removeEventListener("change", update);
|
|
2127
2175
|
}, []);
|
|
2128
|
-
|
|
2176
|
+
React9.useEffect(() => {
|
|
2129
2177
|
if (!isMobile) setMobileOpen(false);
|
|
2130
2178
|
}, [isMobile]);
|
|
2131
2179
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -2299,10 +2347,10 @@ function ThemeProvider({
|
|
|
2299
2347
|
className = "",
|
|
2300
2348
|
style
|
|
2301
2349
|
}) {
|
|
2302
|
-
const id =
|
|
2350
|
+
const id = React9__default.default.useId().replace(/:/g, "");
|
|
2303
2351
|
const scopeClass = `geo-th-${id}`;
|
|
2304
|
-
const divRef =
|
|
2305
|
-
|
|
2352
|
+
const divRef = React9.useRef(null);
|
|
2353
|
+
React9.useEffect(() => {
|
|
2306
2354
|
const el = divRef.current;
|
|
2307
2355
|
if (!el) return;
|
|
2308
2356
|
if (colorScheme === "auto") return;
|
|
@@ -2317,8 +2365,8 @@ function ThemeProvider({
|
|
|
2317
2365
|
}
|
|
2318
2366
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
2319
2367
|
}, [colorScheme]);
|
|
2320
|
-
const lightVars =
|
|
2321
|
-
const darkVarStr =
|
|
2368
|
+
const lightVars = React9.useMemo(() => toCssVars(theme), [theme]);
|
|
2369
|
+
const darkVarStr = React9.useMemo(() => {
|
|
2322
2370
|
if (!darkTheme) return "";
|
|
2323
2371
|
const dvars = toCssVars(darkTheme);
|
|
2324
2372
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -2452,6 +2500,9 @@ function TextInput({
|
|
|
2452
2500
|
className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
|
|
2453
2501
|
style: style ?? {},
|
|
2454
2502
|
children: [
|
|
2503
|
+
label && // Render <label> only when a label is provided. An empty
|
|
2504
|
+
// <label htmlFor=…> announces as an unlabeled control in
|
|
2505
|
+
// some screen readers.
|
|
2455
2506
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2456
2507
|
"label",
|
|
2457
2508
|
{
|
|
@@ -2594,10 +2645,13 @@ function Password({
|
|
|
2594
2645
|
labelColor,
|
|
2595
2646
|
iconColor
|
|
2596
2647
|
}) {
|
|
2597
|
-
const [passwordVisible, setPasswordVisible] =
|
|
2648
|
+
const [passwordVisible, setPasswordVisible] = React9.useState(false);
|
|
2598
2649
|
const color = iconColor ?? chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"];
|
|
2599
2650
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
|
|
2600
2651
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
|
|
2652
|
+
label && // Render <label> only when a label is provided. An empty
|
|
2653
|
+
// <label htmlFor=…> announces as an unlabeled control in
|
|
2654
|
+
// some screen readers.
|
|
2601
2655
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2602
2656
|
"label",
|
|
2603
2657
|
{
|
|
@@ -2737,7 +2791,7 @@ function Switch({
|
|
|
2737
2791
|
checkedIcon,
|
|
2738
2792
|
uncheckedIcon
|
|
2739
2793
|
}) {
|
|
2740
|
-
const id =
|
|
2794
|
+
const id = React9.useId();
|
|
2741
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(
|
|
2742
2796
|
SwitchPrimitive__namespace.Root,
|
|
2743
2797
|
{
|
|
@@ -2767,8 +2821,8 @@ function AutoComplete({
|
|
|
2767
2821
|
onItemClick,
|
|
2768
2822
|
emptyText = "No results found"
|
|
2769
2823
|
}) {
|
|
2770
|
-
const [term, setTerm] =
|
|
2771
|
-
const [open, setOpen] =
|
|
2824
|
+
const [term, setTerm] = React9.useState("");
|
|
2825
|
+
const [open, setOpen] = React9.useState(false);
|
|
2772
2826
|
const foundItems = term.trim() ? items.filter(
|
|
2773
2827
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
2774
2828
|
) : [];
|
|
@@ -2853,10 +2907,10 @@ function TreeSelect({
|
|
|
2853
2907
|
htmlFor,
|
|
2854
2908
|
items = []
|
|
2855
2909
|
}) {
|
|
2856
|
-
const [open, setOpen] =
|
|
2857
|
-
const [hoveredItem, setHoveredItem] =
|
|
2858
|
-
const [innerItems, setInnerItems] =
|
|
2859
|
-
|
|
2910
|
+
const [open, setOpen] = React9.useState(false);
|
|
2911
|
+
const [hoveredItem, setHoveredItem] = React9.useState(null);
|
|
2912
|
+
const [innerItems, setInnerItems] = React9.useState([]);
|
|
2913
|
+
React9.useEffect(() => {
|
|
2860
2914
|
setInnerItems(items);
|
|
2861
2915
|
}, [items]);
|
|
2862
2916
|
const selectItem = (key) => {
|
|
@@ -2955,10 +3009,10 @@ function FileInput({
|
|
|
2955
3009
|
name,
|
|
2956
3010
|
accept = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx"
|
|
2957
3011
|
}) {
|
|
2958
|
-
const fileInput =
|
|
2959
|
-
const [files, setFiles] =
|
|
3012
|
+
const fileInput = React9.useRef(null);
|
|
3013
|
+
const [files, setFiles] = React9.useState([]);
|
|
2960
3014
|
const openPicker = () => {
|
|
2961
|
-
fileInput.current?.
|
|
3015
|
+
fileInput.current?.click();
|
|
2962
3016
|
};
|
|
2963
3017
|
const handleFiles = (list) => {
|
|
2964
3018
|
setFiles(list);
|
|
@@ -2990,56 +3044,70 @@ function FileInput({
|
|
|
2990
3044
|
onChange?.({ target: { files: [], name, id: name, value: "" } });
|
|
2991
3045
|
if (fileInput.current) fileInput.current.value = "";
|
|
2992
3046
|
};
|
|
2993
|
-
return
|
|
2994
|
-
"
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
hidden: true,
|
|
3009
|
-
type: "file",
|
|
3010
|
-
accept,
|
|
3011
|
-
multiple: allowMultiple
|
|
3047
|
+
return (
|
|
3048
|
+
// Dropzone is keyboard-activatable: role="button", focusable via
|
|
3049
|
+
// tabIndex, and Space/Enter trigger the file picker. Without these
|
|
3050
|
+
// a keyboard-only user could not upload a file.
|
|
3051
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3052
|
+
"div",
|
|
3053
|
+
{
|
|
3054
|
+
role: "button",
|
|
3055
|
+
tabIndex: 0,
|
|
3056
|
+
"aria-label": "Upload file \u2014 click or drop",
|
|
3057
|
+
onClick: openPicker,
|
|
3058
|
+
onKeyDown: (e) => {
|
|
3059
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3060
|
+
e.preventDefault();
|
|
3061
|
+
openPicker();
|
|
3012
3062
|
}
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3063
|
+
},
|
|
3064
|
+
className: "border-2 hover:border-prussian-blue border-ice-dark w-full h-full rounded-md transition-all duration-300 border-dashed dark:border-independence hover:dark:border-ice-dark cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
3065
|
+
onDragOver: (e) => e.preventDefault(),
|
|
3066
|
+
onDrop,
|
|
3067
|
+
children: [
|
|
3068
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3069
|
+
"input",
|
|
3070
|
+
{
|
|
3071
|
+
id: name,
|
|
3072
|
+
name,
|
|
3073
|
+
onChange: localOnChange,
|
|
3074
|
+
ref: fileInput,
|
|
3075
|
+
hidden: true,
|
|
3076
|
+
type: "file",
|
|
3077
|
+
accept,
|
|
3078
|
+
multiple: allowMultiple
|
|
3079
|
+
}
|
|
3080
|
+
),
|
|
3081
|
+
files.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full items-center justify-center gap-2", children: [
|
|
3082
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"], className: "w-16 h-16 dark:fill-white", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M11.47 2.47a.75.75 0 011.06 0l4.5 4.5a.75.75 0 01-1.06 1.06l-3.22-3.22V16.5a.75.75 0 01-1.5 0V4.81L8.03 8.03a.75.75 0 01-1.06-1.06l4.5-4.5zM3 15.75a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z", clipRule: "evenodd" }) }),
|
|
3083
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-prussian-blue dark:text-white text-sm", children: "Click or Drop a file" })
|
|
3084
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full", children: files.map((file, id) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3085
|
+
"div",
|
|
3086
|
+
{
|
|
3087
|
+
className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-ice-dark p-4 dark:bg-independence rounded-md relative",
|
|
3088
|
+
children: [
|
|
3089
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3090
|
+
"button",
|
|
3091
|
+
{
|
|
3092
|
+
type: "button",
|
|
3093
|
+
onClick: removeFile,
|
|
3094
|
+
className: "bg-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center",
|
|
3095
|
+
"aria-label": "Remove file",
|
|
3096
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
3097
|
+
}
|
|
3098
|
+
),
|
|
3099
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"], className: "w-10 h-10 dark:fill-white", children: [
|
|
3100
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0016.5 9h-1.875a1.875 1.875 0 01-1.875-1.875V5.25A3.75 3.75 0 009 1.5H5.625z", clipRule: "evenodd" }),
|
|
3101
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.971 1.816A5.23 5.23 0 0114.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 013.434 1.279 9.768 9.768 0 00-6.963-6.963z" })
|
|
3102
|
+
] }),
|
|
3103
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full text-prussian-blue dark:text-white", children: file.name })
|
|
3104
|
+
]
|
|
3105
|
+
},
|
|
3106
|
+
`${id}${file.name}`
|
|
3107
|
+
)) })
|
|
3108
|
+
]
|
|
3109
|
+
}
|
|
3110
|
+
)
|
|
3043
3111
|
);
|
|
3044
3112
|
}
|
|
3045
3113
|
var MONTHS = {
|
|
@@ -3090,12 +3158,12 @@ function DatePickerBase({
|
|
|
3090
3158
|
disableAfter,
|
|
3091
3159
|
disabled
|
|
3092
3160
|
}) {
|
|
3093
|
-
const pickerRef =
|
|
3094
|
-
const calendarRef =
|
|
3095
|
-
const [isExpanded, setExpanded] =
|
|
3096
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3097
|
-
const [currentYear, setCurrentYear] =
|
|
3098
|
-
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);
|
|
3099
3167
|
const toggle = () => {
|
|
3100
3168
|
if (!disabled) setExpanded((p) => !p);
|
|
3101
3169
|
};
|
|
@@ -3139,14 +3207,14 @@ function DatePickerBase({
|
|
|
3139
3207
|
}
|
|
3140
3208
|
return ordered;
|
|
3141
3209
|
};
|
|
3142
|
-
|
|
3210
|
+
React9.useEffect(() => {
|
|
3143
3211
|
const clickAway = (e) => {
|
|
3144
3212
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3145
3213
|
};
|
|
3146
3214
|
document.addEventListener("mousedown", clickAway);
|
|
3147
3215
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3148
3216
|
}, []);
|
|
3149
|
-
|
|
3217
|
+
React9.useEffect(() => {
|
|
3150
3218
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3151
3219
|
if (bbox && (bbox.y > window.innerHeight - 220 || bbox.bottom > window.innerHeight - 400)) {
|
|
3152
3220
|
setCloseToBottom(true);
|
|
@@ -3239,29 +3307,29 @@ function TemporalPickerBase({
|
|
|
3239
3307
|
layout,
|
|
3240
3308
|
style = {}
|
|
3241
3309
|
}) {
|
|
3242
|
-
const pickerRef =
|
|
3243
|
-
const calendarRef =
|
|
3244
|
-
const valueRefs =
|
|
3245
|
-
const [isExpanded, setExpanded] =
|
|
3246
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3247
|
-
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(() => {
|
|
3248
3316
|
const vals = [];
|
|
3249
3317
|
for (let i = lowerLimit; i <= upperLimit; i++) vals.push(i);
|
|
3250
3318
|
return vals;
|
|
3251
3319
|
}, [lowerLimit, upperLimit]);
|
|
3252
|
-
|
|
3320
|
+
React9.useEffect(() => {
|
|
3253
3321
|
const clickAway = (e) => {
|
|
3254
3322
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3255
3323
|
};
|
|
3256
3324
|
document.addEventListener("mousedown", clickAway);
|
|
3257
3325
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3258
3326
|
}, []);
|
|
3259
|
-
|
|
3327
|
+
React9.useEffect(() => {
|
|
3260
3328
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3261
3329
|
if (bbox && bbox.y > window.innerHeight - 220) setCloseToBottom(true);
|
|
3262
3330
|
else setCloseToBottom(false);
|
|
3263
3331
|
}, []);
|
|
3264
|
-
|
|
3332
|
+
React9.useEffect(() => {
|
|
3265
3333
|
if (!isExpanded) return;
|
|
3266
3334
|
const t = setTimeout(() => {
|
|
3267
3335
|
const node = valueRefs.current.find((n) => n.value === value);
|