@geomak/ui 6.2.2 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +307 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -1
- package/dist/index.d.ts +65 -1
- package/dist/index.js +124 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +24 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk255PCZIW_cjs = require('./chunk-255PCZIW.cjs');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var React13 = require('react');
|
|
6
6
|
var reactDom = require('react-dom');
|
|
7
7
|
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
8
8
|
var Dialog = require('@radix-ui/react-dialog');
|
|
9
9
|
var framerMotion = require('framer-motion');
|
|
10
10
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
11
11
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
12
|
-
var
|
|
12
|
+
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
13
13
|
var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
|
|
14
14
|
var Popover = require('@radix-ui/react-popover');
|
|
15
15
|
var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
@@ -39,12 +39,12 @@ function _interopNamespace(e) {
|
|
|
39
39
|
return Object.freeze(n);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var React13__default = /*#__PURE__*/_interopDefault(React13);
|
|
43
43
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
44
44
|
var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
|
|
45
45
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
46
46
|
var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
47
|
-
var
|
|
47
|
+
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
48
48
|
var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenuPrimitive);
|
|
49
49
|
var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
|
|
50
50
|
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
@@ -214,8 +214,8 @@ Icon.Copy = Copy;
|
|
|
214
214
|
Icon.CircleStack = CircleStack;
|
|
215
215
|
var icons_default = Icon;
|
|
216
216
|
function Portal({ children, target }) {
|
|
217
|
-
const [resolved, setResolved] =
|
|
218
|
-
|
|
217
|
+
const [resolved, setResolved] = React13.useState(null);
|
|
218
|
+
React13.useEffect(() => {
|
|
219
219
|
if (target === null) {
|
|
220
220
|
setResolved(null);
|
|
221
221
|
return;
|
|
@@ -648,7 +648,7 @@ function IconButton({
|
|
|
648
648
|
className = "",
|
|
649
649
|
style
|
|
650
650
|
}) {
|
|
651
|
-
const colorScheme =
|
|
651
|
+
const colorScheme = React13.useMemo(() => {
|
|
652
652
|
if (type === "primary") {
|
|
653
653
|
return "bg-accent text-accent-fg hover:bg-accent-hover";
|
|
654
654
|
}
|
|
@@ -960,9 +960,9 @@ function Tooltip({
|
|
|
960
960
|
] }) });
|
|
961
961
|
}
|
|
962
962
|
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
963
|
-
var TabsContext =
|
|
963
|
+
var TabsContext = React13.createContext(null);
|
|
964
964
|
function useTabsContext() {
|
|
965
|
-
const ctx =
|
|
965
|
+
const ctx = React13.useContext(TabsContext);
|
|
966
966
|
if (!ctx) throw new Error("Tabs.List / Tabs.Trigger / Tabs.Panel must be rendered inside <Tabs>.");
|
|
967
967
|
return ctx;
|
|
968
968
|
}
|
|
@@ -984,26 +984,26 @@ function Tabs({
|
|
|
984
984
|
children
|
|
985
985
|
}) {
|
|
986
986
|
const isControlled = value !== void 0;
|
|
987
|
-
const [internal, setInternal] =
|
|
987
|
+
const [internal, setInternal] = React13.useState(defaultValue);
|
|
988
988
|
const current = isControlled ? value : internal;
|
|
989
989
|
const reduced = !!framerMotion.useReducedMotion();
|
|
990
|
-
const indicatorId =
|
|
991
|
-
const select =
|
|
990
|
+
const indicatorId = React13.useId();
|
|
991
|
+
const select = React13.useCallback((next) => {
|
|
992
992
|
if (!isControlled) setInternal(next);
|
|
993
993
|
onValueChange?.(next);
|
|
994
994
|
}, [isControlled, onValueChange]);
|
|
995
|
-
const registry =
|
|
996
|
-
const orderRef =
|
|
997
|
-
const [, bump] =
|
|
998
|
-
const registerTab =
|
|
995
|
+
const registry = React13.useRef(/* @__PURE__ */ new Map());
|
|
996
|
+
const orderRef = React13.useRef(0);
|
|
997
|
+
const [, bump] = React13.useState(0);
|
|
998
|
+
const registerTab = React13.useCallback((val, meta) => {
|
|
999
999
|
const existing = registry.current.get(val);
|
|
1000
1000
|
registry.current.set(val, { ...meta, order: existing?.order ?? orderRef.current++ });
|
|
1001
1001
|
if (!existing) bump((v) => v + 1);
|
|
1002
1002
|
}, []);
|
|
1003
|
-
const unregisterTab =
|
|
1003
|
+
const unregisterTab = React13.useCallback((val) => {
|
|
1004
1004
|
if (registry.current.delete(val)) bump((v) => v + 1);
|
|
1005
1005
|
}, []);
|
|
1006
|
-
const getTabs =
|
|
1006
|
+
const getTabs = React13.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 })), []);
|
|
1007
1007
|
return /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: { value: current, variant, size, orientation, indicatorId, reduced, select, registerTab, unregisterTab, getTabs }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1008
1008
|
TabsPrimitive__namespace.Root,
|
|
1009
1009
|
{
|
|
@@ -1023,10 +1023,10 @@ function Tabs({
|
|
|
1023
1023
|
function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
|
|
1024
1024
|
const { variant, orientation, reduced, value } = useTabsContext();
|
|
1025
1025
|
const horizontal = orientation === "horizontal";
|
|
1026
|
-
const scrollRef =
|
|
1027
|
-
const [edges, setEdges] =
|
|
1026
|
+
const scrollRef = React13.useRef(null);
|
|
1027
|
+
const [edges, setEdges] = React13.useState({ start: false, end: false });
|
|
1028
1028
|
const scrollable = variant !== "segmented";
|
|
1029
|
-
|
|
1029
|
+
React13.useLayoutEffect(() => {
|
|
1030
1030
|
const el = scrollRef.current;
|
|
1031
1031
|
if (!el || !scrollable) return;
|
|
1032
1032
|
const update = () => {
|
|
@@ -1051,13 +1051,13 @@ function TabsList({ children, "aria-label": ariaLabel, className = "" }) {
|
|
|
1051
1051
|
ro.disconnect();
|
|
1052
1052
|
};
|
|
1053
1053
|
}, [horizontal, scrollable, children]);
|
|
1054
|
-
const nudge =
|
|
1054
|
+
const nudge = React13.useCallback((dir) => {
|
|
1055
1055
|
const el = scrollRef.current;
|
|
1056
1056
|
if (!el) return;
|
|
1057
1057
|
const amount = (horizontal ? el.clientWidth : el.clientHeight) * 0.7 * dir;
|
|
1058
1058
|
el.scrollBy({ [horizontal ? "left" : "top"]: amount, behavior: reduced ? "auto" : "smooth" });
|
|
1059
1059
|
}, [horizontal, reduced]);
|
|
1060
|
-
|
|
1060
|
+
React13.useLayoutEffect(() => {
|
|
1061
1061
|
const el = scrollRef.current;
|
|
1062
1062
|
if (!el || !scrollable) return;
|
|
1063
1063
|
const active = el.querySelector("[role=tab][data-state=active]");
|
|
@@ -1115,9 +1115,9 @@ function Chevron({ side, orientation, onClick }) {
|
|
|
1115
1115
|
function OverflowMenu() {
|
|
1116
1116
|
const { getTabs, value, select, orientation } = useTabsContext();
|
|
1117
1117
|
const horizontal = orientation === "horizontal";
|
|
1118
|
-
const [open, setOpen] =
|
|
1119
|
-
const wrapRef =
|
|
1120
|
-
const timer =
|
|
1118
|
+
const [open, setOpen] = React13.useState(false);
|
|
1119
|
+
const wrapRef = React13.useRef(null);
|
|
1120
|
+
const timer = React13.useRef(null);
|
|
1121
1121
|
const openNow = () => {
|
|
1122
1122
|
if (timer.current) clearTimeout(timer.current);
|
|
1123
1123
|
setOpen(true);
|
|
@@ -1125,7 +1125,7 @@ function OverflowMenu() {
|
|
|
1125
1125
|
const closeSoon = () => {
|
|
1126
1126
|
timer.current = setTimeout(() => setOpen(false), 160);
|
|
1127
1127
|
};
|
|
1128
|
-
|
|
1128
|
+
React13.useLayoutEffect(() => {
|
|
1129
1129
|
if (!open) return;
|
|
1130
1130
|
const onDoc = (e) => {
|
|
1131
1131
|
if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
|
|
@@ -1206,7 +1206,7 @@ function TabsTrigger({ value, icon, badge, closeable, onClose, disabled, classNa
|
|
|
1206
1206
|
const isActive = active === value;
|
|
1207
1207
|
const horizontal = orientation === "horizontal";
|
|
1208
1208
|
const sz = SIZE[size];
|
|
1209
|
-
|
|
1209
|
+
React13.useLayoutEffect(() => {
|
|
1210
1210
|
registerTab(value, { label: children, icon, disabled });
|
|
1211
1211
|
return () => unregisterTab(value);
|
|
1212
1212
|
}, [value, children, icon, disabled, registerTab, unregisterTab]);
|
|
@@ -1329,14 +1329,14 @@ function TreeNodeItem({
|
|
|
1329
1329
|
}
|
|
1330
1330
|
const initialOpen = defaultExpandAll || defaultExpandedKeys.includes(item.key) ? [item.key] : [];
|
|
1331
1331
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1332
|
-
|
|
1332
|
+
AccordionPrimitive__namespace.Root,
|
|
1333
1333
|
{
|
|
1334
1334
|
type: "multiple",
|
|
1335
1335
|
defaultValue: initialOpen,
|
|
1336
1336
|
style: { paddingLeft: depth * 12 },
|
|
1337
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1337
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(AccordionPrimitive__namespace.Item, { value: item.key, className: "border-none", children: [
|
|
1338
1338
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1339
|
-
|
|
1339
|
+
AccordionPrimitive__namespace.Trigger,
|
|
1340
1340
|
{
|
|
1341
1341
|
onClick: () => onNodeClick({
|
|
1342
1342
|
isParent: true,
|
|
@@ -1370,7 +1370,7 @@ function TreeNodeItem({
|
|
|
1370
1370
|
]
|
|
1371
1371
|
}
|
|
1372
1372
|
),
|
|
1373
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1373
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Content, { className: "overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-3.5 border-l border-border py-0.5", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1374
1374
|
TreeNodeItem,
|
|
1375
1375
|
{
|
|
1376
1376
|
item: child,
|
|
@@ -1404,7 +1404,102 @@ function Tree({
|
|
|
1404
1404
|
item.key
|
|
1405
1405
|
)) });
|
|
1406
1406
|
}
|
|
1407
|
-
var
|
|
1407
|
+
var AccordionCtx = React13.createContext({ variant: "separated" });
|
|
1408
|
+
function Accordion2({
|
|
1409
|
+
children,
|
|
1410
|
+
type = "single",
|
|
1411
|
+
defaultValue,
|
|
1412
|
+
value,
|
|
1413
|
+
onValueChange,
|
|
1414
|
+
collapsible = true,
|
|
1415
|
+
variant = "separated",
|
|
1416
|
+
className = "",
|
|
1417
|
+
style
|
|
1418
|
+
}) {
|
|
1419
|
+
const common = {
|
|
1420
|
+
className: [
|
|
1421
|
+
variant === "contained" ? "rounded-lg border border-border bg-surface overflow-hidden divide-y divide-border" : "flex flex-col gap-2",
|
|
1422
|
+
className
|
|
1423
|
+
].filter(Boolean).join(" "),
|
|
1424
|
+
style
|
|
1425
|
+
};
|
|
1426
|
+
const inner = /* @__PURE__ */ jsxRuntime.jsx(AccordionCtx.Provider, { value: { variant }, children });
|
|
1427
|
+
if (type === "multiple") {
|
|
1428
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1429
|
+
AccordionPrimitive__namespace.Root,
|
|
1430
|
+
{
|
|
1431
|
+
type: "multiple",
|
|
1432
|
+
defaultValue,
|
|
1433
|
+
value,
|
|
1434
|
+
onValueChange,
|
|
1435
|
+
...common,
|
|
1436
|
+
children: inner
|
|
1437
|
+
}
|
|
1438
|
+
);
|
|
1439
|
+
}
|
|
1440
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1441
|
+
AccordionPrimitive__namespace.Root,
|
|
1442
|
+
{
|
|
1443
|
+
type: "single",
|
|
1444
|
+
collapsible,
|
|
1445
|
+
defaultValue,
|
|
1446
|
+
value,
|
|
1447
|
+
onValueChange,
|
|
1448
|
+
...common,
|
|
1449
|
+
children: inner
|
|
1450
|
+
}
|
|
1451
|
+
);
|
|
1452
|
+
}
|
|
1453
|
+
var Chevron2 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1454
|
+
"svg",
|
|
1455
|
+
{
|
|
1456
|
+
viewBox: "0 0 24 24",
|
|
1457
|
+
fill: "none",
|
|
1458
|
+
stroke: "currentColor",
|
|
1459
|
+
strokeWidth: 2,
|
|
1460
|
+
"aria-hidden": "true",
|
|
1461
|
+
className: "h-4 w-4 flex-shrink-0 text-foreground-muted transition-transform duration-200 group-data-[state=open]/acc:rotate-180 group-data-[state=open]/acc:text-accent",
|
|
1462
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
1463
|
+
}
|
|
1464
|
+
);
|
|
1465
|
+
function AccordionItem({ value, title, icon, children, disabled, className = "" }) {
|
|
1466
|
+
const { variant } = React13.useContext(AccordionCtx);
|
|
1467
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1468
|
+
AccordionPrimitive__namespace.Item,
|
|
1469
|
+
{
|
|
1470
|
+
value,
|
|
1471
|
+
disabled,
|
|
1472
|
+
className: [
|
|
1473
|
+
variant === "separated" ? "rounded-lg border border-border bg-surface overflow-hidden" : "",
|
|
1474
|
+
"data-[disabled]:opacity-60",
|
|
1475
|
+
className
|
|
1476
|
+
].filter(Boolean).join(" "),
|
|
1477
|
+
children: [
|
|
1478
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Header, { className: "m-0", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1479
|
+
AccordionPrimitive__namespace.Trigger,
|
|
1480
|
+
{
|
|
1481
|
+
className: "group/acc flex w-full items-center gap-3 px-4 py-3 text-left select-none\n text-sm font-medium text-foreground transition-colors\n hover:bg-surface-raised data-[state=open]:text-accent\n focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset\n disabled:cursor-not-allowed",
|
|
1482
|
+
children: [
|
|
1483
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5 w-5 flex-shrink-0 items-center justify-center text-foreground-muted group-data-[state=open]/acc:text-accent", children: icon }),
|
|
1484
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 min-w-0", children: title }),
|
|
1485
|
+
Chevron2
|
|
1486
|
+
]
|
|
1487
|
+
}
|
|
1488
|
+
) }),
|
|
1489
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1490
|
+
AccordionPrimitive__namespace.Content,
|
|
1491
|
+
{
|
|
1492
|
+
className: "overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up",
|
|
1493
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pb-4 pt-0 text-sm text-foreground-secondary leading-relaxed", children })
|
|
1494
|
+
}
|
|
1495
|
+
)
|
|
1496
|
+
]
|
|
1497
|
+
}
|
|
1498
|
+
);
|
|
1499
|
+
}
|
|
1500
|
+
Accordion2.Item = AccordionItem;
|
|
1501
|
+
var Accordion_default = Accordion2;
|
|
1502
|
+
var NotificationContext = React13.createContext({
|
|
1408
1503
|
open: () => void 0,
|
|
1409
1504
|
close: () => void 0
|
|
1410
1505
|
});
|
|
@@ -1462,26 +1557,26 @@ function NotificationItem({
|
|
|
1462
1557
|
onClose,
|
|
1463
1558
|
reduced
|
|
1464
1559
|
}) {
|
|
1465
|
-
const [paused, setPaused] =
|
|
1560
|
+
const [paused, setPaused] = React13.useState(false);
|
|
1466
1561
|
const duration = n.duration ?? 4e3;
|
|
1467
1562
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
1468
1563
|
const showProgress = !reduced && isAutoDismissing;
|
|
1469
|
-
const timerRef =
|
|
1470
|
-
const startTimeRef =
|
|
1471
|
-
const remainingRef =
|
|
1472
|
-
const clearTimer =
|
|
1564
|
+
const timerRef = React13.useRef(null);
|
|
1565
|
+
const startTimeRef = React13.useRef(0);
|
|
1566
|
+
const remainingRef = React13.useRef(duration);
|
|
1567
|
+
const clearTimer = React13.useCallback(() => {
|
|
1473
1568
|
if (timerRef.current !== null) {
|
|
1474
1569
|
clearTimeout(timerRef.current);
|
|
1475
1570
|
timerRef.current = null;
|
|
1476
1571
|
}
|
|
1477
1572
|
}, []);
|
|
1478
|
-
const scheduleDismiss =
|
|
1573
|
+
const scheduleDismiss = React13.useCallback((ms) => {
|
|
1479
1574
|
clearTimer();
|
|
1480
1575
|
if (!isAutoDismissing) return;
|
|
1481
1576
|
startTimeRef.current = Date.now();
|
|
1482
1577
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
1483
1578
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
1484
|
-
|
|
1579
|
+
React13.useEffect(() => {
|
|
1485
1580
|
if (paused || !isAutoDismissing) return;
|
|
1486
1581
|
scheduleDismiss(remainingRef.current);
|
|
1487
1582
|
return clearTimer;
|
|
@@ -1564,15 +1659,15 @@ function NotificationProvider({
|
|
|
1564
1659
|
children,
|
|
1565
1660
|
position = "top-right"
|
|
1566
1661
|
}) {
|
|
1567
|
-
const [notifications, setNotifications] =
|
|
1662
|
+
const [notifications, setNotifications] = React13.useState([]);
|
|
1568
1663
|
const reduced = framerMotion.useReducedMotion();
|
|
1569
|
-
const open =
|
|
1664
|
+
const open = React13.useCallback((payload) => {
|
|
1570
1665
|
setNotifications((prev) => [
|
|
1571
1666
|
...prev,
|
|
1572
1667
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
1573
1668
|
]);
|
|
1574
1669
|
}, []);
|
|
1575
|
-
const close =
|
|
1670
|
+
const close = React13.useCallback((id) => {
|
|
1576
1671
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
1577
1672
|
}, []);
|
|
1578
1673
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -1601,7 +1696,7 @@ function NotificationProvider({
|
|
|
1601
1696
|
] });
|
|
1602
1697
|
}
|
|
1603
1698
|
function useNotification() {
|
|
1604
|
-
const { open } =
|
|
1699
|
+
const { open } = React13.useContext(NotificationContext);
|
|
1605
1700
|
return {
|
|
1606
1701
|
info: (props) => open({ type: "info", ...props }),
|
|
1607
1702
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -1718,10 +1813,10 @@ function FadingBase({
|
|
|
1718
1813
|
isMounted = false,
|
|
1719
1814
|
children
|
|
1720
1815
|
}) {
|
|
1721
|
-
const [shouldRender, setShouldRender] =
|
|
1722
|
-
const [visible, setVisible] =
|
|
1723
|
-
const timerRef =
|
|
1724
|
-
|
|
1816
|
+
const [shouldRender, setShouldRender] = React13.useState(isMounted);
|
|
1817
|
+
const [visible, setVisible] = React13.useState(false);
|
|
1818
|
+
const timerRef = React13.useRef(null);
|
|
1819
|
+
React13.useEffect(() => {
|
|
1725
1820
|
if (isMounted) {
|
|
1726
1821
|
setShouldRender(true);
|
|
1727
1822
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -1819,8 +1914,8 @@ function ScalableContainer({
|
|
|
1819
1914
|
togglePosition = "top-right",
|
|
1820
1915
|
className = ""
|
|
1821
1916
|
}) {
|
|
1822
|
-
const containerRef =
|
|
1823
|
-
const [internalScaled, setInternalScaled] =
|
|
1917
|
+
const containerRef = React13.useRef(null);
|
|
1918
|
+
const [internalScaled, setInternalScaled] = React13.useState(false);
|
|
1824
1919
|
const isScaled = expanded ?? internalScaled;
|
|
1825
1920
|
const reduced = framerMotion.useReducedMotion();
|
|
1826
1921
|
const onToggle = () => {
|
|
@@ -1958,17 +2053,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
1958
2053
|
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)) });
|
|
1959
2054
|
}
|
|
1960
2055
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
1961
|
-
const [activeIndex, setActiveIndex] =
|
|
1962
|
-
const [indexPool, setIndexPool] =
|
|
1963
|
-
const cardRefs =
|
|
1964
|
-
const getIndexes =
|
|
2056
|
+
const [activeIndex, setActiveIndex] = React13.useState(0);
|
|
2057
|
+
const [indexPool, setIndexPool] = React13.useState([]);
|
|
2058
|
+
const cardRefs = React13.useRef([]);
|
|
2059
|
+
const getIndexes = React13.useMemo(() => {
|
|
1965
2060
|
let nextIndex = activeIndex + 1;
|
|
1966
2061
|
let previousIndex = activeIndex - 1;
|
|
1967
2062
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
1968
2063
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
1969
2064
|
return { previousIndex, nextIndex };
|
|
1970
2065
|
}, [activeIndex, items.length]);
|
|
1971
|
-
|
|
2066
|
+
React13.useEffect(() => {
|
|
1972
2067
|
const { nextIndex, previousIndex } = getIndexes;
|
|
1973
2068
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
1974
2069
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -2141,8 +2236,8 @@ function writeDismissed(key) {
|
|
|
2141
2236
|
}
|
|
2142
2237
|
}
|
|
2143
2238
|
function useTargetBbox(ref) {
|
|
2144
|
-
const [bbox, setBbox] =
|
|
2145
|
-
|
|
2239
|
+
const [bbox, setBbox] = React13.useState(null);
|
|
2240
|
+
React13.useLayoutEffect(() => {
|
|
2146
2241
|
const el = ref?.current;
|
|
2147
2242
|
if (!el) {
|
|
2148
2243
|
setBbox(null);
|
|
@@ -2172,7 +2267,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
2172
2267
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
2173
2268
|
}
|
|
2174
2269
|
function useFocusTrap(containerRef, active) {
|
|
2175
|
-
|
|
2270
|
+
React13.useEffect(() => {
|
|
2176
2271
|
if (!active) return;
|
|
2177
2272
|
const el = containerRef.current;
|
|
2178
2273
|
if (!el) return;
|
|
@@ -2211,16 +2306,16 @@ function Wizard({
|
|
|
2211
2306
|
onComplete,
|
|
2212
2307
|
onSkip
|
|
2213
2308
|
}) {
|
|
2214
|
-
const tooltipRef =
|
|
2215
|
-
const tooltipTitleId =
|
|
2216
|
-
const tooltipBodyId =
|
|
2309
|
+
const tooltipRef = React13.useRef(null);
|
|
2310
|
+
const tooltipTitleId = React13.useId();
|
|
2311
|
+
const tooltipBodyId = React13.useId();
|
|
2217
2312
|
const reduced = framerMotion.useReducedMotion();
|
|
2218
|
-
const [open, setOpen] =
|
|
2219
|
-
const [activeIndex, setActiveIndex] =
|
|
2313
|
+
const [open, setOpen] = React13.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
2314
|
+
const [activeIndex, setActiveIndex] = React13.useState(0);
|
|
2220
2315
|
const step = steps[activeIndex];
|
|
2221
2316
|
const bbox = useTargetBbox(step?.stepRef);
|
|
2222
2317
|
useFocusTrap(tooltipRef, open);
|
|
2223
|
-
|
|
2318
|
+
React13.useEffect(() => {
|
|
2224
2319
|
if (!open || !dismissible) return;
|
|
2225
2320
|
const onKey = (e) => {
|
|
2226
2321
|
if (e.key === "Escape") {
|
|
@@ -2231,12 +2326,12 @@ function Wizard({
|
|
|
2231
2326
|
document.addEventListener("keydown", onKey);
|
|
2232
2327
|
return () => document.removeEventListener("keydown", onKey);
|
|
2233
2328
|
}, [open, dismissible]);
|
|
2234
|
-
const handleSkip =
|
|
2329
|
+
const handleSkip = React13.useCallback(() => {
|
|
2235
2330
|
writeDismissed(storageKey);
|
|
2236
2331
|
setOpen(false);
|
|
2237
2332
|
onSkip?.();
|
|
2238
2333
|
}, [storageKey, onSkip]);
|
|
2239
|
-
const handleComplete =
|
|
2334
|
+
const handleComplete = React13.useCallback(() => {
|
|
2240
2335
|
writeDismissed(storageKey);
|
|
2241
2336
|
setOpen(false);
|
|
2242
2337
|
onComplete?.();
|
|
@@ -2507,7 +2602,7 @@ function Field({
|
|
|
2507
2602
|
);
|
|
2508
2603
|
}
|
|
2509
2604
|
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" }) });
|
|
2510
|
-
var SearchInput =
|
|
2605
|
+
var SearchInput = React13__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
2511
2606
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2512
2607
|
"div",
|
|
2513
2608
|
{
|
|
@@ -2561,11 +2656,11 @@ function MultiTagRow({
|
|
|
2561
2656
|
labelFor,
|
|
2562
2657
|
onRemove
|
|
2563
2658
|
}) {
|
|
2564
|
-
const wrapRef =
|
|
2565
|
-
const measureRef =
|
|
2566
|
-
const [visibleCount, setVisibleCount] =
|
|
2659
|
+
const wrapRef = React13.useRef(null);
|
|
2660
|
+
const measureRef = React13.useRef(null);
|
|
2661
|
+
const [visibleCount, setVisibleCount] = React13.useState(values.length);
|
|
2567
2662
|
const key = values.map(String).join("|");
|
|
2568
|
-
|
|
2663
|
+
React13.useLayoutEffect(() => {
|
|
2569
2664
|
const wrap = wrapRef.current;
|
|
2570
2665
|
const measure = measureRef.current;
|
|
2571
2666
|
if (!wrap || !measure) return;
|
|
@@ -2659,16 +2754,16 @@ function Dropdown({
|
|
|
2659
2754
|
size = "md",
|
|
2660
2755
|
className = ""
|
|
2661
2756
|
}) {
|
|
2662
|
-
const [open, setOpen] =
|
|
2663
|
-
const [selectedItems, setSelectedItems] =
|
|
2664
|
-
const [searchTerm, setSearchTerm] =
|
|
2665
|
-
const [innerItems, setInnerItems] =
|
|
2666
|
-
const errorId =
|
|
2757
|
+
const [open, setOpen] = React13.useState(false);
|
|
2758
|
+
const [selectedItems, setSelectedItems] = React13.useState([]);
|
|
2759
|
+
const [searchTerm, setSearchTerm] = React13.useState("");
|
|
2760
|
+
const [innerItems, setInnerItems] = React13.useState([]);
|
|
2761
|
+
const errorId = React13.useId();
|
|
2667
2762
|
const hasError = errorMessage != null;
|
|
2668
|
-
|
|
2763
|
+
React13.useEffect(() => {
|
|
2669
2764
|
setInnerItems(items);
|
|
2670
2765
|
}, [items]);
|
|
2671
|
-
|
|
2766
|
+
React13.useEffect(() => {
|
|
2672
2767
|
if (isMultiselect && Array.isArray(value)) {
|
|
2673
2768
|
setSelectedItems(value);
|
|
2674
2769
|
}
|
|
@@ -2993,7 +3088,8 @@ function TableBody({
|
|
|
2993
3088
|
expandRow,
|
|
2994
3089
|
getRowKey
|
|
2995
3090
|
}) {
|
|
2996
|
-
const [expanded, setExpanded] =
|
|
3091
|
+
const [expanded, setExpanded] = React13.useState(() => /* @__PURE__ */ new Set());
|
|
3092
|
+
const reduced = framerMotion.useReducedMotion();
|
|
2997
3093
|
const toggleRow = (rowKey) => {
|
|
2998
3094
|
setExpanded((prev) => {
|
|
2999
3095
|
const next = new Set(prev);
|
|
@@ -3007,7 +3103,7 @@ function TableBody({
|
|
|
3007
3103
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
3008
3104
|
const rowKey = getRowKey(row, i);
|
|
3009
3105
|
const isExpanded = expanded.has(rowKey);
|
|
3010
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3106
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React13__default.default.Fragment, { children: [
|
|
3011
3107
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3012
3108
|
"tr",
|
|
3013
3109
|
{
|
|
@@ -3035,7 +3131,19 @@ function TableBody({
|
|
|
3035
3131
|
]
|
|
3036
3132
|
}
|
|
3037
3133
|
),
|
|
3038
|
-
hasExpand &&
|
|
3134
|
+
hasExpand && /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "bg-surface", children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: expandColCount, className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: isExpanded && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3135
|
+
framerMotion.motion.div,
|
|
3136
|
+
{
|
|
3137
|
+
initial: { height: 0, opacity: 0 },
|
|
3138
|
+
animate: { height: "auto", opacity: 1 },
|
|
3139
|
+
exit: { height: 0, opacity: 0 },
|
|
3140
|
+
transition: reduced ? { duration: 0 } : { height: { duration: 0.28, ease: [0.16, 1, 0.3, 1] }, opacity: { duration: 0.2 } },
|
|
3141
|
+
style: { overflow: "hidden" },
|
|
3142
|
+
className: "border-b border-border",
|
|
3143
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3", children: expandRow.expandComponent?.(row) })
|
|
3144
|
+
},
|
|
3145
|
+
"expand"
|
|
3146
|
+
) }) }) })
|
|
3039
3147
|
] }, rowKey);
|
|
3040
3148
|
}) });
|
|
3041
3149
|
}
|
|
@@ -3051,9 +3159,9 @@ function Pagination({
|
|
|
3051
3159
|
const matchedOption = picker.find(
|
|
3052
3160
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
3053
3161
|
);
|
|
3054
|
-
const [perPageKey, setPerPageKey] =
|
|
3162
|
+
const [perPageKey, setPerPageKey] = React13.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
3055
3163
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
3056
|
-
|
|
3164
|
+
React13.useEffect(() => {
|
|
3057
3165
|
if (serverSide && options.perPage != null) {
|
|
3058
3166
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
3059
3167
|
if (next) setPerPageKey(next.key);
|
|
@@ -3117,14 +3225,14 @@ function Table({
|
|
|
3117
3225
|
className = "",
|
|
3118
3226
|
style
|
|
3119
3227
|
}) {
|
|
3120
|
-
const searchRef =
|
|
3121
|
-
const [searchTerm, setSearchTerm] =
|
|
3122
|
-
const [perPage, setPerPage] =
|
|
3228
|
+
const searchRef = React13.useRef(null);
|
|
3229
|
+
const [searchTerm, setSearchTerm] = React13.useState("");
|
|
3230
|
+
const [perPage, setPerPage] = React13.useState(
|
|
3123
3231
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
3124
3232
|
);
|
|
3125
|
-
const [activePage, setActivePage] =
|
|
3233
|
+
const [activePage, setActivePage] = React13.useState(0);
|
|
3126
3234
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
3127
|
-
const filteredRows =
|
|
3235
|
+
const filteredRows = React13.useMemo(() => {
|
|
3128
3236
|
if (isServerSide || !searchTerm) return rows;
|
|
3129
3237
|
const term = searchTerm.toLowerCase();
|
|
3130
3238
|
return rows.filter(
|
|
@@ -3133,29 +3241,29 @@ function Table({
|
|
|
3133
3241
|
)
|
|
3134
3242
|
);
|
|
3135
3243
|
}, [rows, searchTerm, isServerSide]);
|
|
3136
|
-
const datasets =
|
|
3244
|
+
const datasets = React13.useMemo(() => {
|
|
3137
3245
|
if (isServerSide) return [rows];
|
|
3138
3246
|
return createDatasets(filteredRows, pagination.enabled ? perPage : null);
|
|
3139
3247
|
}, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
3140
|
-
const MAX_PAGE =
|
|
3248
|
+
const MAX_PAGE = React13.useMemo(() => {
|
|
3141
3249
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
3142
3250
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
3143
3251
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
3144
3252
|
return datasets.length ? datasets.length - 1 : 0;
|
|
3145
3253
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
3146
|
-
const currentPageRows =
|
|
3254
|
+
const currentPageRows = React13.useMemo(() => {
|
|
3147
3255
|
if (isServerSide) return rows;
|
|
3148
3256
|
return datasets[activePage] ?? [];
|
|
3149
3257
|
}, [isServerSide, rows, datasets, activePage]);
|
|
3150
|
-
|
|
3258
|
+
React13.useEffect(() => {
|
|
3151
3259
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
3152
3260
|
setPerPage(pagination.perPage);
|
|
3153
3261
|
}
|
|
3154
3262
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
3155
|
-
|
|
3263
|
+
React13.useEffect(() => {
|
|
3156
3264
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
3157
3265
|
}, [isServerSide, pagination.perPage]);
|
|
3158
|
-
|
|
3266
|
+
React13.useEffect(() => {
|
|
3159
3267
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
3160
3268
|
setActivePage(pagination.page - 1);
|
|
3161
3269
|
}, [isServerSide, pagination.page]);
|
|
@@ -3239,7 +3347,7 @@ function TableSkeletonBody({
|
|
|
3239
3347
|
)) });
|
|
3240
3348
|
}
|
|
3241
3349
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
3242
|
-
const id =
|
|
3350
|
+
const id = React13.useId();
|
|
3243
3351
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3244
3352
|
SwitchPrimitive__namespace.Root,
|
|
3245
3353
|
{
|
|
@@ -3423,7 +3531,7 @@ function Sidebar({
|
|
|
3423
3531
|
}
|
|
3424
3532
|
) });
|
|
3425
3533
|
}
|
|
3426
|
-
var MegaMenuContext =
|
|
3534
|
+
var MegaMenuContext = React13.createContext({ align: "start" });
|
|
3427
3535
|
function MegaMenu({
|
|
3428
3536
|
children,
|
|
3429
3537
|
align = "start",
|
|
@@ -3454,7 +3562,7 @@ function MegaMenu({
|
|
|
3454
3562
|
}
|
|
3455
3563
|
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";
|
|
3456
3564
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
3457
|
-
const { align } =
|
|
3565
|
+
const { align } = React13.useContext(MegaMenuContext);
|
|
3458
3566
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
3459
3567
|
if (!children) {
|
|
3460
3568
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
|
|
@@ -3539,8 +3647,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
3539
3647
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
3540
3648
|
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 });
|
|
3541
3649
|
}
|
|
3542
|
-
var elementsOfType = (children, type) =>
|
|
3543
|
-
(c) =>
|
|
3650
|
+
var elementsOfType = (children, type) => React13__default.default.Children.toArray(children).filter(
|
|
3651
|
+
(c) => React13__default.default.isValidElement(c) && c.type === type
|
|
3544
3652
|
);
|
|
3545
3653
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3546
3654
|
"svg",
|
|
@@ -3577,9 +3685,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
3577
3685
|
);
|
|
3578
3686
|
}
|
|
3579
3687
|
function MobilePanel({ panel, onNavigate }) {
|
|
3580
|
-
const nodes =
|
|
3688
|
+
const nodes = React13__default.default.Children.toArray(panel.props.children);
|
|
3581
3689
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
3582
|
-
if (!
|
|
3690
|
+
if (!React13__default.default.isValidElement(node)) return null;
|
|
3583
3691
|
const el = node;
|
|
3584
3692
|
if (el.type === MegaMenuSection) {
|
|
3585
3693
|
const { title, children } = el.props;
|
|
@@ -3598,8 +3706,8 @@ function MegaMenuMobile({
|
|
|
3598
3706
|
children,
|
|
3599
3707
|
label
|
|
3600
3708
|
}) {
|
|
3601
|
-
const [open, setOpen] =
|
|
3602
|
-
const [expanded, setExpanded] =
|
|
3709
|
+
const [open, setOpen] = React13.useState(false);
|
|
3710
|
+
const [expanded, setExpanded] = React13.useState(null);
|
|
3603
3711
|
const items = elementsOfType(children, MegaMenuItem);
|
|
3604
3712
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
3605
3713
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3672,17 +3780,17 @@ function AppShell({
|
|
|
3672
3780
|
children,
|
|
3673
3781
|
className = ""
|
|
3674
3782
|
}) {
|
|
3675
|
-
const [expanded, setExpanded] =
|
|
3676
|
-
const [isMobile, setIsMobile] =
|
|
3677
|
-
const [mobileOpen, setMobileOpen] =
|
|
3678
|
-
|
|
3783
|
+
const [expanded, setExpanded] = React13.useState(sidebarDefaultExpanded);
|
|
3784
|
+
const [isMobile, setIsMobile] = React13.useState(false);
|
|
3785
|
+
const [mobileOpen, setMobileOpen] = React13.useState(false);
|
|
3786
|
+
React13.useEffect(() => {
|
|
3679
3787
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
3680
3788
|
const update = (e) => setIsMobile(e.matches);
|
|
3681
3789
|
update(mq);
|
|
3682
3790
|
mq.addEventListener("change", update);
|
|
3683
3791
|
return () => mq.removeEventListener("change", update);
|
|
3684
3792
|
}, []);
|
|
3685
|
-
|
|
3793
|
+
React13.useEffect(() => {
|
|
3686
3794
|
if (!isMobile) setMobileOpen(false);
|
|
3687
3795
|
}, [isMobile]);
|
|
3688
3796
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -3872,10 +3980,10 @@ function ThemeProvider({
|
|
|
3872
3980
|
className = "",
|
|
3873
3981
|
style
|
|
3874
3982
|
}) {
|
|
3875
|
-
const id =
|
|
3983
|
+
const id = React13__default.default.useId().replace(/:/g, "");
|
|
3876
3984
|
const scopeClass = `geo-th-${id}`;
|
|
3877
|
-
const divRef =
|
|
3878
|
-
|
|
3985
|
+
const divRef = React13.useRef(null);
|
|
3986
|
+
React13.useEffect(() => {
|
|
3879
3987
|
const el = divRef.current;
|
|
3880
3988
|
if (!el) return;
|
|
3881
3989
|
if (colorScheme === "auto") return;
|
|
@@ -3890,8 +3998,8 @@ function ThemeProvider({
|
|
|
3890
3998
|
}
|
|
3891
3999
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
3892
4000
|
}, [colorScheme]);
|
|
3893
|
-
const lightVars =
|
|
3894
|
-
const darkVarStr =
|
|
4001
|
+
const lightVars = React13.useMemo(() => toCssVars(theme), [theme]);
|
|
4002
|
+
const darkVarStr = React13.useMemo(() => {
|
|
3895
4003
|
if (!darkTheme) return "";
|
|
3896
4004
|
const dvars = toCssVars(darkTheme);
|
|
3897
4005
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -3931,7 +4039,7 @@ function TextInput({
|
|
|
3931
4039
|
prefix,
|
|
3932
4040
|
suffix
|
|
3933
4041
|
}) {
|
|
3934
|
-
const errorId =
|
|
4042
|
+
const errorId = React13.useId();
|
|
3935
4043
|
const hasError = errorMessage != null;
|
|
3936
4044
|
const hasAdornment = prefix != null || suffix != null;
|
|
3937
4045
|
const input = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4001,7 +4109,7 @@ function NumberInput({
|
|
|
4001
4109
|
readOnly = false,
|
|
4002
4110
|
precision
|
|
4003
4111
|
}) {
|
|
4004
|
-
const errorId =
|
|
4112
|
+
const errorId = React13.useId();
|
|
4005
4113
|
const hasError = errorMessage != null;
|
|
4006
4114
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
4007
4115
|
const round = (n) => {
|
|
@@ -4132,8 +4240,8 @@ function Password({
|
|
|
4132
4240
|
showIcon,
|
|
4133
4241
|
hideIcon
|
|
4134
4242
|
}) {
|
|
4135
|
-
const [visible, setVisible] =
|
|
4136
|
-
const errorId =
|
|
4243
|
+
const [visible, setVisible] = React13.useState(false);
|
|
4244
|
+
const errorId = React13.useId();
|
|
4137
4245
|
const hasError = errorMessage != null;
|
|
4138
4246
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4139
4247
|
Field,
|
|
@@ -4206,7 +4314,7 @@ function Checkbox({
|
|
|
4206
4314
|
}) {
|
|
4207
4315
|
const isChecked = checked ?? value ?? false;
|
|
4208
4316
|
const labelFirst = labelPosition === "left";
|
|
4209
|
-
const errorId =
|
|
4317
|
+
const errorId = React13.useId();
|
|
4210
4318
|
const hasError = errorMessage != null;
|
|
4211
4319
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4212
4320
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -4314,8 +4422,8 @@ function RadioGroup({
|
|
|
4314
4422
|
className,
|
|
4315
4423
|
errorMessage
|
|
4316
4424
|
}) {
|
|
4317
|
-
const errorId =
|
|
4318
|
-
const groupId =
|
|
4425
|
+
const errorId = React13.useId();
|
|
4426
|
+
const groupId = React13.useId();
|
|
4319
4427
|
const hasError = errorMessage != null;
|
|
4320
4428
|
const labelFirst = labelPosition === "left";
|
|
4321
4429
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4415,11 +4523,11 @@ function Switch({
|
|
|
4415
4523
|
disabled,
|
|
4416
4524
|
errorMessage
|
|
4417
4525
|
}) {
|
|
4418
|
-
const id =
|
|
4419
|
-
const errorId =
|
|
4526
|
+
const id = React13.useId();
|
|
4527
|
+
const errorId = React13.useId();
|
|
4420
4528
|
const hasError = errorMessage != null;
|
|
4421
4529
|
const isControlled = checked !== void 0;
|
|
4422
|
-
const [internal, setInternal] =
|
|
4530
|
+
const [internal, setInternal] = React13.useState(defaultChecked);
|
|
4423
4531
|
const isOn = isControlled ? checked : internal;
|
|
4424
4532
|
const handle = (c) => {
|
|
4425
4533
|
if (!isControlled) setInternal(c);
|
|
@@ -4492,19 +4600,19 @@ function AutoComplete({
|
|
|
4492
4600
|
required,
|
|
4493
4601
|
htmlFor
|
|
4494
4602
|
}) {
|
|
4495
|
-
const errorId =
|
|
4603
|
+
const errorId = React13.useId();
|
|
4496
4604
|
const hasError = errorMessage != null;
|
|
4497
|
-
const [term, setTerm] =
|
|
4498
|
-
const [open, setOpen] =
|
|
4499
|
-
const [asyncItems, setAsyncItems] =
|
|
4500
|
-
const [loading, setLoading] =
|
|
4605
|
+
const [term, setTerm] = React13.useState("");
|
|
4606
|
+
const [open, setOpen] = React13.useState(false);
|
|
4607
|
+
const [asyncItems, setAsyncItems] = React13.useState([]);
|
|
4608
|
+
const [loading, setLoading] = React13.useState(false);
|
|
4501
4609
|
const isAsync = typeof onSearch === "function";
|
|
4502
|
-
const debounceRef =
|
|
4503
|
-
const requestIdRef =
|
|
4610
|
+
const debounceRef = React13.useRef(null);
|
|
4611
|
+
const requestIdRef = React13.useRef(0);
|
|
4504
4612
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
4505
4613
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
4506
4614
|
) : [];
|
|
4507
|
-
|
|
4615
|
+
React13.useEffect(() => {
|
|
4508
4616
|
if (!isAsync) return;
|
|
4509
4617
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
4510
4618
|
if (!term.trim()) {
|
|
@@ -4660,15 +4768,15 @@ function TreeSelect({
|
|
|
4660
4768
|
defaultExpandedKeys = [],
|
|
4661
4769
|
size = "md"
|
|
4662
4770
|
}) {
|
|
4663
|
-
const errorId =
|
|
4771
|
+
const errorId = React13.useId();
|
|
4664
4772
|
const hasError = errorMessage != null;
|
|
4665
|
-
const [open, setOpen] =
|
|
4666
|
-
const [expanded, setExpanded] =
|
|
4667
|
-
const [activeIndex, setActiveIndex] =
|
|
4668
|
-
const listRef =
|
|
4669
|
-
const visible =
|
|
4670
|
-
const didSyncOnOpenRef =
|
|
4671
|
-
|
|
4773
|
+
const [open, setOpen] = React13.useState(false);
|
|
4774
|
+
const [expanded, setExpanded] = React13.useState(() => new Set(defaultExpandedKeys));
|
|
4775
|
+
const [activeIndex, setActiveIndex] = React13.useState(0);
|
|
4776
|
+
const listRef = React13.useRef(null);
|
|
4777
|
+
const visible = React13.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
4778
|
+
const didSyncOnOpenRef = React13.useRef(false);
|
|
4779
|
+
React13.useEffect(() => {
|
|
4672
4780
|
if (!open) {
|
|
4673
4781
|
didSyncOnOpenRef.current = false;
|
|
4674
4782
|
return;
|
|
@@ -4678,7 +4786,7 @@ function TreeSelect({
|
|
|
4678
4786
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
4679
4787
|
didSyncOnOpenRef.current = true;
|
|
4680
4788
|
}, [open, value]);
|
|
4681
|
-
const selectedNode =
|
|
4789
|
+
const selectedNode = React13.useMemo(
|
|
4682
4790
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
4683
4791
|
[items, value]
|
|
4684
4792
|
);
|
|
@@ -4909,11 +5017,11 @@ function FileInput({
|
|
|
4909
5017
|
required,
|
|
4910
5018
|
icon
|
|
4911
5019
|
}) {
|
|
4912
|
-
const inputRef =
|
|
4913
|
-
const errorId =
|
|
4914
|
-
const [files, setFiles] =
|
|
4915
|
-
const [dragging, setDragging] =
|
|
4916
|
-
const [sizeError, setSizeError] =
|
|
5020
|
+
const inputRef = React13.useRef(null);
|
|
5021
|
+
const errorId = React13.useId();
|
|
5022
|
+
const [files, setFiles] = React13.useState([]);
|
|
5023
|
+
const [dragging, setDragging] = React13.useState(false);
|
|
5024
|
+
const [sizeError, setSizeError] = React13.useState(null);
|
|
4917
5025
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
4918
5026
|
const openPicker = () => {
|
|
4919
5027
|
if (!disabled) inputRef.current?.click();
|
|
@@ -5104,30 +5212,30 @@ function DatePicker({
|
|
|
5104
5212
|
size = "md",
|
|
5105
5213
|
className = ""
|
|
5106
5214
|
}) {
|
|
5107
|
-
const errorId =
|
|
5215
|
+
const errorId = React13.useId();
|
|
5108
5216
|
const hasError = errorMessage != null;
|
|
5109
|
-
const [open, setOpen] =
|
|
5110
|
-
const [viewMonth, setViewMonth] =
|
|
5111
|
-
const [focusDate, setFocusDate] =
|
|
5112
|
-
const [view, setView] =
|
|
5113
|
-
const gridRef =
|
|
5114
|
-
|
|
5217
|
+
const [open, setOpen] = React13.useState(false);
|
|
5218
|
+
const [viewMonth, setViewMonth] = React13.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
5219
|
+
const [focusDate, setFocusDate] = React13.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
5220
|
+
const [view, setView] = React13.useState("days");
|
|
5221
|
+
const gridRef = React13.useRef(null);
|
|
5222
|
+
React13.useEffect(() => {
|
|
5115
5223
|
if (!open) return;
|
|
5116
5224
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
5117
5225
|
setViewMonth(startOfMonth(target));
|
|
5118
5226
|
setFocusDate(target);
|
|
5119
5227
|
setView("days");
|
|
5120
5228
|
}, [open, value]);
|
|
5121
|
-
|
|
5229
|
+
React13.useEffect(() => {
|
|
5122
5230
|
if (!open) return;
|
|
5123
5231
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat(focusDate)}"]`);
|
|
5124
5232
|
cell?.focus();
|
|
5125
5233
|
}, [open, focusDate]);
|
|
5126
|
-
const weekdays =
|
|
5234
|
+
const weekdays = React13.useMemo(() => {
|
|
5127
5235
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5128
5236
|
return ordered;
|
|
5129
5237
|
}, [weekStartsOn]);
|
|
5130
|
-
const grid =
|
|
5238
|
+
const grid = React13.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5131
5239
|
const isDisabled = (d) => {
|
|
5132
5240
|
if (min && d < min) return true;
|
|
5133
5241
|
if (max && d > max) return true;
|
|
@@ -5417,10 +5525,10 @@ function TextArea({
|
|
|
5417
5525
|
style,
|
|
5418
5526
|
inputStyle
|
|
5419
5527
|
}) {
|
|
5420
|
-
const errorId =
|
|
5528
|
+
const errorId = React13.useId();
|
|
5421
5529
|
const hasError = errorMessage != null;
|
|
5422
|
-
const ref =
|
|
5423
|
-
|
|
5530
|
+
const ref = React13.useRef(null);
|
|
5531
|
+
React13.useLayoutEffect(() => {
|
|
5424
5532
|
if (!autoGrow) return;
|
|
5425
5533
|
const el = ref.current;
|
|
5426
5534
|
if (!el) return;
|
|
@@ -5490,11 +5598,11 @@ function SegmentedControl({
|
|
|
5490
5598
|
"aria-label": ariaLabel
|
|
5491
5599
|
}) {
|
|
5492
5600
|
const sz = SIZE2[size];
|
|
5493
|
-
const groupId =
|
|
5494
|
-
const errorId =
|
|
5601
|
+
const groupId = React13.useId();
|
|
5602
|
+
const errorId = React13.useId();
|
|
5495
5603
|
const hasError = errorMessage != null;
|
|
5496
5604
|
const isControlled = value !== void 0;
|
|
5497
|
-
const [internal, setInternal] =
|
|
5605
|
+
const [internal, setInternal] = React13.useState(defaultValue);
|
|
5498
5606
|
const current = isControlled ? value : internal;
|
|
5499
5607
|
const handle = (v) => {
|
|
5500
5608
|
if (!v) return;
|
|
@@ -5588,14 +5696,14 @@ function Slider({
|
|
|
5588
5696
|
name,
|
|
5589
5697
|
htmlFor
|
|
5590
5698
|
}) {
|
|
5591
|
-
const errorId =
|
|
5699
|
+
const errorId = React13.useId();
|
|
5592
5700
|
const hasError = errorMessage != null;
|
|
5593
5701
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
5594
|
-
const [internal, setInternal] =
|
|
5702
|
+
const [internal, setInternal] = React13.useState(
|
|
5595
5703
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
5596
5704
|
);
|
|
5597
5705
|
const current = toArray(value) ?? internal;
|
|
5598
|
-
const [dragging, setDragging] =
|
|
5706
|
+
const [dragging, setDragging] = React13.useState(false);
|
|
5599
5707
|
const emit = (arr) => {
|
|
5600
5708
|
setInternal(arr);
|
|
5601
5709
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -5690,11 +5798,11 @@ function TagsInput({
|
|
|
5690
5798
|
validate,
|
|
5691
5799
|
separators = ["Enter", ","]
|
|
5692
5800
|
}) {
|
|
5693
|
-
const errorId =
|
|
5694
|
-
const inputRef =
|
|
5695
|
-
const [internal, setInternal] =
|
|
5696
|
-
const [draft, setDraft] =
|
|
5697
|
-
const [localError, setLocalError] =
|
|
5801
|
+
const errorId = React13.useId();
|
|
5802
|
+
const inputRef = React13.useRef(null);
|
|
5803
|
+
const [internal, setInternal] = React13.useState(defaultValue ?? []);
|
|
5804
|
+
const [draft, setDraft] = React13.useState("");
|
|
5805
|
+
const [localError, setLocalError] = React13.useState(null);
|
|
5698
5806
|
const tags = value ?? internal;
|
|
5699
5807
|
const hasError = errorMessage != null || localError != null;
|
|
5700
5808
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -5825,9 +5933,9 @@ function OtpInput({
|
|
|
5825
5933
|
className,
|
|
5826
5934
|
groupAfter
|
|
5827
5935
|
}) {
|
|
5828
|
-
const errorId =
|
|
5936
|
+
const errorId = React13.useId();
|
|
5829
5937
|
const hasError = errorMessage != null;
|
|
5830
|
-
const refs =
|
|
5938
|
+
const refs = React13.useRef([]);
|
|
5831
5939
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
5832
5940
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
5833
5941
|
const emit = (next) => {
|
|
@@ -5876,7 +5984,7 @@ function OtpInput({
|
|
|
5876
5984
|
emit(valid.join(""));
|
|
5877
5985
|
focusBox(valid.length);
|
|
5878
5986
|
};
|
|
5879
|
-
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(
|
|
5987
|
+
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(React13__default.default.Fragment, { children: [
|
|
5880
5988
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5881
5989
|
"input",
|
|
5882
5990
|
{
|
|
@@ -5934,9 +6042,9 @@ function Rating({
|
|
|
5934
6042
|
className,
|
|
5935
6043
|
required
|
|
5936
6044
|
}) {
|
|
5937
|
-
const errorId =
|
|
5938
|
-
const [internal, setInternal] =
|
|
5939
|
-
const [hover, setHover] =
|
|
6045
|
+
const errorId = React13.useId();
|
|
6046
|
+
const [internal, setInternal] = React13.useState(defaultValue);
|
|
6047
|
+
const [hover, setHover] = React13.useState(null);
|
|
5940
6048
|
const current = value ?? internal;
|
|
5941
6049
|
const display2 = hover ?? current;
|
|
5942
6050
|
const interactive = !readOnly && !disabled;
|
|
@@ -6059,9 +6167,9 @@ function TimePicker({
|
|
|
6059
6167
|
required,
|
|
6060
6168
|
style
|
|
6061
6169
|
}) {
|
|
6062
|
-
const errorId =
|
|
6170
|
+
const errorId = React13.useId();
|
|
6063
6171
|
const hasError = errorMessage != null;
|
|
6064
|
-
const [open, setOpen] =
|
|
6172
|
+
const [open, setOpen] = React13.useState(false);
|
|
6065
6173
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
6066
6174
|
const update = (next) => {
|
|
6067
6175
|
const merged = { ...parsed, ...next };
|
|
@@ -6185,13 +6293,13 @@ function DateRangePicker({
|
|
|
6185
6293
|
required,
|
|
6186
6294
|
style
|
|
6187
6295
|
}) {
|
|
6188
|
-
const errorId =
|
|
6296
|
+
const errorId = React13.useId();
|
|
6189
6297
|
const hasError = errorMessage != null;
|
|
6190
|
-
const [open, setOpen] =
|
|
6191
|
-
const [leftMonth, setLeftMonth] =
|
|
6192
|
-
const [pendingStart, setPendingStart] =
|
|
6193
|
-
const [hoverDate, setHoverDate] =
|
|
6194
|
-
const weekdays =
|
|
6298
|
+
const [open, setOpen] = React13.useState(false);
|
|
6299
|
+
const [leftMonth, setLeftMonth] = React13.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
6300
|
+
const [pendingStart, setPendingStart] = React13.useState(null);
|
|
6301
|
+
const [hoverDate, setHoverDate] = React13.useState(null);
|
|
6302
|
+
const weekdays = React13.useMemo(
|
|
6195
6303
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6196
6304
|
[weekStartsOn]
|
|
6197
6305
|
);
|
|
@@ -6367,10 +6475,10 @@ function ColorPicker({
|
|
|
6367
6475
|
required,
|
|
6368
6476
|
placeholder = "Pick a colour\u2026"
|
|
6369
6477
|
}) {
|
|
6370
|
-
const errorId =
|
|
6478
|
+
const errorId = React13.useId();
|
|
6371
6479
|
const hasError = errorMessage != null;
|
|
6372
|
-
const [open, setOpen] =
|
|
6373
|
-
const [draft, setDraft] =
|
|
6480
|
+
const [open, setOpen] = React13.useState(false);
|
|
6481
|
+
const [draft, setDraft] = React13.useState(value);
|
|
6374
6482
|
const valid = HEX_RE.test(value);
|
|
6375
6483
|
const pick = (hex) => {
|
|
6376
6484
|
onChange?.(hex);
|
|
@@ -6757,11 +6865,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
6757
6865
|
|
|
6758
6866
|
// src/form/useForm.ts
|
|
6759
6867
|
function useForm(options = {}) {
|
|
6760
|
-
const ref =
|
|
6868
|
+
const ref = React13.useRef(null);
|
|
6761
6869
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
6762
6870
|
const store = ref.current;
|
|
6763
|
-
|
|
6764
|
-
const make =
|
|
6871
|
+
React13.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
6872
|
+
const make = React13.useCallback(
|
|
6765
6873
|
(kind) => (name, rules) => {
|
|
6766
6874
|
if (rules !== void 0) store.setRule(name, rules);
|
|
6767
6875
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -6790,9 +6898,9 @@ function useForm(options = {}) {
|
|
|
6790
6898
|
fieldTarget: make("target")
|
|
6791
6899
|
};
|
|
6792
6900
|
}
|
|
6793
|
-
var FormContext =
|
|
6901
|
+
var FormContext = React13.createContext(null);
|
|
6794
6902
|
function useFormStore() {
|
|
6795
|
-
const store =
|
|
6903
|
+
const store = React13.useContext(FormContext);
|
|
6796
6904
|
if (!store) {
|
|
6797
6905
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
6798
6906
|
}
|
|
@@ -6806,8 +6914,8 @@ function Form({
|
|
|
6806
6914
|
children,
|
|
6807
6915
|
...rest
|
|
6808
6916
|
}) {
|
|
6809
|
-
const ref =
|
|
6810
|
-
const bypass =
|
|
6917
|
+
const ref = React13.useRef(null);
|
|
6918
|
+
const bypass = React13.useRef(false);
|
|
6811
6919
|
const handleSubmit = async (e) => {
|
|
6812
6920
|
if (bypass.current) {
|
|
6813
6921
|
bypass.current = false;
|
|
@@ -6859,12 +6967,12 @@ function useFormField(name, options = {}) {
|
|
|
6859
6967
|
const store = useFormStore();
|
|
6860
6968
|
const { kind = "value", rules } = options;
|
|
6861
6969
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
6862
|
-
|
|
6970
|
+
React13.useEffect(() => {
|
|
6863
6971
|
return () => {
|
|
6864
6972
|
if (rules !== void 0) store.removeRule(name);
|
|
6865
6973
|
};
|
|
6866
6974
|
}, [store, name]);
|
|
6867
|
-
const snap =
|
|
6975
|
+
const snap = React13.useSyncExternalStore(
|
|
6868
6976
|
store.subscribe,
|
|
6869
6977
|
() => store.getFieldSnapshot(name)
|
|
6870
6978
|
);
|
|
@@ -6876,7 +6984,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
6876
6984
|
}
|
|
6877
6985
|
function useFieldArray(name) {
|
|
6878
6986
|
const store = useFormStore();
|
|
6879
|
-
|
|
6987
|
+
React13.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
6880
6988
|
const arr = store.getValue(name) ?? [];
|
|
6881
6989
|
const keys = store.getKeys(name);
|
|
6882
6990
|
return {
|
|
@@ -6999,7 +7107,7 @@ function CreditCardForm({
|
|
|
6999
7107
|
className = "",
|
|
7000
7108
|
style
|
|
7001
7109
|
}) {
|
|
7002
|
-
const initial =
|
|
7110
|
+
const initial = React13.useRef({
|
|
7003
7111
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
7004
7112
|
name: defaultValue?.name ?? "",
|
|
7005
7113
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -7008,7 +7116,7 @@ function CreditCardForm({
|
|
|
7008
7116
|
const form = useForm({ initialValues: initial });
|
|
7009
7117
|
const numberStr = String(form.values.number ?? "");
|
|
7010
7118
|
const brand = detectBrand(numberStr);
|
|
7011
|
-
|
|
7119
|
+
React13.useEffect(() => {
|
|
7012
7120
|
onChange?.(toCard(form.values));
|
|
7013
7121
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
7014
7122
|
const numberBind = form.fieldNative("number", {
|
|
@@ -7106,6 +7214,7 @@ Object.defineProperty(exports, "vars", {
|
|
|
7106
7214
|
enumerable: true,
|
|
7107
7215
|
get: function () { return chunk255PCZIW_cjs.vars; }
|
|
7108
7216
|
});
|
|
7217
|
+
exports.Accordion = Accordion_default;
|
|
7109
7218
|
exports.AppShell = AppShell;
|
|
7110
7219
|
exports.AutoComplete = AutoComplete;
|
|
7111
7220
|
exports.Avatar = Avatar;
|