@geomak/ui 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +160 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -2
- package/dist/index.d.ts +74 -2
- package/dist/index.js +63 -36
- package/dist/index.js.map +1 -1
- package/dist/styles.css +16 -6
- package/package.json +8 -10
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk255PCZIW_cjs = require('./chunk-255PCZIW.cjs');
|
|
4
|
+
var React10 = require('react');
|
|
5
|
+
var reactDom = require('react-dom');
|
|
4
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var React9 = require('react');
|
|
6
7
|
var Dialog = require('@radix-ui/react-dialog');
|
|
7
8
|
var framerMotion = require('framer-motion');
|
|
8
9
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
@@ -34,7 +35,7 @@ function _interopNamespace(e) {
|
|
|
34
35
|
return Object.freeze(n);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
var
|
|
38
|
+
var React10__default = /*#__PURE__*/_interopDefault(React10);
|
|
38
39
|
var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
|
|
39
40
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
40
41
|
var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
@@ -45,6 +46,18 @@ var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
|
|
|
45
46
|
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
46
47
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
47
48
|
|
|
49
|
+
function Portal({ children, target }) {
|
|
50
|
+
const [resolved, setResolved] = React10.useState(null);
|
|
51
|
+
React10.useEffect(() => {
|
|
52
|
+
if (target === null) {
|
|
53
|
+
setResolved(null);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const node = typeof target === "function" ? target() : target ?? document.body;
|
|
57
|
+
setResolved(node ?? null);
|
|
58
|
+
}, [target]);
|
|
59
|
+
return resolved ? reactDom.createPortal(children, resolved) : null;
|
|
60
|
+
}
|
|
48
61
|
var Moon = ({ color = "gray" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" }) });
|
|
49
62
|
var Sun = ({ color = "yellow" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" }) });
|
|
50
63
|
var CheckCircle = ({ color = "#fff", size = 28 }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M14 0.25C6.40625 0.25 0.25 6.40625 0.25 14C0.25 21.5937 6.40625 27.75 14 27.75C21.5937 27.75 27.75 21.5937 27.75 14C27.75 6.40625 21.5937 0.25 14 0.25ZM19.96 11.675C20.0697 11.5496 20.1533 11.4034 20.2057 11.2452C20.2582 11.087 20.2784 10.9199 20.2653 10.7537C20.2522 10.5876 20.206 10.4257 20.1295 10.2777C20.0529 10.1296 19.9475 9.99838 19.8194 9.89168C19.6914 9.78497 19.5433 9.70495 19.3839 9.65633C19.2244 9.6077 19.0569 9.59145 18.8911 9.60853C18.7253 9.62562 18.5646 9.67568 18.4184 9.75579C18.2723 9.8359 18.1436 9.94443 18.04 10.075L12.665 16.5237L9.88375 13.7412C9.648 13.5136 9.33224 13.3876 9.0045 13.3904C8.67675 13.3933 8.36324 13.5247 8.13148 13.7565C7.89972 13.9882 7.76825 14.3018 7.76541 14.6295C7.76256 14.9572 7.88855 15.273 8.11625 15.5087L11.8662 19.2587C11.9891 19.3815 12.1361 19.4773 12.298 19.5401C12.4599 19.6028 12.6331 19.6312 12.8066 19.6233C12.98 19.6154 13.15 19.5715 13.3055 19.4943C13.4611 19.4171 13.5988 19.3084 13.71 19.175L19.96 11.675Z", fill: color }) });
|
|
@@ -214,7 +227,7 @@ function IconButton({
|
|
|
214
227
|
loading = false,
|
|
215
228
|
loadingIcon
|
|
216
229
|
}) {
|
|
217
|
-
const colorScheme =
|
|
230
|
+
const colorScheme = React10.useMemo(() => {
|
|
218
231
|
if (type === "primary") {
|
|
219
232
|
return "hover:bg-true-blue bg-usafa-blue dark:bg-independence dark:hover:bg-black-coral";
|
|
220
233
|
}
|
|
@@ -523,11 +536,11 @@ function Tabs({
|
|
|
523
536
|
tabsClosable = true,
|
|
524
537
|
defaultActiveTab
|
|
525
538
|
}) {
|
|
526
|
-
const [value, setValue] =
|
|
527
|
-
|
|
539
|
+
const [value, setValue] = React10.useState(() => defaultActiveTab ?? tabs[0]?.key ?? "");
|
|
540
|
+
React10.useEffect(() => {
|
|
528
541
|
if (defaultActiveTab) setValue(defaultActiveTab);
|
|
529
542
|
}, [defaultActiveTab]);
|
|
530
|
-
|
|
543
|
+
React10.useEffect(() => {
|
|
531
544
|
if (tabs.length === 0) {
|
|
532
545
|
setValue("");
|
|
533
546
|
return;
|
|
@@ -756,7 +769,7 @@ function ToggleButton({ items, onChange, activeKey }) {
|
|
|
756
769
|
}
|
|
757
770
|
);
|
|
758
771
|
}
|
|
759
|
-
var NotificationContext =
|
|
772
|
+
var NotificationContext = React10.createContext({
|
|
760
773
|
open: () => void 0,
|
|
761
774
|
close: () => void 0
|
|
762
775
|
});
|
|
@@ -767,11 +780,11 @@ var TYPE_BG = {
|
|
|
767
780
|
danger: "bg-status-error"
|
|
768
781
|
};
|
|
769
782
|
var VIEWPORT_CLASSES = {
|
|
770
|
-
"top-right": "fixed top-
|
|
771
|
-
"top-left": "fixed top-
|
|
772
|
-
"top-center": "fixed top-
|
|
773
|
-
"bottom-right": "fixed bottom-4 right-
|
|
774
|
-
"bottom-left": "fixed bottom-4 left-
|
|
783
|
+
"top-right": "fixed top-4 right-4 flex flex-col items-end",
|
|
784
|
+
"top-left": "fixed top-4 left-4 flex flex-col items-start",
|
|
785
|
+
"top-center": "fixed top-4 left-1/2 flex flex-col items-center -translate-x-1/2",
|
|
786
|
+
"bottom-right": "fixed bottom-4 right-4 flex flex-col-reverse items-end",
|
|
787
|
+
"bottom-left": "fixed bottom-4 left-4 flex flex-col-reverse items-start",
|
|
775
788
|
"bottom-center": "fixed bottom-4 left-1/2 flex flex-col-reverse items-center -translate-x-1/2"
|
|
776
789
|
};
|
|
777
790
|
function getInitialMotion(pos, reduced) {
|
|
@@ -779,9 +792,9 @@ function getInitialMotion(pos, reduced) {
|
|
|
779
792
|
const bottom = pos.startsWith("bottom");
|
|
780
793
|
return {
|
|
781
794
|
opacity: 0,
|
|
782
|
-
y: bottom ?
|
|
783
|
-
//
|
|
784
|
-
scale: 0.
|
|
795
|
+
y: bottom ? 24 : -24,
|
|
796
|
+
// rise from below (bottom) or drop from above (top)
|
|
797
|
+
scale: 0.92
|
|
785
798
|
};
|
|
786
799
|
}
|
|
787
800
|
function TypeIcon({ type }) {
|
|
@@ -814,7 +827,7 @@ function NotificationItem({
|
|
|
814
827
|
onClose,
|
|
815
828
|
reduced
|
|
816
829
|
}) {
|
|
817
|
-
const [hovered, setHovered] =
|
|
830
|
+
const [hovered, setHovered] = React10.useState(false);
|
|
818
831
|
const initial = getInitialMotion(pos, reduced);
|
|
819
832
|
const center = pos.endsWith("center");
|
|
820
833
|
const duration = n.duration ?? 4e3;
|
|
@@ -822,15 +835,25 @@ function NotificationItem({
|
|
|
822
835
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
823
836
|
framerMotion.motion.div,
|
|
824
837
|
{
|
|
825
|
-
|
|
838
|
+
className: "pointer-events-auto",
|
|
826
839
|
initial,
|
|
827
840
|
animate: { opacity: 1, y: 0, scale: 1 },
|
|
828
|
-
exit:
|
|
841
|
+
exit: {
|
|
842
|
+
opacity: 0,
|
|
843
|
+
y: pos.startsWith("bottom") ? 16 : -16,
|
|
844
|
+
scale: 0.94,
|
|
845
|
+
transition: reduced ? { duration: 0 } : {
|
|
846
|
+
opacity: { duration: 0.14, delay: 0.06 },
|
|
847
|
+
y: { type: "tween", duration: 0.22, ease: [0.4, 0, 1, 1] },
|
|
848
|
+
scale: { type: "tween", duration: 0.22, ease: [0.4, 0, 1, 1] }
|
|
849
|
+
}
|
|
850
|
+
},
|
|
829
851
|
transition: reduced ? { duration: 0 } : {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
852
|
+
// Opacity finishes in 0.15 s — card is fully opaque while y/scale
|
|
853
|
+
// still have ~55 % of their travel left → movement is clearly visible.
|
|
854
|
+
opacity: { duration: 0.15 },
|
|
855
|
+
y: { type: "tween", duration: 0.34, ease: [0.16, 1, 0.3, 1] },
|
|
856
|
+
scale: { type: "tween", duration: 0.34, ease: [0.16, 1, 0.3, 1] }
|
|
834
857
|
},
|
|
835
858
|
onMouseEnter: () => setHovered(true),
|
|
836
859
|
onMouseLeave: () => setHovered(false),
|
|
@@ -885,7 +908,7 @@ function NotificationProvider({
|
|
|
885
908
|
children,
|
|
886
909
|
position = "top-right"
|
|
887
910
|
}) {
|
|
888
|
-
const [notifications, setNotifications] =
|
|
911
|
+
const [notifications, setNotifications] = React10.useState([]);
|
|
889
912
|
const reduced = framerMotion.useReducedMotion();
|
|
890
913
|
const open = (payload) => {
|
|
891
914
|
setNotifications((prev) => [
|
|
@@ -898,13 +921,13 @@ function NotificationProvider({
|
|
|
898
921
|
};
|
|
899
922
|
return /* @__PURE__ */ jsxRuntime.jsx(NotificationContext.Provider, { value: { open, close }, children: /* @__PURE__ */ jsxRuntime.jsxs(Toast__namespace.Provider, { swipeDirection: position.endsWith("right") ? "right" : position.endsWith("left") ? "left" : "up", children: [
|
|
900
923
|
children,
|
|
901
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
924
|
+
/* @__PURE__ */ jsxRuntime.jsx(Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
902
925
|
Toast__namespace.Viewport,
|
|
903
926
|
{
|
|
904
927
|
asChild: true,
|
|
905
928
|
className: [
|
|
906
929
|
VIEWPORT_CLASSES[position],
|
|
907
|
-
"z-[500000] gap-2 w-[332px]
|
|
930
|
+
"z-[500000] gap-2 w-[332px] outline-none pointer-events-none"
|
|
908
931
|
].join(" "),
|
|
909
932
|
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: notifications.map((n) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
910
933
|
NotificationItem,
|
|
@@ -917,11 +940,11 @@ function NotificationProvider({
|
|
|
917
940
|
n.id
|
|
918
941
|
)) }) })
|
|
919
942
|
}
|
|
920
|
-
)
|
|
943
|
+
) })
|
|
921
944
|
] }) });
|
|
922
945
|
}
|
|
923
946
|
function useNotification() {
|
|
924
|
-
const { open } =
|
|
947
|
+
const { open } = React10.useContext(NotificationContext);
|
|
925
948
|
return {
|
|
926
949
|
info: (props) => open({ type: "info", ...props }),
|
|
927
950
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -930,9 +953,9 @@ function useNotification() {
|
|
|
930
953
|
};
|
|
931
954
|
}
|
|
932
955
|
function LoadingSpinner({ prompt }) {
|
|
933
|
-
const letterRefs =
|
|
956
|
+
const letterRefs = React10.useMemo(() => [], []);
|
|
934
957
|
const letters = prompt.split("");
|
|
935
|
-
|
|
958
|
+
React10.useEffect(() => {
|
|
936
959
|
const timeouts = [];
|
|
937
960
|
if (letterRefs.length === letters.length) {
|
|
938
961
|
letterRefs.forEach((ref, index) => {
|
|
@@ -944,30 +967,34 @@ function LoadingSpinner({ prompt }) {
|
|
|
944
967
|
}
|
|
945
968
|
return () => timeouts.forEach(clearTimeout);
|
|
946
969
|
}, [letterRefs, letters.length]);
|
|
947
|
-
return
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
{
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
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
|
|
955
983
|
},
|
|
956
|
-
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
] });
|
|
984
|
+
index
|
|
985
|
+
)) })
|
|
986
|
+
] }) })
|
|
987
|
+
);
|
|
961
988
|
}
|
|
962
989
|
function FadingBase({
|
|
963
990
|
className = "",
|
|
964
991
|
isMounted = false,
|
|
965
992
|
children
|
|
966
993
|
}) {
|
|
967
|
-
const [shouldRender, setShouldRender] =
|
|
968
|
-
const [visible, setVisible] =
|
|
969
|
-
const timerRef =
|
|
970
|
-
|
|
994
|
+
const [shouldRender, setShouldRender] = React10.useState(isMounted);
|
|
995
|
+
const [visible, setVisible] = React10.useState(false);
|
|
996
|
+
const timerRef = React10.useRef(null);
|
|
997
|
+
React10.useEffect(() => {
|
|
971
998
|
if (isMounted) {
|
|
972
999
|
setShouldRender(true);
|
|
973
1000
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -1008,9 +1035,9 @@ function ScalableContainer({
|
|
|
1008
1035
|
children,
|
|
1009
1036
|
assignClassOnClick
|
|
1010
1037
|
}) {
|
|
1011
|
-
const containerRef =
|
|
1012
|
-
const [isScaled, setScaled] =
|
|
1013
|
-
const [wrapperClass, setWrapperClass] =
|
|
1038
|
+
const containerRef = React10.useRef(null);
|
|
1039
|
+
const [isScaled, setScaled] = React10.useState(false);
|
|
1040
|
+
const [wrapperClass, setWrapperClass] = React10.useState("");
|
|
1014
1041
|
const onClick = () => {
|
|
1015
1042
|
const next = !isScaled;
|
|
1016
1043
|
setScaled(next);
|
|
@@ -1120,17 +1147,17 @@ function CatalogGrid({ items, buttonText, onOpen }) {
|
|
|
1120
1147
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(GridCard, { item, buttonText, onOpen }, item.key)) });
|
|
1121
1148
|
}
|
|
1122
1149
|
function CatalogCarousel({ items, buttonText, onOpen }) {
|
|
1123
|
-
const [activeIndex, setActiveIndex] =
|
|
1124
|
-
const [indexPool, setIndexPool] =
|
|
1125
|
-
const cardRefs =
|
|
1126
|
-
const getIndexes =
|
|
1150
|
+
const [activeIndex, setActiveIndex] = React10.useState(0);
|
|
1151
|
+
const [indexPool, setIndexPool] = React10.useState([]);
|
|
1152
|
+
const cardRefs = React10.useRef([]);
|
|
1153
|
+
const getIndexes = React10.useMemo(() => {
|
|
1127
1154
|
let nextIndex = activeIndex + 1;
|
|
1128
1155
|
let previousIndex = activeIndex - 1;
|
|
1129
1156
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
1130
1157
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
1131
1158
|
return { previousIndex, nextIndex };
|
|
1132
1159
|
}, [activeIndex, items.length]);
|
|
1133
|
-
|
|
1160
|
+
React10.useEffect(() => {
|
|
1134
1161
|
const { nextIndex, previousIndex } = getIndexes;
|
|
1135
1162
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
1136
1163
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -1244,14 +1271,14 @@ function MenuBar({ items }) {
|
|
|
1244
1271
|
);
|
|
1245
1272
|
}
|
|
1246
1273
|
function ContextMenu({ items, position, visible, onClose }) {
|
|
1247
|
-
const contextRef =
|
|
1248
|
-
const childMenuRef =
|
|
1249
|
-
const [hasArrowUp, setHasArrowUp] =
|
|
1250
|
-
const [childArrowUp, setChildArrowUp] =
|
|
1251
|
-
const [hoveredItem, setHoveredItem] =
|
|
1252
|
-
const [hoveredChild, setHoveredChild] =
|
|
1253
|
-
const [activeChildren, setActiveChildren] =
|
|
1254
|
-
|
|
1274
|
+
const contextRef = React10.useRef(null);
|
|
1275
|
+
const childMenuRef = React10.useRef(null);
|
|
1276
|
+
const [hasArrowUp, setHasArrowUp] = React10.useState(true);
|
|
1277
|
+
const [childArrowUp, setChildArrowUp] = React10.useState(false);
|
|
1278
|
+
const [hoveredItem, setHoveredItem] = React10.useState(-1);
|
|
1279
|
+
const [hoveredChild, setHoveredChild] = React10.useState(-1);
|
|
1280
|
+
const [activeChildren, setActiveChildren] = React10.useState([]);
|
|
1281
|
+
React10.useEffect(() => {
|
|
1255
1282
|
const clickAway = ({ target }) => {
|
|
1256
1283
|
if (contextRef.current && !contextRef.current.contains(target)) {
|
|
1257
1284
|
if (childMenuRef.current) {
|
|
@@ -1266,7 +1293,7 @@ function ContextMenu({ items, position, visible, onClose }) {
|
|
|
1266
1293
|
window.addEventListener("click", clickAway);
|
|
1267
1294
|
return () => window.removeEventListener("click", clickAway);
|
|
1268
1295
|
}, [onClose]);
|
|
1269
|
-
|
|
1296
|
+
React10.useEffect(() => {
|
|
1270
1297
|
const current = contextRef.current;
|
|
1271
1298
|
const child = childMenuRef.current;
|
|
1272
1299
|
if (!current || !child) return;
|
|
@@ -1362,18 +1389,18 @@ function ContextMenu({ items, position, visible, onClose }) {
|
|
|
1362
1389
|
);
|
|
1363
1390
|
}
|
|
1364
1391
|
function Wizard({ children, steps, storageKey = "po_wizard" }) {
|
|
1365
|
-
const wizardRef =
|
|
1366
|
-
const [activeStep, setActiveStep] =
|
|
1367
|
-
const [targetBbox, setTargetBbox] =
|
|
1368
|
-
const HIGHLIGHTED =
|
|
1392
|
+
const wizardRef = React10.useRef(null);
|
|
1393
|
+
const [activeStep, setActiveStep] = React10.useState(0);
|
|
1394
|
+
const [targetBbox, setTargetBbox] = React10.useState(null);
|
|
1395
|
+
const HIGHLIGHTED = React10.useMemo(
|
|
1369
1396
|
() => ["border", "border-4", "border-prussian-blue", "pointer-events-none"],
|
|
1370
1397
|
[]
|
|
1371
1398
|
);
|
|
1372
|
-
const closeWizard =
|
|
1399
|
+
const closeWizard = React10.useCallback(() => {
|
|
1373
1400
|
steps[activeStep]?.stepRef.current?.classList.remove(...HIGHLIGHTED);
|
|
1374
1401
|
if (wizardRef.current) wizardRef.current.style.display = "none";
|
|
1375
1402
|
}, [HIGHLIGHTED, steps, activeStep]);
|
|
1376
|
-
|
|
1403
|
+
React10.useEffect(() => {
|
|
1377
1404
|
const visited = JSON.parse(localStorage.getItem(storageKey) ?? "false");
|
|
1378
1405
|
if (visited) {
|
|
1379
1406
|
closeWizard();
|
|
@@ -1427,7 +1454,7 @@ function Wizard({ children, steps, storageKey = "po_wizard" }) {
|
|
|
1427
1454
|
children
|
|
1428
1455
|
] });
|
|
1429
1456
|
}
|
|
1430
|
-
var SearchInput =
|
|
1457
|
+
var SearchInput = React10__default.default.forwardRef(function SearchInput2({
|
|
1431
1458
|
value,
|
|
1432
1459
|
onChange,
|
|
1433
1460
|
disabled,
|
|
@@ -1494,15 +1521,15 @@ function Dropdown({
|
|
|
1494
1521
|
labelStyle = {},
|
|
1495
1522
|
placeholder
|
|
1496
1523
|
}) {
|
|
1497
|
-
const [open, setOpen] =
|
|
1498
|
-
const [selectedItems, setSelectedItems] =
|
|
1499
|
-
const [hoveredItem, setHoveredItem] =
|
|
1500
|
-
const [searchTerm, setSearchTerm] =
|
|
1501
|
-
const [innerItems, setInnerItems] =
|
|
1502
|
-
|
|
1524
|
+
const [open, setOpen] = React10.useState(false);
|
|
1525
|
+
const [selectedItems, setSelectedItems] = React10.useState([]);
|
|
1526
|
+
const [hoveredItem, setHoveredItem] = React10.useState(null);
|
|
1527
|
+
const [searchTerm, setSearchTerm] = React10.useState("");
|
|
1528
|
+
const [innerItems, setInnerItems] = React10.useState([]);
|
|
1529
|
+
React10.useEffect(() => {
|
|
1503
1530
|
setInnerItems(items);
|
|
1504
1531
|
}, [items]);
|
|
1505
|
-
|
|
1532
|
+
React10.useEffect(() => {
|
|
1506
1533
|
if (isMultiselect && Array.isArray(value)) {
|
|
1507
1534
|
setSelectedItems(value);
|
|
1508
1535
|
}
|
|
@@ -1675,14 +1702,14 @@ function TableBody({
|
|
|
1675
1702
|
rows,
|
|
1676
1703
|
expandRow
|
|
1677
1704
|
}) {
|
|
1678
|
-
const [visibleRows, setVisibleRows] =
|
|
1705
|
+
const [visibleRows, setVisibleRows] = React10.useState({});
|
|
1679
1706
|
const toggleRow = (rowKey) => {
|
|
1680
1707
|
setVisibleRows((prev) => ({
|
|
1681
1708
|
...prev,
|
|
1682
1709
|
[rowKey]: { visible: !prev[rowKey]?.visible }
|
|
1683
1710
|
}));
|
|
1684
1711
|
};
|
|
1685
|
-
|
|
1712
|
+
React10.useEffect(() => {
|
|
1686
1713
|
if (rows.length && Object.keys(visibleRows).length === 0) {
|
|
1687
1714
|
const initial = {};
|
|
1688
1715
|
rows.forEach((row) => {
|
|
@@ -1691,7 +1718,7 @@ function TableBody({
|
|
|
1691
1718
|
setVisibleRows(initial);
|
|
1692
1719
|
}
|
|
1693
1720
|
}, [rows]);
|
|
1694
|
-
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1721
|
+
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "w-full", children: rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs(React10__default.default.Fragment, { children: [
|
|
1695
1722
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1696
1723
|
"tr",
|
|
1697
1724
|
{
|
|
@@ -1745,9 +1772,9 @@ function Pagination({
|
|
|
1745
1772
|
const matchedOption = picker.find(
|
|
1746
1773
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
1747
1774
|
);
|
|
1748
|
-
const [perPageKey, setPerPageKey] =
|
|
1775
|
+
const [perPageKey, setPerPageKey] = React10.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
1749
1776
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
1750
|
-
|
|
1777
|
+
React10.useEffect(() => {
|
|
1751
1778
|
if (serverSide && options.perPage != null) {
|
|
1752
1779
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
1753
1780
|
if (next) setPerPageKey(next.key);
|
|
@@ -1807,35 +1834,35 @@ function Table({
|
|
|
1807
1834
|
footer = null,
|
|
1808
1835
|
header = null
|
|
1809
1836
|
}) {
|
|
1810
|
-
const searchRef =
|
|
1811
|
-
const [searchTerm, setSearchTerm] =
|
|
1812
|
-
const [perPage, setPerPage] =
|
|
1837
|
+
const searchRef = React10.useRef(null);
|
|
1838
|
+
const [searchTerm, setSearchTerm] = React10.useState("");
|
|
1839
|
+
const [perPage, setPerPage] = React10.useState(
|
|
1813
1840
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
1814
1841
|
);
|
|
1815
|
-
const [activePage, setActivePage] =
|
|
1816
|
-
const [datasets, setDatasets] =
|
|
1842
|
+
const [activePage, setActivePage] = React10.useState(0);
|
|
1843
|
+
const [datasets, setDatasets] = React10.useState([]);
|
|
1817
1844
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
1818
|
-
const MAX_PAGE =
|
|
1845
|
+
const MAX_PAGE = React10.useMemo(() => {
|
|
1819
1846
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
1820
1847
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
1821
1848
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
1822
1849
|
return datasets.length ? datasets.length - 1 : 0;
|
|
1823
1850
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
1824
|
-
const currentPageRows =
|
|
1851
|
+
const currentPageRows = React10.useMemo(() => {
|
|
1825
1852
|
if (isServerSide) return rows;
|
|
1826
1853
|
return datasets.length ? datasets[activePage] ?? [] : [];
|
|
1827
1854
|
}, [isServerSide, rows, datasets, activePage]);
|
|
1828
|
-
|
|
1855
|
+
React10.useEffect(() => {
|
|
1829
1856
|
if (pagination.enabled && !isServerSide) setPerPage(pagination.perPage ?? 15);
|
|
1830
1857
|
}, [pagination, isServerSide]);
|
|
1831
|
-
|
|
1858
|
+
React10.useEffect(() => {
|
|
1832
1859
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
1833
1860
|
}, [isServerSide, pagination.perPage]);
|
|
1834
|
-
|
|
1861
|
+
React10.useEffect(() => {
|
|
1835
1862
|
if (isServerSide) return;
|
|
1836
1863
|
setDatasets(createDatasets(rows, pagination.enabled ? perPage : null));
|
|
1837
1864
|
}, [rows, perPage, pagination, isServerSide]);
|
|
1838
|
-
|
|
1865
|
+
React10.useEffect(() => {
|
|
1839
1866
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
1840
1867
|
setActivePage(pagination.page - 1);
|
|
1841
1868
|
}, [isServerSide, pagination.page]);
|
|
@@ -1895,7 +1922,7 @@ function Table({
|
|
|
1895
1922
|
] });
|
|
1896
1923
|
}
|
|
1897
1924
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode" }) {
|
|
1898
|
-
const id =
|
|
1925
|
+
const id = React10.useId();
|
|
1899
1926
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center gap-2 cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1900
1927
|
SwitchPrimitive__namespace.Root,
|
|
1901
1928
|
{
|
|
@@ -2088,17 +2115,17 @@ function AppShell({
|
|
|
2088
2115
|
children,
|
|
2089
2116
|
className = ""
|
|
2090
2117
|
}) {
|
|
2091
|
-
const [expanded, setExpanded] =
|
|
2092
|
-
const [isMobile, setIsMobile] =
|
|
2093
|
-
const [mobileOpen, setMobileOpen] =
|
|
2094
|
-
|
|
2118
|
+
const [expanded, setExpanded] = React10.useState(sidebarDefaultExpanded);
|
|
2119
|
+
const [isMobile, setIsMobile] = React10.useState(false);
|
|
2120
|
+
const [mobileOpen, setMobileOpen] = React10.useState(false);
|
|
2121
|
+
React10.useEffect(() => {
|
|
2095
2122
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
2096
2123
|
const update = (e) => setIsMobile(e.matches);
|
|
2097
2124
|
update(mq);
|
|
2098
2125
|
mq.addEventListener("change", update);
|
|
2099
2126
|
return () => mq.removeEventListener("change", update);
|
|
2100
2127
|
}, []);
|
|
2101
|
-
|
|
2128
|
+
React10.useEffect(() => {
|
|
2102
2129
|
if (!isMobile) setMobileOpen(false);
|
|
2103
2130
|
}, [isMobile]);
|
|
2104
2131
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -2141,7 +2168,7 @@ function AppShell({
|
|
|
2141
2168
|
footer: sidebarFooter
|
|
2142
2169
|
}
|
|
2143
2170
|
),
|
|
2144
|
-
hasSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2171
|
+
hasSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsxs(Portal, { children: [
|
|
2145
2172
|
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: mobileOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2146
2173
|
framerMotion.motion.div,
|
|
2147
2174
|
{
|
|
@@ -2272,10 +2299,10 @@ function ThemeProvider({
|
|
|
2272
2299
|
className = "",
|
|
2273
2300
|
style
|
|
2274
2301
|
}) {
|
|
2275
|
-
const id =
|
|
2302
|
+
const id = React10__default.default.useId().replace(/:/g, "");
|
|
2276
2303
|
const scopeClass = `geo-th-${id}`;
|
|
2277
|
-
const divRef =
|
|
2278
|
-
|
|
2304
|
+
const divRef = React10.useRef(null);
|
|
2305
|
+
React10.useEffect(() => {
|
|
2279
2306
|
const el = divRef.current;
|
|
2280
2307
|
if (!el) return;
|
|
2281
2308
|
if (colorScheme === "auto") return;
|
|
@@ -2290,8 +2317,8 @@ function ThemeProvider({
|
|
|
2290
2317
|
}
|
|
2291
2318
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
2292
2319
|
}, [colorScheme]);
|
|
2293
|
-
const lightVars =
|
|
2294
|
-
const darkVarStr =
|
|
2320
|
+
const lightVars = React10.useMemo(() => toCssVars(theme), [theme]);
|
|
2321
|
+
const darkVarStr = React10.useMemo(() => {
|
|
2295
2322
|
if (!darkTheme) return "";
|
|
2296
2323
|
const dvars = toCssVars(darkTheme);
|
|
2297
2324
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -2567,7 +2594,7 @@ function Password({
|
|
|
2567
2594
|
labelColor,
|
|
2568
2595
|
iconColor
|
|
2569
2596
|
}) {
|
|
2570
|
-
const [passwordVisible, setPasswordVisible] =
|
|
2597
|
+
const [passwordVisible, setPasswordVisible] = React10.useState(false);
|
|
2571
2598
|
const color = iconColor ?? chunk255PCZIW_cjs.colors_default.PALETTE["prussian-blue"];
|
|
2572
2599
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", style: style ?? {}, children: [
|
|
2573
2600
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`, children: [
|
|
@@ -2710,7 +2737,7 @@ function Switch({
|
|
|
2710
2737
|
checkedIcon,
|
|
2711
2738
|
uncheckedIcon
|
|
2712
2739
|
}) {
|
|
2713
|
-
const id =
|
|
2740
|
+
const id = React10.useId();
|
|
2714
2741
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer mr-12 select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2715
2742
|
SwitchPrimitive__namespace.Root,
|
|
2716
2743
|
{
|
|
@@ -2740,8 +2767,8 @@ function AutoComplete({
|
|
|
2740
2767
|
onItemClick,
|
|
2741
2768
|
emptyText = "No results found"
|
|
2742
2769
|
}) {
|
|
2743
|
-
const [term, setTerm] =
|
|
2744
|
-
const [open, setOpen] =
|
|
2770
|
+
const [term, setTerm] = React10.useState("");
|
|
2771
|
+
const [open, setOpen] = React10.useState(false);
|
|
2745
2772
|
const foundItems = term.trim() ? items.filter(
|
|
2746
2773
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
2747
2774
|
) : [];
|
|
@@ -2826,10 +2853,10 @@ function TreeSelect({
|
|
|
2826
2853
|
htmlFor,
|
|
2827
2854
|
items = []
|
|
2828
2855
|
}) {
|
|
2829
|
-
const [open, setOpen] =
|
|
2830
|
-
const [hoveredItem, setHoveredItem] =
|
|
2831
|
-
const [innerItems, setInnerItems] =
|
|
2832
|
-
|
|
2856
|
+
const [open, setOpen] = React10.useState(false);
|
|
2857
|
+
const [hoveredItem, setHoveredItem] = React10.useState(null);
|
|
2858
|
+
const [innerItems, setInnerItems] = React10.useState([]);
|
|
2859
|
+
React10.useEffect(() => {
|
|
2833
2860
|
setInnerItems(items);
|
|
2834
2861
|
}, [items]);
|
|
2835
2862
|
const selectItem = (key) => {
|
|
@@ -2928,8 +2955,8 @@ function FileInput({
|
|
|
2928
2955
|
name,
|
|
2929
2956
|
accept = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx"
|
|
2930
2957
|
}) {
|
|
2931
|
-
const fileInput =
|
|
2932
|
-
const [files, setFiles] =
|
|
2958
|
+
const fileInput = React10.useRef(null);
|
|
2959
|
+
const [files, setFiles] = React10.useState([]);
|
|
2933
2960
|
const openPicker = () => {
|
|
2934
2961
|
fileInput.current?.dispatchEvent(new MouseEvent("click", { bubbles: false }));
|
|
2935
2962
|
};
|
|
@@ -3063,12 +3090,12 @@ function DatePickerBase({
|
|
|
3063
3090
|
disableAfter,
|
|
3064
3091
|
disabled
|
|
3065
3092
|
}) {
|
|
3066
|
-
const pickerRef =
|
|
3067
|
-
const calendarRef =
|
|
3068
|
-
const [isExpanded, setExpanded] =
|
|
3069
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3070
|
-
const [currentYear, setCurrentYear] =
|
|
3071
|
-
const [currentMonth, setCurrentMonth] =
|
|
3093
|
+
const pickerRef = React10.useRef(null);
|
|
3094
|
+
const calendarRef = React10.useRef(null);
|
|
3095
|
+
const [isExpanded, setExpanded] = React10.useState(false);
|
|
3096
|
+
const [isCloseToBottom, setCloseToBottom] = React10.useState(false);
|
|
3097
|
+
const [currentYear, setCurrentYear] = React10.useState(value.getFullYear());
|
|
3098
|
+
const [currentMonth, setCurrentMonth] = React10.useState(value.getMonth() + 1);
|
|
3072
3099
|
const toggle = () => {
|
|
3073
3100
|
if (!disabled) setExpanded((p) => !p);
|
|
3074
3101
|
};
|
|
@@ -3112,14 +3139,14 @@ function DatePickerBase({
|
|
|
3112
3139
|
}
|
|
3113
3140
|
return ordered;
|
|
3114
3141
|
};
|
|
3115
|
-
|
|
3142
|
+
React10.useEffect(() => {
|
|
3116
3143
|
const clickAway = (e) => {
|
|
3117
3144
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3118
3145
|
};
|
|
3119
3146
|
document.addEventListener("mousedown", clickAway);
|
|
3120
3147
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3121
3148
|
}, []);
|
|
3122
|
-
|
|
3149
|
+
React10.useEffect(() => {
|
|
3123
3150
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3124
3151
|
if (bbox && (bbox.y > window.innerHeight - 220 || bbox.bottom > window.innerHeight - 400)) {
|
|
3125
3152
|
setCloseToBottom(true);
|
|
@@ -3212,29 +3239,29 @@ function TemporalPickerBase({
|
|
|
3212
3239
|
layout,
|
|
3213
3240
|
style = {}
|
|
3214
3241
|
}) {
|
|
3215
|
-
const pickerRef =
|
|
3216
|
-
const calendarRef =
|
|
3217
|
-
const valueRefs =
|
|
3218
|
-
const [isExpanded, setExpanded] =
|
|
3219
|
-
const [isCloseToBottom, setCloseToBottom] =
|
|
3220
|
-
const innerValues =
|
|
3242
|
+
const pickerRef = React10.useRef(null);
|
|
3243
|
+
const calendarRef = React10.useRef(null);
|
|
3244
|
+
const valueRefs = React10.useRef([]);
|
|
3245
|
+
const [isExpanded, setExpanded] = React10.useState(false);
|
|
3246
|
+
const [isCloseToBottom, setCloseToBottom] = React10.useState(false);
|
|
3247
|
+
const innerValues = React10.useMemo(() => {
|
|
3221
3248
|
const vals = [];
|
|
3222
3249
|
for (let i = lowerLimit; i <= upperLimit; i++) vals.push(i);
|
|
3223
3250
|
return vals;
|
|
3224
3251
|
}, [lowerLimit, upperLimit]);
|
|
3225
|
-
|
|
3252
|
+
React10.useEffect(() => {
|
|
3226
3253
|
const clickAway = (e) => {
|
|
3227
3254
|
if (pickerRef.current && !pickerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) setExpanded(false);
|
|
3228
3255
|
};
|
|
3229
3256
|
document.addEventListener("mousedown", clickAway);
|
|
3230
3257
|
return () => document.removeEventListener("mousedown", clickAway);
|
|
3231
3258
|
}, []);
|
|
3232
|
-
|
|
3259
|
+
React10.useEffect(() => {
|
|
3233
3260
|
const bbox = pickerRef.current?.getBoundingClientRect();
|
|
3234
3261
|
if (bbox && bbox.y > window.innerHeight - 220) setCloseToBottom(true);
|
|
3235
3262
|
else setCloseToBottom(false);
|
|
3236
3263
|
}, []);
|
|
3237
|
-
|
|
3264
|
+
React10.useEffect(() => {
|
|
3238
3265
|
if (!isExpanded) return;
|
|
3239
3266
|
const t = setTimeout(() => {
|
|
3240
3267
|
const node = valueRefs.current.find((n) => n.value === value);
|
|
@@ -3345,6 +3372,7 @@ exports.NotificationProvider = NotificationProvider;
|
|
|
3345
3372
|
exports.NumberInput = NumberInput;
|
|
3346
3373
|
exports.OpaqueGridCard = OpaqueGridCard;
|
|
3347
3374
|
exports.Password = Password;
|
|
3375
|
+
exports.Portal = Portal;
|
|
3348
3376
|
exports.ScalableContainer = ScalableContainer;
|
|
3349
3377
|
exports.SearchInput = SearchInput_default;
|
|
3350
3378
|
exports.Sidebar = Sidebar;
|