@geomak/ui 6.22.0 → 6.24.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 +353 -232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -4
- package/dist/index.d.ts +70 -4
- package/dist/index.js +137 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkOAV4TA4B_cjs = require('./chunk-OAV4TA4B.cjs');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var React27 = require('react');
|
|
6
6
|
var reactDom = require('react-dom');
|
|
7
7
|
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
8
8
|
var DropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
@@ -40,7 +40,7 @@ function _interopNamespace(e) {
|
|
|
40
40
|
return Object.freeze(n);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var React27__default = /*#__PURE__*/_interopDefault(React27);
|
|
44
44
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
45
45
|
var DropdownMenu__namespace = /*#__PURE__*/_interopNamespace(DropdownMenu);
|
|
46
46
|
var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
|
|
@@ -216,8 +216,8 @@ Icon.Copy = Copy;
|
|
|
216
216
|
Icon.CircleStack = CircleStack;
|
|
217
217
|
var icons_default = Icon;
|
|
218
218
|
function Portal({ children, target }) {
|
|
219
|
-
const [resolved, setResolved] =
|
|
220
|
-
|
|
219
|
+
const [resolved, setResolved] = React27.useState(null);
|
|
220
|
+
React27.useEffect(() => {
|
|
221
221
|
if (target === null) {
|
|
222
222
|
setResolved(null);
|
|
223
223
|
return;
|
|
@@ -651,7 +651,7 @@ function IconButton({
|
|
|
651
651
|
className = "",
|
|
652
652
|
style
|
|
653
653
|
}) {
|
|
654
|
-
const colorScheme =
|
|
654
|
+
const colorScheme = React27.useMemo(() => {
|
|
655
655
|
if (type === "primary") {
|
|
656
656
|
return "bg-accent text-accent-fg hover:bg-accent-hover";
|
|
657
657
|
}
|
|
@@ -730,7 +730,7 @@ var SIZE_CLASSES = {
|
|
|
730
730
|
md: "h-9 px-4 text-sm gap-1.5 rounded-lg",
|
|
731
731
|
lg: "h-11 px-5 text-sm gap-2 rounded-xl"
|
|
732
732
|
};
|
|
733
|
-
var Button =
|
|
733
|
+
var Button = React27__default.default.forwardRef(function Button2({
|
|
734
734
|
content,
|
|
735
735
|
variant = "primary",
|
|
736
736
|
size = "md",
|
|
@@ -838,7 +838,7 @@ function MenuButton({
|
|
|
838
838
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
839
839
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
|
|
840
840
|
].join(" "),
|
|
841
|
-
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
841
|
+
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(React27__default.default.Fragment, { children: [
|
|
842
842
|
item.separatorBefore && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Separator, { className: "my-1 h-px bg-border" }),
|
|
843
843
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
844
844
|
DropdownMenu__namespace.Item,
|
|
@@ -1081,9 +1081,9 @@ function Tooltip({
|
|
|
1081
1081
|
] }) });
|
|
1082
1082
|
}
|
|
1083
1083
|
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
1084
|
-
var TabsContext =
|
|
1084
|
+
var TabsContext = React27.createContext(null);
|
|
1085
1085
|
function useTabsContext() {
|
|
1086
|
-
const ctx =
|
|
1086
|
+
const ctx = React27.useContext(TabsContext);
|
|
1087
1087
|
if (!ctx) throw new Error("Tabs.List / Tabs.Trigger / Tabs.Panel must be rendered inside <Tabs>.");
|
|
1088
1088
|
return ctx;
|
|
1089
1089
|
}
|
|
@@ -1105,26 +1105,26 @@ function Tabs({
|
|
|
1105
1105
|
children
|
|
1106
1106
|
}) {
|
|
1107
1107
|
const isControlled = value !== void 0;
|
|
1108
|
-
const [internal, setInternal] =
|
|
1108
|
+
const [internal, setInternal] = React27.useState(defaultValue);
|
|
1109
1109
|
const current = isControlled ? value : internal;
|
|
1110
1110
|
const reduced = !!framerMotion.useReducedMotion();
|
|
1111
|
-
const indicatorId =
|
|
1112
|
-
const select =
|
|
1111
|
+
const indicatorId = React27.useId();
|
|
1112
|
+
const select = React27.useCallback((next) => {
|
|
1113
1113
|
if (!isControlled) setInternal(next);
|
|
1114
1114
|
onValueChange?.(next);
|
|
1115
1115
|
}, [isControlled, onValueChange]);
|
|
1116
|
-
const registry =
|
|
1117
|
-
const orderRef =
|
|
1118
|
-
const [, bump] =
|
|
1119
|
-
const registerTab =
|
|
1116
|
+
const registry = React27.useRef(/* @__PURE__ */ new Map());
|
|
1117
|
+
const orderRef = React27.useRef(0);
|
|
1118
|
+
const [, bump] = React27.useState(0);
|
|
1119
|
+
const registerTab = React27.useCallback((val, meta) => {
|
|
1120
1120
|
const existing = registry.current.get(val);
|
|
1121
1121
|
registry.current.set(val, { ...meta, order: existing?.order ?? orderRef.current++ });
|
|
1122
1122
|
if (!existing) bump((v) => v + 1);
|
|
1123
1123
|
}, []);
|
|
1124
|
-
const unregisterTab =
|
|
1124
|
+
const unregisterTab = React27.useCallback((val) => {
|
|
1125
1125
|
if (registry.current.delete(val)) bump((v) => v + 1);
|
|
1126
1126
|
}, []);
|
|
1127
|
-
const getTabs =
|
|
1127
|
+
const getTabs = React27.useCallback(() => [...registry.current.entries()].sort((a, b) => a[1].order - b[1].order).map(([val, m]) => ({ value: val, label: m.label, icon: m.icon, disabled: m.disabled })), []);
|
|
1128
1128
|
return /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: { value: current, variant, size, orientation, indicatorId, reduced, select, registerTab, unregisterTab, getTabs }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1129
1129
|
TabsPrimitive__namespace.Root,
|
|
1130
1130
|
{
|
|
@@ -1144,10 +1144,10 @@ function Tabs({
|
|
|
1144
1144
|
function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
|
|
1145
1145
|
const { variant, orientation, reduced, value } = useTabsContext();
|
|
1146
1146
|
const horizontal = orientation === "horizontal";
|
|
1147
|
-
const scrollRef =
|
|
1148
|
-
const [edges, setEdges] =
|
|
1147
|
+
const scrollRef = React27.useRef(null);
|
|
1148
|
+
const [edges, setEdges] = React27.useState({ start: false, end: false });
|
|
1149
1149
|
const scrollable = variant !== "segmented";
|
|
1150
|
-
|
|
1150
|
+
React27.useLayoutEffect(() => {
|
|
1151
1151
|
const el = scrollRef.current;
|
|
1152
1152
|
if (!el || !scrollable) return;
|
|
1153
1153
|
const update = () => {
|
|
@@ -1172,13 +1172,13 @@ function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
|
|
|
1172
1172
|
ro.disconnect();
|
|
1173
1173
|
};
|
|
1174
1174
|
}, [horizontal, scrollable, children]);
|
|
1175
|
-
const nudge =
|
|
1175
|
+
const nudge = React27.useCallback((dir) => {
|
|
1176
1176
|
const el = scrollRef.current;
|
|
1177
1177
|
if (!el) return;
|
|
1178
1178
|
const amount = (horizontal ? el.clientWidth : el.clientHeight) * 0.7 * dir;
|
|
1179
1179
|
el.scrollBy({ [horizontal ? "left" : "top"]: amount, behavior: reduced ? "auto" : "smooth" });
|
|
1180
1180
|
}, [horizontal, reduced]);
|
|
1181
|
-
|
|
1181
|
+
React27.useLayoutEffect(() => {
|
|
1182
1182
|
const el = scrollRef.current;
|
|
1183
1183
|
if (!el || !scrollable) return;
|
|
1184
1184
|
const active = el.querySelector("[role=tab][data-state=active]");
|
|
@@ -1236,9 +1236,9 @@ function Chevron2({ side, orientation, onClick }) {
|
|
|
1236
1236
|
function OverflowMenu() {
|
|
1237
1237
|
const { getTabs, value, select, orientation } = useTabsContext();
|
|
1238
1238
|
const horizontal = orientation === "horizontal";
|
|
1239
|
-
const [open, setOpen] =
|
|
1240
|
-
const wrapRef =
|
|
1241
|
-
const timer =
|
|
1239
|
+
const [open, setOpen] = React27.useState(false);
|
|
1240
|
+
const wrapRef = React27.useRef(null);
|
|
1241
|
+
const timer = React27.useRef(null);
|
|
1242
1242
|
const openNow = () => {
|
|
1243
1243
|
if (timer.current) clearTimeout(timer.current);
|
|
1244
1244
|
setOpen(true);
|
|
@@ -1246,7 +1246,7 @@ function OverflowMenu() {
|
|
|
1246
1246
|
const closeSoon = () => {
|
|
1247
1247
|
timer.current = setTimeout(() => setOpen(false), 160);
|
|
1248
1248
|
};
|
|
1249
|
-
|
|
1249
|
+
React27.useLayoutEffect(() => {
|
|
1250
1250
|
if (!open) return;
|
|
1251
1251
|
const onDoc = (e) => {
|
|
1252
1252
|
if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
|
|
@@ -1327,7 +1327,7 @@ function TabsTrigger({ value, icon, badge, closeable, onClose, disabled, classNa
|
|
|
1327
1327
|
const isActive = active === value;
|
|
1328
1328
|
const horizontal = orientation === "horizontal";
|
|
1329
1329
|
const sz = SIZE[size];
|
|
1330
|
-
|
|
1330
|
+
React27.useLayoutEffect(() => {
|
|
1331
1331
|
registerTab(value, { label: children, icon, disabled });
|
|
1332
1332
|
return () => unregisterTab(value);
|
|
1333
1333
|
}, [value, children, icon, disabled, registerTab, unregisterTab]);
|
|
@@ -1525,7 +1525,7 @@ function Tree({
|
|
|
1525
1525
|
item.key
|
|
1526
1526
|
)) });
|
|
1527
1527
|
}
|
|
1528
|
-
var AccordionCtx =
|
|
1528
|
+
var AccordionCtx = React27.createContext({ variant: "separated" });
|
|
1529
1529
|
function Accordion2({
|
|
1530
1530
|
children,
|
|
1531
1531
|
type = "single",
|
|
@@ -1584,7 +1584,7 @@ var Chevron3 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
1584
1584
|
}
|
|
1585
1585
|
);
|
|
1586
1586
|
function AccordionItem({ value, title, icon, children, disabled, className = "" }) {
|
|
1587
|
-
const { variant } =
|
|
1587
|
+
const { variant } = React27.useContext(AccordionCtx);
|
|
1588
1588
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1589
1589
|
AccordionPrimitive__namespace.Item,
|
|
1590
1590
|
{
|
|
@@ -1643,7 +1643,7 @@ function Breadcrumbs({
|
|
|
1643
1643
|
className = "",
|
|
1644
1644
|
style
|
|
1645
1645
|
}) {
|
|
1646
|
-
const [expanded, setExpanded] =
|
|
1646
|
+
const [expanded, setExpanded] = React27.useState(false);
|
|
1647
1647
|
const shouldCollapse = maxItems > 0 && items.length > maxItems && !expanded;
|
|
1648
1648
|
const visible = [];
|
|
1649
1649
|
if (shouldCollapse) {
|
|
@@ -1827,8 +1827,8 @@ function Stepper({
|
|
|
1827
1827
|
className = ""
|
|
1828
1828
|
}) {
|
|
1829
1829
|
const reduced = framerMotion.useReducedMotion();
|
|
1830
|
-
const [forcedVertical, setForcedVertical] =
|
|
1831
|
-
|
|
1830
|
+
const [forcedVertical, setForcedVertical] = React27.useState(false);
|
|
1831
|
+
React27.useEffect(() => {
|
|
1832
1832
|
if (!responsive || orientation === "vertical") return;
|
|
1833
1833
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1834
1834
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
@@ -1937,7 +1937,7 @@ function Kbd({
|
|
|
1937
1937
|
style
|
|
1938
1938
|
}) {
|
|
1939
1939
|
if (keys && keys.length > 0) {
|
|
1940
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1940
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(React27__default.default.Fragment, { children: [
|
|
1941
1941
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-xs select-none", children: separator }),
|
|
1942
1942
|
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: [cap, SIZE3[size]].join(" "), children: k })
|
|
1943
1943
|
] }, `${k}-${i}`)) });
|
|
@@ -2028,13 +2028,13 @@ function FlatCarousel({
|
|
|
2028
2028
|
className = "",
|
|
2029
2029
|
style
|
|
2030
2030
|
}) {
|
|
2031
|
-
const scrollerRef =
|
|
2032
|
-
const slides =
|
|
2033
|
-
const [active, setActive] =
|
|
2034
|
-
const [atStart, setAtStart] =
|
|
2035
|
-
const [atEnd, setAtEnd] =
|
|
2031
|
+
const scrollerRef = React27.useRef(null);
|
|
2032
|
+
const slides = React27__default.default.Children.toArray(children);
|
|
2033
|
+
const [active, setActive] = React27.useState(0);
|
|
2034
|
+
const [atStart, setAtStart] = React27.useState(true);
|
|
2035
|
+
const [atEnd, setAtEnd] = React27.useState(false);
|
|
2036
2036
|
const width = typeof itemWidth === "number" ? `${itemWidth}px` : itemWidth;
|
|
2037
|
-
const update =
|
|
2037
|
+
const update = React27.useCallback(() => {
|
|
2038
2038
|
const el = scrollerRef.current;
|
|
2039
2039
|
if (!el) return;
|
|
2040
2040
|
setAtStart(el.scrollLeft <= 1);
|
|
@@ -2043,7 +2043,7 @@ function FlatCarousel({
|
|
|
2043
2043
|
const slideW = first ? first.getBoundingClientRect().width + gap : el.clientWidth;
|
|
2044
2044
|
setActive(Math.round(el.scrollLeft / slideW));
|
|
2045
2045
|
}, [gap]);
|
|
2046
|
-
|
|
2046
|
+
React27.useEffect(() => {
|
|
2047
2047
|
update();
|
|
2048
2048
|
const el = scrollerRef.current;
|
|
2049
2049
|
if (!el) return;
|
|
@@ -2084,9 +2084,9 @@ function RotatingCarousel({
|
|
|
2084
2084
|
className = "",
|
|
2085
2085
|
style
|
|
2086
2086
|
}) {
|
|
2087
|
-
const slides =
|
|
2087
|
+
const slides = React27__default.default.Children.toArray(children);
|
|
2088
2088
|
const count = slides.length;
|
|
2089
|
-
const [active, setActive] =
|
|
2089
|
+
const [active, setActive] = React27.useState(0);
|
|
2090
2090
|
const reduced = framerMotion.useReducedMotion();
|
|
2091
2091
|
const wrap = (n) => count > 0 ? (n % count + count) % count : 0;
|
|
2092
2092
|
const idx = wrap(active);
|
|
@@ -2236,7 +2236,7 @@ function FAB({
|
|
|
2236
2236
|
className = "",
|
|
2237
2237
|
style
|
|
2238
2238
|
}) {
|
|
2239
|
-
const [open, setOpen] =
|
|
2239
|
+
const [open, setOpen] = React27.useState(false);
|
|
2240
2240
|
const reduced = framerMotion.useReducedMotion();
|
|
2241
2241
|
const hasDial = !!actions && actions.length > 0;
|
|
2242
2242
|
const bottom = position.startsWith("bottom");
|
|
@@ -2338,8 +2338,8 @@ function PopConfirm({
|
|
|
2338
2338
|
onOpenChange,
|
|
2339
2339
|
className = ""
|
|
2340
2340
|
}) {
|
|
2341
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
2342
|
-
const [loading, setLoading] =
|
|
2341
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React27.useState(false);
|
|
2342
|
+
const [loading, setLoading] = React27.useState(false);
|
|
2343
2343
|
const isOpen = open ?? uncontrolledOpen;
|
|
2344
2344
|
const setOpen = (next) => {
|
|
2345
2345
|
onOpenChange?.(next);
|
|
@@ -2405,6 +2405,119 @@ function PopConfirm({
|
|
|
2405
2405
|
) })
|
|
2406
2406
|
] });
|
|
2407
2407
|
}
|
|
2408
|
+
var DEFAULT_EVENTS = ["mousemove", "mousedown", "keydown", "touchstart", "scroll", "wheel"];
|
|
2409
|
+
var formatTime = (ms) => {
|
|
2410
|
+
const total = Math.max(0, Math.ceil(ms / 1e3));
|
|
2411
|
+
const m = Math.floor(total / 60);
|
|
2412
|
+
const s = total % 60;
|
|
2413
|
+
return `${m}:${String(s).padStart(2, "0")}`;
|
|
2414
|
+
};
|
|
2415
|
+
function LogoutTimer({
|
|
2416
|
+
timeout,
|
|
2417
|
+
countdown = 6e4,
|
|
2418
|
+
onLogout,
|
|
2419
|
+
onContinue,
|
|
2420
|
+
onWarning,
|
|
2421
|
+
events = DEFAULT_EVENTS,
|
|
2422
|
+
enabled = true,
|
|
2423
|
+
title = "Still there?",
|
|
2424
|
+
description = "You\u2019ll be signed out soon due to inactivity.",
|
|
2425
|
+
continueLabel = "Stay signed in",
|
|
2426
|
+
logoutLabel = "Sign out now"
|
|
2427
|
+
}) {
|
|
2428
|
+
const reduced = framerMotion.useReducedMotion();
|
|
2429
|
+
const [warning, setWarning] = React27.useState(false);
|
|
2430
|
+
const [remaining, setRemaining] = React27.useState(countdown);
|
|
2431
|
+
const idleTimer = React27.useRef(null);
|
|
2432
|
+
const tick = React27.useRef(null);
|
|
2433
|
+
const deadline = React27.useRef(0);
|
|
2434
|
+
const warningRef = React27.useRef(false);
|
|
2435
|
+
const lastReset = React27.useRef(0);
|
|
2436
|
+
const cbs = React27.useRef({ onLogout, onContinue, onWarning });
|
|
2437
|
+
cbs.current = { onLogout, onContinue, onWarning };
|
|
2438
|
+
const clearTimers = React27.useCallback(() => {
|
|
2439
|
+
if (idleTimer.current) {
|
|
2440
|
+
clearTimeout(idleTimer.current);
|
|
2441
|
+
idleTimer.current = null;
|
|
2442
|
+
}
|
|
2443
|
+
if (tick.current) {
|
|
2444
|
+
clearInterval(tick.current);
|
|
2445
|
+
tick.current = null;
|
|
2446
|
+
}
|
|
2447
|
+
}, []);
|
|
2448
|
+
const logout = React27.useCallback(() => {
|
|
2449
|
+
clearTimers();
|
|
2450
|
+
warningRef.current = false;
|
|
2451
|
+
setWarning(false);
|
|
2452
|
+
cbs.current.onLogout();
|
|
2453
|
+
}, [clearTimers]);
|
|
2454
|
+
const startIdle = React27.useCallback(() => {
|
|
2455
|
+
if (idleTimer.current) clearTimeout(idleTimer.current);
|
|
2456
|
+
idleTimer.current = setTimeout(() => {
|
|
2457
|
+
warningRef.current = true;
|
|
2458
|
+
deadline.current = Date.now() + countdown;
|
|
2459
|
+
setRemaining(countdown);
|
|
2460
|
+
setWarning(true);
|
|
2461
|
+
cbs.current.onWarning?.();
|
|
2462
|
+
tick.current = setInterval(() => {
|
|
2463
|
+
const left = deadline.current - Date.now();
|
|
2464
|
+
if (left <= 0) logout();
|
|
2465
|
+
else setRemaining(left);
|
|
2466
|
+
}, 250);
|
|
2467
|
+
}, timeout);
|
|
2468
|
+
}, [timeout, countdown, logout]);
|
|
2469
|
+
const stay = React27.useCallback(() => {
|
|
2470
|
+
if (tick.current) {
|
|
2471
|
+
clearInterval(tick.current);
|
|
2472
|
+
tick.current = null;
|
|
2473
|
+
}
|
|
2474
|
+
warningRef.current = false;
|
|
2475
|
+
setWarning(false);
|
|
2476
|
+
cbs.current.onContinue?.();
|
|
2477
|
+
startIdle();
|
|
2478
|
+
}, [startIdle]);
|
|
2479
|
+
React27.useEffect(() => {
|
|
2480
|
+
if (!enabled) {
|
|
2481
|
+
clearTimers();
|
|
2482
|
+
warningRef.current = false;
|
|
2483
|
+
setWarning(false);
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2486
|
+
const onActivity = () => {
|
|
2487
|
+
if (warningRef.current) return;
|
|
2488
|
+
const now = Date.now();
|
|
2489
|
+
if (now - lastReset.current < 500) return;
|
|
2490
|
+
lastReset.current = now;
|
|
2491
|
+
startIdle();
|
|
2492
|
+
};
|
|
2493
|
+
startIdle();
|
|
2494
|
+
events.forEach((e) => window.addEventListener(e, onActivity, { passive: true }));
|
|
2495
|
+
return () => {
|
|
2496
|
+
events.forEach((e) => window.removeEventListener(e, onActivity));
|
|
2497
|
+
clearTimers();
|
|
2498
|
+
};
|
|
2499
|
+
}, [enabled, timeout, countdown, events.join(","), startIdle, clearTimers]);
|
|
2500
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Modal, { isOpen: warning, onClose: stay, hasFooter: false, title, size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
2501
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground-secondary", children: description }),
|
|
2502
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
2503
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-3xl font-semibold tabular-nums text-foreground", "aria-live": "polite", children: formatTime(remaining) }),
|
|
2504
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1 w-full overflow-hidden rounded-full bg-border", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2505
|
+
framerMotion.motion.div,
|
|
2506
|
+
{
|
|
2507
|
+
className: "h-full bg-accent",
|
|
2508
|
+
initial: { width: "100%" },
|
|
2509
|
+
animate: { width: "0%" },
|
|
2510
|
+
transition: { duration: reduced ? 0 : countdown / 1e3, ease: "linear" }
|
|
2511
|
+
},
|
|
2512
|
+
warning ? deadline.current : "idle"
|
|
2513
|
+
) })
|
|
2514
|
+
] }),
|
|
2515
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex justify-end gap-2", children: [
|
|
2516
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button_default, { content: logoutLabel, variant: "secondary", size: "sm", onClick: logout }),
|
|
2517
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button_default, { content: continueLabel, size: "sm", onClick: stay })
|
|
2518
|
+
] })
|
|
2519
|
+
] }) });
|
|
2520
|
+
}
|
|
2408
2521
|
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
2409
2522
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
2410
2523
|
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
@@ -2435,16 +2548,16 @@ function Calendar2({
|
|
|
2435
2548
|
className = "",
|
|
2436
2549
|
style
|
|
2437
2550
|
}) {
|
|
2438
|
-
const today =
|
|
2439
|
-
const [internalMonth, setInternalMonth] =
|
|
2551
|
+
const today = React27.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
2552
|
+
const [internalMonth, setInternalMonth] = React27.useState(() => month ?? defaultMonth ?? value ?? today);
|
|
2440
2553
|
const visible = month ?? internalMonth;
|
|
2441
2554
|
const setMonth = (next) => {
|
|
2442
2555
|
onMonthChange?.(next);
|
|
2443
2556
|
if (month === void 0) setInternalMonth(next);
|
|
2444
2557
|
};
|
|
2445
|
-
const grid =
|
|
2446
|
-
const weekdays =
|
|
2447
|
-
const eventsByDay =
|
|
2558
|
+
const grid = React27.useMemo(() => buildGrid(visible, weekStartsOn), [visible, weekStartsOn]);
|
|
2559
|
+
const weekdays = React27.useMemo(() => Array.from({ length: 7 }, (_, i) => WEEKDAYS[(i + weekStartsOn) % 7]), [weekStartsOn]);
|
|
2560
|
+
const eventsByDay = React27.useMemo(() => {
|
|
2448
2561
|
const map = /* @__PURE__ */ new Map();
|
|
2449
2562
|
for (const ev of events ?? []) {
|
|
2450
2563
|
const key = startOfDay(ev.date).toDateString();
|
|
@@ -2651,17 +2764,17 @@ function Cart({
|
|
|
2651
2764
|
] })
|
|
2652
2765
|
] });
|
|
2653
2766
|
}
|
|
2654
|
-
var CartContext =
|
|
2767
|
+
var CartContext = React27.createContext(null);
|
|
2655
2768
|
var clampQty = (qty, max) => {
|
|
2656
2769
|
const lower = Math.max(1, Math.round(qty));
|
|
2657
2770
|
return max != null ? Math.min(lower, max) : lower;
|
|
2658
2771
|
};
|
|
2659
2772
|
function CartProvider({ children, initialItems = [], onChange }) {
|
|
2660
|
-
const [items, setItems] =
|
|
2661
|
-
|
|
2773
|
+
const [items, setItems] = React27.useState(initialItems);
|
|
2774
|
+
React27.useEffect(() => {
|
|
2662
2775
|
onChange?.(items);
|
|
2663
2776
|
}, [items]);
|
|
2664
|
-
const addToCart =
|
|
2777
|
+
const addToCart = React27.useCallback((item, quantity) => {
|
|
2665
2778
|
const addQty = quantity ?? item.quantity ?? 1;
|
|
2666
2779
|
setItems((prev) => {
|
|
2667
2780
|
const existing = prev.find((it) => it.id === item.id);
|
|
@@ -2674,29 +2787,29 @@ function CartProvider({ children, initialItems = [], onChange }) {
|
|
|
2674
2787
|
return [...prev, { ...rest, quantity: clampQty(addQty, item.max) }];
|
|
2675
2788
|
});
|
|
2676
2789
|
}, []);
|
|
2677
|
-
const removeFromCart =
|
|
2790
|
+
const removeFromCart = React27.useCallback((id) => {
|
|
2678
2791
|
setItems((prev) => prev.filter((it) => it.id !== id));
|
|
2679
2792
|
}, []);
|
|
2680
|
-
const updateQuantity =
|
|
2793
|
+
const updateQuantity = React27.useCallback((id, quantity) => {
|
|
2681
2794
|
setItems(
|
|
2682
2795
|
(prev) => prev.map((it) => it.id === id ? { ...it, quantity: clampQty(quantity, it.max) } : it)
|
|
2683
2796
|
);
|
|
2684
2797
|
}, []);
|
|
2685
|
-
const clearCart =
|
|
2686
|
-
const isInCart =
|
|
2687
|
-
const getItemCount =
|
|
2688
|
-
const getCartTotal =
|
|
2798
|
+
const clearCart = React27.useCallback(() => setItems([]), []);
|
|
2799
|
+
const isInCart = React27.useCallback((id) => items.some((it) => it.id === id), [items]);
|
|
2800
|
+
const getItemCount = React27.useCallback(() => items.reduce((sum, it) => sum + it.quantity, 0), [items]);
|
|
2801
|
+
const getCartTotal = React27.useCallback(
|
|
2689
2802
|
() => items.reduce((sum, it) => sum + it.price * it.quantity, 0),
|
|
2690
2803
|
[items]
|
|
2691
2804
|
);
|
|
2692
|
-
const value =
|
|
2805
|
+
const value = React27.useMemo(
|
|
2693
2806
|
() => ({ items, addToCart, removeFromCart, updateQuantity, clearCart, isInCart, getItemCount, getCartTotal }),
|
|
2694
2807
|
[items, addToCart, removeFromCart, updateQuantity, clearCart, isInCart, getItemCount, getCartTotal]
|
|
2695
2808
|
);
|
|
2696
2809
|
return /* @__PURE__ */ jsxRuntime.jsx(CartContext.Provider, { value, children });
|
|
2697
2810
|
}
|
|
2698
2811
|
function useCart() {
|
|
2699
|
-
const ctx =
|
|
2812
|
+
const ctx = React27.useContext(CartContext);
|
|
2700
2813
|
if (!ctx) {
|
|
2701
2814
|
throw new Error("useCart must be used within a <CartProvider>.");
|
|
2702
2815
|
}
|
|
@@ -3030,11 +3143,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
3030
3143
|
|
|
3031
3144
|
// src/form/useForm.ts
|
|
3032
3145
|
function useForm(options = {}) {
|
|
3033
|
-
const ref =
|
|
3146
|
+
const ref = React27.useRef(null);
|
|
3034
3147
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
3035
3148
|
const store = ref.current;
|
|
3036
|
-
|
|
3037
|
-
const make =
|
|
3149
|
+
React27.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
3150
|
+
const make = React27.useCallback(
|
|
3038
3151
|
(kind) => (name, rules) => {
|
|
3039
3152
|
if (rules !== void 0) store.setRule(name, rules);
|
|
3040
3153
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -3063,9 +3176,9 @@ function useForm(options = {}) {
|
|
|
3063
3176
|
fieldTarget: make("target")
|
|
3064
3177
|
};
|
|
3065
3178
|
}
|
|
3066
|
-
var FormContext =
|
|
3179
|
+
var FormContext = React27.createContext(null);
|
|
3067
3180
|
function useFormStore() {
|
|
3068
|
-
const store =
|
|
3181
|
+
const store = React27.useContext(FormContext);
|
|
3069
3182
|
if (!store) {
|
|
3070
3183
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
3071
3184
|
}
|
|
@@ -3079,8 +3192,8 @@ function Form({
|
|
|
3079
3192
|
children,
|
|
3080
3193
|
...rest
|
|
3081
3194
|
}) {
|
|
3082
|
-
const ref =
|
|
3083
|
-
const bypass =
|
|
3195
|
+
const ref = React27.useRef(null);
|
|
3196
|
+
const bypass = React27.useRef(false);
|
|
3084
3197
|
const handleSubmit = async (e) => {
|
|
3085
3198
|
if (bypass.current) {
|
|
3086
3199
|
bypass.current = false;
|
|
@@ -3132,12 +3245,12 @@ function useFormField(name, options = {}) {
|
|
|
3132
3245
|
const store = useFormStore();
|
|
3133
3246
|
const { kind = "value", rules } = options;
|
|
3134
3247
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
3135
|
-
|
|
3248
|
+
React27.useEffect(() => {
|
|
3136
3249
|
return () => {
|
|
3137
3250
|
if (rules !== void 0) store.removeRule(name);
|
|
3138
3251
|
};
|
|
3139
3252
|
}, [store, name]);
|
|
3140
|
-
const snap =
|
|
3253
|
+
const snap = React27.useSyncExternalStore(
|
|
3141
3254
|
store.subscribe,
|
|
3142
3255
|
() => store.getFieldSnapshot(name)
|
|
3143
3256
|
);
|
|
@@ -3149,7 +3262,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
3149
3262
|
}
|
|
3150
3263
|
function useFieldArray(name) {
|
|
3151
3264
|
const store = useFormStore();
|
|
3152
|
-
|
|
3265
|
+
React27.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
3153
3266
|
const arr = store.getValue(name) ?? [];
|
|
3154
3267
|
const keys = store.getKeys(name);
|
|
3155
3268
|
return {
|
|
@@ -3310,7 +3423,7 @@ function TextInput({
|
|
|
3310
3423
|
suffix,
|
|
3311
3424
|
id
|
|
3312
3425
|
}) {
|
|
3313
|
-
const errorId =
|
|
3426
|
+
const errorId = React27.useId();
|
|
3314
3427
|
const hasError = errorMessage != null;
|
|
3315
3428
|
const hasAdornment = prefix != null || suffix != null;
|
|
3316
3429
|
const inputId = htmlFor ?? id;
|
|
@@ -3471,7 +3584,7 @@ function CreditCardForm({
|
|
|
3471
3584
|
className = "",
|
|
3472
3585
|
style
|
|
3473
3586
|
}) {
|
|
3474
|
-
const initial =
|
|
3587
|
+
const initial = React27.useRef({
|
|
3475
3588
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
3476
3589
|
name: defaultValue?.name ?? "",
|
|
3477
3590
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -3480,7 +3593,7 @@ function CreditCardForm({
|
|
|
3480
3593
|
const form = useForm({ initialValues: initial });
|
|
3481
3594
|
const numberStr = String(form.values.number ?? "");
|
|
3482
3595
|
const brand = detectBrand(numberStr);
|
|
3483
|
-
|
|
3596
|
+
React27.useEffect(() => {
|
|
3484
3597
|
onChange?.(toCard(form.values));
|
|
3485
3598
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
3486
3599
|
const numberBind = form.fieldNative("number", {
|
|
@@ -3603,7 +3716,7 @@ function Checkout({
|
|
|
3603
3716
|
] })
|
|
3604
3717
|
] });
|
|
3605
3718
|
}
|
|
3606
|
-
var NotificationContext =
|
|
3719
|
+
var NotificationContext = React27.createContext({
|
|
3607
3720
|
open: () => void 0,
|
|
3608
3721
|
close: () => void 0
|
|
3609
3722
|
});
|
|
@@ -3661,26 +3774,26 @@ function NotificationItem({
|
|
|
3661
3774
|
onClose,
|
|
3662
3775
|
reduced
|
|
3663
3776
|
}) {
|
|
3664
|
-
const [paused, setPaused] =
|
|
3777
|
+
const [paused, setPaused] = React27.useState(false);
|
|
3665
3778
|
const duration = n.duration ?? 4e3;
|
|
3666
3779
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
3667
3780
|
const showProgress = !reduced && isAutoDismissing;
|
|
3668
|
-
const timerRef =
|
|
3669
|
-
const startTimeRef =
|
|
3670
|
-
const remainingRef =
|
|
3671
|
-
const clearTimer =
|
|
3781
|
+
const timerRef = React27.useRef(null);
|
|
3782
|
+
const startTimeRef = React27.useRef(0);
|
|
3783
|
+
const remainingRef = React27.useRef(duration);
|
|
3784
|
+
const clearTimer = React27.useCallback(() => {
|
|
3672
3785
|
if (timerRef.current !== null) {
|
|
3673
3786
|
clearTimeout(timerRef.current);
|
|
3674
3787
|
timerRef.current = null;
|
|
3675
3788
|
}
|
|
3676
3789
|
}, []);
|
|
3677
|
-
const scheduleDismiss =
|
|
3790
|
+
const scheduleDismiss = React27.useCallback((ms) => {
|
|
3678
3791
|
clearTimer();
|
|
3679
3792
|
if (!isAutoDismissing) return;
|
|
3680
3793
|
startTimeRef.current = Date.now();
|
|
3681
3794
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
3682
3795
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
3683
|
-
|
|
3796
|
+
React27.useEffect(() => {
|
|
3684
3797
|
if (paused || !isAutoDismissing) return;
|
|
3685
3798
|
scheduleDismiss(remainingRef.current);
|
|
3686
3799
|
return clearTimer;
|
|
@@ -3763,15 +3876,15 @@ function NotificationProvider({
|
|
|
3763
3876
|
children,
|
|
3764
3877
|
position = "top-right"
|
|
3765
3878
|
}) {
|
|
3766
|
-
const [notifications, setNotifications] =
|
|
3879
|
+
const [notifications, setNotifications] = React27.useState([]);
|
|
3767
3880
|
const reduced = framerMotion.useReducedMotion();
|
|
3768
|
-
const open =
|
|
3881
|
+
const open = React27.useCallback((payload) => {
|
|
3769
3882
|
setNotifications((prev) => [
|
|
3770
3883
|
...prev,
|
|
3771
3884
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
3772
3885
|
]);
|
|
3773
3886
|
}, []);
|
|
3774
|
-
const close =
|
|
3887
|
+
const close = React27.useCallback((id) => {
|
|
3775
3888
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
3776
3889
|
}, []);
|
|
3777
3890
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -3800,7 +3913,7 @@ function NotificationProvider({
|
|
|
3800
3913
|
] });
|
|
3801
3914
|
}
|
|
3802
3915
|
function useNotification() {
|
|
3803
|
-
const { open } =
|
|
3916
|
+
const { open } = React27.useContext(NotificationContext);
|
|
3804
3917
|
return {
|
|
3805
3918
|
info: (props) => open({ type: "info", ...props }),
|
|
3806
3919
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -3917,10 +4030,10 @@ function FadingBase({
|
|
|
3917
4030
|
isMounted = false,
|
|
3918
4031
|
children
|
|
3919
4032
|
}) {
|
|
3920
|
-
const [shouldRender, setShouldRender] =
|
|
3921
|
-
const [visible, setVisible] =
|
|
3922
|
-
const timerRef =
|
|
3923
|
-
|
|
4033
|
+
const [shouldRender, setShouldRender] = React27.useState(isMounted);
|
|
4034
|
+
const [visible, setVisible] = React27.useState(false);
|
|
4035
|
+
const timerRef = React27.useRef(null);
|
|
4036
|
+
React27.useEffect(() => {
|
|
3924
4037
|
if (isMounted) {
|
|
3925
4038
|
setShouldRender(true);
|
|
3926
4039
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -4018,8 +4131,8 @@ function ScalableContainer({
|
|
|
4018
4131
|
togglePosition = "top-right",
|
|
4019
4132
|
className = ""
|
|
4020
4133
|
}) {
|
|
4021
|
-
const containerRef =
|
|
4022
|
-
const [internalScaled, setInternalScaled] =
|
|
4134
|
+
const containerRef = React27.useRef(null);
|
|
4135
|
+
const [internalScaled, setInternalScaled] = React27.useState(false);
|
|
4023
4136
|
const isScaled = expanded ?? internalScaled;
|
|
4024
4137
|
const reduced = framerMotion.useReducedMotion();
|
|
4025
4138
|
const onToggle = () => {
|
|
@@ -4157,17 +4270,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
4157
4270
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex flex-wrap gap-2 ${className}`.trim(), children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(GridCard, { item, buttonText, onOpen }, item.key)) });
|
|
4158
4271
|
}
|
|
4159
4272
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
4160
|
-
const [activeIndex, setActiveIndex] =
|
|
4161
|
-
const [indexPool, setIndexPool] =
|
|
4162
|
-
const cardRefs =
|
|
4163
|
-
const getIndexes =
|
|
4273
|
+
const [activeIndex, setActiveIndex] = React27.useState(0);
|
|
4274
|
+
const [indexPool, setIndexPool] = React27.useState([]);
|
|
4275
|
+
const cardRefs = React27.useRef([]);
|
|
4276
|
+
const getIndexes = React27.useMemo(() => {
|
|
4164
4277
|
let nextIndex = activeIndex + 1;
|
|
4165
4278
|
let previousIndex = activeIndex - 1;
|
|
4166
4279
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
4167
4280
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
4168
4281
|
return { previousIndex, nextIndex };
|
|
4169
4282
|
}, [activeIndex, items.length]);
|
|
4170
|
-
|
|
4283
|
+
React27.useEffect(() => {
|
|
4171
4284
|
const { nextIndex, previousIndex } = getIndexes;
|
|
4172
4285
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
4173
4286
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -4340,8 +4453,8 @@ function writeDismissed(key) {
|
|
|
4340
4453
|
}
|
|
4341
4454
|
}
|
|
4342
4455
|
function useTargetBbox(ref) {
|
|
4343
|
-
const [bbox, setBbox] =
|
|
4344
|
-
|
|
4456
|
+
const [bbox, setBbox] = React27.useState(null);
|
|
4457
|
+
React27.useLayoutEffect(() => {
|
|
4345
4458
|
const el = ref?.current;
|
|
4346
4459
|
if (!el) {
|
|
4347
4460
|
setBbox(null);
|
|
@@ -4371,7 +4484,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
4371
4484
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
4372
4485
|
}
|
|
4373
4486
|
function useFocusTrap(containerRef, active) {
|
|
4374
|
-
|
|
4487
|
+
React27.useEffect(() => {
|
|
4375
4488
|
if (!active) return;
|
|
4376
4489
|
const el = containerRef.current;
|
|
4377
4490
|
if (!el) return;
|
|
@@ -4410,16 +4523,16 @@ function Wizard({
|
|
|
4410
4523
|
onComplete,
|
|
4411
4524
|
onSkip
|
|
4412
4525
|
}) {
|
|
4413
|
-
const tooltipRef =
|
|
4414
|
-
const tooltipTitleId =
|
|
4415
|
-
const tooltipBodyId =
|
|
4526
|
+
const tooltipRef = React27.useRef(null);
|
|
4527
|
+
const tooltipTitleId = React27.useId();
|
|
4528
|
+
const tooltipBodyId = React27.useId();
|
|
4416
4529
|
const reduced = framerMotion.useReducedMotion();
|
|
4417
|
-
const [open, setOpen] =
|
|
4418
|
-
const [activeIndex, setActiveIndex] =
|
|
4530
|
+
const [open, setOpen] = React27.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
4531
|
+
const [activeIndex, setActiveIndex] = React27.useState(0);
|
|
4419
4532
|
const step = steps[activeIndex];
|
|
4420
4533
|
const bbox = useTargetBbox(step?.stepRef);
|
|
4421
4534
|
useFocusTrap(tooltipRef, open);
|
|
4422
|
-
|
|
4535
|
+
React27.useEffect(() => {
|
|
4423
4536
|
if (!open || !dismissible) return;
|
|
4424
4537
|
const onKey = (e) => {
|
|
4425
4538
|
if (e.key === "Escape") {
|
|
@@ -4430,12 +4543,12 @@ function Wizard({
|
|
|
4430
4543
|
document.addEventListener("keydown", onKey);
|
|
4431
4544
|
return () => document.removeEventListener("keydown", onKey);
|
|
4432
4545
|
}, [open, dismissible]);
|
|
4433
|
-
const handleSkip =
|
|
4546
|
+
const handleSkip = React27.useCallback(() => {
|
|
4434
4547
|
writeDismissed(storageKey);
|
|
4435
4548
|
setOpen(false);
|
|
4436
4549
|
onSkip?.();
|
|
4437
4550
|
}, [storageKey, onSkip]);
|
|
4438
|
-
const handleComplete =
|
|
4551
|
+
const handleComplete = React27.useCallback(() => {
|
|
4439
4552
|
writeDismissed(storageKey);
|
|
4440
4553
|
setOpen(false);
|
|
4441
4554
|
onComplete?.();
|
|
@@ -4578,7 +4691,7 @@ function Wizard({
|
|
|
4578
4691
|
] });
|
|
4579
4692
|
}
|
|
4580
4693
|
var SearchIcon = /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-4 h-4", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) });
|
|
4581
|
-
var SearchInput =
|
|
4694
|
+
var SearchInput = React27__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
4582
4695
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4583
4696
|
"div",
|
|
4584
4697
|
{
|
|
@@ -4632,11 +4745,11 @@ function MultiTagRow({
|
|
|
4632
4745
|
labelFor,
|
|
4633
4746
|
onRemove
|
|
4634
4747
|
}) {
|
|
4635
|
-
const wrapRef =
|
|
4636
|
-
const measureRef =
|
|
4637
|
-
const [visibleCount, setVisibleCount] =
|
|
4748
|
+
const wrapRef = React27.useRef(null);
|
|
4749
|
+
const measureRef = React27.useRef(null);
|
|
4750
|
+
const [visibleCount, setVisibleCount] = React27.useState(values.length);
|
|
4638
4751
|
const key = values.map(String).join("|");
|
|
4639
|
-
|
|
4752
|
+
React27.useLayoutEffect(() => {
|
|
4640
4753
|
const wrap = wrapRef.current;
|
|
4641
4754
|
const measure = measureRef.current;
|
|
4642
4755
|
if (!wrap || !measure) return;
|
|
@@ -4730,16 +4843,16 @@ function Dropdown({
|
|
|
4730
4843
|
size = "md",
|
|
4731
4844
|
className = ""
|
|
4732
4845
|
}) {
|
|
4733
|
-
const [open, setOpen] =
|
|
4734
|
-
const [selectedItems, setSelectedItems] =
|
|
4735
|
-
const [searchTerm, setSearchTerm] =
|
|
4736
|
-
const [innerItems, setInnerItems] =
|
|
4737
|
-
const errorId =
|
|
4846
|
+
const [open, setOpen] = React27.useState(false);
|
|
4847
|
+
const [selectedItems, setSelectedItems] = React27.useState([]);
|
|
4848
|
+
const [searchTerm, setSearchTerm] = React27.useState("");
|
|
4849
|
+
const [innerItems, setInnerItems] = React27.useState([]);
|
|
4850
|
+
const errorId = React27.useId();
|
|
4738
4851
|
const hasError = errorMessage != null;
|
|
4739
|
-
|
|
4852
|
+
React27.useEffect(() => {
|
|
4740
4853
|
setInnerItems(items);
|
|
4741
4854
|
}, [items]);
|
|
4742
|
-
|
|
4855
|
+
React27.useEffect(() => {
|
|
4743
4856
|
if (isMultiselect && Array.isArray(value)) {
|
|
4744
4857
|
setSelectedItems(value);
|
|
4745
4858
|
}
|
|
@@ -5064,7 +5177,7 @@ function TableBody({
|
|
|
5064
5177
|
expandRow,
|
|
5065
5178
|
getRowKey
|
|
5066
5179
|
}) {
|
|
5067
|
-
const [expanded, setExpanded] =
|
|
5180
|
+
const [expanded, setExpanded] = React27.useState(() => /* @__PURE__ */ new Set());
|
|
5068
5181
|
const reduced = framerMotion.useReducedMotion();
|
|
5069
5182
|
const toggleRow = (rowKey) => {
|
|
5070
5183
|
setExpanded((prev) => {
|
|
@@ -5079,7 +5192,7 @@ function TableBody({
|
|
|
5079
5192
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
5080
5193
|
const rowKey = getRowKey(row, i);
|
|
5081
5194
|
const isExpanded = expanded.has(rowKey);
|
|
5082
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5195
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React27__default.default.Fragment, { children: [
|
|
5083
5196
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5084
5197
|
"tr",
|
|
5085
5198
|
{
|
|
@@ -5135,9 +5248,9 @@ function Pagination({
|
|
|
5135
5248
|
const matchedOption = picker.find(
|
|
5136
5249
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
5137
5250
|
);
|
|
5138
|
-
const [perPageKey, setPerPageKey] =
|
|
5251
|
+
const [perPageKey, setPerPageKey] = React27.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
5139
5252
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
5140
|
-
|
|
5253
|
+
React27.useEffect(() => {
|
|
5141
5254
|
if (serverSide && options.perPage != null) {
|
|
5142
5255
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
5143
5256
|
if (next) setPerPageKey(next.key);
|
|
@@ -5201,14 +5314,14 @@ function Table({
|
|
|
5201
5314
|
className = "",
|
|
5202
5315
|
style
|
|
5203
5316
|
}) {
|
|
5204
|
-
const searchRef =
|
|
5205
|
-
const [searchTerm, setSearchTerm] =
|
|
5206
|
-
const [perPage, setPerPage] =
|
|
5317
|
+
const searchRef = React27.useRef(null);
|
|
5318
|
+
const [searchTerm, setSearchTerm] = React27.useState("");
|
|
5319
|
+
const [perPage, setPerPage] = React27.useState(
|
|
5207
5320
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
5208
5321
|
);
|
|
5209
|
-
const [activePage, setActivePage] =
|
|
5322
|
+
const [activePage, setActivePage] = React27.useState(0);
|
|
5210
5323
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
5211
|
-
const filteredRows =
|
|
5324
|
+
const filteredRows = React27.useMemo(() => {
|
|
5212
5325
|
if (isServerSide || !searchTerm) return rows;
|
|
5213
5326
|
const term = searchTerm.toLowerCase();
|
|
5214
5327
|
return rows.filter(
|
|
@@ -5217,29 +5330,29 @@ function Table({
|
|
|
5217
5330
|
)
|
|
5218
5331
|
);
|
|
5219
5332
|
}, [rows, searchTerm, isServerSide]);
|
|
5220
|
-
const datasets =
|
|
5333
|
+
const datasets = React27.useMemo(() => {
|
|
5221
5334
|
if (isServerSide) return [rows];
|
|
5222
5335
|
return createDatasets(filteredRows, pagination.enabled ? perPage : null);
|
|
5223
5336
|
}, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
5224
|
-
const MAX_PAGE =
|
|
5337
|
+
const MAX_PAGE = React27.useMemo(() => {
|
|
5225
5338
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
5226
5339
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
5227
5340
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
5228
5341
|
return datasets.length ? datasets.length - 1 : 0;
|
|
5229
5342
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
5230
|
-
const currentPageRows =
|
|
5343
|
+
const currentPageRows = React27.useMemo(() => {
|
|
5231
5344
|
if (isServerSide) return rows;
|
|
5232
5345
|
return datasets[activePage] ?? [];
|
|
5233
5346
|
}, [isServerSide, rows, datasets, activePage]);
|
|
5234
|
-
|
|
5347
|
+
React27.useEffect(() => {
|
|
5235
5348
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
5236
5349
|
setPerPage(pagination.perPage);
|
|
5237
5350
|
}
|
|
5238
5351
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
5239
|
-
|
|
5352
|
+
React27.useEffect(() => {
|
|
5240
5353
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
5241
5354
|
}, [isServerSide, pagination.perPage]);
|
|
5242
|
-
|
|
5355
|
+
React27.useEffect(() => {
|
|
5243
5356
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
5244
5357
|
setActivePage(pagination.page - 1);
|
|
5245
5358
|
}, [isServerSide, pagination.page]);
|
|
@@ -5323,7 +5436,7 @@ function TableSkeletonBody({
|
|
|
5323
5436
|
)) });
|
|
5324
5437
|
}
|
|
5325
5438
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
5326
|
-
const id =
|
|
5439
|
+
const id = React27.useId();
|
|
5327
5440
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5328
5441
|
SwitchPrimitive__namespace.Root,
|
|
5329
5442
|
{
|
|
@@ -5507,7 +5620,7 @@ function Sidebar({
|
|
|
5507
5620
|
}
|
|
5508
5621
|
) });
|
|
5509
5622
|
}
|
|
5510
|
-
var MegaMenuContext =
|
|
5623
|
+
var MegaMenuContext = React27.createContext({ align: "start" });
|
|
5511
5624
|
function MegaMenu({
|
|
5512
5625
|
children,
|
|
5513
5626
|
align = "start",
|
|
@@ -5538,7 +5651,7 @@ function MegaMenu({
|
|
|
5538
5651
|
}
|
|
5539
5652
|
var TOP_ITEM = "group/top inline-flex items-center gap-1.5 h-10 px-3 rounded-md text-sm font-medium select-none text-foreground-secondary hover:text-foreground hover:bg-surface-raised data-[state=open]:text-accent data-[active]:text-accent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent";
|
|
5540
5653
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
5541
|
-
const { align } =
|
|
5654
|
+
const { align } = React27.useContext(MegaMenuContext);
|
|
5542
5655
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
5543
5656
|
if (!children) {
|
|
5544
5657
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
|
|
@@ -5623,8 +5736,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
5623
5736
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
5624
5737
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["min-w-0 rounded-lg bg-surface-raised border border-border p-4 flex flex-col", className].filter(Boolean).join(" "), children });
|
|
5625
5738
|
}
|
|
5626
|
-
var elementsOfType = (children, type) =>
|
|
5627
|
-
(c) =>
|
|
5739
|
+
var elementsOfType = (children, type) => React27__default.default.Children.toArray(children).filter(
|
|
5740
|
+
(c) => React27__default.default.isValidElement(c) && c.type === type
|
|
5628
5741
|
);
|
|
5629
5742
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5630
5743
|
"svg",
|
|
@@ -5661,9 +5774,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
5661
5774
|
);
|
|
5662
5775
|
}
|
|
5663
5776
|
function MobilePanel({ panel, onNavigate }) {
|
|
5664
|
-
const nodes =
|
|
5777
|
+
const nodes = React27__default.default.Children.toArray(panel.props.children);
|
|
5665
5778
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
5666
|
-
if (!
|
|
5779
|
+
if (!React27__default.default.isValidElement(node)) return null;
|
|
5667
5780
|
const el = node;
|
|
5668
5781
|
if (el.type === MegaMenuSection) {
|
|
5669
5782
|
const { title, children } = el.props;
|
|
@@ -5682,8 +5795,8 @@ function MegaMenuMobile({
|
|
|
5682
5795
|
children,
|
|
5683
5796
|
label
|
|
5684
5797
|
}) {
|
|
5685
|
-
const [open, setOpen] =
|
|
5686
|
-
const [expanded, setExpanded] =
|
|
5798
|
+
const [open, setOpen] = React27.useState(false);
|
|
5799
|
+
const [expanded, setExpanded] = React27.useState(null);
|
|
5687
5800
|
const items = elementsOfType(children, MegaMenuItem);
|
|
5688
5801
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
5689
5802
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5756,17 +5869,17 @@ function AppShell({
|
|
|
5756
5869
|
children,
|
|
5757
5870
|
className = ""
|
|
5758
5871
|
}) {
|
|
5759
|
-
const [expanded, setExpanded] =
|
|
5760
|
-
const [isMobile, setIsMobile] =
|
|
5761
|
-
const [mobileOpen, setMobileOpen] =
|
|
5762
|
-
|
|
5872
|
+
const [expanded, setExpanded] = React27.useState(sidebarDefaultExpanded);
|
|
5873
|
+
const [isMobile, setIsMobile] = React27.useState(false);
|
|
5874
|
+
const [mobileOpen, setMobileOpen] = React27.useState(false);
|
|
5875
|
+
React27.useEffect(() => {
|
|
5763
5876
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
5764
5877
|
const update = (e) => setIsMobile(e.matches);
|
|
5765
5878
|
update(mq);
|
|
5766
5879
|
mq.addEventListener("change", update);
|
|
5767
5880
|
return () => mq.removeEventListener("change", update);
|
|
5768
5881
|
}, []);
|
|
5769
|
-
|
|
5882
|
+
React27.useEffect(() => {
|
|
5770
5883
|
if (!isMobile) setMobileOpen(false);
|
|
5771
5884
|
}, [isMobile]);
|
|
5772
5885
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -5884,6 +5997,7 @@ function SecureLayout({
|
|
|
5884
5997
|
permissions,
|
|
5885
5998
|
requiredPermissions,
|
|
5886
5999
|
requireAllPermissions,
|
|
6000
|
+
route,
|
|
5887
6001
|
canAccess,
|
|
5888
6002
|
loadingFallback,
|
|
5889
6003
|
fallback,
|
|
@@ -5905,10 +6019,10 @@ function SecureLayout({
|
|
|
5905
6019
|
if (requiredPermissions?.length && !has(permissions, requiredPermissions, requireAllPermissions)) return false;
|
|
5906
6020
|
return true;
|
|
5907
6021
|
};
|
|
5908
|
-
const [state, setState] =
|
|
6022
|
+
const [state, setState] = React27.useState(
|
|
5909
6023
|
() => !passesSync() ? "denied" : canAccess ? "checking" : "granted"
|
|
5910
6024
|
);
|
|
5911
|
-
|
|
6025
|
+
React27.useEffect(() => {
|
|
5912
6026
|
let cancelled = false;
|
|
5913
6027
|
const finish = (ok) => {
|
|
5914
6028
|
if (cancelled) return;
|
|
@@ -5921,8 +6035,13 @@ function SecureLayout({
|
|
|
5921
6035
|
} else if (!canAccess) {
|
|
5922
6036
|
finish(true);
|
|
5923
6037
|
} else {
|
|
5924
|
-
|
|
5925
|
-
|
|
6038
|
+
const result = canAccess(route);
|
|
6039
|
+
if (result && typeof result.then === "function") {
|
|
6040
|
+
setState("checking");
|
|
6041
|
+
result.then((ok) => finish(Boolean(ok)));
|
|
6042
|
+
} else {
|
|
6043
|
+
finish(Boolean(result));
|
|
6044
|
+
}
|
|
5926
6045
|
}
|
|
5927
6046
|
return () => {
|
|
5928
6047
|
cancelled = true;
|
|
@@ -5930,6 +6049,7 @@ function SecureLayout({
|
|
|
5930
6049
|
}, [
|
|
5931
6050
|
isAuthenticated,
|
|
5932
6051
|
token,
|
|
6052
|
+
route,
|
|
5933
6053
|
requireAllRoles,
|
|
5934
6054
|
requireAllPermissions,
|
|
5935
6055
|
canAccess,
|
|
@@ -6063,10 +6183,10 @@ function ThemeProvider({
|
|
|
6063
6183
|
className = "",
|
|
6064
6184
|
style
|
|
6065
6185
|
}) {
|
|
6066
|
-
const id =
|
|
6186
|
+
const id = React27__default.default.useId().replace(/:/g, "");
|
|
6067
6187
|
const scopeClass = `geo-th-${id}`;
|
|
6068
|
-
const divRef =
|
|
6069
|
-
|
|
6188
|
+
const divRef = React27.useRef(null);
|
|
6189
|
+
React27.useEffect(() => {
|
|
6070
6190
|
const el = divRef.current;
|
|
6071
6191
|
if (!el) return;
|
|
6072
6192
|
if (colorScheme === "auto") return;
|
|
@@ -6081,8 +6201,8 @@ function ThemeProvider({
|
|
|
6081
6201
|
}
|
|
6082
6202
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
6083
6203
|
}, [colorScheme]);
|
|
6084
|
-
const lightVars =
|
|
6085
|
-
const darkVarStr =
|
|
6204
|
+
const lightVars = React27.useMemo(() => toCssVars(theme), [theme]);
|
|
6205
|
+
const darkVarStr = React27.useMemo(() => {
|
|
6086
6206
|
if (!darkTheme) return "";
|
|
6087
6207
|
const dvars = toCssVars(darkTheme);
|
|
6088
6208
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -6124,7 +6244,7 @@ function NumberInput({
|
|
|
6124
6244
|
readOnly = false,
|
|
6125
6245
|
precision
|
|
6126
6246
|
}) {
|
|
6127
|
-
const errorId =
|
|
6247
|
+
const errorId = React27.useId();
|
|
6128
6248
|
const hasError = errorMessage != null;
|
|
6129
6249
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
6130
6250
|
const round = (n) => {
|
|
@@ -6255,8 +6375,8 @@ function Password({
|
|
|
6255
6375
|
showIcon,
|
|
6256
6376
|
hideIcon
|
|
6257
6377
|
}) {
|
|
6258
|
-
const [visible, setVisible] =
|
|
6259
|
-
const errorId =
|
|
6378
|
+
const [visible, setVisible] = React27.useState(false);
|
|
6379
|
+
const errorId = React27.useId();
|
|
6260
6380
|
const hasError = errorMessage != null;
|
|
6261
6381
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6262
6382
|
Field,
|
|
@@ -6329,7 +6449,7 @@ function Checkbox({
|
|
|
6329
6449
|
}) {
|
|
6330
6450
|
const isChecked = checked ?? value ?? false;
|
|
6331
6451
|
const labelFirst = labelPosition === "left";
|
|
6332
|
-
const errorId =
|
|
6452
|
+
const errorId = React27.useId();
|
|
6333
6453
|
const hasError = errorMessage != null;
|
|
6334
6454
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6335
6455
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -6437,8 +6557,8 @@ function RadioGroup({
|
|
|
6437
6557
|
className,
|
|
6438
6558
|
errorMessage
|
|
6439
6559
|
}) {
|
|
6440
|
-
const errorId =
|
|
6441
|
-
const groupId =
|
|
6560
|
+
const errorId = React27.useId();
|
|
6561
|
+
const groupId = React27.useId();
|
|
6442
6562
|
const hasError = errorMessage != null;
|
|
6443
6563
|
const labelFirst = labelPosition === "left";
|
|
6444
6564
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6538,11 +6658,11 @@ function Switch({
|
|
|
6538
6658
|
disabled,
|
|
6539
6659
|
errorMessage
|
|
6540
6660
|
}) {
|
|
6541
|
-
const id =
|
|
6542
|
-
const errorId =
|
|
6661
|
+
const id = React27.useId();
|
|
6662
|
+
const errorId = React27.useId();
|
|
6543
6663
|
const hasError = errorMessage != null;
|
|
6544
6664
|
const isControlled = checked !== void 0;
|
|
6545
|
-
const [internal, setInternal] =
|
|
6665
|
+
const [internal, setInternal] = React27.useState(defaultChecked);
|
|
6546
6666
|
const isOn = isControlled ? checked : internal;
|
|
6547
6667
|
const handle = (c) => {
|
|
6548
6668
|
if (!isControlled) setInternal(c);
|
|
@@ -6615,19 +6735,19 @@ function AutoComplete({
|
|
|
6615
6735
|
required,
|
|
6616
6736
|
htmlFor
|
|
6617
6737
|
}) {
|
|
6618
|
-
const errorId =
|
|
6738
|
+
const errorId = React27.useId();
|
|
6619
6739
|
const hasError = errorMessage != null;
|
|
6620
|
-
const [term, setTerm] =
|
|
6621
|
-
const [open, setOpen] =
|
|
6622
|
-
const [asyncItems, setAsyncItems] =
|
|
6623
|
-
const [loading, setLoading] =
|
|
6740
|
+
const [term, setTerm] = React27.useState("");
|
|
6741
|
+
const [open, setOpen] = React27.useState(false);
|
|
6742
|
+
const [asyncItems, setAsyncItems] = React27.useState([]);
|
|
6743
|
+
const [loading, setLoading] = React27.useState(false);
|
|
6624
6744
|
const isAsync = typeof onSearch === "function";
|
|
6625
|
-
const debounceRef =
|
|
6626
|
-
const requestIdRef =
|
|
6745
|
+
const debounceRef = React27.useRef(null);
|
|
6746
|
+
const requestIdRef = React27.useRef(0);
|
|
6627
6747
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
6628
6748
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
6629
6749
|
) : [];
|
|
6630
|
-
|
|
6750
|
+
React27.useEffect(() => {
|
|
6631
6751
|
if (!isAsync) return;
|
|
6632
6752
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
6633
6753
|
if (!term.trim()) {
|
|
@@ -6783,15 +6903,15 @@ function TreeSelect({
|
|
|
6783
6903
|
defaultExpandedKeys = [],
|
|
6784
6904
|
size = "md"
|
|
6785
6905
|
}) {
|
|
6786
|
-
const errorId =
|
|
6906
|
+
const errorId = React27.useId();
|
|
6787
6907
|
const hasError = errorMessage != null;
|
|
6788
|
-
const [open, setOpen] =
|
|
6789
|
-
const [expanded, setExpanded] =
|
|
6790
|
-
const [activeIndex, setActiveIndex] =
|
|
6791
|
-
const listRef =
|
|
6792
|
-
const visible =
|
|
6793
|
-
const didSyncOnOpenRef =
|
|
6794
|
-
|
|
6908
|
+
const [open, setOpen] = React27.useState(false);
|
|
6909
|
+
const [expanded, setExpanded] = React27.useState(() => new Set(defaultExpandedKeys));
|
|
6910
|
+
const [activeIndex, setActiveIndex] = React27.useState(0);
|
|
6911
|
+
const listRef = React27.useRef(null);
|
|
6912
|
+
const visible = React27.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
6913
|
+
const didSyncOnOpenRef = React27.useRef(false);
|
|
6914
|
+
React27.useEffect(() => {
|
|
6795
6915
|
if (!open) {
|
|
6796
6916
|
didSyncOnOpenRef.current = false;
|
|
6797
6917
|
return;
|
|
@@ -6801,7 +6921,7 @@ function TreeSelect({
|
|
|
6801
6921
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
6802
6922
|
didSyncOnOpenRef.current = true;
|
|
6803
6923
|
}, [open, value]);
|
|
6804
|
-
const selectedNode =
|
|
6924
|
+
const selectedNode = React27.useMemo(
|
|
6805
6925
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
6806
6926
|
[items, value]
|
|
6807
6927
|
);
|
|
@@ -7032,11 +7152,11 @@ function FileInput({
|
|
|
7032
7152
|
required,
|
|
7033
7153
|
icon
|
|
7034
7154
|
}) {
|
|
7035
|
-
const inputRef =
|
|
7036
|
-
const errorId =
|
|
7037
|
-
const [files, setFiles] =
|
|
7038
|
-
const [dragging, setDragging] =
|
|
7039
|
-
const [sizeError, setSizeError] =
|
|
7155
|
+
const inputRef = React27.useRef(null);
|
|
7156
|
+
const errorId = React27.useId();
|
|
7157
|
+
const [files, setFiles] = React27.useState([]);
|
|
7158
|
+
const [dragging, setDragging] = React27.useState(false);
|
|
7159
|
+
const [sizeError, setSizeError] = React27.useState(null);
|
|
7040
7160
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
7041
7161
|
const openPicker = () => {
|
|
7042
7162
|
if (!disabled) inputRef.current?.click();
|
|
@@ -7227,30 +7347,30 @@ function DatePicker({
|
|
|
7227
7347
|
size = "md",
|
|
7228
7348
|
className = ""
|
|
7229
7349
|
}) {
|
|
7230
|
-
const errorId =
|
|
7350
|
+
const errorId = React27.useId();
|
|
7231
7351
|
const hasError = errorMessage != null;
|
|
7232
|
-
const [open, setOpen] =
|
|
7233
|
-
const [viewMonth, setViewMonth] =
|
|
7234
|
-
const [focusDate, setFocusDate] =
|
|
7235
|
-
const [view, setView] =
|
|
7236
|
-
const gridRef =
|
|
7237
|
-
|
|
7352
|
+
const [open, setOpen] = React27.useState(false);
|
|
7353
|
+
const [viewMonth, setViewMonth] = React27.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
7354
|
+
const [focusDate, setFocusDate] = React27.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
7355
|
+
const [view, setView] = React27.useState("days");
|
|
7356
|
+
const gridRef = React27.useRef(null);
|
|
7357
|
+
React27.useEffect(() => {
|
|
7238
7358
|
if (!open) return;
|
|
7239
7359
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
7240
7360
|
setViewMonth(startOfMonth(target));
|
|
7241
7361
|
setFocusDate(target);
|
|
7242
7362
|
setView("days");
|
|
7243
7363
|
}, [open, value]);
|
|
7244
|
-
|
|
7364
|
+
React27.useEffect(() => {
|
|
7245
7365
|
if (!open) return;
|
|
7246
7366
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat3(focusDate)}"]`);
|
|
7247
7367
|
cell?.focus();
|
|
7248
7368
|
}, [open, focusDate]);
|
|
7249
|
-
const weekdays =
|
|
7369
|
+
const weekdays = React27.useMemo(() => {
|
|
7250
7370
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
7251
7371
|
return ordered;
|
|
7252
7372
|
}, [weekStartsOn]);
|
|
7253
|
-
const grid =
|
|
7373
|
+
const grid = React27.useMemo(() => buildGrid2(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
7254
7374
|
const isDisabled = (d) => {
|
|
7255
7375
|
if (min && d < min) return true;
|
|
7256
7376
|
if (max && d > max) return true;
|
|
@@ -7540,10 +7660,10 @@ function TextArea({
|
|
|
7540
7660
|
style,
|
|
7541
7661
|
inputStyle
|
|
7542
7662
|
}) {
|
|
7543
|
-
const errorId =
|
|
7663
|
+
const errorId = React27.useId();
|
|
7544
7664
|
const hasError = errorMessage != null;
|
|
7545
|
-
const ref =
|
|
7546
|
-
|
|
7665
|
+
const ref = React27.useRef(null);
|
|
7666
|
+
React27.useLayoutEffect(() => {
|
|
7547
7667
|
if (!autoGrow) return;
|
|
7548
7668
|
const el = ref.current;
|
|
7549
7669
|
if (!el) return;
|
|
@@ -7613,11 +7733,11 @@ function SegmentedControl({
|
|
|
7613
7733
|
"aria-label": ariaLabel
|
|
7614
7734
|
}) {
|
|
7615
7735
|
const sz = SIZE5[size];
|
|
7616
|
-
const groupId =
|
|
7617
|
-
const errorId =
|
|
7736
|
+
const groupId = React27.useId();
|
|
7737
|
+
const errorId = React27.useId();
|
|
7618
7738
|
const hasError = errorMessage != null;
|
|
7619
7739
|
const isControlled = value !== void 0;
|
|
7620
|
-
const [internal, setInternal] =
|
|
7740
|
+
const [internal, setInternal] = React27.useState(defaultValue);
|
|
7621
7741
|
const current = isControlled ? value : internal;
|
|
7622
7742
|
const handle = (v) => {
|
|
7623
7743
|
if (!v) return;
|
|
@@ -7711,14 +7831,14 @@ function Slider({
|
|
|
7711
7831
|
name,
|
|
7712
7832
|
htmlFor
|
|
7713
7833
|
}) {
|
|
7714
|
-
const errorId =
|
|
7834
|
+
const errorId = React27.useId();
|
|
7715
7835
|
const hasError = errorMessage != null;
|
|
7716
7836
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
7717
|
-
const [internal, setInternal] =
|
|
7837
|
+
const [internal, setInternal] = React27.useState(
|
|
7718
7838
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
7719
7839
|
);
|
|
7720
7840
|
const current = toArray(value) ?? internal;
|
|
7721
|
-
const [dragging, setDragging] =
|
|
7841
|
+
const [dragging, setDragging] = React27.useState(false);
|
|
7722
7842
|
const emit = (arr) => {
|
|
7723
7843
|
setInternal(arr);
|
|
7724
7844
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -7813,11 +7933,11 @@ function TagsInput({
|
|
|
7813
7933
|
validate,
|
|
7814
7934
|
separators = ["Enter", ","]
|
|
7815
7935
|
}) {
|
|
7816
|
-
const errorId =
|
|
7817
|
-
const inputRef =
|
|
7818
|
-
const [internal, setInternal] =
|
|
7819
|
-
const [draft, setDraft] =
|
|
7820
|
-
const [localError, setLocalError] =
|
|
7936
|
+
const errorId = React27.useId();
|
|
7937
|
+
const inputRef = React27.useRef(null);
|
|
7938
|
+
const [internal, setInternal] = React27.useState(defaultValue ?? []);
|
|
7939
|
+
const [draft, setDraft] = React27.useState("");
|
|
7940
|
+
const [localError, setLocalError] = React27.useState(null);
|
|
7821
7941
|
const tags = value ?? internal;
|
|
7822
7942
|
const hasError = errorMessage != null || localError != null;
|
|
7823
7943
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -7948,9 +8068,9 @@ function OtpInput({
|
|
|
7948
8068
|
className,
|
|
7949
8069
|
groupAfter
|
|
7950
8070
|
}) {
|
|
7951
|
-
const errorId =
|
|
8071
|
+
const errorId = React27.useId();
|
|
7952
8072
|
const hasError = errorMessage != null;
|
|
7953
|
-
const refs =
|
|
8073
|
+
const refs = React27.useRef([]);
|
|
7954
8074
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
7955
8075
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
7956
8076
|
const emit = (next) => {
|
|
@@ -7999,7 +8119,7 @@ function OtpInput({
|
|
|
7999
8119
|
emit(valid.join(""));
|
|
8000
8120
|
focusBox(valid.length);
|
|
8001
8121
|
};
|
|
8002
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8122
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React27__default.default.Fragment, { children: [
|
|
8003
8123
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8004
8124
|
"input",
|
|
8005
8125
|
{
|
|
@@ -8057,9 +8177,9 @@ function Rating({
|
|
|
8057
8177
|
className,
|
|
8058
8178
|
required
|
|
8059
8179
|
}) {
|
|
8060
|
-
const errorId =
|
|
8061
|
-
const [internal, setInternal] =
|
|
8062
|
-
const [hover, setHover] =
|
|
8180
|
+
const errorId = React27.useId();
|
|
8181
|
+
const [internal, setInternal] = React27.useState(defaultValue);
|
|
8182
|
+
const [hover, setHover] = React27.useState(null);
|
|
8063
8183
|
const current = value ?? internal;
|
|
8064
8184
|
const display2 = hover ?? current;
|
|
8065
8185
|
const interactive = !readOnly && !disabled;
|
|
@@ -8182,9 +8302,9 @@ function TimePicker({
|
|
|
8182
8302
|
required,
|
|
8183
8303
|
style
|
|
8184
8304
|
}) {
|
|
8185
|
-
const errorId =
|
|
8305
|
+
const errorId = React27.useId();
|
|
8186
8306
|
const hasError = errorMessage != null;
|
|
8187
|
-
const [open, setOpen] =
|
|
8307
|
+
const [open, setOpen] = React27.useState(false);
|
|
8188
8308
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
8189
8309
|
const update = (next) => {
|
|
8190
8310
|
const merged = { ...parsed, ...next };
|
|
@@ -8308,13 +8428,13 @@ function DateRangePicker({
|
|
|
8308
8428
|
required,
|
|
8309
8429
|
style
|
|
8310
8430
|
}) {
|
|
8311
|
-
const errorId =
|
|
8431
|
+
const errorId = React27.useId();
|
|
8312
8432
|
const hasError = errorMessage != null;
|
|
8313
|
-
const [open, setOpen] =
|
|
8314
|
-
const [leftMonth, setLeftMonth] =
|
|
8315
|
-
const [pendingStart, setPendingStart] =
|
|
8316
|
-
const [hoverDate, setHoverDate] =
|
|
8317
|
-
const weekdays =
|
|
8433
|
+
const [open, setOpen] = React27.useState(false);
|
|
8434
|
+
const [leftMonth, setLeftMonth] = React27.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
8435
|
+
const [pendingStart, setPendingStart] = React27.useState(null);
|
|
8436
|
+
const [hoverDate, setHoverDate] = React27.useState(null);
|
|
8437
|
+
const weekdays = React27.useMemo(
|
|
8318
8438
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
8319
8439
|
[weekStartsOn]
|
|
8320
8440
|
);
|
|
@@ -8490,10 +8610,10 @@ function ColorPicker({
|
|
|
8490
8610
|
required,
|
|
8491
8611
|
placeholder = "Pick a colour\u2026"
|
|
8492
8612
|
}) {
|
|
8493
|
-
const errorId =
|
|
8613
|
+
const errorId = React27.useId();
|
|
8494
8614
|
const hasError = errorMessage != null;
|
|
8495
|
-
const [open, setOpen] =
|
|
8496
|
-
const [draft, setDraft] =
|
|
8615
|
+
const [open, setOpen] = React27.useState(false);
|
|
8616
|
+
const [draft, setDraft] = React27.useState(value);
|
|
8497
8617
|
const valid = HEX_RE.test(value);
|
|
8498
8618
|
const pick = (hex) => {
|
|
8499
8619
|
onChange?.(hex);
|
|
@@ -8640,6 +8760,7 @@ exports.IconButton = IconButton;
|
|
|
8640
8760
|
exports.Kbd = Kbd;
|
|
8641
8761
|
exports.List = List2;
|
|
8642
8762
|
exports.LoadingSpinner = LoadingSpinner;
|
|
8763
|
+
exports.LogoutTimer = LogoutTimer;
|
|
8643
8764
|
exports.MegaMenu = MegaMenu_default;
|
|
8644
8765
|
exports.MenuButton = MenuButton;
|
|
8645
8766
|
exports.Modal = Modal;
|