@geomak/ui 6.23.0 → 6.24.1
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 +351 -235
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +135 -20
- 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;
|
|
@@ -5893,6 +6006,8 @@ function SecureLayout({
|
|
|
5893
6006
|
className = ""
|
|
5894
6007
|
}) {
|
|
5895
6008
|
const reduced = framerMotion.useReducedMotion();
|
|
6009
|
+
const cbs = React27.useRef({ canAccess, onGranted, onDeny });
|
|
6010
|
+
cbs.current = { canAccess, onGranted, onDeny };
|
|
5896
6011
|
const rolesKey = JSON.stringify(roles);
|
|
5897
6012
|
const requiredRolesKey = JSON.stringify(requiredRoles);
|
|
5898
6013
|
const permissionsKey = JSON.stringify(permissions);
|
|
@@ -5906,23 +6021,24 @@ function SecureLayout({
|
|
|
5906
6021
|
if (requiredPermissions?.length && !has(permissions, requiredPermissions, requireAllPermissions)) return false;
|
|
5907
6022
|
return true;
|
|
5908
6023
|
};
|
|
5909
|
-
const [state, setState] =
|
|
6024
|
+
const [state, setState] = React27.useState(
|
|
5910
6025
|
() => !passesSync() ? "denied" : canAccess ? "checking" : "granted"
|
|
5911
6026
|
);
|
|
5912
|
-
|
|
6027
|
+
React27.useEffect(() => {
|
|
5913
6028
|
let cancelled = false;
|
|
6029
|
+
const { canAccess: check, onGranted: granted, onDeny: deny } = cbs.current;
|
|
5914
6030
|
const finish = (ok) => {
|
|
5915
6031
|
if (cancelled) return;
|
|
5916
6032
|
setState(ok ? "granted" : "denied");
|
|
5917
|
-
if (ok)
|
|
5918
|
-
else
|
|
6033
|
+
if (ok) granted?.();
|
|
6034
|
+
else deny?.();
|
|
5919
6035
|
};
|
|
5920
6036
|
if (!passesSync()) {
|
|
5921
6037
|
finish(false);
|
|
5922
|
-
} else if (!
|
|
6038
|
+
} else if (!check) {
|
|
5923
6039
|
finish(true);
|
|
5924
6040
|
} else {
|
|
5925
|
-
const result =
|
|
6041
|
+
const result = check(route);
|
|
5926
6042
|
if (result && typeof result.then === "function") {
|
|
5927
6043
|
setState("checking");
|
|
5928
6044
|
result.then((ok) => finish(Boolean(ok)));
|
|
@@ -5939,7 +6055,6 @@ function SecureLayout({
|
|
|
5939
6055
|
route,
|
|
5940
6056
|
requireAllRoles,
|
|
5941
6057
|
requireAllPermissions,
|
|
5942
|
-
canAccess,
|
|
5943
6058
|
rolesKey,
|
|
5944
6059
|
requiredRolesKey,
|
|
5945
6060
|
permissionsKey,
|
|
@@ -6070,10 +6185,10 @@ function ThemeProvider({
|
|
|
6070
6185
|
className = "",
|
|
6071
6186
|
style
|
|
6072
6187
|
}) {
|
|
6073
|
-
const id =
|
|
6188
|
+
const id = React27__default.default.useId().replace(/:/g, "");
|
|
6074
6189
|
const scopeClass = `geo-th-${id}`;
|
|
6075
|
-
const divRef =
|
|
6076
|
-
|
|
6190
|
+
const divRef = React27.useRef(null);
|
|
6191
|
+
React27.useEffect(() => {
|
|
6077
6192
|
const el = divRef.current;
|
|
6078
6193
|
if (!el) return;
|
|
6079
6194
|
if (colorScheme === "auto") return;
|
|
@@ -6088,8 +6203,8 @@ function ThemeProvider({
|
|
|
6088
6203
|
}
|
|
6089
6204
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
6090
6205
|
}, [colorScheme]);
|
|
6091
|
-
const lightVars =
|
|
6092
|
-
const darkVarStr =
|
|
6206
|
+
const lightVars = React27.useMemo(() => toCssVars(theme), [theme]);
|
|
6207
|
+
const darkVarStr = React27.useMemo(() => {
|
|
6093
6208
|
if (!darkTheme) return "";
|
|
6094
6209
|
const dvars = toCssVars(darkTheme);
|
|
6095
6210
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -6131,7 +6246,7 @@ function NumberInput({
|
|
|
6131
6246
|
readOnly = false,
|
|
6132
6247
|
precision
|
|
6133
6248
|
}) {
|
|
6134
|
-
const errorId =
|
|
6249
|
+
const errorId = React27.useId();
|
|
6135
6250
|
const hasError = errorMessage != null;
|
|
6136
6251
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
6137
6252
|
const round = (n) => {
|
|
@@ -6262,8 +6377,8 @@ function Password({
|
|
|
6262
6377
|
showIcon,
|
|
6263
6378
|
hideIcon
|
|
6264
6379
|
}) {
|
|
6265
|
-
const [visible, setVisible] =
|
|
6266
|
-
const errorId =
|
|
6380
|
+
const [visible, setVisible] = React27.useState(false);
|
|
6381
|
+
const errorId = React27.useId();
|
|
6267
6382
|
const hasError = errorMessage != null;
|
|
6268
6383
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6269
6384
|
Field,
|
|
@@ -6336,7 +6451,7 @@ function Checkbox({
|
|
|
6336
6451
|
}) {
|
|
6337
6452
|
const isChecked = checked ?? value ?? false;
|
|
6338
6453
|
const labelFirst = labelPosition === "left";
|
|
6339
|
-
const errorId =
|
|
6454
|
+
const errorId = React27.useId();
|
|
6340
6455
|
const hasError = errorMessage != null;
|
|
6341
6456
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6342
6457
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -6444,8 +6559,8 @@ function RadioGroup({
|
|
|
6444
6559
|
className,
|
|
6445
6560
|
errorMessage
|
|
6446
6561
|
}) {
|
|
6447
|
-
const errorId =
|
|
6448
|
-
const groupId =
|
|
6562
|
+
const errorId = React27.useId();
|
|
6563
|
+
const groupId = React27.useId();
|
|
6449
6564
|
const hasError = errorMessage != null;
|
|
6450
6565
|
const labelFirst = labelPosition === "left";
|
|
6451
6566
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6545,11 +6660,11 @@ function Switch({
|
|
|
6545
6660
|
disabled,
|
|
6546
6661
|
errorMessage
|
|
6547
6662
|
}) {
|
|
6548
|
-
const id =
|
|
6549
|
-
const errorId =
|
|
6663
|
+
const id = React27.useId();
|
|
6664
|
+
const errorId = React27.useId();
|
|
6550
6665
|
const hasError = errorMessage != null;
|
|
6551
6666
|
const isControlled = checked !== void 0;
|
|
6552
|
-
const [internal, setInternal] =
|
|
6667
|
+
const [internal, setInternal] = React27.useState(defaultChecked);
|
|
6553
6668
|
const isOn = isControlled ? checked : internal;
|
|
6554
6669
|
const handle = (c) => {
|
|
6555
6670
|
if (!isControlled) setInternal(c);
|
|
@@ -6622,19 +6737,19 @@ function AutoComplete({
|
|
|
6622
6737
|
required,
|
|
6623
6738
|
htmlFor
|
|
6624
6739
|
}) {
|
|
6625
|
-
const errorId =
|
|
6740
|
+
const errorId = React27.useId();
|
|
6626
6741
|
const hasError = errorMessage != null;
|
|
6627
|
-
const [term, setTerm] =
|
|
6628
|
-
const [open, setOpen] =
|
|
6629
|
-
const [asyncItems, setAsyncItems] =
|
|
6630
|
-
const [loading, setLoading] =
|
|
6742
|
+
const [term, setTerm] = React27.useState("");
|
|
6743
|
+
const [open, setOpen] = React27.useState(false);
|
|
6744
|
+
const [asyncItems, setAsyncItems] = React27.useState([]);
|
|
6745
|
+
const [loading, setLoading] = React27.useState(false);
|
|
6631
6746
|
const isAsync = typeof onSearch === "function";
|
|
6632
|
-
const debounceRef =
|
|
6633
|
-
const requestIdRef =
|
|
6747
|
+
const debounceRef = React27.useRef(null);
|
|
6748
|
+
const requestIdRef = React27.useRef(0);
|
|
6634
6749
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
6635
6750
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
6636
6751
|
) : [];
|
|
6637
|
-
|
|
6752
|
+
React27.useEffect(() => {
|
|
6638
6753
|
if (!isAsync) return;
|
|
6639
6754
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
6640
6755
|
if (!term.trim()) {
|
|
@@ -6790,15 +6905,15 @@ function TreeSelect({
|
|
|
6790
6905
|
defaultExpandedKeys = [],
|
|
6791
6906
|
size = "md"
|
|
6792
6907
|
}) {
|
|
6793
|
-
const errorId =
|
|
6908
|
+
const errorId = React27.useId();
|
|
6794
6909
|
const hasError = errorMessage != null;
|
|
6795
|
-
const [open, setOpen] =
|
|
6796
|
-
const [expanded, setExpanded] =
|
|
6797
|
-
const [activeIndex, setActiveIndex] =
|
|
6798
|
-
const listRef =
|
|
6799
|
-
const visible =
|
|
6800
|
-
const didSyncOnOpenRef =
|
|
6801
|
-
|
|
6910
|
+
const [open, setOpen] = React27.useState(false);
|
|
6911
|
+
const [expanded, setExpanded] = React27.useState(() => new Set(defaultExpandedKeys));
|
|
6912
|
+
const [activeIndex, setActiveIndex] = React27.useState(0);
|
|
6913
|
+
const listRef = React27.useRef(null);
|
|
6914
|
+
const visible = React27.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
6915
|
+
const didSyncOnOpenRef = React27.useRef(false);
|
|
6916
|
+
React27.useEffect(() => {
|
|
6802
6917
|
if (!open) {
|
|
6803
6918
|
didSyncOnOpenRef.current = false;
|
|
6804
6919
|
return;
|
|
@@ -6808,7 +6923,7 @@ function TreeSelect({
|
|
|
6808
6923
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
6809
6924
|
didSyncOnOpenRef.current = true;
|
|
6810
6925
|
}, [open, value]);
|
|
6811
|
-
const selectedNode =
|
|
6926
|
+
const selectedNode = React27.useMemo(
|
|
6812
6927
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
6813
6928
|
[items, value]
|
|
6814
6929
|
);
|
|
@@ -7039,11 +7154,11 @@ function FileInput({
|
|
|
7039
7154
|
required,
|
|
7040
7155
|
icon
|
|
7041
7156
|
}) {
|
|
7042
|
-
const inputRef =
|
|
7043
|
-
const errorId =
|
|
7044
|
-
const [files, setFiles] =
|
|
7045
|
-
const [dragging, setDragging] =
|
|
7046
|
-
const [sizeError, setSizeError] =
|
|
7157
|
+
const inputRef = React27.useRef(null);
|
|
7158
|
+
const errorId = React27.useId();
|
|
7159
|
+
const [files, setFiles] = React27.useState([]);
|
|
7160
|
+
const [dragging, setDragging] = React27.useState(false);
|
|
7161
|
+
const [sizeError, setSizeError] = React27.useState(null);
|
|
7047
7162
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
7048
7163
|
const openPicker = () => {
|
|
7049
7164
|
if (!disabled) inputRef.current?.click();
|
|
@@ -7234,30 +7349,30 @@ function DatePicker({
|
|
|
7234
7349
|
size = "md",
|
|
7235
7350
|
className = ""
|
|
7236
7351
|
}) {
|
|
7237
|
-
const errorId =
|
|
7352
|
+
const errorId = React27.useId();
|
|
7238
7353
|
const hasError = errorMessage != null;
|
|
7239
|
-
const [open, setOpen] =
|
|
7240
|
-
const [viewMonth, setViewMonth] =
|
|
7241
|
-
const [focusDate, setFocusDate] =
|
|
7242
|
-
const [view, setView] =
|
|
7243
|
-
const gridRef =
|
|
7244
|
-
|
|
7354
|
+
const [open, setOpen] = React27.useState(false);
|
|
7355
|
+
const [viewMonth, setViewMonth] = React27.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
7356
|
+
const [focusDate, setFocusDate] = React27.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
7357
|
+
const [view, setView] = React27.useState("days");
|
|
7358
|
+
const gridRef = React27.useRef(null);
|
|
7359
|
+
React27.useEffect(() => {
|
|
7245
7360
|
if (!open) return;
|
|
7246
7361
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
7247
7362
|
setViewMonth(startOfMonth(target));
|
|
7248
7363
|
setFocusDate(target);
|
|
7249
7364
|
setView("days");
|
|
7250
7365
|
}, [open, value]);
|
|
7251
|
-
|
|
7366
|
+
React27.useEffect(() => {
|
|
7252
7367
|
if (!open) return;
|
|
7253
7368
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat3(focusDate)}"]`);
|
|
7254
7369
|
cell?.focus();
|
|
7255
7370
|
}, [open, focusDate]);
|
|
7256
|
-
const weekdays =
|
|
7371
|
+
const weekdays = React27.useMemo(() => {
|
|
7257
7372
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
7258
7373
|
return ordered;
|
|
7259
7374
|
}, [weekStartsOn]);
|
|
7260
|
-
const grid =
|
|
7375
|
+
const grid = React27.useMemo(() => buildGrid2(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
7261
7376
|
const isDisabled = (d) => {
|
|
7262
7377
|
if (min && d < min) return true;
|
|
7263
7378
|
if (max && d > max) return true;
|
|
@@ -7547,10 +7662,10 @@ function TextArea({
|
|
|
7547
7662
|
style,
|
|
7548
7663
|
inputStyle
|
|
7549
7664
|
}) {
|
|
7550
|
-
const errorId =
|
|
7665
|
+
const errorId = React27.useId();
|
|
7551
7666
|
const hasError = errorMessage != null;
|
|
7552
|
-
const ref =
|
|
7553
|
-
|
|
7667
|
+
const ref = React27.useRef(null);
|
|
7668
|
+
React27.useLayoutEffect(() => {
|
|
7554
7669
|
if (!autoGrow) return;
|
|
7555
7670
|
const el = ref.current;
|
|
7556
7671
|
if (!el) return;
|
|
@@ -7620,11 +7735,11 @@ function SegmentedControl({
|
|
|
7620
7735
|
"aria-label": ariaLabel
|
|
7621
7736
|
}) {
|
|
7622
7737
|
const sz = SIZE5[size];
|
|
7623
|
-
const groupId =
|
|
7624
|
-
const errorId =
|
|
7738
|
+
const groupId = React27.useId();
|
|
7739
|
+
const errorId = React27.useId();
|
|
7625
7740
|
const hasError = errorMessage != null;
|
|
7626
7741
|
const isControlled = value !== void 0;
|
|
7627
|
-
const [internal, setInternal] =
|
|
7742
|
+
const [internal, setInternal] = React27.useState(defaultValue);
|
|
7628
7743
|
const current = isControlled ? value : internal;
|
|
7629
7744
|
const handle = (v) => {
|
|
7630
7745
|
if (!v) return;
|
|
@@ -7718,14 +7833,14 @@ function Slider({
|
|
|
7718
7833
|
name,
|
|
7719
7834
|
htmlFor
|
|
7720
7835
|
}) {
|
|
7721
|
-
const errorId =
|
|
7836
|
+
const errorId = React27.useId();
|
|
7722
7837
|
const hasError = errorMessage != null;
|
|
7723
7838
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
7724
|
-
const [internal, setInternal] =
|
|
7839
|
+
const [internal, setInternal] = React27.useState(
|
|
7725
7840
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
7726
7841
|
);
|
|
7727
7842
|
const current = toArray(value) ?? internal;
|
|
7728
|
-
const [dragging, setDragging] =
|
|
7843
|
+
const [dragging, setDragging] = React27.useState(false);
|
|
7729
7844
|
const emit = (arr) => {
|
|
7730
7845
|
setInternal(arr);
|
|
7731
7846
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -7820,11 +7935,11 @@ function TagsInput({
|
|
|
7820
7935
|
validate,
|
|
7821
7936
|
separators = ["Enter", ","]
|
|
7822
7937
|
}) {
|
|
7823
|
-
const errorId =
|
|
7824
|
-
const inputRef =
|
|
7825
|
-
const [internal, setInternal] =
|
|
7826
|
-
const [draft, setDraft] =
|
|
7827
|
-
const [localError, setLocalError] =
|
|
7938
|
+
const errorId = React27.useId();
|
|
7939
|
+
const inputRef = React27.useRef(null);
|
|
7940
|
+
const [internal, setInternal] = React27.useState(defaultValue ?? []);
|
|
7941
|
+
const [draft, setDraft] = React27.useState("");
|
|
7942
|
+
const [localError, setLocalError] = React27.useState(null);
|
|
7828
7943
|
const tags = value ?? internal;
|
|
7829
7944
|
const hasError = errorMessage != null || localError != null;
|
|
7830
7945
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -7955,9 +8070,9 @@ function OtpInput({
|
|
|
7955
8070
|
className,
|
|
7956
8071
|
groupAfter
|
|
7957
8072
|
}) {
|
|
7958
|
-
const errorId =
|
|
8073
|
+
const errorId = React27.useId();
|
|
7959
8074
|
const hasError = errorMessage != null;
|
|
7960
|
-
const refs =
|
|
8075
|
+
const refs = React27.useRef([]);
|
|
7961
8076
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
7962
8077
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
7963
8078
|
const emit = (next) => {
|
|
@@ -8006,7 +8121,7 @@ function OtpInput({
|
|
|
8006
8121
|
emit(valid.join(""));
|
|
8007
8122
|
focusBox(valid.length);
|
|
8008
8123
|
};
|
|
8009
|
-
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(
|
|
8124
|
+
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: [
|
|
8010
8125
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8011
8126
|
"input",
|
|
8012
8127
|
{
|
|
@@ -8064,9 +8179,9 @@ function Rating({
|
|
|
8064
8179
|
className,
|
|
8065
8180
|
required
|
|
8066
8181
|
}) {
|
|
8067
|
-
const errorId =
|
|
8068
|
-
const [internal, setInternal] =
|
|
8069
|
-
const [hover, setHover] =
|
|
8182
|
+
const errorId = React27.useId();
|
|
8183
|
+
const [internal, setInternal] = React27.useState(defaultValue);
|
|
8184
|
+
const [hover, setHover] = React27.useState(null);
|
|
8070
8185
|
const current = value ?? internal;
|
|
8071
8186
|
const display2 = hover ?? current;
|
|
8072
8187
|
const interactive = !readOnly && !disabled;
|
|
@@ -8189,9 +8304,9 @@ function TimePicker({
|
|
|
8189
8304
|
required,
|
|
8190
8305
|
style
|
|
8191
8306
|
}) {
|
|
8192
|
-
const errorId =
|
|
8307
|
+
const errorId = React27.useId();
|
|
8193
8308
|
const hasError = errorMessage != null;
|
|
8194
|
-
const [open, setOpen] =
|
|
8309
|
+
const [open, setOpen] = React27.useState(false);
|
|
8195
8310
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
8196
8311
|
const update = (next) => {
|
|
8197
8312
|
const merged = { ...parsed, ...next };
|
|
@@ -8315,13 +8430,13 @@ function DateRangePicker({
|
|
|
8315
8430
|
required,
|
|
8316
8431
|
style
|
|
8317
8432
|
}) {
|
|
8318
|
-
const errorId =
|
|
8433
|
+
const errorId = React27.useId();
|
|
8319
8434
|
const hasError = errorMessage != null;
|
|
8320
|
-
const [open, setOpen] =
|
|
8321
|
-
const [leftMonth, setLeftMonth] =
|
|
8322
|
-
const [pendingStart, setPendingStart] =
|
|
8323
|
-
const [hoverDate, setHoverDate] =
|
|
8324
|
-
const weekdays =
|
|
8435
|
+
const [open, setOpen] = React27.useState(false);
|
|
8436
|
+
const [leftMonth, setLeftMonth] = React27.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
8437
|
+
const [pendingStart, setPendingStart] = React27.useState(null);
|
|
8438
|
+
const [hoverDate, setHoverDate] = React27.useState(null);
|
|
8439
|
+
const weekdays = React27.useMemo(
|
|
8325
8440
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
8326
8441
|
[weekStartsOn]
|
|
8327
8442
|
);
|
|
@@ -8497,10 +8612,10 @@ function ColorPicker({
|
|
|
8497
8612
|
required,
|
|
8498
8613
|
placeholder = "Pick a colour\u2026"
|
|
8499
8614
|
}) {
|
|
8500
|
-
const errorId =
|
|
8615
|
+
const errorId = React27.useId();
|
|
8501
8616
|
const hasError = errorMessage != null;
|
|
8502
|
-
const [open, setOpen] =
|
|
8503
|
-
const [draft, setDraft] =
|
|
8617
|
+
const [open, setOpen] = React27.useState(false);
|
|
8618
|
+
const [draft, setDraft] = React27.useState(value);
|
|
8504
8619
|
const valid = HEX_RE.test(value);
|
|
8505
8620
|
const pick = (hex) => {
|
|
8506
8621
|
onChange?.(hex);
|
|
@@ -8647,6 +8762,7 @@ exports.IconButton = IconButton;
|
|
|
8647
8762
|
exports.Kbd = Kbd;
|
|
8648
8763
|
exports.List = List2;
|
|
8649
8764
|
exports.LoadingSpinner = LoadingSpinner;
|
|
8765
|
+
exports.LogoutTimer = LogoutTimer;
|
|
8650
8766
|
exports.MegaMenu = MegaMenu_default;
|
|
8651
8767
|
exports.MenuButton = MenuButton;
|
|
8652
8768
|
exports.Modal = Modal;
|