@geomak/ui 7.5.1 → 7.5.3
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 +385 -366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +93 -74
- 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 chunk4V4U2W7K_cjs = require('./chunk-4V4U2W7K.cjs');
|
|
4
4
|
var chunkCNUDNGJM_cjs = require('./chunk-CNUDNGJM.cjs');
|
|
5
|
-
var
|
|
5
|
+
var React31 = require('react');
|
|
6
6
|
var reactDom = require('react-dom');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
@@ -41,7 +41,7 @@ function _interopNamespace(e) {
|
|
|
41
41
|
return Object.freeze(n);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var React31__default = /*#__PURE__*/_interopDefault(React31);
|
|
45
45
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
46
46
|
var DropdownMenu2__namespace = /*#__PURE__*/_interopNamespace(DropdownMenu2);
|
|
47
47
|
var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
|
|
@@ -67,8 +67,8 @@ function cx(...values) {
|
|
|
67
67
|
return out;
|
|
68
68
|
}
|
|
69
69
|
function Portal({ children, target }) {
|
|
70
|
-
const [resolved, setResolved] =
|
|
71
|
-
|
|
70
|
+
const [resolved, setResolved] = React31.useState(null);
|
|
71
|
+
React31.useEffect(() => {
|
|
72
72
|
if (target === null) {
|
|
73
73
|
setResolved(null);
|
|
74
74
|
return;
|
|
@@ -489,7 +489,7 @@ function Typography({
|
|
|
489
489
|
}
|
|
490
490
|
);
|
|
491
491
|
}
|
|
492
|
-
|
|
492
|
+
var IconButton = React31__default.default.forwardRef(function IconButton2({
|
|
493
493
|
icon,
|
|
494
494
|
onClick,
|
|
495
495
|
type = "primary",
|
|
@@ -501,8 +501,8 @@ function IconButton({
|
|
|
501
501
|
title,
|
|
502
502
|
className = "",
|
|
503
503
|
style
|
|
504
|
-
}) {
|
|
505
|
-
const colorScheme =
|
|
504
|
+
}, ref) {
|
|
505
|
+
const colorScheme = React31.useMemo(() => {
|
|
506
506
|
if (type === "primary") {
|
|
507
507
|
return "bg-accent text-accent-fg hover:bg-accent-hover";
|
|
508
508
|
}
|
|
@@ -517,6 +517,7 @@ function IconButton({
|
|
|
517
517
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
518
518
|
"button",
|
|
519
519
|
{
|
|
520
|
+
ref,
|
|
520
521
|
type: buttonType,
|
|
521
522
|
disabled: disabled || loading,
|
|
522
523
|
onClick,
|
|
@@ -527,7 +528,9 @@ function IconButton({
|
|
|
527
528
|
children: loading ? loadingIcon : icon
|
|
528
529
|
}
|
|
529
530
|
);
|
|
530
|
-
}
|
|
531
|
+
});
|
|
532
|
+
IconButton.displayName = "IconButton";
|
|
533
|
+
var IconButton_default = IconButton;
|
|
531
534
|
var VARIANT_CLASSES = {
|
|
532
535
|
primary: [
|
|
533
536
|
"bg-accent text-accent-fg",
|
|
@@ -595,7 +598,7 @@ var SIZE_CLASSES = {
|
|
|
595
598
|
md: "h-9 px-4 text-sm gap-1.5 rounded-lg",
|
|
596
599
|
lg: "h-11 px-5 text-sm gap-2 rounded-xl"
|
|
597
600
|
};
|
|
598
|
-
var Button =
|
|
601
|
+
var Button = React31__default.default.forwardRef(function Button2({
|
|
599
602
|
content,
|
|
600
603
|
variant = "primary",
|
|
601
604
|
size = "md",
|
|
@@ -703,7 +706,7 @@ function MenuButton({
|
|
|
703
706
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
704
707
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
|
|
705
708
|
].join(" "),
|
|
706
|
-
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
709
|
+
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(React31__default.default.Fragment, { children: [
|
|
707
710
|
item.separatorBefore && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Separator, { className: "my-1 h-px bg-border" }),
|
|
708
711
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
709
712
|
DropdownMenu2__namespace.Item,
|
|
@@ -946,9 +949,9 @@ function Tooltip({
|
|
|
946
949
|
] }) });
|
|
947
950
|
}
|
|
948
951
|
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
949
|
-
var TabsContext =
|
|
952
|
+
var TabsContext = React31.createContext(null);
|
|
950
953
|
function useTabsContext() {
|
|
951
|
-
const ctx =
|
|
954
|
+
const ctx = React31.useContext(TabsContext);
|
|
952
955
|
if (!ctx) throw new Error("Tabs.List / Tabs.Trigger / Tabs.Panel must be rendered inside <Tabs>.");
|
|
953
956
|
return ctx;
|
|
954
957
|
}
|
|
@@ -970,26 +973,26 @@ function Tabs({
|
|
|
970
973
|
children
|
|
971
974
|
}) {
|
|
972
975
|
const isControlled = value !== void 0;
|
|
973
|
-
const [internal, setInternal] =
|
|
976
|
+
const [internal, setInternal] = React31.useState(defaultValue);
|
|
974
977
|
const current = isControlled ? value : internal;
|
|
975
978
|
const reduced = !!framerMotion.useReducedMotion();
|
|
976
|
-
const indicatorId =
|
|
977
|
-
const select =
|
|
979
|
+
const indicatorId = React31.useId();
|
|
980
|
+
const select = React31.useCallback((next) => {
|
|
978
981
|
if (!isControlled) setInternal(next);
|
|
979
982
|
onChange?.(next);
|
|
980
983
|
}, [isControlled, onChange]);
|
|
981
|
-
const registry =
|
|
982
|
-
const orderRef =
|
|
983
|
-
const [, bump] =
|
|
984
|
-
const registerTab =
|
|
984
|
+
const registry = React31.useRef(/* @__PURE__ */ new Map());
|
|
985
|
+
const orderRef = React31.useRef(0);
|
|
986
|
+
const [, bump] = React31.useState(0);
|
|
987
|
+
const registerTab = React31.useCallback((val, meta) => {
|
|
985
988
|
const existing = registry.current.get(val);
|
|
986
989
|
registry.current.set(val, { ...meta, order: existing?.order ?? orderRef.current++ });
|
|
987
990
|
if (!existing) bump((v) => v + 1);
|
|
988
991
|
}, []);
|
|
989
|
-
const unregisterTab =
|
|
992
|
+
const unregisterTab = React31.useCallback((val) => {
|
|
990
993
|
if (registry.current.delete(val)) bump((v) => v + 1);
|
|
991
994
|
}, []);
|
|
992
|
-
const getTabs =
|
|
995
|
+
const getTabs = React31.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 })), []);
|
|
993
996
|
return /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: { value: current, variant, size, orientation, indicatorId, reduced, select, registerTab, unregisterTab, getTabs }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
994
997
|
TabsPrimitive__namespace.Root,
|
|
995
998
|
{
|
|
@@ -1009,10 +1012,10 @@ function Tabs({
|
|
|
1009
1012
|
function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
|
|
1010
1013
|
const { variant, orientation, reduced, value } = useTabsContext();
|
|
1011
1014
|
const horizontal = orientation === "horizontal";
|
|
1012
|
-
const scrollRef =
|
|
1013
|
-
const [edges, setEdges] =
|
|
1015
|
+
const scrollRef = React31.useRef(null);
|
|
1016
|
+
const [edges, setEdges] = React31.useState({ start: false, end: false });
|
|
1014
1017
|
const scrollable = variant !== "segmented";
|
|
1015
|
-
|
|
1018
|
+
React31.useLayoutEffect(() => {
|
|
1016
1019
|
const el = scrollRef.current;
|
|
1017
1020
|
if (!el || !scrollable) return;
|
|
1018
1021
|
const update = () => {
|
|
@@ -1037,13 +1040,13 @@ function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
|
|
|
1037
1040
|
ro.disconnect();
|
|
1038
1041
|
};
|
|
1039
1042
|
}, [horizontal, scrollable, children]);
|
|
1040
|
-
const nudge =
|
|
1043
|
+
const nudge = React31.useCallback((dir) => {
|
|
1041
1044
|
const el = scrollRef.current;
|
|
1042
1045
|
if (!el) return;
|
|
1043
1046
|
const amount = (horizontal ? el.clientWidth : el.clientHeight) * 0.7 * dir;
|
|
1044
1047
|
el.scrollBy({ [horizontal ? "left" : "top"]: amount, behavior: reduced ? "auto" : "smooth" });
|
|
1045
1048
|
}, [horizontal, reduced]);
|
|
1046
|
-
|
|
1049
|
+
React31.useLayoutEffect(() => {
|
|
1047
1050
|
const el = scrollRef.current;
|
|
1048
1051
|
if (!el || !scrollable) return;
|
|
1049
1052
|
const active = el.querySelector("[role=tab][data-state=active]");
|
|
@@ -1101,9 +1104,9 @@ function Chevron2({ side, orientation, onClick }) {
|
|
|
1101
1104
|
function OverflowMenu() {
|
|
1102
1105
|
const { getTabs, value, select, orientation } = useTabsContext();
|
|
1103
1106
|
const horizontal = orientation === "horizontal";
|
|
1104
|
-
const [open, setOpen] =
|
|
1105
|
-
const wrapRef =
|
|
1106
|
-
const timer =
|
|
1107
|
+
const [open, setOpen] = React31.useState(false);
|
|
1108
|
+
const wrapRef = React31.useRef(null);
|
|
1109
|
+
const timer = React31.useRef(null);
|
|
1107
1110
|
const openNow = () => {
|
|
1108
1111
|
if (timer.current) clearTimeout(timer.current);
|
|
1109
1112
|
setOpen(true);
|
|
@@ -1111,7 +1114,7 @@ function OverflowMenu() {
|
|
|
1111
1114
|
const closeSoon = () => {
|
|
1112
1115
|
timer.current = setTimeout(() => setOpen(false), 160);
|
|
1113
1116
|
};
|
|
1114
|
-
|
|
1117
|
+
React31.useLayoutEffect(() => {
|
|
1115
1118
|
if (!open) return;
|
|
1116
1119
|
const onDoc = (e) => {
|
|
1117
1120
|
if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
|
|
@@ -1192,7 +1195,7 @@ function TabsTrigger({ value, icon, badge, closeable, onClose, disabled, classNa
|
|
|
1192
1195
|
const isActive = active === value;
|
|
1193
1196
|
const horizontal = orientation === "horizontal";
|
|
1194
1197
|
const sz = SIZE[size];
|
|
1195
|
-
|
|
1198
|
+
React31.useLayoutEffect(() => {
|
|
1196
1199
|
registerTab(value, { label: children, icon, disabled });
|
|
1197
1200
|
return () => unregisterTab(value);
|
|
1198
1201
|
}, [value, children, icon, disabled, registerTab, unregisterTab]);
|
|
@@ -1379,7 +1382,7 @@ function Tree({
|
|
|
1379
1382
|
item.key
|
|
1380
1383
|
)) });
|
|
1381
1384
|
}
|
|
1382
|
-
var AccordionCtx =
|
|
1385
|
+
var AccordionCtx = React31.createContext({ variant: "separated" });
|
|
1383
1386
|
function Accordion2({
|
|
1384
1387
|
children,
|
|
1385
1388
|
type = "single",
|
|
@@ -1438,7 +1441,7 @@ var Chevron3 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
1438
1441
|
}
|
|
1439
1442
|
);
|
|
1440
1443
|
function AccordionItem({ value, title, icon, children, disabled, className = "" }) {
|
|
1441
|
-
const { variant } =
|
|
1444
|
+
const { variant } = React31.useContext(AccordionCtx);
|
|
1442
1445
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1443
1446
|
AccordionPrimitive__namespace.Item,
|
|
1444
1447
|
{
|
|
@@ -1497,7 +1500,7 @@ function Breadcrumbs({
|
|
|
1497
1500
|
className = "",
|
|
1498
1501
|
style
|
|
1499
1502
|
}) {
|
|
1500
|
-
const [expanded, setExpanded] =
|
|
1503
|
+
const [expanded, setExpanded] = React31.useState(false);
|
|
1501
1504
|
const shouldCollapse = maxItems > 0 && items.length > maxItems && !expanded;
|
|
1502
1505
|
const visible = [];
|
|
1503
1506
|
if (shouldCollapse) {
|
|
@@ -1681,8 +1684,8 @@ function Stepper({
|
|
|
1681
1684
|
className = ""
|
|
1682
1685
|
}) {
|
|
1683
1686
|
const reduced = framerMotion.useReducedMotion();
|
|
1684
|
-
const [forcedVertical, setForcedVertical] =
|
|
1685
|
-
|
|
1687
|
+
const [forcedVertical, setForcedVertical] = React31.useState(false);
|
|
1688
|
+
React31.useEffect(() => {
|
|
1686
1689
|
if (!responsive || orientation === "vertical") return;
|
|
1687
1690
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1688
1691
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
@@ -1791,7 +1794,7 @@ function Kbd({
|
|
|
1791
1794
|
style
|
|
1792
1795
|
}) {
|
|
1793
1796
|
if (keys && keys.length > 0) {
|
|
1794
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx("inline-flex items-center gap-1", className), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1797
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx("inline-flex items-center gap-1", className), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(React31__default.default.Fragment, { children: [
|
|
1795
1798
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-xs select-none", children: separator }),
|
|
1796
1799
|
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: [cap, SIZE3[size]].join(" "), children: k })
|
|
1797
1800
|
] }, `${k}-${i}`)) });
|
|
@@ -1882,13 +1885,13 @@ function FlatCarousel({
|
|
|
1882
1885
|
className = "",
|
|
1883
1886
|
style
|
|
1884
1887
|
}) {
|
|
1885
|
-
const scrollerRef =
|
|
1886
|
-
const slides =
|
|
1887
|
-
const [active, setActive] =
|
|
1888
|
-
const [atStart, setAtStart] =
|
|
1889
|
-
const [atEnd, setAtEnd] =
|
|
1888
|
+
const scrollerRef = React31.useRef(null);
|
|
1889
|
+
const slides = React31__default.default.Children.toArray(children);
|
|
1890
|
+
const [active, setActive] = React31.useState(0);
|
|
1891
|
+
const [atStart, setAtStart] = React31.useState(true);
|
|
1892
|
+
const [atEnd, setAtEnd] = React31.useState(false);
|
|
1890
1893
|
const width = typeof itemWidth === "number" ? `${itemWidth}px` : itemWidth;
|
|
1891
|
-
const update =
|
|
1894
|
+
const update = React31.useCallback(() => {
|
|
1892
1895
|
const el = scrollerRef.current;
|
|
1893
1896
|
if (!el) return;
|
|
1894
1897
|
setAtStart(el.scrollLeft <= 1);
|
|
@@ -1897,7 +1900,7 @@ function FlatCarousel({
|
|
|
1897
1900
|
const slideW = first ? first.getBoundingClientRect().width + gap : el.clientWidth;
|
|
1898
1901
|
setActive(Math.round(el.scrollLeft / slideW));
|
|
1899
1902
|
}, [gap]);
|
|
1900
|
-
|
|
1903
|
+
React31.useEffect(() => {
|
|
1901
1904
|
update();
|
|
1902
1905
|
const el = scrollerRef.current;
|
|
1903
1906
|
if (!el) return;
|
|
@@ -1938,9 +1941,9 @@ function RotatingCarousel({
|
|
|
1938
1941
|
className = "",
|
|
1939
1942
|
style
|
|
1940
1943
|
}) {
|
|
1941
|
-
const slides =
|
|
1944
|
+
const slides = React31__default.default.Children.toArray(children);
|
|
1942
1945
|
const count = slides.length;
|
|
1943
|
-
const [active, setActive] =
|
|
1946
|
+
const [active, setActive] = React31.useState(0);
|
|
1944
1947
|
const reduced = framerMotion.useReducedMotion();
|
|
1945
1948
|
const wrap = (n) => count > 0 ? (n % count + count) % count : 0;
|
|
1946
1949
|
const idx = wrap(active);
|
|
@@ -2178,13 +2181,13 @@ function Chat({
|
|
|
2178
2181
|
className = "",
|
|
2179
2182
|
style
|
|
2180
2183
|
}) {
|
|
2181
|
-
const listRef =
|
|
2182
|
-
const atBottomRef =
|
|
2183
|
-
const [showJump, setShowJump] =
|
|
2184
|
-
const [draft, setDraft] =
|
|
2184
|
+
const listRef = React31.useRef(null);
|
|
2185
|
+
const atBottomRef = React31.useRef(true);
|
|
2186
|
+
const [showJump, setShowJump] = React31.useState(false);
|
|
2187
|
+
const [draft, setDraft] = React31.useState("");
|
|
2185
2188
|
const hasHeader = title != null || subtitle != null || avatar != null || headerActions != null;
|
|
2186
2189
|
const isTyping = typingNames.length > 0;
|
|
2187
|
-
const scrollToBottom =
|
|
2190
|
+
const scrollToBottom = React31.useCallback((smooth = true) => {
|
|
2188
2191
|
const el = listRef.current;
|
|
2189
2192
|
if (!el) return;
|
|
2190
2193
|
if (typeof el.scrollTo === "function") el.scrollTo({ top: el.scrollHeight, behavior: smooth ? "smooth" : "auto" });
|
|
@@ -2197,10 +2200,10 @@ function Chat({
|
|
|
2197
2200
|
atBottomRef.current = near;
|
|
2198
2201
|
setShowJump(!near);
|
|
2199
2202
|
};
|
|
2200
|
-
|
|
2203
|
+
React31.useEffect(() => {
|
|
2201
2204
|
if (atBottomRef.current) scrollToBottom(messages.length > 0);
|
|
2202
2205
|
}, [messages.length, isTyping]);
|
|
2203
|
-
|
|
2206
|
+
React31.useEffect(() => {
|
|
2204
2207
|
scrollToBottom(false);
|
|
2205
2208
|
}, [scrollToBottom]);
|
|
2206
2209
|
const send = () => {
|
|
@@ -2297,7 +2300,7 @@ function Chat({
|
|
|
2297
2300
|
}
|
|
2298
2301
|
),
|
|
2299
2302
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2300
|
-
|
|
2303
|
+
IconButton_default,
|
|
2301
2304
|
{
|
|
2302
2305
|
type: "primary",
|
|
2303
2306
|
icon: /* @__PURE__ */ jsxRuntime.jsx(SendIcon, {}),
|
|
@@ -2390,7 +2393,7 @@ function FAB({
|
|
|
2390
2393
|
className = "",
|
|
2391
2394
|
style
|
|
2392
2395
|
}) {
|
|
2393
|
-
const [open, setOpen] =
|
|
2396
|
+
const [open, setOpen] = React31.useState(false);
|
|
2394
2397
|
const reduced = framerMotion.useReducedMotion();
|
|
2395
2398
|
const hasDial = !!actions && actions.length > 0;
|
|
2396
2399
|
const bottom = position.startsWith("bottom");
|
|
@@ -2492,8 +2495,8 @@ function PopConfirm({
|
|
|
2492
2495
|
onOpenChange,
|
|
2493
2496
|
className = ""
|
|
2494
2497
|
}) {
|
|
2495
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
2496
|
-
const [loading, setLoading] =
|
|
2498
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React31.useState(false);
|
|
2499
|
+
const [loading, setLoading] = React31.useState(false);
|
|
2497
2500
|
const isOpen = open ?? uncontrolledOpen;
|
|
2498
2501
|
const setOpen = (next) => {
|
|
2499
2502
|
onOpenChange?.(next);
|
|
@@ -2512,52 +2515,68 @@ function PopConfirm({
|
|
|
2512
2515
|
onCancel?.();
|
|
2513
2516
|
setOpen(false);
|
|
2514
2517
|
};
|
|
2515
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
{
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2518
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2519
|
+
Popover__namespace.Root,
|
|
2520
|
+
{
|
|
2521
|
+
open: isOpen,
|
|
2522
|
+
onOpenChange: (o) => {
|
|
2523
|
+
if (o) setOpen(true);
|
|
2524
|
+
else if (!loading) handleCancel();
|
|
2525
|
+
},
|
|
2526
|
+
children: [
|
|
2527
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Trigger, { asChild: true, children }),
|
|
2528
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2529
|
+
Popover__namespace.Content,
|
|
2530
|
+
{
|
|
2531
|
+
side,
|
|
2532
|
+
sideOffset: 8,
|
|
2533
|
+
collisionPadding: 12,
|
|
2534
|
+
className: cx("z-[400] focus:outline-none", className),
|
|
2535
|
+
onEscapeKeyDown: (e) => {
|
|
2536
|
+
if (loading) e.preventDefault();
|
|
2537
|
+
},
|
|
2538
|
+
onInteractOutside: (e) => {
|
|
2539
|
+
if (loading) e.preventDefault();
|
|
2540
|
+
},
|
|
2541
|
+
children: [
|
|
2542
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2543
|
+
framerMotion.motion.div,
|
|
2544
|
+
{
|
|
2545
|
+
initial: { opacity: 0, scale: 0.95 },
|
|
2546
|
+
animate: { opacity: 1, scale: 1 },
|
|
2547
|
+
transition: { duration: 0.12, ease: [0.16, 1, 0.3, 1] },
|
|
2548
|
+
className: "w-64 rounded-lg border border-border bg-surface p-3.5 shadow-lg",
|
|
2549
|
+
children: [
|
|
2550
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2.5", children: [
|
|
2551
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center ${ICON_COLOR[tone]}`, children: icon }),
|
|
2552
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
2553
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-foreground", children: title }),
|
|
2554
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-foreground-secondary leading-snug", children: description })
|
|
2555
|
+
] })
|
|
2556
|
+
] }),
|
|
2557
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex justify-end gap-2", children: [
|
|
2558
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button_default, { content: cancelText, size: "sm", variant: "ghost", disabled: loading, onClick: handleCancel }),
|
|
2559
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2560
|
+
Button_default,
|
|
2561
|
+
{
|
|
2562
|
+
content: confirmText,
|
|
2563
|
+
size: "sm",
|
|
2564
|
+
variant: CONFIRM_VARIANT[tone],
|
|
2565
|
+
loading,
|
|
2566
|
+
onClick: handleConfirm
|
|
2567
|
+
}
|
|
2568
|
+
)
|
|
2569
|
+
] })
|
|
2570
|
+
]
|
|
2571
|
+
}
|
|
2572
|
+
),
|
|
2573
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Arrow, { className: "fill-surface" })
|
|
2574
|
+
]
|
|
2575
|
+
}
|
|
2576
|
+
) })
|
|
2577
|
+
]
|
|
2578
|
+
}
|
|
2579
|
+
);
|
|
2561
2580
|
}
|
|
2562
2581
|
var DEFAULT_EVENTS = ["mousemove", "mousedown", "keydown", "touchstart", "scroll", "wheel"];
|
|
2563
2582
|
var formatTime = (ms) => {
|
|
@@ -2580,16 +2599,16 @@ function LogoutTimer({
|
|
|
2580
2599
|
logoutLabel = "Sign out now"
|
|
2581
2600
|
}) {
|
|
2582
2601
|
const reduced = framerMotion.useReducedMotion();
|
|
2583
|
-
const [warning, setWarning] =
|
|
2584
|
-
const [remaining, setRemaining] =
|
|
2585
|
-
const idleTimer =
|
|
2586
|
-
const tick =
|
|
2587
|
-
const deadline =
|
|
2588
|
-
const warningRef =
|
|
2589
|
-
const lastReset =
|
|
2590
|
-
const cbs =
|
|
2602
|
+
const [warning, setWarning] = React31.useState(false);
|
|
2603
|
+
const [remaining, setRemaining] = React31.useState(countdown);
|
|
2604
|
+
const idleTimer = React31.useRef(null);
|
|
2605
|
+
const tick = React31.useRef(null);
|
|
2606
|
+
const deadline = React31.useRef(0);
|
|
2607
|
+
const warningRef = React31.useRef(false);
|
|
2608
|
+
const lastReset = React31.useRef(0);
|
|
2609
|
+
const cbs = React31.useRef({ onLogout, onContinue, onWarning });
|
|
2591
2610
|
cbs.current = { onLogout, onContinue, onWarning };
|
|
2592
|
-
const clearTimers =
|
|
2611
|
+
const clearTimers = React31.useCallback(() => {
|
|
2593
2612
|
if (idleTimer.current) {
|
|
2594
2613
|
clearTimeout(idleTimer.current);
|
|
2595
2614
|
idleTimer.current = null;
|
|
@@ -2599,13 +2618,13 @@ function LogoutTimer({
|
|
|
2599
2618
|
tick.current = null;
|
|
2600
2619
|
}
|
|
2601
2620
|
}, []);
|
|
2602
|
-
const logout =
|
|
2621
|
+
const logout = React31.useCallback(() => {
|
|
2603
2622
|
clearTimers();
|
|
2604
2623
|
warningRef.current = false;
|
|
2605
2624
|
setWarning(false);
|
|
2606
2625
|
cbs.current.onLogout();
|
|
2607
2626
|
}, [clearTimers]);
|
|
2608
|
-
const startIdle =
|
|
2627
|
+
const startIdle = React31.useCallback(() => {
|
|
2609
2628
|
if (idleTimer.current) clearTimeout(idleTimer.current);
|
|
2610
2629
|
idleTimer.current = setTimeout(() => {
|
|
2611
2630
|
warningRef.current = true;
|
|
@@ -2620,7 +2639,7 @@ function LogoutTimer({
|
|
|
2620
2639
|
}, 250);
|
|
2621
2640
|
}, timeout);
|
|
2622
2641
|
}, [timeout, countdown, logout]);
|
|
2623
|
-
const stay =
|
|
2642
|
+
const stay = React31.useCallback(() => {
|
|
2624
2643
|
if (tick.current) {
|
|
2625
2644
|
clearInterval(tick.current);
|
|
2626
2645
|
tick.current = null;
|
|
@@ -2630,7 +2649,7 @@ function LogoutTimer({
|
|
|
2630
2649
|
cbs.current.onContinue?.();
|
|
2631
2650
|
startIdle();
|
|
2632
2651
|
}, [startIdle]);
|
|
2633
|
-
|
|
2652
|
+
React31.useEffect(() => {
|
|
2634
2653
|
if (!enabled) {
|
|
2635
2654
|
clearTimers();
|
|
2636
2655
|
warningRef.current = false;
|
|
@@ -2695,11 +2714,11 @@ function SegmentedControl({
|
|
|
2695
2714
|
"aria-label": ariaLabel
|
|
2696
2715
|
}) {
|
|
2697
2716
|
const sz = SIZE5[size];
|
|
2698
|
-
const groupId =
|
|
2699
|
-
const errorId =
|
|
2717
|
+
const groupId = React31.useId();
|
|
2718
|
+
const errorId = React31.useId();
|
|
2700
2719
|
const hasError = errorMessage != null;
|
|
2701
2720
|
const isControlled = value !== void 0;
|
|
2702
|
-
const [internal, setInternal] =
|
|
2721
|
+
const [internal, setInternal] = React31.useState(defaultValue);
|
|
2703
2722
|
const current = isControlled ? value : internal;
|
|
2704
2723
|
const handle = (v) => {
|
|
2705
2724
|
if (!v) return;
|
|
@@ -2860,22 +2879,22 @@ function Scheduler({
|
|
|
2860
2879
|
style
|
|
2861
2880
|
}) {
|
|
2862
2881
|
const reduced = framerMotion.useReducedMotion();
|
|
2863
|
-
const [view, setView] =
|
|
2864
|
-
const [cursor, setCursor] =
|
|
2865
|
-
const [loaded, setLoaded] =
|
|
2866
|
-
const [loading, setLoading] =
|
|
2867
|
-
const [error, setError] =
|
|
2868
|
-
const [reloadKey, setReloadKey] =
|
|
2869
|
-
const [dir, setDir] =
|
|
2870
|
-
const cbRef =
|
|
2882
|
+
const [view, setView] = React31.useState(defaultView);
|
|
2883
|
+
const [cursor, setCursor] = React31.useState(() => defaultDate ?? /* @__PURE__ */ new Date());
|
|
2884
|
+
const [loaded, setLoaded] = React31.useState([]);
|
|
2885
|
+
const [loading, setLoading] = React31.useState(false);
|
|
2886
|
+
const [error, setError] = React31.useState(null);
|
|
2887
|
+
const [reloadKey, setReloadKey] = React31.useState(0);
|
|
2888
|
+
const [dir, setDir] = React31.useState(0);
|
|
2889
|
+
const cbRef = React31.useRef({ loadEvents, onError });
|
|
2871
2890
|
cbRef.current = { loadEvents, onError };
|
|
2872
|
-
const range =
|
|
2891
|
+
const range = React31.useMemo(
|
|
2873
2892
|
() => view === "month" ? monthRange(cursor) : weekRange(cursor, weekStartsOn),
|
|
2874
2893
|
[view, cursor, weekStartsOn]
|
|
2875
2894
|
);
|
|
2876
2895
|
const fromKey = range.from.getTime();
|
|
2877
2896
|
const toKey = range.to.getTime();
|
|
2878
|
-
|
|
2897
|
+
React31.useEffect(() => {
|
|
2879
2898
|
const { loadEvents: loader, onError: onErr } = cbRef.current;
|
|
2880
2899
|
if (!loader) return;
|
|
2881
2900
|
let cancelled = false;
|
|
@@ -2895,16 +2914,16 @@ function Scheduler({
|
|
|
2895
2914
|
cancelled = true;
|
|
2896
2915
|
};
|
|
2897
2916
|
}, [fromKey, toKey, view, reloadKey]);
|
|
2898
|
-
const retry =
|
|
2899
|
-
const events =
|
|
2917
|
+
const retry = React31.useCallback(() => setReloadKey((k) => k + 1), []);
|
|
2918
|
+
const events = React31.useMemo(
|
|
2900
2919
|
() => (controlledEvents ?? loaded).map(normalize),
|
|
2901
2920
|
[controlledEvents, loaded]
|
|
2902
2921
|
);
|
|
2903
|
-
const go =
|
|
2922
|
+
const go = React31.useCallback((delta) => {
|
|
2904
2923
|
setDir(delta);
|
|
2905
2924
|
setCursor((c) => view === "month" ? addMonths(c, delta) : addDays(c, delta * 7));
|
|
2906
2925
|
}, [view]);
|
|
2907
|
-
const goToday =
|
|
2926
|
+
const goToday = React31.useCallback(() => {
|
|
2908
2927
|
setDir(0);
|
|
2909
2928
|
setCursor(/* @__PURE__ */ new Date());
|
|
2910
2929
|
}, []);
|
|
@@ -2918,8 +2937,8 @@ function Scheduler({
|
|
|
2918
2937
|
children: [
|
|
2919
2938
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
2920
2939
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2921
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2922
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2940
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton_default, { type: "bordered", size: "sm", icon: /* @__PURE__ */ jsxRuntime.jsx(Chevron4, { dir: "left" }), title: "Previous", onClick: () => go(-1) }),
|
|
2941
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton_default, { type: "bordered", size: "sm", icon: /* @__PURE__ */ jsxRuntime.jsx(Chevron4, { dir: "right" }), title: "Next", onClick: () => go(1) }),
|
|
2923
2942
|
/* @__PURE__ */ jsxRuntime.jsx(Button_default, { variant: "ghost", size: "sm", content: "Today", onClick: goToday }),
|
|
2924
2943
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2925
2944
|
MonthYearPicker,
|
|
@@ -3014,9 +3033,9 @@ function SchedulerError({ onRetry }) {
|
|
|
3014
3033
|
] });
|
|
3015
3034
|
}
|
|
3016
3035
|
function MonthYearPicker({ label, cursor, onPick }) {
|
|
3017
|
-
const [open, setOpen] =
|
|
3018
|
-
const [viewYear, setViewYear] =
|
|
3019
|
-
|
|
3036
|
+
const [open, setOpen] = React31.useState(false);
|
|
3037
|
+
const [viewYear, setViewYear] = React31.useState(cursor.getFullYear());
|
|
3038
|
+
React31.useEffect(() => {
|
|
3020
3039
|
if (open) setViewYear(cursor.getFullYear());
|
|
3021
3040
|
}, [open, cursor]);
|
|
3022
3041
|
return /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open, onOpenChange: setOpen, children: [
|
|
@@ -3043,9 +3062,9 @@ function MonthYearPicker({ label, cursor, onPick }) {
|
|
|
3043
3062
|
].join(" "),
|
|
3044
3063
|
children: [
|
|
3045
3064
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
3046
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3065
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton_default, { size: "sm", type: "bordered", icon: /* @__PURE__ */ jsxRuntime.jsx(Chevron4, { dir: "left" }), title: "Previous year", onClick: () => setViewYear((y) => y - 1) }),
|
|
3047
3066
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold tabular-nums text-foreground", children: viewYear }),
|
|
3048
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3067
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton_default, { size: "sm", type: "bordered", icon: /* @__PURE__ */ jsxRuntime.jsx(Chevron4, { dir: "right" }), title: "Next year", onClick: () => setViewYear((y) => y + 1) })
|
|
3049
3068
|
] }),
|
|
3050
3069
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1", children: MONTHS_SHORT.map((m, i) => {
|
|
3051
3070
|
const current = i === cursor.getMonth() && viewYear === cursor.getFullYear();
|
|
@@ -3090,8 +3109,8 @@ function MonthView({
|
|
|
3090
3109
|
onSelectSlot,
|
|
3091
3110
|
onSelectEvent
|
|
3092
3111
|
}) {
|
|
3093
|
-
const grid =
|
|
3094
|
-
const eventsByDay =
|
|
3112
|
+
const grid = React31.useMemo(() => buildMonthGrid(cursor, weekStartsOn), [cursor, weekStartsOn]);
|
|
3113
|
+
const eventsByDay = React31.useMemo(() => bucketByDay(events), [events]);
|
|
3095
3114
|
const labels = weekdayLabels(weekStartsOn);
|
|
3096
3115
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", children: [
|
|
3097
3116
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 border-b border-border", children: labels.map((l) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 text-center text-[11px] font-medium uppercase tracking-wide text-foreground-muted", children: l }, l)) }),
|
|
@@ -3165,12 +3184,12 @@ function WeekView({
|
|
|
3165
3184
|
onSelectSlot,
|
|
3166
3185
|
onSelectEvent
|
|
3167
3186
|
}) {
|
|
3168
|
-
const days =
|
|
3169
|
-
const eventsByDay =
|
|
3170
|
-
const labels =
|
|
3187
|
+
const days = React31.useMemo(() => getWeekDays(cursor, weekStartsOn), [cursor, weekStartsOn]);
|
|
3188
|
+
const eventsByDay = React31.useMemo(() => bucketByDay(events), [events]);
|
|
3189
|
+
const labels = React31.useMemo(() => weekdayLabels(weekStartsOn), [weekStartsOn]);
|
|
3171
3190
|
const dow = (d) => labels[(d.getDay() - weekStartsOn + 7) % 7];
|
|
3172
3191
|
const [startHour, endHour] = dayHours;
|
|
3173
|
-
const hours =
|
|
3192
|
+
const hours = React31.useMemo(
|
|
3174
3193
|
() => Array.from({ length: endHour - startHour }, (_, i) => startHour + i),
|
|
3175
3194
|
[startHour, endHour]
|
|
3176
3195
|
);
|
|
@@ -3361,17 +3380,17 @@ function Cart({
|
|
|
3361
3380
|
] })
|
|
3362
3381
|
] });
|
|
3363
3382
|
}
|
|
3364
|
-
var CartContext =
|
|
3383
|
+
var CartContext = React31.createContext(null);
|
|
3365
3384
|
var clampQty = (qty, max) => {
|
|
3366
3385
|
const lower = Math.max(1, Math.round(qty));
|
|
3367
3386
|
return max != null ? Math.min(lower, max) : lower;
|
|
3368
3387
|
};
|
|
3369
3388
|
function CartProvider({ children, initialItems = [], onChange }) {
|
|
3370
|
-
const [items, setItems] =
|
|
3371
|
-
|
|
3389
|
+
const [items, setItems] = React31.useState(initialItems);
|
|
3390
|
+
React31.useEffect(() => {
|
|
3372
3391
|
onChange?.(items);
|
|
3373
3392
|
}, [items]);
|
|
3374
|
-
const addToCart =
|
|
3393
|
+
const addToCart = React31.useCallback((item, quantity) => {
|
|
3375
3394
|
const addQty = quantity ?? item.quantity ?? 1;
|
|
3376
3395
|
setItems((prev) => {
|
|
3377
3396
|
const existing = prev.find((it) => it.id === item.id);
|
|
@@ -3384,29 +3403,29 @@ function CartProvider({ children, initialItems = [], onChange }) {
|
|
|
3384
3403
|
return [...prev, { ...rest, quantity: clampQty(addQty, item.max) }];
|
|
3385
3404
|
});
|
|
3386
3405
|
}, []);
|
|
3387
|
-
const removeFromCart =
|
|
3406
|
+
const removeFromCart = React31.useCallback((id) => {
|
|
3388
3407
|
setItems((prev) => prev.filter((it) => it.id !== id));
|
|
3389
3408
|
}, []);
|
|
3390
|
-
const updateQuantity =
|
|
3409
|
+
const updateQuantity = React31.useCallback((id, quantity) => {
|
|
3391
3410
|
setItems(
|
|
3392
3411
|
(prev) => prev.map((it) => it.id === id ? { ...it, quantity: clampQty(quantity, it.max) } : it)
|
|
3393
3412
|
);
|
|
3394
3413
|
}, []);
|
|
3395
|
-
const clearCart =
|
|
3396
|
-
const isInCart =
|
|
3397
|
-
const getItemCount =
|
|
3398
|
-
const getCartTotal =
|
|
3414
|
+
const clearCart = React31.useCallback(() => setItems([]), []);
|
|
3415
|
+
const isInCart = React31.useCallback((id) => items.some((it) => it.id === id), [items]);
|
|
3416
|
+
const getItemCount = React31.useCallback(() => items.reduce((sum, it) => sum + it.quantity, 0), [items]);
|
|
3417
|
+
const getCartTotal = React31.useCallback(
|
|
3399
3418
|
() => items.reduce((sum, it) => sum + it.price * it.quantity, 0),
|
|
3400
3419
|
[items]
|
|
3401
3420
|
);
|
|
3402
|
-
const value =
|
|
3421
|
+
const value = React31.useMemo(
|
|
3403
3422
|
() => ({ items, addToCart, removeFromCart, updateQuantity, clearCart, isInCart, getItemCount, getCartTotal }),
|
|
3404
3423
|
[items, addToCart, removeFromCart, updateQuantity, clearCart, isInCart, getItemCount, getCartTotal]
|
|
3405
3424
|
);
|
|
3406
3425
|
return /* @__PURE__ */ jsxRuntime.jsx(CartContext.Provider, { value, children });
|
|
3407
3426
|
}
|
|
3408
3427
|
function useCart() {
|
|
3409
|
-
const ctx =
|
|
3428
|
+
const ctx = React31.useContext(CartContext);
|
|
3410
3429
|
if (!ctx) {
|
|
3411
3430
|
throw new Error("useCart must be used within a <CartProvider>.");
|
|
3412
3431
|
}
|
|
@@ -3429,7 +3448,7 @@ function CartButton({
|
|
|
3429
3448
|
const { getItemCount } = useCart();
|
|
3430
3449
|
const count = getItemCount();
|
|
3431
3450
|
return /* @__PURE__ */ jsxRuntime.jsx(Badge, { count, max, tone: badgeTone, className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3432
|
-
|
|
3451
|
+
IconButton_default,
|
|
3433
3452
|
{
|
|
3434
3453
|
type: variant,
|
|
3435
3454
|
icon,
|
|
@@ -3748,11 +3767,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
3748
3767
|
|
|
3749
3768
|
// src/form/useForm.ts
|
|
3750
3769
|
function useForm(options = {}) {
|
|
3751
|
-
const ref =
|
|
3770
|
+
const ref = React31.useRef(null);
|
|
3752
3771
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
3753
3772
|
const store = ref.current;
|
|
3754
|
-
|
|
3755
|
-
const make =
|
|
3773
|
+
React31.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
3774
|
+
const make = React31.useCallback(
|
|
3756
3775
|
(kind) => (name, rules) => {
|
|
3757
3776
|
if (rules !== void 0) store.setRule(name, rules);
|
|
3758
3777
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -3782,9 +3801,9 @@ function useForm(options = {}) {
|
|
|
3782
3801
|
fieldTarget: make("target")
|
|
3783
3802
|
};
|
|
3784
3803
|
}
|
|
3785
|
-
var FormContext =
|
|
3804
|
+
var FormContext = React31.createContext(null);
|
|
3786
3805
|
function useFormStore() {
|
|
3787
|
-
const store =
|
|
3806
|
+
const store = React31.useContext(FormContext);
|
|
3788
3807
|
if (!store) {
|
|
3789
3808
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
3790
3809
|
}
|
|
@@ -3798,8 +3817,8 @@ function Form({
|
|
|
3798
3817
|
children,
|
|
3799
3818
|
...rest
|
|
3800
3819
|
}) {
|
|
3801
|
-
const ref =
|
|
3802
|
-
const bypass =
|
|
3820
|
+
const ref = React31.useRef(null);
|
|
3821
|
+
const bypass = React31.useRef(false);
|
|
3803
3822
|
const handleSubmit = async (e) => {
|
|
3804
3823
|
if (bypass.current) {
|
|
3805
3824
|
bypass.current = false;
|
|
@@ -3856,12 +3875,12 @@ function useFormField(name, options = {}) {
|
|
|
3856
3875
|
const store = useFormStore();
|
|
3857
3876
|
const { kind = "value", rules } = options;
|
|
3858
3877
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
3859
|
-
|
|
3878
|
+
React31.useEffect(() => {
|
|
3860
3879
|
return () => {
|
|
3861
3880
|
if (rules !== void 0) store.removeRule(name);
|
|
3862
3881
|
};
|
|
3863
3882
|
}, [store, name]);
|
|
3864
|
-
const snap =
|
|
3883
|
+
const snap = React31.useSyncExternalStore(
|
|
3865
3884
|
store.subscribe,
|
|
3866
3885
|
() => store.getFieldSnapshot(name)
|
|
3867
3886
|
);
|
|
@@ -3873,7 +3892,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
3873
3892
|
}
|
|
3874
3893
|
function useFieldArray(name) {
|
|
3875
3894
|
const store = useFormStore();
|
|
3876
|
-
|
|
3895
|
+
React31.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
3877
3896
|
const arr = store.getValue(name) ?? [];
|
|
3878
3897
|
const keys = store.getKeys(name);
|
|
3879
3898
|
return {
|
|
@@ -3906,7 +3925,7 @@ function TextInput({
|
|
|
3906
3925
|
suffix,
|
|
3907
3926
|
id
|
|
3908
3927
|
}) {
|
|
3909
|
-
const errorId =
|
|
3928
|
+
const errorId = React31.useId();
|
|
3910
3929
|
const hasError = errorMessage != null;
|
|
3911
3930
|
const hasAdornment = prefix != null || suffix != null;
|
|
3912
3931
|
const inputId = htmlFor ?? id;
|
|
@@ -4067,7 +4086,7 @@ function CreditCardForm({
|
|
|
4067
4086
|
className = "",
|
|
4068
4087
|
style
|
|
4069
4088
|
}) {
|
|
4070
|
-
const initial =
|
|
4089
|
+
const initial = React31.useRef({
|
|
4071
4090
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
4072
4091
|
name: defaultValue?.name ?? "",
|
|
4073
4092
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -4076,7 +4095,7 @@ function CreditCardForm({
|
|
|
4076
4095
|
const form = useForm({ initialValues: initial });
|
|
4077
4096
|
const numberStr = String(form.values.number ?? "");
|
|
4078
4097
|
const brand = detectBrand(numberStr);
|
|
4079
|
-
|
|
4098
|
+
React31.useEffect(() => {
|
|
4080
4099
|
onChange?.(toCard(form.values));
|
|
4081
4100
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
4082
4101
|
const numberBind = form.fieldNative("number", {
|
|
@@ -4199,7 +4218,7 @@ function Checkout({
|
|
|
4199
4218
|
] })
|
|
4200
4219
|
] });
|
|
4201
4220
|
}
|
|
4202
|
-
var NotificationContext =
|
|
4221
|
+
var NotificationContext = React31.createContext({
|
|
4203
4222
|
open: () => void 0,
|
|
4204
4223
|
close: () => void 0
|
|
4205
4224
|
});
|
|
@@ -4257,26 +4276,26 @@ function NotificationItem({
|
|
|
4257
4276
|
onClose,
|
|
4258
4277
|
reduced
|
|
4259
4278
|
}) {
|
|
4260
|
-
const [paused, setPaused] =
|
|
4279
|
+
const [paused, setPaused] = React31.useState(false);
|
|
4261
4280
|
const duration = n.duration ?? 4e3;
|
|
4262
4281
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
4263
4282
|
const showProgress = !reduced && isAutoDismissing;
|
|
4264
|
-
const timerRef =
|
|
4265
|
-
const startTimeRef =
|
|
4266
|
-
const remainingRef =
|
|
4267
|
-
const clearTimer =
|
|
4283
|
+
const timerRef = React31.useRef(null);
|
|
4284
|
+
const startTimeRef = React31.useRef(0);
|
|
4285
|
+
const remainingRef = React31.useRef(duration);
|
|
4286
|
+
const clearTimer = React31.useCallback(() => {
|
|
4268
4287
|
if (timerRef.current !== null) {
|
|
4269
4288
|
clearTimeout(timerRef.current);
|
|
4270
4289
|
timerRef.current = null;
|
|
4271
4290
|
}
|
|
4272
4291
|
}, []);
|
|
4273
|
-
const scheduleDismiss =
|
|
4292
|
+
const scheduleDismiss = React31.useCallback((ms) => {
|
|
4274
4293
|
clearTimer();
|
|
4275
4294
|
if (!isAutoDismissing) return;
|
|
4276
4295
|
startTimeRef.current = Date.now();
|
|
4277
4296
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
4278
4297
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
4279
|
-
|
|
4298
|
+
React31.useEffect(() => {
|
|
4280
4299
|
if (paused || !isAutoDismissing) return;
|
|
4281
4300
|
scheduleDismiss(remainingRef.current);
|
|
4282
4301
|
return clearTimer;
|
|
@@ -4359,15 +4378,15 @@ function NotificationProvider({
|
|
|
4359
4378
|
children,
|
|
4360
4379
|
position = "top-right"
|
|
4361
4380
|
}) {
|
|
4362
|
-
const [notifications, setNotifications] =
|
|
4381
|
+
const [notifications, setNotifications] = React31.useState([]);
|
|
4363
4382
|
const reduced = framerMotion.useReducedMotion();
|
|
4364
|
-
const open =
|
|
4383
|
+
const open = React31.useCallback((payload) => {
|
|
4365
4384
|
setNotifications((prev) => [
|
|
4366
4385
|
...prev,
|
|
4367
4386
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
4368
4387
|
]);
|
|
4369
4388
|
}, []);
|
|
4370
|
-
const close =
|
|
4389
|
+
const close = React31.useCallback((id) => {
|
|
4371
4390
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
4372
4391
|
}, []);
|
|
4373
4392
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -4396,7 +4415,7 @@ function NotificationProvider({
|
|
|
4396
4415
|
] });
|
|
4397
4416
|
}
|
|
4398
4417
|
function useNotification() {
|
|
4399
|
-
const { open } =
|
|
4418
|
+
const { open } = React31.useContext(NotificationContext);
|
|
4400
4419
|
return {
|
|
4401
4420
|
info: (props) => open({ type: "info", ...props }),
|
|
4402
4421
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -4513,10 +4532,10 @@ function FadingBase({
|
|
|
4513
4532
|
isMounted = false,
|
|
4514
4533
|
children
|
|
4515
4534
|
}) {
|
|
4516
|
-
const [shouldRender, setShouldRender] =
|
|
4517
|
-
const [visible, setVisible] =
|
|
4518
|
-
const timerRef =
|
|
4519
|
-
|
|
4535
|
+
const [shouldRender, setShouldRender] = React31.useState(isMounted);
|
|
4536
|
+
const [visible, setVisible] = React31.useState(false);
|
|
4537
|
+
const timerRef = React31.useRef(null);
|
|
4538
|
+
React31.useEffect(() => {
|
|
4520
4539
|
if (isMounted) {
|
|
4521
4540
|
setShouldRender(true);
|
|
4522
4541
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -4616,13 +4635,13 @@ function ScalableContainer({
|
|
|
4616
4635
|
expandRatio = 3,
|
|
4617
4636
|
className = ""
|
|
4618
4637
|
}) {
|
|
4619
|
-
const containerRef =
|
|
4620
|
-
const [internalScaled, setInternalScaled] =
|
|
4638
|
+
const containerRef = React31.useRef(null);
|
|
4639
|
+
const [internalScaled, setInternalScaled] = React31.useState(false);
|
|
4621
4640
|
const isScaled = expanded ?? internalScaled;
|
|
4622
4641
|
const reduced = framerMotion.useReducedMotion();
|
|
4623
4642
|
const usePush = expandContainerRef != null;
|
|
4624
|
-
const grownRef =
|
|
4625
|
-
const prevScaled =
|
|
4643
|
+
const grownRef = React31.useRef([]);
|
|
4644
|
+
const prevScaled = React31.useRef(isScaled);
|
|
4626
4645
|
const kickResizeDuringTransition = () => {
|
|
4627
4646
|
if (typeof window === "undefined") return;
|
|
4628
4647
|
const kick = () => window.dispatchEvent(new Event("resize"));
|
|
@@ -4680,14 +4699,14 @@ function ScalableContainer({
|
|
|
4680
4699
|
}
|
|
4681
4700
|
grownRef.current = [];
|
|
4682
4701
|
};
|
|
4683
|
-
|
|
4702
|
+
React31.useEffect(() => {
|
|
4684
4703
|
if (!usePush || isScaled === prevScaled.current) return;
|
|
4685
4704
|
prevScaled.current = isScaled;
|
|
4686
4705
|
if (isScaled) growAncestors();
|
|
4687
4706
|
else restoreAncestors();
|
|
4688
4707
|
kickResizeDuringTransition();
|
|
4689
4708
|
}, [isScaled, usePush]);
|
|
4690
|
-
|
|
4709
|
+
React31.useEffect(() => () => {
|
|
4691
4710
|
for (const { el, parent, prev } of grownRef.current) {
|
|
4692
4711
|
el.style.flexGrow = prev.flexGrow;
|
|
4693
4712
|
el.style.flexBasis = prev.flexBasis;
|
|
@@ -4837,17 +4856,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
4837
4856
|
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)) });
|
|
4838
4857
|
}
|
|
4839
4858
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
4840
|
-
const [activeIndex, setActiveIndex] =
|
|
4841
|
-
const [indexPool, setIndexPool] =
|
|
4842
|
-
const cardRefs =
|
|
4843
|
-
const getIndexes =
|
|
4859
|
+
const [activeIndex, setActiveIndex] = React31.useState(0);
|
|
4860
|
+
const [indexPool, setIndexPool] = React31.useState([]);
|
|
4861
|
+
const cardRefs = React31.useRef([]);
|
|
4862
|
+
const getIndexes = React31.useMemo(() => {
|
|
4844
4863
|
let nextIndex = activeIndex + 1;
|
|
4845
4864
|
let previousIndex = activeIndex - 1;
|
|
4846
4865
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
4847
4866
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
4848
4867
|
return { previousIndex, nextIndex };
|
|
4849
4868
|
}, [activeIndex, items.length]);
|
|
4850
|
-
|
|
4869
|
+
React31.useEffect(() => {
|
|
4851
4870
|
const { nextIndex, previousIndex } = getIndexes;
|
|
4852
4871
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
4853
4872
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -5020,8 +5039,8 @@ function writeDismissed(key) {
|
|
|
5020
5039
|
}
|
|
5021
5040
|
}
|
|
5022
5041
|
function useTargetBbox(ref) {
|
|
5023
|
-
const [bbox, setBbox] =
|
|
5024
|
-
|
|
5042
|
+
const [bbox, setBbox] = React31.useState(null);
|
|
5043
|
+
React31.useLayoutEffect(() => {
|
|
5025
5044
|
const el = ref?.current;
|
|
5026
5045
|
if (!el) {
|
|
5027
5046
|
setBbox(null);
|
|
@@ -5051,7 +5070,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
5051
5070
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
5052
5071
|
}
|
|
5053
5072
|
function useFocusTrap(containerRef, active) {
|
|
5054
|
-
|
|
5073
|
+
React31.useEffect(() => {
|
|
5055
5074
|
if (!active) return;
|
|
5056
5075
|
const el = containerRef.current;
|
|
5057
5076
|
if (!el) return;
|
|
@@ -5090,16 +5109,16 @@ function Wizard({
|
|
|
5090
5109
|
onComplete,
|
|
5091
5110
|
onSkip
|
|
5092
5111
|
}) {
|
|
5093
|
-
const tooltipRef =
|
|
5094
|
-
const tooltipTitleId =
|
|
5095
|
-
const tooltipBodyId =
|
|
5112
|
+
const tooltipRef = React31.useRef(null);
|
|
5113
|
+
const tooltipTitleId = React31.useId();
|
|
5114
|
+
const tooltipBodyId = React31.useId();
|
|
5096
5115
|
const reduced = framerMotion.useReducedMotion();
|
|
5097
|
-
const [open, setOpen] =
|
|
5098
|
-
const [activeIndex, setActiveIndex] =
|
|
5116
|
+
const [open, setOpen] = React31.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
5117
|
+
const [activeIndex, setActiveIndex] = React31.useState(0);
|
|
5099
5118
|
const step = steps[activeIndex];
|
|
5100
5119
|
const bbox = useTargetBbox(step?.stepRef);
|
|
5101
5120
|
useFocusTrap(tooltipRef, open);
|
|
5102
|
-
|
|
5121
|
+
React31.useEffect(() => {
|
|
5103
5122
|
if (!open || !dismissible) return;
|
|
5104
5123
|
const onKey = (e) => {
|
|
5105
5124
|
if (e.key === "Escape") {
|
|
@@ -5110,12 +5129,12 @@ function Wizard({
|
|
|
5110
5129
|
document.addEventListener("keydown", onKey);
|
|
5111
5130
|
return () => document.removeEventListener("keydown", onKey);
|
|
5112
5131
|
}, [open, dismissible]);
|
|
5113
|
-
const handleSkip =
|
|
5132
|
+
const handleSkip = React31.useCallback(() => {
|
|
5114
5133
|
writeDismissed(storageKey);
|
|
5115
5134
|
setOpen(false);
|
|
5116
5135
|
onSkip?.();
|
|
5117
5136
|
}, [storageKey, onSkip]);
|
|
5118
|
-
const handleComplete =
|
|
5137
|
+
const handleComplete = React31.useCallback(() => {
|
|
5119
5138
|
writeDismissed(storageKey);
|
|
5120
5139
|
setOpen(false);
|
|
5121
5140
|
onComplete?.();
|
|
@@ -5258,7 +5277,7 @@ function Wizard({
|
|
|
5258
5277
|
] });
|
|
5259
5278
|
}
|
|
5260
5279
|
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" }) });
|
|
5261
|
-
var SearchInput =
|
|
5280
|
+
var SearchInput = React31__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
5262
5281
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5263
5282
|
"div",
|
|
5264
5283
|
{
|
|
@@ -5493,7 +5512,7 @@ function EditableCell({
|
|
|
5493
5512
|
rowIndex,
|
|
5494
5513
|
onCellEdit
|
|
5495
5514
|
}) {
|
|
5496
|
-
const [editing, setEditing] =
|
|
5515
|
+
const [editing, setEditing] = React31.useState(false);
|
|
5497
5516
|
const value = row[col.keyBind];
|
|
5498
5517
|
const commit = (next) => {
|
|
5499
5518
|
setEditing(false);
|
|
@@ -5541,7 +5560,7 @@ function TableBody({
|
|
|
5541
5560
|
getRowKey,
|
|
5542
5561
|
onCellEdit
|
|
5543
5562
|
}) {
|
|
5544
|
-
const [expanded, setExpanded] =
|
|
5563
|
+
const [expanded, setExpanded] = React31.useState(() => /* @__PURE__ */ new Set());
|
|
5545
5564
|
const reduced = framerMotion.useReducedMotion();
|
|
5546
5565
|
const toggleRow = (rowKey) => {
|
|
5547
5566
|
setExpanded((prev) => {
|
|
@@ -5556,7 +5575,7 @@ function TableBody({
|
|
|
5556
5575
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
5557
5576
|
const rowKey = getRowKey(row, i);
|
|
5558
5577
|
const isExpanded = expanded.has(rowKey);
|
|
5559
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5578
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React31__default.default.Fragment, { children: [
|
|
5560
5579
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5561
5580
|
"tr",
|
|
5562
5581
|
{
|
|
@@ -5668,13 +5687,13 @@ function Table({
|
|
|
5668
5687
|
className = "",
|
|
5669
5688
|
style
|
|
5670
5689
|
}) {
|
|
5671
|
-
const searchRef =
|
|
5672
|
-
const [searchTerm, setSearchTerm] =
|
|
5673
|
-
const [perPage, setPerPage] =
|
|
5690
|
+
const searchRef = React31.useRef(null);
|
|
5691
|
+
const [searchTerm, setSearchTerm] = React31.useState("");
|
|
5692
|
+
const [perPage, setPerPage] = React31.useState(
|
|
5674
5693
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
5675
5694
|
);
|
|
5676
|
-
const [activePage, setActivePage] =
|
|
5677
|
-
const [sortState, setSortState] =
|
|
5695
|
+
const [activePage, setActivePage] = React31.useState(0);
|
|
5696
|
+
const [sortState, setSortState] = React31.useState(defaultSort);
|
|
5678
5697
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
5679
5698
|
const handleSort = (col) => {
|
|
5680
5699
|
const key = col.keyBind;
|
|
@@ -5686,8 +5705,8 @@ function Table({
|
|
|
5686
5705
|
onSortChange?.(next);
|
|
5687
5706
|
};
|
|
5688
5707
|
const debounceMs = search?.debounceMs ?? 0;
|
|
5689
|
-
const [debouncedTerm, setDebouncedTerm] =
|
|
5690
|
-
|
|
5708
|
+
const [debouncedTerm, setDebouncedTerm] = React31.useState("");
|
|
5709
|
+
React31.useEffect(() => {
|
|
5691
5710
|
if (debounceMs <= 0) {
|
|
5692
5711
|
setDebouncedTerm(searchTerm);
|
|
5693
5712
|
return;
|
|
@@ -5696,7 +5715,7 @@ function Table({
|
|
|
5696
5715
|
return () => clearTimeout(t);
|
|
5697
5716
|
}, [searchTerm, debounceMs]);
|
|
5698
5717
|
const term = debounceMs > 0 ? debouncedTerm : searchTerm;
|
|
5699
|
-
const filteredRows =
|
|
5718
|
+
const filteredRows = React31.useMemo(() => {
|
|
5700
5719
|
if (isServerSide || !term) return rows;
|
|
5701
5720
|
if (search?.predicate) return rows.filter((row) => search.predicate(row, term));
|
|
5702
5721
|
const cs = !!search?.caseSensitive;
|
|
@@ -5710,7 +5729,7 @@ function Table({
|
|
|
5710
5729
|
};
|
|
5711
5730
|
return rows.filter((row) => keys ? keys.some((k) => test(row[k])) : Object.values(row).some(test));
|
|
5712
5731
|
}, [rows, term, isServerSide, search?.predicate, search?.caseSensitive, search?.matchMode, search?.keys]);
|
|
5713
|
-
const sortedRows =
|
|
5732
|
+
const sortedRows = React31.useMemo(() => {
|
|
5714
5733
|
if (isServerSide || !sortState) return filteredRows;
|
|
5715
5734
|
const col = columns.find((c) => c.keyBind === sortState.key);
|
|
5716
5735
|
const accessor = col?.sortAccessor ?? ((r) => r[sortState.key]);
|
|
@@ -5718,29 +5737,29 @@ function Table({
|
|
|
5718
5737
|
if (sortState.direction === "desc") out.reverse();
|
|
5719
5738
|
return out;
|
|
5720
5739
|
}, [filteredRows, sortState, isServerSide, columns]);
|
|
5721
|
-
const datasets =
|
|
5740
|
+
const datasets = React31.useMemo(() => {
|
|
5722
5741
|
if (isServerSide) return [rows];
|
|
5723
5742
|
return createDatasets(sortedRows, pagination.enabled ? perPage : null);
|
|
5724
5743
|
}, [sortedRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
5725
|
-
const MAX_PAGE =
|
|
5744
|
+
const MAX_PAGE = React31.useMemo(() => {
|
|
5726
5745
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
5727
5746
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
5728
5747
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
5729
5748
|
return datasets.length ? datasets.length - 1 : 0;
|
|
5730
5749
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
5731
|
-
const currentPageRows =
|
|
5750
|
+
const currentPageRows = React31.useMemo(() => {
|
|
5732
5751
|
if (isServerSide) return rows;
|
|
5733
5752
|
return datasets[activePage] ?? [];
|
|
5734
5753
|
}, [isServerSide, rows, datasets, activePage]);
|
|
5735
|
-
|
|
5754
|
+
React31.useEffect(() => {
|
|
5736
5755
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
5737
5756
|
setPerPage(pagination.perPage);
|
|
5738
5757
|
}
|
|
5739
5758
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
5740
|
-
|
|
5759
|
+
React31.useEffect(() => {
|
|
5741
5760
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
5742
5761
|
}, [isServerSide, pagination.perPage]);
|
|
5743
|
-
|
|
5762
|
+
React31.useEffect(() => {
|
|
5744
5763
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
5745
5764
|
setActivePage(pagination.page - 1);
|
|
5746
5765
|
}, [isServerSide, pagination.page]);
|
|
@@ -5829,7 +5848,7 @@ function TableSkeletonBody({
|
|
|
5829
5848
|
i
|
|
5830
5849
|
)) });
|
|
5831
5850
|
}
|
|
5832
|
-
var useIsoLayoutEffect = typeof window !== "undefined" ?
|
|
5851
|
+
var useIsoLayoutEffect = typeof window !== "undefined" ? React31.useLayoutEffect : React31.useEffect;
|
|
5833
5852
|
function VirtualList({
|
|
5834
5853
|
items,
|
|
5835
5854
|
rowHeight,
|
|
@@ -5846,10 +5865,10 @@ function VirtualList({
|
|
|
5846
5865
|
className = "",
|
|
5847
5866
|
style
|
|
5848
5867
|
}) {
|
|
5849
|
-
const scrollRef =
|
|
5850
|
-
const [scrollTop, setScrollTop] =
|
|
5851
|
-
const [viewport, setViewport] =
|
|
5852
|
-
const [term, setTerm] =
|
|
5868
|
+
const scrollRef = React31.useRef(null);
|
|
5869
|
+
const [scrollTop, setScrollTop] = React31.useState(0);
|
|
5870
|
+
const [viewport, setViewport] = React31.useState(typeof height === "number" ? height : 400);
|
|
5871
|
+
const [term, setTerm] = React31.useState("");
|
|
5853
5872
|
useIsoLayoutEffect(() => {
|
|
5854
5873
|
const el = scrollRef.current;
|
|
5855
5874
|
if (!el) return;
|
|
@@ -5860,7 +5879,7 @@ function VirtualList({
|
|
|
5860
5879
|
ro.observe(el);
|
|
5861
5880
|
return () => ro.disconnect();
|
|
5862
5881
|
}, []);
|
|
5863
|
-
const filtered =
|
|
5882
|
+
const filtered = React31.useMemo(() => {
|
|
5864
5883
|
if (!searchable || !term) return items;
|
|
5865
5884
|
if (filter) return items.filter((it) => filter(it, term));
|
|
5866
5885
|
const needle = term.toLowerCase();
|
|
@@ -5908,7 +5927,7 @@ function VirtualList({
|
|
|
5908
5927
|
] });
|
|
5909
5928
|
}
|
|
5910
5929
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
5911
|
-
const id =
|
|
5930
|
+
const id = React31.useId();
|
|
5912
5931
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5913
5932
|
SwitchPrimitive__namespace.Root,
|
|
5914
5933
|
{
|
|
@@ -6006,8 +6025,8 @@ function FlyoutItems({ items }) {
|
|
|
6006
6025
|
}) });
|
|
6007
6026
|
}
|
|
6008
6027
|
function CollapsedFlyout({ item, trigger }) {
|
|
6009
|
-
const [open, setOpen] =
|
|
6010
|
-
const closeTimer =
|
|
6028
|
+
const [open, setOpen] = React31.useState(false);
|
|
6029
|
+
const closeTimer = React31__default.default.useRef(void 0);
|
|
6011
6030
|
const openNow = () => {
|
|
6012
6031
|
window.clearTimeout(closeTimer.current);
|
|
6013
6032
|
setOpen(true);
|
|
@@ -6016,7 +6035,7 @@ function CollapsedFlyout({ item, trigger }) {
|
|
|
6016
6035
|
window.clearTimeout(closeTimer.current);
|
|
6017
6036
|
closeTimer.current = window.setTimeout(() => setOpen(false), 150);
|
|
6018
6037
|
};
|
|
6019
|
-
|
|
6038
|
+
React31__default.default.useEffect(() => () => window.clearTimeout(closeTimer.current), []);
|
|
6020
6039
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
6021
6040
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6022
6041
|
DropdownMenu2__namespace.Trigger,
|
|
@@ -6054,7 +6073,7 @@ function NavItem({
|
|
|
6054
6073
|
depth = 0
|
|
6055
6074
|
}) {
|
|
6056
6075
|
const hasChildren = !!(item.items && item.items.length);
|
|
6057
|
-
const [open, setOpen] =
|
|
6076
|
+
const [open, setOpen] = React31.useState(item.defaultOpen ?? (hasChildren && hasActiveDescendant(item)));
|
|
6058
6077
|
const handleClick = () => {
|
|
6059
6078
|
if (hasChildren && isExpanded) setOpen((o) => !o);
|
|
6060
6079
|
item.onClick?.();
|
|
@@ -6192,7 +6211,7 @@ function Sidebar({
|
|
|
6192
6211
|
}
|
|
6193
6212
|
) });
|
|
6194
6213
|
}
|
|
6195
|
-
var MegaMenuContext =
|
|
6214
|
+
var MegaMenuContext = React31.createContext({ align: "start" });
|
|
6196
6215
|
function MegaMenu({
|
|
6197
6216
|
children,
|
|
6198
6217
|
align = "start",
|
|
@@ -6223,7 +6242,7 @@ function MegaMenu({
|
|
|
6223
6242
|
}
|
|
6224
6243
|
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";
|
|
6225
6244
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
6226
|
-
const { align } =
|
|
6245
|
+
const { align } = React31.useContext(MegaMenuContext);
|
|
6227
6246
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
6228
6247
|
if (!children) {
|
|
6229
6248
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: cx(TOP_ITEM, className), children: [
|
|
@@ -6308,8 +6327,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
6308
6327
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
6309
6328
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx("min-w-0 rounded-lg bg-surface-raised border border-border p-4 flex flex-col", className), children });
|
|
6310
6329
|
}
|
|
6311
|
-
var elementsOfType = (children, type) =>
|
|
6312
|
-
(c) =>
|
|
6330
|
+
var elementsOfType = (children, type) => React31__default.default.Children.toArray(children).filter(
|
|
6331
|
+
(c) => React31__default.default.isValidElement(c) && c.type === type
|
|
6313
6332
|
);
|
|
6314
6333
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6315
6334
|
"svg",
|
|
@@ -6346,9 +6365,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
6346
6365
|
);
|
|
6347
6366
|
}
|
|
6348
6367
|
function MobilePanel({ panel, onNavigate }) {
|
|
6349
|
-
const nodes =
|
|
6368
|
+
const nodes = React31__default.default.Children.toArray(panel.props.children);
|
|
6350
6369
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
6351
|
-
if (!
|
|
6370
|
+
if (!React31__default.default.isValidElement(node)) return null;
|
|
6352
6371
|
const el = node;
|
|
6353
6372
|
if (el.type === MegaMenuSection) {
|
|
6354
6373
|
const { title, children } = el.props;
|
|
@@ -6367,8 +6386,8 @@ function MegaMenuMobile({
|
|
|
6367
6386
|
children,
|
|
6368
6387
|
label
|
|
6369
6388
|
}) {
|
|
6370
|
-
const [open, setOpen] =
|
|
6371
|
-
const [expanded, setExpanded] =
|
|
6389
|
+
const [open, setOpen] = React31.useState(false);
|
|
6390
|
+
const [expanded, setExpanded] = React31.useState(null);
|
|
6372
6391
|
const items = elementsOfType(children, MegaMenuItem);
|
|
6373
6392
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
6374
6393
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6441,17 +6460,17 @@ function AppShell({
|
|
|
6441
6460
|
children,
|
|
6442
6461
|
className = ""
|
|
6443
6462
|
}) {
|
|
6444
|
-
const [expanded, setExpanded] =
|
|
6445
|
-
const [isMobile, setIsMobile] =
|
|
6446
|
-
const [mobileOpen, setMobileOpen] =
|
|
6447
|
-
|
|
6463
|
+
const [expanded, setExpanded] = React31.useState(sidebarDefaultExpanded);
|
|
6464
|
+
const [isMobile, setIsMobile] = React31.useState(false);
|
|
6465
|
+
const [mobileOpen, setMobileOpen] = React31.useState(false);
|
|
6466
|
+
React31.useEffect(() => {
|
|
6448
6467
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
6449
6468
|
const update = (e) => setIsMobile(e.matches);
|
|
6450
6469
|
update(mq);
|
|
6451
6470
|
mq.addEventListener("change", update);
|
|
6452
6471
|
return () => mq.removeEventListener("change", update);
|
|
6453
6472
|
}, []);
|
|
6454
|
-
|
|
6473
|
+
React31.useEffect(() => {
|
|
6455
6474
|
if (!isMobile) setMobileOpen(false);
|
|
6456
6475
|
}, [isMobile]);
|
|
6457
6476
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -6578,7 +6597,7 @@ function SecureLayout({
|
|
|
6578
6597
|
className = ""
|
|
6579
6598
|
}) {
|
|
6580
6599
|
const reduced = framerMotion.useReducedMotion();
|
|
6581
|
-
const cbs =
|
|
6600
|
+
const cbs = React31.useRef({ canAccess, onGranted, onDeny });
|
|
6582
6601
|
cbs.current = { canAccess, onGranted, onDeny };
|
|
6583
6602
|
const rolesKey = JSON.stringify(roles);
|
|
6584
6603
|
const requiredRolesKey = JSON.stringify(requiredRoles);
|
|
@@ -6593,10 +6612,10 @@ function SecureLayout({
|
|
|
6593
6612
|
if (requiredPermissions?.length && !has(permissions, requiredPermissions, requireAllPermissions)) return false;
|
|
6594
6613
|
return true;
|
|
6595
6614
|
};
|
|
6596
|
-
const [state, setState] =
|
|
6615
|
+
const [state, setState] = React31.useState(
|
|
6597
6616
|
() => !passesSync() ? "denied" : canAccess ? "checking" : "granted"
|
|
6598
6617
|
);
|
|
6599
|
-
|
|
6618
|
+
React31.useEffect(() => {
|
|
6600
6619
|
let cancelled = false;
|
|
6601
6620
|
const { canAccess: check, onGranted: granted, onDeny: deny } = cbs.current;
|
|
6602
6621
|
const finish = (ok) => {
|
|
@@ -6757,10 +6776,10 @@ function ThemeProvider({
|
|
|
6757
6776
|
className = "",
|
|
6758
6777
|
style
|
|
6759
6778
|
}) {
|
|
6760
|
-
const id =
|
|
6779
|
+
const id = React31__default.default.useId().replace(/:/g, "");
|
|
6761
6780
|
const scopeClass = `geo-th-${id}`;
|
|
6762
|
-
const divRef =
|
|
6763
|
-
|
|
6781
|
+
const divRef = React31.useRef(null);
|
|
6782
|
+
React31.useEffect(() => {
|
|
6764
6783
|
const el = divRef.current;
|
|
6765
6784
|
if (!el) return;
|
|
6766
6785
|
if (colorScheme === "auto") return;
|
|
@@ -6775,8 +6794,8 @@ function ThemeProvider({
|
|
|
6775
6794
|
}
|
|
6776
6795
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
6777
6796
|
}, [colorScheme]);
|
|
6778
|
-
const lightVars =
|
|
6779
|
-
const darkVarStr =
|
|
6797
|
+
const lightVars = React31.useMemo(() => toCssVars(theme), [theme]);
|
|
6798
|
+
const darkVarStr = React31.useMemo(() => {
|
|
6780
6799
|
if (!darkTheme) return "";
|
|
6781
6800
|
const dvars = toCssVars(darkTheme);
|
|
6782
6801
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -6818,7 +6837,7 @@ function NumberInput({
|
|
|
6818
6837
|
readOnly = false,
|
|
6819
6838
|
precision
|
|
6820
6839
|
}) {
|
|
6821
|
-
const errorId =
|
|
6840
|
+
const errorId = React31.useId();
|
|
6822
6841
|
const hasError = errorMessage != null;
|
|
6823
6842
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
6824
6843
|
const round = (n) => {
|
|
@@ -6949,8 +6968,8 @@ function Password({
|
|
|
6949
6968
|
showIcon,
|
|
6950
6969
|
hideIcon
|
|
6951
6970
|
}) {
|
|
6952
|
-
const [visible, setVisible] =
|
|
6953
|
-
const errorId =
|
|
6971
|
+
const [visible, setVisible] = React31.useState(false);
|
|
6972
|
+
const errorId = React31.useId();
|
|
6954
6973
|
const hasError = errorMessage != null;
|
|
6955
6974
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6956
6975
|
Field,
|
|
@@ -7050,7 +7069,7 @@ function PasswordStrength({
|
|
|
7050
7069
|
className = "",
|
|
7051
7070
|
style
|
|
7052
7071
|
}) {
|
|
7053
|
-
const { score, label } =
|
|
7072
|
+
const { score, label } = React31.useMemo(() => scorer(value), [scorer, value]);
|
|
7054
7073
|
const showMatch = confirmValue != null && (value.length > 0 || confirmValue.length > 0);
|
|
7055
7074
|
const matches = value.length > 0 && value === confirmValue;
|
|
7056
7075
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cx("flex flex-col gap-2", className), style, "aria-live": "polite", children: [
|
|
@@ -7109,8 +7128,8 @@ function RadioTile({
|
|
|
7109
7128
|
errorMessage,
|
|
7110
7129
|
className
|
|
7111
7130
|
}) {
|
|
7112
|
-
const groupId =
|
|
7113
|
-
const errorId =
|
|
7131
|
+
const groupId = React31.useId();
|
|
7132
|
+
const errorId = React31.useId();
|
|
7114
7133
|
const hasError = errorMessage != null;
|
|
7115
7134
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7116
7135
|
Field,
|
|
@@ -7185,7 +7204,7 @@ function Checkbox({
|
|
|
7185
7204
|
}) {
|
|
7186
7205
|
const isChecked = checked ?? value ?? false;
|
|
7187
7206
|
const labelFirst = labelPosition === "left";
|
|
7188
|
-
const errorId =
|
|
7207
|
+
const errorId = React31.useId();
|
|
7189
7208
|
const hasError = errorMessage != null;
|
|
7190
7209
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
7191
7210
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -7293,8 +7312,8 @@ function RadioGroup({
|
|
|
7293
7312
|
className,
|
|
7294
7313
|
errorMessage
|
|
7295
7314
|
}) {
|
|
7296
|
-
const errorId =
|
|
7297
|
-
const groupId =
|
|
7315
|
+
const errorId = React31.useId();
|
|
7316
|
+
const groupId = React31.useId();
|
|
7298
7317
|
const hasError = errorMessage != null;
|
|
7299
7318
|
const labelFirst = labelPosition === "left";
|
|
7300
7319
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7394,11 +7413,11 @@ function Switch({
|
|
|
7394
7413
|
disabled,
|
|
7395
7414
|
errorMessage
|
|
7396
7415
|
}) {
|
|
7397
|
-
const id =
|
|
7398
|
-
const errorId =
|
|
7416
|
+
const id = React31.useId();
|
|
7417
|
+
const errorId = React31.useId();
|
|
7399
7418
|
const hasError = errorMessage != null;
|
|
7400
7419
|
const isControlled = checked !== void 0;
|
|
7401
|
-
const [internal, setInternal] =
|
|
7420
|
+
const [internal, setInternal] = React31.useState(defaultChecked);
|
|
7402
7421
|
const isOn = isControlled ? checked : internal;
|
|
7403
7422
|
const handle = (c) => {
|
|
7404
7423
|
if (!isControlled) setInternal(c);
|
|
@@ -7474,11 +7493,11 @@ function MultiTagRow({
|
|
|
7474
7493
|
labelFor,
|
|
7475
7494
|
onRemove
|
|
7476
7495
|
}) {
|
|
7477
|
-
const wrapRef =
|
|
7478
|
-
const measureRef =
|
|
7479
|
-
const [visibleCount, setVisibleCount] =
|
|
7496
|
+
const wrapRef = React31.useRef(null);
|
|
7497
|
+
const measureRef = React31.useRef(null);
|
|
7498
|
+
const [visibleCount, setVisibleCount] = React31.useState(values.length);
|
|
7480
7499
|
const key = values.map(String).join("|");
|
|
7481
|
-
|
|
7500
|
+
React31.useLayoutEffect(() => {
|
|
7482
7501
|
const wrap = wrapRef.current;
|
|
7483
7502
|
const measure = measureRef.current;
|
|
7484
7503
|
if (!wrap || !measure) return;
|
|
@@ -7572,16 +7591,16 @@ function Dropdown({
|
|
|
7572
7591
|
size = "md",
|
|
7573
7592
|
className = ""
|
|
7574
7593
|
}) {
|
|
7575
|
-
const [open, setOpen] =
|
|
7576
|
-
const [selectedItems, setSelectedItems] =
|
|
7577
|
-
const [searchTerm, setSearchTerm] =
|
|
7578
|
-
const [innerItems, setInnerItems] =
|
|
7579
|
-
const errorId =
|
|
7594
|
+
const [open, setOpen] = React31.useState(false);
|
|
7595
|
+
const [selectedItems, setSelectedItems] = React31.useState([]);
|
|
7596
|
+
const [searchTerm, setSearchTerm] = React31.useState("");
|
|
7597
|
+
const [innerItems, setInnerItems] = React31.useState([]);
|
|
7598
|
+
const errorId = React31.useId();
|
|
7580
7599
|
const hasError = errorMessage != null;
|
|
7581
|
-
|
|
7600
|
+
React31.useEffect(() => {
|
|
7582
7601
|
setInnerItems(items);
|
|
7583
7602
|
}, [items]);
|
|
7584
|
-
|
|
7603
|
+
React31.useEffect(() => {
|
|
7585
7604
|
if (isMultiselect && Array.isArray(value)) {
|
|
7586
7605
|
setSelectedItems(value);
|
|
7587
7606
|
}
|
|
@@ -7774,19 +7793,19 @@ function AutoComplete({
|
|
|
7774
7793
|
required,
|
|
7775
7794
|
htmlFor
|
|
7776
7795
|
}) {
|
|
7777
|
-
const errorId =
|
|
7796
|
+
const errorId = React31.useId();
|
|
7778
7797
|
const hasError = errorMessage != null;
|
|
7779
|
-
const [term, setTerm] =
|
|
7780
|
-
const [open, setOpen] =
|
|
7781
|
-
const [asyncItems, setAsyncItems] =
|
|
7782
|
-
const [loading, setLoading] =
|
|
7798
|
+
const [term, setTerm] = React31.useState("");
|
|
7799
|
+
const [open, setOpen] = React31.useState(false);
|
|
7800
|
+
const [asyncItems, setAsyncItems] = React31.useState([]);
|
|
7801
|
+
const [loading, setLoading] = React31.useState(false);
|
|
7783
7802
|
const isAsync = typeof onSearch === "function";
|
|
7784
|
-
const debounceRef =
|
|
7785
|
-
const requestIdRef =
|
|
7803
|
+
const debounceRef = React31.useRef(null);
|
|
7804
|
+
const requestIdRef = React31.useRef(0);
|
|
7786
7805
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
7787
7806
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
7788
7807
|
) : [];
|
|
7789
|
-
|
|
7808
|
+
React31.useEffect(() => {
|
|
7790
7809
|
if (!isAsync) return;
|
|
7791
7810
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
7792
7811
|
if (!term.trim()) {
|
|
@@ -7943,15 +7962,15 @@ function TreeSelect({
|
|
|
7943
7962
|
defaultExpandedKeys = [],
|
|
7944
7963
|
size = "md"
|
|
7945
7964
|
}) {
|
|
7946
|
-
const errorId =
|
|
7965
|
+
const errorId = React31.useId();
|
|
7947
7966
|
const hasError = errorMessage != null;
|
|
7948
|
-
const [open, setOpen] =
|
|
7949
|
-
const [expanded, setExpanded] =
|
|
7950
|
-
const [activeIndex, setActiveIndex] =
|
|
7951
|
-
const listRef =
|
|
7952
|
-
const visible =
|
|
7953
|
-
const didSyncOnOpenRef =
|
|
7954
|
-
|
|
7967
|
+
const [open, setOpen] = React31.useState(false);
|
|
7968
|
+
const [expanded, setExpanded] = React31.useState(() => new Set(defaultExpandedKeys));
|
|
7969
|
+
const [activeIndex, setActiveIndex] = React31.useState(0);
|
|
7970
|
+
const listRef = React31.useRef(null);
|
|
7971
|
+
const visible = React31.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
7972
|
+
const didSyncOnOpenRef = React31.useRef(false);
|
|
7973
|
+
React31.useEffect(() => {
|
|
7955
7974
|
if (!open) {
|
|
7956
7975
|
didSyncOnOpenRef.current = false;
|
|
7957
7976
|
return;
|
|
@@ -7961,7 +7980,7 @@ function TreeSelect({
|
|
|
7961
7980
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
7962
7981
|
didSyncOnOpenRef.current = true;
|
|
7963
7982
|
}, [open, value]);
|
|
7964
|
-
const selectedNode =
|
|
7983
|
+
const selectedNode = React31.useMemo(
|
|
7965
7984
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
7966
7985
|
[items, value]
|
|
7967
7986
|
);
|
|
@@ -8193,11 +8212,11 @@ function FileInput({
|
|
|
8193
8212
|
required,
|
|
8194
8213
|
icon
|
|
8195
8214
|
}) {
|
|
8196
|
-
const inputRef =
|
|
8197
|
-
const errorId =
|
|
8198
|
-
const [files, setFiles] =
|
|
8199
|
-
const [dragging, setDragging] =
|
|
8200
|
-
const [sizeError, setSizeError] =
|
|
8215
|
+
const inputRef = React31.useRef(null);
|
|
8216
|
+
const errorId = React31.useId();
|
|
8217
|
+
const [files, setFiles] = React31.useState([]);
|
|
8218
|
+
const [dragging, setDragging] = React31.useState(false);
|
|
8219
|
+
const [sizeError, setSizeError] = React31.useState(null);
|
|
8201
8220
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
8202
8221
|
const openPicker = () => {
|
|
8203
8222
|
if (!disabled) inputRef.current?.click();
|
|
@@ -8388,30 +8407,30 @@ function DatePicker({
|
|
|
8388
8407
|
size = "md",
|
|
8389
8408
|
className = ""
|
|
8390
8409
|
}) {
|
|
8391
|
-
const errorId =
|
|
8410
|
+
const errorId = React31.useId();
|
|
8392
8411
|
const hasError = errorMessage != null;
|
|
8393
|
-
const [open, setOpen] =
|
|
8394
|
-
const [viewMonth, setViewMonth] =
|
|
8395
|
-
const [focusDate, setFocusDate] =
|
|
8396
|
-
const [view, setView] =
|
|
8397
|
-
const gridRef =
|
|
8398
|
-
|
|
8412
|
+
const [open, setOpen] = React31.useState(false);
|
|
8413
|
+
const [viewMonth, setViewMonth] = React31.useState(() => startOfMonth2(value ?? /* @__PURE__ */ new Date()));
|
|
8414
|
+
const [focusDate, setFocusDate] = React31.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
8415
|
+
const [view, setView] = React31.useState("days");
|
|
8416
|
+
const gridRef = React31.useRef(null);
|
|
8417
|
+
React31.useEffect(() => {
|
|
8399
8418
|
if (!open) return;
|
|
8400
8419
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
8401
8420
|
setViewMonth(startOfMonth2(target));
|
|
8402
8421
|
setFocusDate(target);
|
|
8403
8422
|
setView("days");
|
|
8404
8423
|
}, [open, value]);
|
|
8405
|
-
|
|
8424
|
+
React31.useEffect(() => {
|
|
8406
8425
|
if (!open) return;
|
|
8407
8426
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat3(focusDate)}"]`);
|
|
8408
8427
|
cell?.focus();
|
|
8409
8428
|
}, [open, focusDate]);
|
|
8410
|
-
const weekdays =
|
|
8429
|
+
const weekdays = React31.useMemo(() => {
|
|
8411
8430
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
8412
8431
|
return ordered;
|
|
8413
8432
|
}, [weekStartsOn]);
|
|
8414
|
-
const grid =
|
|
8433
|
+
const grid = React31.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
8415
8434
|
const isDisabled = (d) => {
|
|
8416
8435
|
if (min && d < min) return true;
|
|
8417
8436
|
if (max && d > max) return true;
|
|
@@ -8702,10 +8721,10 @@ function TextArea({
|
|
|
8702
8721
|
style,
|
|
8703
8722
|
inputStyle
|
|
8704
8723
|
}) {
|
|
8705
|
-
const errorId =
|
|
8724
|
+
const errorId = React31.useId();
|
|
8706
8725
|
const hasError = errorMessage != null;
|
|
8707
|
-
const ref =
|
|
8708
|
-
|
|
8726
|
+
const ref = React31.useRef(null);
|
|
8727
|
+
React31.useLayoutEffect(() => {
|
|
8709
8728
|
if (!autoGrow) return;
|
|
8710
8729
|
const el = ref.current;
|
|
8711
8730
|
if (!el) return;
|
|
@@ -8777,14 +8796,14 @@ function Slider({
|
|
|
8777
8796
|
name,
|
|
8778
8797
|
htmlFor
|
|
8779
8798
|
}) {
|
|
8780
|
-
const errorId =
|
|
8799
|
+
const errorId = React31.useId();
|
|
8781
8800
|
const hasError = errorMessage != null;
|
|
8782
8801
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
8783
|
-
const [internal, setInternal] =
|
|
8802
|
+
const [internal, setInternal] = React31.useState(
|
|
8784
8803
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
8785
8804
|
);
|
|
8786
8805
|
const current = toArray(value) ?? internal;
|
|
8787
|
-
const [dragging, setDragging] =
|
|
8806
|
+
const [dragging, setDragging] = React31.useState(false);
|
|
8788
8807
|
const emit = (arr) => {
|
|
8789
8808
|
setInternal(arr);
|
|
8790
8809
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -8879,11 +8898,11 @@ function TagsInput({
|
|
|
8879
8898
|
validate,
|
|
8880
8899
|
separators = ["Enter", ","]
|
|
8881
8900
|
}) {
|
|
8882
|
-
const errorId =
|
|
8883
|
-
const inputRef =
|
|
8884
|
-
const [internal, setInternal] =
|
|
8885
|
-
const [draft, setDraft] =
|
|
8886
|
-
const [localError, setLocalError] =
|
|
8901
|
+
const errorId = React31.useId();
|
|
8902
|
+
const inputRef = React31.useRef(null);
|
|
8903
|
+
const [internal, setInternal] = React31.useState(defaultValue ?? []);
|
|
8904
|
+
const [draft, setDraft] = React31.useState("");
|
|
8905
|
+
const [localError, setLocalError] = React31.useState(null);
|
|
8887
8906
|
const tags = value ?? internal;
|
|
8888
8907
|
const hasError = errorMessage != null || localError != null;
|
|
8889
8908
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -9014,9 +9033,9 @@ function OtpInput({
|
|
|
9014
9033
|
className,
|
|
9015
9034
|
groupAfter
|
|
9016
9035
|
}) {
|
|
9017
|
-
const errorId =
|
|
9036
|
+
const errorId = React31.useId();
|
|
9018
9037
|
const hasError = errorMessage != null;
|
|
9019
|
-
const refs =
|
|
9038
|
+
const refs = React31.useRef([]);
|
|
9020
9039
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
9021
9040
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
9022
9041
|
const emit = (next) => {
|
|
@@ -9065,7 +9084,7 @@ function OtpInput({
|
|
|
9065
9084
|
emit(valid.join(""));
|
|
9066
9085
|
focusBox(valid.length);
|
|
9067
9086
|
};
|
|
9068
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9087
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React31__default.default.Fragment, { children: [
|
|
9069
9088
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9070
9089
|
"input",
|
|
9071
9090
|
{
|
|
@@ -9123,9 +9142,9 @@ function Rating({
|
|
|
9123
9142
|
className,
|
|
9124
9143
|
required
|
|
9125
9144
|
}) {
|
|
9126
|
-
const errorId =
|
|
9127
|
-
const [internal, setInternal] =
|
|
9128
|
-
const [hover, setHover] =
|
|
9145
|
+
const errorId = React31.useId();
|
|
9146
|
+
const [internal, setInternal] = React31.useState(defaultValue);
|
|
9147
|
+
const [hover, setHover] = React31.useState(null);
|
|
9129
9148
|
const current = value ?? internal;
|
|
9130
9149
|
const display2 = hover ?? current;
|
|
9131
9150
|
const interactive = !readOnly && !disabled;
|
|
@@ -9248,9 +9267,9 @@ function TimePicker({
|
|
|
9248
9267
|
required,
|
|
9249
9268
|
style
|
|
9250
9269
|
}) {
|
|
9251
|
-
const errorId =
|
|
9270
|
+
const errorId = React31.useId();
|
|
9252
9271
|
const hasError = errorMessage != null;
|
|
9253
|
-
const [open, setOpen] =
|
|
9272
|
+
const [open, setOpen] = React31.useState(false);
|
|
9254
9273
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
9255
9274
|
const update = (next) => {
|
|
9256
9275
|
const merged = { ...parsed, ...next };
|
|
@@ -9375,13 +9394,13 @@ function DateRangePicker({
|
|
|
9375
9394
|
required,
|
|
9376
9395
|
style
|
|
9377
9396
|
}) {
|
|
9378
|
-
const errorId =
|
|
9397
|
+
const errorId = React31.useId();
|
|
9379
9398
|
const hasError = errorMessage != null;
|
|
9380
|
-
const [open, setOpen] =
|
|
9381
|
-
const [leftMonth, setLeftMonth] =
|
|
9382
|
-
const [pendingStart, setPendingStart] =
|
|
9383
|
-
const [hoverDate, setHoverDate] =
|
|
9384
|
-
const weekdays =
|
|
9399
|
+
const [open, setOpen] = React31.useState(false);
|
|
9400
|
+
const [leftMonth, setLeftMonth] = React31.useState(() => startOfMonth3(value.start ?? /* @__PURE__ */ new Date()));
|
|
9401
|
+
const [pendingStart, setPendingStart] = React31.useState(null);
|
|
9402
|
+
const [hoverDate, setHoverDate] = React31.useState(null);
|
|
9403
|
+
const weekdays = React31.useMemo(
|
|
9385
9404
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
9386
9405
|
[weekStartsOn]
|
|
9387
9406
|
);
|
|
@@ -9558,10 +9577,10 @@ function ColorPicker({
|
|
|
9558
9577
|
required,
|
|
9559
9578
|
placeholder = "Pick a colour\u2026"
|
|
9560
9579
|
}) {
|
|
9561
|
-
const errorId =
|
|
9580
|
+
const errorId = React31.useId();
|
|
9562
9581
|
const hasError = errorMessage != null;
|
|
9563
|
-
const [open, setOpen] =
|
|
9564
|
-
const [draft, setDraft] =
|
|
9582
|
+
const [open, setOpen] = React31.useState(false);
|
|
9583
|
+
const [draft, setDraft] = React31.useState(value);
|
|
9565
9584
|
const valid = HEX_RE.test(value);
|
|
9566
9585
|
const pick = (hex) => {
|
|
9567
9586
|
onChange?.(hex);
|
|
@@ -9649,7 +9668,7 @@ function ColorPicker({
|
|
|
9649
9668
|
}
|
|
9650
9669
|
var CUSTOM_EVENT = "oxy-local-storage";
|
|
9651
9670
|
function useLocalStorage(key, initialValue) {
|
|
9652
|
-
const read =
|
|
9671
|
+
const read = React31.useCallback(() => {
|
|
9653
9672
|
if (typeof window === "undefined") return initialValue;
|
|
9654
9673
|
try {
|
|
9655
9674
|
const item = window.localStorage.getItem(key);
|
|
@@ -9658,8 +9677,8 @@ function useLocalStorage(key, initialValue) {
|
|
|
9658
9677
|
return initialValue;
|
|
9659
9678
|
}
|
|
9660
9679
|
}, [key]);
|
|
9661
|
-
const [stored, setStored] =
|
|
9662
|
-
const setValue =
|
|
9680
|
+
const [stored, setStored] = React31.useState(read);
|
|
9681
|
+
const setValue = React31.useCallback((value) => {
|
|
9663
9682
|
setStored((prev) => {
|
|
9664
9683
|
const next = value instanceof Function ? value(prev) : value;
|
|
9665
9684
|
try {
|
|
@@ -9672,7 +9691,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
9672
9691
|
return next;
|
|
9673
9692
|
});
|
|
9674
9693
|
}, [key]);
|
|
9675
|
-
const remove =
|
|
9694
|
+
const remove = React31.useCallback(() => {
|
|
9676
9695
|
try {
|
|
9677
9696
|
if (typeof window !== "undefined") {
|
|
9678
9697
|
window.localStorage.removeItem(key);
|
|
@@ -9682,10 +9701,10 @@ function useLocalStorage(key, initialValue) {
|
|
|
9682
9701
|
}
|
|
9683
9702
|
setStored(initialValue);
|
|
9684
9703
|
}, [key]);
|
|
9685
|
-
|
|
9704
|
+
React31.useEffect(() => {
|
|
9686
9705
|
setStored(read());
|
|
9687
9706
|
}, [key, read]);
|
|
9688
|
-
|
|
9707
|
+
React31.useEffect(() => {
|
|
9689
9708
|
if (typeof window === "undefined") return;
|
|
9690
9709
|
const onStorage = (e) => {
|
|
9691
9710
|
if (e.key === null || e.key === key) setStored(read());
|
|
@@ -9704,8 +9723,8 @@ function useLocalStorage(key, initialValue) {
|
|
|
9704
9723
|
}
|
|
9705
9724
|
function useMediaQuery(query) {
|
|
9706
9725
|
const get = () => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query).matches : false;
|
|
9707
|
-
const [matches, setMatches] =
|
|
9708
|
-
|
|
9726
|
+
const [matches, setMatches] = React31.useState(get);
|
|
9727
|
+
React31.useEffect(() => {
|
|
9709
9728
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
9710
9729
|
const mql = window.matchMedia(query);
|
|
9711
9730
|
const onChange = () => setMatches(mql.matches);
|
|
@@ -9736,8 +9755,8 @@ function decodeSegment(seg) {
|
|
|
9736
9755
|
}
|
|
9737
9756
|
}
|
|
9738
9757
|
function useJwt(token) {
|
|
9739
|
-
const [, tick] =
|
|
9740
|
-
const decoded =
|
|
9758
|
+
const [, tick] = React31.useState(0);
|
|
9759
|
+
const decoded = React31.useMemo(() => {
|
|
9741
9760
|
if (!token) return { payload: null, header: null, exp: null };
|
|
9742
9761
|
const [h, p] = token.split(".");
|
|
9743
9762
|
const header = decodeSegment(h);
|
|
@@ -9745,7 +9764,7 @@ function useJwt(token) {
|
|
|
9745
9764
|
const exp = payload && typeof payload.exp === "number" ? payload.exp : null;
|
|
9746
9765
|
return { payload, header, exp };
|
|
9747
9766
|
}, [token]);
|
|
9748
|
-
|
|
9767
|
+
React31.useEffect(() => {
|
|
9749
9768
|
if (decoded.exp == null) return;
|
|
9750
9769
|
const ms = decoded.exp * 1e3 - Date.now();
|
|
9751
9770
|
if (ms <= 0) return;
|
|
@@ -9919,13 +9938,13 @@ function SlideShow({
|
|
|
9919
9938
|
style
|
|
9920
9939
|
}) {
|
|
9921
9940
|
const reduced = framerMotion.useReducedMotion();
|
|
9922
|
-
const [index, setIndex] =
|
|
9923
|
-
const [paused, setPaused] =
|
|
9941
|
+
const [index, setIndex] = React31.useState(0);
|
|
9942
|
+
const [paused, setPaused] = React31.useState(false);
|
|
9924
9943
|
const count = slides.length;
|
|
9925
9944
|
const idx = count ? (index % count + count) % count : 0;
|
|
9926
|
-
const go =
|
|
9927
|
-
const timer =
|
|
9928
|
-
|
|
9945
|
+
const go = React31.useCallback((d) => setIndex((i) => i + d), []);
|
|
9946
|
+
const timer = React31.useRef(null);
|
|
9947
|
+
React31.useEffect(() => {
|
|
9929
9948
|
if (!autoPlay || paused || count <= 1) return;
|
|
9930
9949
|
timer.current = setInterval(() => setIndex((i) => i + 1), interval);
|
|
9931
9950
|
return () => {
|
|
@@ -10001,7 +10020,7 @@ function Video({
|
|
|
10001
10020
|
className = "",
|
|
10002
10021
|
style
|
|
10003
10022
|
}) {
|
|
10004
|
-
const [playing, setPlaying] =
|
|
10023
|
+
const [playing, setPlaying] = React31.useState(autoPlay);
|
|
10005
10024
|
const frame = cx("relative w-full overflow-hidden bg-backdrop", framed ? "rounded-2xl border border-border shadow-sm" : "", className);
|
|
10006
10025
|
const ratio = aspect.replace("/", " / ");
|
|
10007
10026
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: frame, style: { aspectRatio: ratio, ...style }, children: embedUrl ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10056,7 +10075,7 @@ function Parallax({
|
|
|
10056
10075
|
style
|
|
10057
10076
|
}) {
|
|
10058
10077
|
const reduced = framerMotion.useReducedMotion();
|
|
10059
|
-
const ref =
|
|
10078
|
+
const ref = React31.useRef(null);
|
|
10060
10079
|
const { scrollYProgress } = framerMotion.useScroll({ target: ref, offset: ["start end", "end start"] });
|
|
10061
10080
|
const shift = Math.max(0, Math.min(1, speed)) * 100;
|
|
10062
10081
|
const y = framerMotion.useTransform(scrollYProgress, [0, 1], reduced ? ["0%", "0%"] : [`-${shift / 2}%`, `${shift / 2}%`]);
|
|
@@ -10124,7 +10143,7 @@ function Blog({
|
|
|
10124
10143
|
post.tag != null && !post.image && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "accent", variant: "soft", size: "sm", children: post.tag }) }),
|
|
10125
10144
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-semibold leading-snug text-foreground transition-colors group-hover:text-accent", children: post.title }),
|
|
10126
10145
|
post.excerpt != null && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-3 text-sm leading-relaxed text-foreground-secondary", children: post.excerpt }),
|
|
10127
|
-
meta.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto flex flex-wrap items-center gap-x-2 gap-y-1 pt-3 text-xs text-foreground-muted", children: meta.map((m, j) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10146
|
+
meta.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto flex flex-wrap items-center gap-x-2 gap-y-1 pt-3 text-xs text-foreground-muted", children: meta.map((m, j) => /* @__PURE__ */ jsxRuntime.jsxs(React31__default.default.Fragment, { children: [
|
|
10128
10147
|
j > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
10129
10148
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: m })
|
|
10130
10149
|
] }, j)) })
|
|
@@ -10253,8 +10272,8 @@ function LeadCapture({
|
|
|
10253
10272
|
className = "",
|
|
10254
10273
|
style
|
|
10255
10274
|
}) {
|
|
10256
|
-
const [email, setEmail] =
|
|
10257
|
-
const [done, setDone] =
|
|
10275
|
+
const [email, setEmail] = React31.useState("");
|
|
10276
|
+
const [done, setDone] = React31.useState(false);
|
|
10258
10277
|
const submit = (e) => {
|
|
10259
10278
|
e.preventDefault();
|
|
10260
10279
|
const value = email.trim();
|
|
@@ -10364,7 +10383,7 @@ exports.FormField = FormField;
|
|
|
10364
10383
|
exports.FormStore = FormStore;
|
|
10365
10384
|
exports.Grid = Grid;
|
|
10366
10385
|
exports.GridCard = GridCard;
|
|
10367
|
-
exports.IconButton =
|
|
10386
|
+
exports.IconButton = IconButton_default;
|
|
10368
10387
|
exports.Jumbotron = Jumbotron;
|
|
10369
10388
|
exports.Kbd = Kbd;
|
|
10370
10389
|
exports.LeadCapture = LeadCapture;
|