@geomak/ui 6.8.0 → 6.10.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 +381 -206
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -1
- package/dist/index.d.ts +92 -1
- package/dist/index.js +188 -15
- package/dist/index.js.map +1 -1
- package/dist/styles.css +40 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk255PCZIW_cjs = require('./chunk-255PCZIW.cjs');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var React18 = 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');
|
|
@@ -10,8 +10,8 @@ var framerMotion = require('framer-motion');
|
|
|
10
10
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
11
11
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
12
12
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
13
|
-
var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
|
|
14
13
|
var Popover = require('@radix-ui/react-popover');
|
|
14
|
+
var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
|
|
15
15
|
var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
16
16
|
var NavigationMenu = require('@radix-ui/react-navigation-menu');
|
|
17
17
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
@@ -39,14 +39,14 @@ function _interopNamespace(e) {
|
|
|
39
39
|
return Object.freeze(n);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var React18__default = /*#__PURE__*/_interopDefault(React18);
|
|
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
47
|
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
48
|
-
var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenuPrimitive);
|
|
49
48
|
var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
|
|
49
|
+
var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenuPrimitive);
|
|
50
50
|
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
51
51
|
var NavigationMenu__namespace = /*#__PURE__*/_interopNamespace(NavigationMenu);
|
|
52
52
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
@@ -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] = React18.useState(null);
|
|
218
|
+
React18.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 = React18.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 = React18.createContext(null);
|
|
964
964
|
function useTabsContext() {
|
|
965
|
-
const ctx =
|
|
965
|
+
const ctx = React18.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] = React18.useState(defaultValue);
|
|
988
988
|
const current = isControlled ? value : internal;
|
|
989
989
|
const reduced = !!framerMotion.useReducedMotion();
|
|
990
|
-
const indicatorId =
|
|
991
|
-
const select =
|
|
990
|
+
const indicatorId = React18.useId();
|
|
991
|
+
const select = React18.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 = React18.useRef(/* @__PURE__ */ new Map());
|
|
996
|
+
const orderRef = React18.useRef(0);
|
|
997
|
+
const [, bump] = React18.useState(0);
|
|
998
|
+
const registerTab = React18.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 = React18.useCallback((val) => {
|
|
1004
1004
|
if (registry.current.delete(val)) bump((v) => v + 1);
|
|
1005
1005
|
}, []);
|
|
1006
|
-
const getTabs =
|
|
1006
|
+
const getTabs = React18.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 = React18.useRef(null);
|
|
1027
|
+
const [edges, setEdges] = React18.useState({ start: false, end: false });
|
|
1028
1028
|
const scrollable = variant !== "segmented";
|
|
1029
|
-
|
|
1029
|
+
React18.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 = React18.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
|
+
React18.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] = React18.useState(false);
|
|
1119
|
+
const wrapRef = React18.useRef(null);
|
|
1120
|
+
const timer = React18.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
|
+
React18.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
|
+
React18.useLayoutEffect(() => {
|
|
1210
1210
|
registerTab(value, { label: children, icon, disabled });
|
|
1211
1211
|
return () => unregisterTab(value);
|
|
1212
1212
|
}, [value, children, icon, disabled, registerTab, unregisterTab]);
|
|
@@ -1404,7 +1404,7 @@ function Tree({
|
|
|
1404
1404
|
item.key
|
|
1405
1405
|
)) });
|
|
1406
1406
|
}
|
|
1407
|
-
var AccordionCtx =
|
|
1407
|
+
var AccordionCtx = React18.createContext({ variant: "separated" });
|
|
1408
1408
|
function Accordion2({
|
|
1409
1409
|
children,
|
|
1410
1410
|
type = "single",
|
|
@@ -1463,7 +1463,7 @@ var Chevron2 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
1463
1463
|
}
|
|
1464
1464
|
);
|
|
1465
1465
|
function AccordionItem({ value, title, icon, children, disabled, className = "" }) {
|
|
1466
|
-
const { variant } =
|
|
1466
|
+
const { variant } = React18.useContext(AccordionCtx);
|
|
1467
1467
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1468
1468
|
AccordionPrimitive__namespace.Item,
|
|
1469
1469
|
{
|
|
@@ -1522,7 +1522,7 @@ function Breadcrumbs({
|
|
|
1522
1522
|
className = "",
|
|
1523
1523
|
style
|
|
1524
1524
|
}) {
|
|
1525
|
-
const [expanded, setExpanded] =
|
|
1525
|
+
const [expanded, setExpanded] = React18.useState(false);
|
|
1526
1526
|
const shouldCollapse = maxItems > 0 && items.length > maxItems && !expanded;
|
|
1527
1527
|
const visible = [];
|
|
1528
1528
|
if (shouldCollapse) {
|
|
@@ -1666,7 +1666,7 @@ function Kbd({
|
|
|
1666
1666
|
style
|
|
1667
1667
|
}) {
|
|
1668
1668
|
if (keys && keys.length > 0) {
|
|
1669
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1669
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(React18__default.default.Fragment, { children: [
|
|
1670
1670
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-xs select-none", children: separator }),
|
|
1671
1671
|
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: [cap, SIZE3[size]].join(" "), children: k })
|
|
1672
1672
|
] }, `${k}-${i}`)) });
|
|
@@ -1739,13 +1739,13 @@ function CardCarousel({
|
|
|
1739
1739
|
className = "",
|
|
1740
1740
|
style
|
|
1741
1741
|
}) {
|
|
1742
|
-
const scrollerRef =
|
|
1743
|
-
const slides =
|
|
1744
|
-
const [active, setActive] =
|
|
1745
|
-
const [atStart, setAtStart] =
|
|
1746
|
-
const [atEnd, setAtEnd] =
|
|
1742
|
+
const scrollerRef = React18.useRef(null);
|
|
1743
|
+
const slides = React18__default.default.Children.toArray(children);
|
|
1744
|
+
const [active, setActive] = React18.useState(0);
|
|
1745
|
+
const [atStart, setAtStart] = React18.useState(true);
|
|
1746
|
+
const [atEnd, setAtEnd] = React18.useState(false);
|
|
1747
1747
|
const width = typeof itemWidth === "number" ? `${itemWidth}px` : itemWidth;
|
|
1748
|
-
const update =
|
|
1748
|
+
const update = React18.useCallback(() => {
|
|
1749
1749
|
const el = scrollerRef.current;
|
|
1750
1750
|
if (!el) return;
|
|
1751
1751
|
el.clientWidth;
|
|
@@ -1755,7 +1755,7 @@ function CardCarousel({
|
|
|
1755
1755
|
const slideW = first ? first.getBoundingClientRect().width + gap : el.clientWidth;
|
|
1756
1756
|
setActive(Math.round(el.scrollLeft / slideW));
|
|
1757
1757
|
}, [gap]);
|
|
1758
|
-
|
|
1758
|
+
React18.useEffect(() => {
|
|
1759
1759
|
update();
|
|
1760
1760
|
const el = scrollerRef.current;
|
|
1761
1761
|
if (!el) return;
|
|
@@ -1862,7 +1862,180 @@ function Statistic({
|
|
|
1862
1862
|
}
|
|
1863
1863
|
);
|
|
1864
1864
|
}
|
|
1865
|
-
var
|
|
1865
|
+
var POS = {
|
|
1866
|
+
"bottom-right": "bottom-6 right-6 items-end",
|
|
1867
|
+
"bottom-left": "bottom-6 left-6 items-start",
|
|
1868
|
+
"top-right": "top-6 right-6 items-end",
|
|
1869
|
+
"top-left": "top-6 left-6 items-start"
|
|
1870
|
+
};
|
|
1871
|
+
var SIZE4 = {
|
|
1872
|
+
md: "h-12 w-12",
|
|
1873
|
+
lg: "h-14 w-14"
|
|
1874
|
+
};
|
|
1875
|
+
var TONE3 = {
|
|
1876
|
+
accent: "bg-accent text-accent-fg hover:bg-accent-hover",
|
|
1877
|
+
neutral: "bg-foreground-secondary text-background hover:opacity-90"
|
|
1878
|
+
};
|
|
1879
|
+
function FAB({
|
|
1880
|
+
icon,
|
|
1881
|
+
label,
|
|
1882
|
+
onClick,
|
|
1883
|
+
actions,
|
|
1884
|
+
position = "bottom-right",
|
|
1885
|
+
size = "lg",
|
|
1886
|
+
tone = "accent",
|
|
1887
|
+
fixed = true,
|
|
1888
|
+
className = "",
|
|
1889
|
+
style
|
|
1890
|
+
}) {
|
|
1891
|
+
const [open, setOpen] = React18.useState(false);
|
|
1892
|
+
const reduced = framerMotion.useReducedMotion();
|
|
1893
|
+
const hasDial = !!actions && actions.length > 0;
|
|
1894
|
+
const bottom = position.startsWith("bottom");
|
|
1895
|
+
const alignRight = position.endsWith("right");
|
|
1896
|
+
const dial = hasDial && /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1897
|
+
framerMotion.motion.ul,
|
|
1898
|
+
{
|
|
1899
|
+
className: `flex flex-col gap-3 ${bottom ? "mb-3" : "mt-3 order-last"} ${alignRight ? "items-end" : "items-start"}`,
|
|
1900
|
+
initial: "hidden",
|
|
1901
|
+
animate: "show",
|
|
1902
|
+
exit: "hidden",
|
|
1903
|
+
variants: { show: { transition: { staggerChildren: reduced ? 0 : 0.04, staggerDirection: bottom ? -1 : 1 } } },
|
|
1904
|
+
children: actions.map((a, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1905
|
+
framerMotion.motion.li,
|
|
1906
|
+
{
|
|
1907
|
+
className: `flex items-center gap-2 ${alignRight ? "flex-row" : "flex-row-reverse"}`,
|
|
1908
|
+
variants: {
|
|
1909
|
+
hidden: { opacity: 0, y: reduced ? 0 : bottom ? 8 : -8, scale: reduced ? 1 : 0.9 },
|
|
1910
|
+
show: { opacity: 1, y: 0, scale: 1 }
|
|
1911
|
+
},
|
|
1912
|
+
children: [
|
|
1913
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md bg-surface px-2 py-1 text-xs font-medium text-foreground shadow-md border border-border whitespace-nowrap", children: a.label }),
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1915
|
+
"button",
|
|
1916
|
+
{
|
|
1917
|
+
type: "button",
|
|
1918
|
+
"aria-label": a.label,
|
|
1919
|
+
onClick: (e) => {
|
|
1920
|
+
a.onClick?.(e);
|
|
1921
|
+
setOpen(false);
|
|
1922
|
+
},
|
|
1923
|
+
className: "flex h-11 w-11 items-center justify-center rounded-full bg-surface text-foreground-secondary shadow-lg border border-border transition hover:text-foreground hover:bg-surface-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
1924
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-5 w-5 inline-flex items-center justify-center", children: a.icon })
|
|
1925
|
+
}
|
|
1926
|
+
)
|
|
1927
|
+
]
|
|
1928
|
+
},
|
|
1929
|
+
i
|
|
1930
|
+
))
|
|
1931
|
+
}
|
|
1932
|
+
) });
|
|
1933
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1934
|
+
"div",
|
|
1935
|
+
{
|
|
1936
|
+
className: [fixed ? "fixed" : "absolute", "z-40 flex flex-col", POS[position], className].filter(Boolean).join(" "),
|
|
1937
|
+
style,
|
|
1938
|
+
children: [
|
|
1939
|
+
bottom && dial,
|
|
1940
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1941
|
+
"button",
|
|
1942
|
+
{
|
|
1943
|
+
type: "button",
|
|
1944
|
+
"aria-label": label,
|
|
1945
|
+
"aria-expanded": hasDial ? open : void 0,
|
|
1946
|
+
onClick: (e) => hasDial ? setOpen((o) => !o) : onClick?.(e),
|
|
1947
|
+
className: [
|
|
1948
|
+
"flex items-center justify-center rounded-full shadow-lg transition-[background-color,transform] duration-200",
|
|
1949
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",
|
|
1950
|
+
SIZE4[size],
|
|
1951
|
+
TONE3[tone],
|
|
1952
|
+
hasDial && open ? "rotate-45" : ""
|
|
1953
|
+
].filter(Boolean).join(" "),
|
|
1954
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-6 w-6 inline-flex items-center justify-center", children: icon })
|
|
1955
|
+
}
|
|
1956
|
+
),
|
|
1957
|
+
!bottom && dial
|
|
1958
|
+
]
|
|
1959
|
+
}
|
|
1960
|
+
);
|
|
1961
|
+
}
|
|
1962
|
+
function PopConfirm({
|
|
1963
|
+
children,
|
|
1964
|
+
title,
|
|
1965
|
+
description,
|
|
1966
|
+
onConfirm,
|
|
1967
|
+
onCancel,
|
|
1968
|
+
confirmText = "Confirm",
|
|
1969
|
+
cancelText = "Cancel",
|
|
1970
|
+
tone = "default",
|
|
1971
|
+
icon,
|
|
1972
|
+
side = "top",
|
|
1973
|
+
open,
|
|
1974
|
+
onOpenChange,
|
|
1975
|
+
className = ""
|
|
1976
|
+
}) {
|
|
1977
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React18.useState(false);
|
|
1978
|
+
const [loading, setLoading] = React18.useState(false);
|
|
1979
|
+
const isOpen = open ?? uncontrolledOpen;
|
|
1980
|
+
const setOpen = (next) => {
|
|
1981
|
+
onOpenChange?.(next);
|
|
1982
|
+
if (open === void 0) setUncontrolledOpen(next);
|
|
1983
|
+
};
|
|
1984
|
+
const handleConfirm = async () => {
|
|
1985
|
+
try {
|
|
1986
|
+
setLoading(true);
|
|
1987
|
+
await onConfirm?.();
|
|
1988
|
+
setOpen(false);
|
|
1989
|
+
} finally {
|
|
1990
|
+
setLoading(false);
|
|
1991
|
+
}
|
|
1992
|
+
};
|
|
1993
|
+
const handleCancel = () => {
|
|
1994
|
+
onCancel?.();
|
|
1995
|
+
setOpen(false);
|
|
1996
|
+
};
|
|
1997
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: isOpen, onOpenChange: (o) => o ? setOpen(true) : handleCancel(), children: [
|
|
1998
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Trigger, { asChild: true, children }),
|
|
1999
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2000
|
+
Popover__namespace.Content,
|
|
2001
|
+
{
|
|
2002
|
+
side,
|
|
2003
|
+
sideOffset: 8,
|
|
2004
|
+
collisionPadding: 12,
|
|
2005
|
+
className: [
|
|
2006
|
+
"z-[400] w-64 rounded-lg border border-border bg-surface p-3.5 shadow-lg",
|
|
2007
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
2008
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
2009
|
+
className
|
|
2010
|
+
].filter(Boolean).join(" "),
|
|
2011
|
+
children: [
|
|
2012
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2.5", children: [
|
|
2013
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center ${tone === "danger" ? "text-status-error" : "text-status-warning"}`, children: icon }),
|
|
2014
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
2015
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-foreground", children: title }),
|
|
2016
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-foreground-secondary leading-snug", children: description })
|
|
2017
|
+
] })
|
|
2018
|
+
] }),
|
|
2019
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex justify-end gap-2", children: [
|
|
2020
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { content: cancelText, size: "sm", variant: "ghost", onClick: handleCancel }),
|
|
2021
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2022
|
+
Button,
|
|
2023
|
+
{
|
|
2024
|
+
content: confirmText,
|
|
2025
|
+
size: "sm",
|
|
2026
|
+
variant: tone === "danger" ? "danger" : "primary",
|
|
2027
|
+
loading,
|
|
2028
|
+
onClick: handleConfirm
|
|
2029
|
+
}
|
|
2030
|
+
)
|
|
2031
|
+
] }),
|
|
2032
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Arrow, { className: "fill-surface" })
|
|
2033
|
+
]
|
|
2034
|
+
}
|
|
2035
|
+
) })
|
|
2036
|
+
] });
|
|
2037
|
+
}
|
|
2038
|
+
var NotificationContext = React18.createContext({
|
|
1866
2039
|
open: () => void 0,
|
|
1867
2040
|
close: () => void 0
|
|
1868
2041
|
});
|
|
@@ -1920,26 +2093,26 @@ function NotificationItem({
|
|
|
1920
2093
|
onClose,
|
|
1921
2094
|
reduced
|
|
1922
2095
|
}) {
|
|
1923
|
-
const [paused, setPaused] =
|
|
2096
|
+
const [paused, setPaused] = React18.useState(false);
|
|
1924
2097
|
const duration = n.duration ?? 4e3;
|
|
1925
2098
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
1926
2099
|
const showProgress = !reduced && isAutoDismissing;
|
|
1927
|
-
const timerRef =
|
|
1928
|
-
const startTimeRef =
|
|
1929
|
-
const remainingRef =
|
|
1930
|
-
const clearTimer =
|
|
2100
|
+
const timerRef = React18.useRef(null);
|
|
2101
|
+
const startTimeRef = React18.useRef(0);
|
|
2102
|
+
const remainingRef = React18.useRef(duration);
|
|
2103
|
+
const clearTimer = React18.useCallback(() => {
|
|
1931
2104
|
if (timerRef.current !== null) {
|
|
1932
2105
|
clearTimeout(timerRef.current);
|
|
1933
2106
|
timerRef.current = null;
|
|
1934
2107
|
}
|
|
1935
2108
|
}, []);
|
|
1936
|
-
const scheduleDismiss =
|
|
2109
|
+
const scheduleDismiss = React18.useCallback((ms) => {
|
|
1937
2110
|
clearTimer();
|
|
1938
2111
|
if (!isAutoDismissing) return;
|
|
1939
2112
|
startTimeRef.current = Date.now();
|
|
1940
2113
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
1941
2114
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
1942
|
-
|
|
2115
|
+
React18.useEffect(() => {
|
|
1943
2116
|
if (paused || !isAutoDismissing) return;
|
|
1944
2117
|
scheduleDismiss(remainingRef.current);
|
|
1945
2118
|
return clearTimer;
|
|
@@ -2022,15 +2195,15 @@ function NotificationProvider({
|
|
|
2022
2195
|
children,
|
|
2023
2196
|
position = "top-right"
|
|
2024
2197
|
}) {
|
|
2025
|
-
const [notifications, setNotifications] =
|
|
2198
|
+
const [notifications, setNotifications] = React18.useState([]);
|
|
2026
2199
|
const reduced = framerMotion.useReducedMotion();
|
|
2027
|
-
const open =
|
|
2200
|
+
const open = React18.useCallback((payload) => {
|
|
2028
2201
|
setNotifications((prev) => [
|
|
2029
2202
|
...prev,
|
|
2030
2203
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
2031
2204
|
]);
|
|
2032
2205
|
}, []);
|
|
2033
|
-
const close =
|
|
2206
|
+
const close = React18.useCallback((id) => {
|
|
2034
2207
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
2035
2208
|
}, []);
|
|
2036
2209
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -2059,7 +2232,7 @@ function NotificationProvider({
|
|
|
2059
2232
|
] });
|
|
2060
2233
|
}
|
|
2061
2234
|
function useNotification() {
|
|
2062
|
-
const { open } =
|
|
2235
|
+
const { open } = React18.useContext(NotificationContext);
|
|
2063
2236
|
return {
|
|
2064
2237
|
info: (props) => open({ type: "info", ...props }),
|
|
2065
2238
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -2176,10 +2349,10 @@ function FadingBase({
|
|
|
2176
2349
|
isMounted = false,
|
|
2177
2350
|
children
|
|
2178
2351
|
}) {
|
|
2179
|
-
const [shouldRender, setShouldRender] =
|
|
2180
|
-
const [visible, setVisible] =
|
|
2181
|
-
const timerRef =
|
|
2182
|
-
|
|
2352
|
+
const [shouldRender, setShouldRender] = React18.useState(isMounted);
|
|
2353
|
+
const [visible, setVisible] = React18.useState(false);
|
|
2354
|
+
const timerRef = React18.useRef(null);
|
|
2355
|
+
React18.useEffect(() => {
|
|
2183
2356
|
if (isMounted) {
|
|
2184
2357
|
setShouldRender(true);
|
|
2185
2358
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -2277,8 +2450,8 @@ function ScalableContainer({
|
|
|
2277
2450
|
togglePosition = "top-right",
|
|
2278
2451
|
className = ""
|
|
2279
2452
|
}) {
|
|
2280
|
-
const containerRef =
|
|
2281
|
-
const [internalScaled, setInternalScaled] =
|
|
2453
|
+
const containerRef = React18.useRef(null);
|
|
2454
|
+
const [internalScaled, setInternalScaled] = React18.useState(false);
|
|
2282
2455
|
const isScaled = expanded ?? internalScaled;
|
|
2283
2456
|
const reduced = framerMotion.useReducedMotion();
|
|
2284
2457
|
const onToggle = () => {
|
|
@@ -2416,17 +2589,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
2416
2589
|
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)) });
|
|
2417
2590
|
}
|
|
2418
2591
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
2419
|
-
const [activeIndex, setActiveIndex] =
|
|
2420
|
-
const [indexPool, setIndexPool] =
|
|
2421
|
-
const cardRefs =
|
|
2422
|
-
const getIndexes =
|
|
2592
|
+
const [activeIndex, setActiveIndex] = React18.useState(0);
|
|
2593
|
+
const [indexPool, setIndexPool] = React18.useState([]);
|
|
2594
|
+
const cardRefs = React18.useRef([]);
|
|
2595
|
+
const getIndexes = React18.useMemo(() => {
|
|
2423
2596
|
let nextIndex = activeIndex + 1;
|
|
2424
2597
|
let previousIndex = activeIndex - 1;
|
|
2425
2598
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
2426
2599
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
2427
2600
|
return { previousIndex, nextIndex };
|
|
2428
2601
|
}, [activeIndex, items.length]);
|
|
2429
|
-
|
|
2602
|
+
React18.useEffect(() => {
|
|
2430
2603
|
const { nextIndex, previousIndex } = getIndexes;
|
|
2431
2604
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
2432
2605
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -2599,8 +2772,8 @@ function writeDismissed(key) {
|
|
|
2599
2772
|
}
|
|
2600
2773
|
}
|
|
2601
2774
|
function useTargetBbox(ref) {
|
|
2602
|
-
const [bbox, setBbox] =
|
|
2603
|
-
|
|
2775
|
+
const [bbox, setBbox] = React18.useState(null);
|
|
2776
|
+
React18.useLayoutEffect(() => {
|
|
2604
2777
|
const el = ref?.current;
|
|
2605
2778
|
if (!el) {
|
|
2606
2779
|
setBbox(null);
|
|
@@ -2630,7 +2803,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
2630
2803
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
2631
2804
|
}
|
|
2632
2805
|
function useFocusTrap(containerRef, active) {
|
|
2633
|
-
|
|
2806
|
+
React18.useEffect(() => {
|
|
2634
2807
|
if (!active) return;
|
|
2635
2808
|
const el = containerRef.current;
|
|
2636
2809
|
if (!el) return;
|
|
@@ -2669,16 +2842,16 @@ function Wizard({
|
|
|
2669
2842
|
onComplete,
|
|
2670
2843
|
onSkip
|
|
2671
2844
|
}) {
|
|
2672
|
-
const tooltipRef =
|
|
2673
|
-
const tooltipTitleId =
|
|
2674
|
-
const tooltipBodyId =
|
|
2845
|
+
const tooltipRef = React18.useRef(null);
|
|
2846
|
+
const tooltipTitleId = React18.useId();
|
|
2847
|
+
const tooltipBodyId = React18.useId();
|
|
2675
2848
|
const reduced = framerMotion.useReducedMotion();
|
|
2676
|
-
const [open, setOpen] =
|
|
2677
|
-
const [activeIndex, setActiveIndex] =
|
|
2849
|
+
const [open, setOpen] = React18.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
2850
|
+
const [activeIndex, setActiveIndex] = React18.useState(0);
|
|
2678
2851
|
const step = steps[activeIndex];
|
|
2679
2852
|
const bbox = useTargetBbox(step?.stepRef);
|
|
2680
2853
|
useFocusTrap(tooltipRef, open);
|
|
2681
|
-
|
|
2854
|
+
React18.useEffect(() => {
|
|
2682
2855
|
if (!open || !dismissible) return;
|
|
2683
2856
|
const onKey = (e) => {
|
|
2684
2857
|
if (e.key === "Escape") {
|
|
@@ -2689,12 +2862,12 @@ function Wizard({
|
|
|
2689
2862
|
document.addEventListener("keydown", onKey);
|
|
2690
2863
|
return () => document.removeEventListener("keydown", onKey);
|
|
2691
2864
|
}, [open, dismissible]);
|
|
2692
|
-
const handleSkip =
|
|
2865
|
+
const handleSkip = React18.useCallback(() => {
|
|
2693
2866
|
writeDismissed(storageKey);
|
|
2694
2867
|
setOpen(false);
|
|
2695
2868
|
onSkip?.();
|
|
2696
2869
|
}, [storageKey, onSkip]);
|
|
2697
|
-
const handleComplete =
|
|
2870
|
+
const handleComplete = React18.useCallback(() => {
|
|
2698
2871
|
writeDismissed(storageKey);
|
|
2699
2872
|
setOpen(false);
|
|
2700
2873
|
onComplete?.();
|
|
@@ -2965,7 +3138,7 @@ function Field({
|
|
|
2965
3138
|
);
|
|
2966
3139
|
}
|
|
2967
3140
|
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" }) });
|
|
2968
|
-
var SearchInput =
|
|
3141
|
+
var SearchInput = React18__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
2969
3142
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2970
3143
|
"div",
|
|
2971
3144
|
{
|
|
@@ -3019,11 +3192,11 @@ function MultiTagRow({
|
|
|
3019
3192
|
labelFor,
|
|
3020
3193
|
onRemove
|
|
3021
3194
|
}) {
|
|
3022
|
-
const wrapRef =
|
|
3023
|
-
const measureRef =
|
|
3024
|
-
const [visibleCount, setVisibleCount] =
|
|
3195
|
+
const wrapRef = React18.useRef(null);
|
|
3196
|
+
const measureRef = React18.useRef(null);
|
|
3197
|
+
const [visibleCount, setVisibleCount] = React18.useState(values.length);
|
|
3025
3198
|
const key = values.map(String).join("|");
|
|
3026
|
-
|
|
3199
|
+
React18.useLayoutEffect(() => {
|
|
3027
3200
|
const wrap = wrapRef.current;
|
|
3028
3201
|
const measure = measureRef.current;
|
|
3029
3202
|
if (!wrap || !measure) return;
|
|
@@ -3117,16 +3290,16 @@ function Dropdown({
|
|
|
3117
3290
|
size = "md",
|
|
3118
3291
|
className = ""
|
|
3119
3292
|
}) {
|
|
3120
|
-
const [open, setOpen] =
|
|
3121
|
-
const [selectedItems, setSelectedItems] =
|
|
3122
|
-
const [searchTerm, setSearchTerm] =
|
|
3123
|
-
const [innerItems, setInnerItems] =
|
|
3124
|
-
const errorId =
|
|
3293
|
+
const [open, setOpen] = React18.useState(false);
|
|
3294
|
+
const [selectedItems, setSelectedItems] = React18.useState([]);
|
|
3295
|
+
const [searchTerm, setSearchTerm] = React18.useState("");
|
|
3296
|
+
const [innerItems, setInnerItems] = React18.useState([]);
|
|
3297
|
+
const errorId = React18.useId();
|
|
3125
3298
|
const hasError = errorMessage != null;
|
|
3126
|
-
|
|
3299
|
+
React18.useEffect(() => {
|
|
3127
3300
|
setInnerItems(items);
|
|
3128
3301
|
}, [items]);
|
|
3129
|
-
|
|
3302
|
+
React18.useEffect(() => {
|
|
3130
3303
|
if (isMultiselect && Array.isArray(value)) {
|
|
3131
3304
|
setSelectedItems(value);
|
|
3132
3305
|
}
|
|
@@ -3451,7 +3624,7 @@ function TableBody({
|
|
|
3451
3624
|
expandRow,
|
|
3452
3625
|
getRowKey
|
|
3453
3626
|
}) {
|
|
3454
|
-
const [expanded, setExpanded] =
|
|
3627
|
+
const [expanded, setExpanded] = React18.useState(() => /* @__PURE__ */ new Set());
|
|
3455
3628
|
const reduced = framerMotion.useReducedMotion();
|
|
3456
3629
|
const toggleRow = (rowKey) => {
|
|
3457
3630
|
setExpanded((prev) => {
|
|
@@ -3466,7 +3639,7 @@ function TableBody({
|
|
|
3466
3639
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
3467
3640
|
const rowKey = getRowKey(row, i);
|
|
3468
3641
|
const isExpanded = expanded.has(rowKey);
|
|
3469
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3642
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React18__default.default.Fragment, { children: [
|
|
3470
3643
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3471
3644
|
"tr",
|
|
3472
3645
|
{
|
|
@@ -3522,9 +3695,9 @@ function Pagination({
|
|
|
3522
3695
|
const matchedOption = picker.find(
|
|
3523
3696
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
3524
3697
|
);
|
|
3525
|
-
const [perPageKey, setPerPageKey] =
|
|
3698
|
+
const [perPageKey, setPerPageKey] = React18.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
3526
3699
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
3527
|
-
|
|
3700
|
+
React18.useEffect(() => {
|
|
3528
3701
|
if (serverSide && options.perPage != null) {
|
|
3529
3702
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
3530
3703
|
if (next) setPerPageKey(next.key);
|
|
@@ -3588,14 +3761,14 @@ function Table({
|
|
|
3588
3761
|
className = "",
|
|
3589
3762
|
style
|
|
3590
3763
|
}) {
|
|
3591
|
-
const searchRef =
|
|
3592
|
-
const [searchTerm, setSearchTerm] =
|
|
3593
|
-
const [perPage, setPerPage] =
|
|
3764
|
+
const searchRef = React18.useRef(null);
|
|
3765
|
+
const [searchTerm, setSearchTerm] = React18.useState("");
|
|
3766
|
+
const [perPage, setPerPage] = React18.useState(
|
|
3594
3767
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
3595
3768
|
);
|
|
3596
|
-
const [activePage, setActivePage] =
|
|
3769
|
+
const [activePage, setActivePage] = React18.useState(0);
|
|
3597
3770
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
3598
|
-
const filteredRows =
|
|
3771
|
+
const filteredRows = React18.useMemo(() => {
|
|
3599
3772
|
if (isServerSide || !searchTerm) return rows;
|
|
3600
3773
|
const term = searchTerm.toLowerCase();
|
|
3601
3774
|
return rows.filter(
|
|
@@ -3604,29 +3777,29 @@ function Table({
|
|
|
3604
3777
|
)
|
|
3605
3778
|
);
|
|
3606
3779
|
}, [rows, searchTerm, isServerSide]);
|
|
3607
|
-
const datasets =
|
|
3780
|
+
const datasets = React18.useMemo(() => {
|
|
3608
3781
|
if (isServerSide) return [rows];
|
|
3609
3782
|
return createDatasets(filteredRows, pagination.enabled ? perPage : null);
|
|
3610
3783
|
}, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
3611
|
-
const MAX_PAGE =
|
|
3784
|
+
const MAX_PAGE = React18.useMemo(() => {
|
|
3612
3785
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
3613
3786
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
3614
3787
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
3615
3788
|
return datasets.length ? datasets.length - 1 : 0;
|
|
3616
3789
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
3617
|
-
const currentPageRows =
|
|
3790
|
+
const currentPageRows = React18.useMemo(() => {
|
|
3618
3791
|
if (isServerSide) return rows;
|
|
3619
3792
|
return datasets[activePage] ?? [];
|
|
3620
3793
|
}, [isServerSide, rows, datasets, activePage]);
|
|
3621
|
-
|
|
3794
|
+
React18.useEffect(() => {
|
|
3622
3795
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
3623
3796
|
setPerPage(pagination.perPage);
|
|
3624
3797
|
}
|
|
3625
3798
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
3626
|
-
|
|
3799
|
+
React18.useEffect(() => {
|
|
3627
3800
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
3628
3801
|
}, [isServerSide, pagination.perPage]);
|
|
3629
|
-
|
|
3802
|
+
React18.useEffect(() => {
|
|
3630
3803
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
3631
3804
|
setActivePage(pagination.page - 1);
|
|
3632
3805
|
}, [isServerSide, pagination.page]);
|
|
@@ -3710,7 +3883,7 @@ function TableSkeletonBody({
|
|
|
3710
3883
|
)) });
|
|
3711
3884
|
}
|
|
3712
3885
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
3713
|
-
const id =
|
|
3886
|
+
const id = React18.useId();
|
|
3714
3887
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3715
3888
|
SwitchPrimitive__namespace.Root,
|
|
3716
3889
|
{
|
|
@@ -3894,7 +4067,7 @@ function Sidebar({
|
|
|
3894
4067
|
}
|
|
3895
4068
|
) });
|
|
3896
4069
|
}
|
|
3897
|
-
var MegaMenuContext =
|
|
4070
|
+
var MegaMenuContext = React18.createContext({ align: "start" });
|
|
3898
4071
|
function MegaMenu({
|
|
3899
4072
|
children,
|
|
3900
4073
|
align = "start",
|
|
@@ -3925,7 +4098,7 @@ function MegaMenu({
|
|
|
3925
4098
|
}
|
|
3926
4099
|
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";
|
|
3927
4100
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
3928
|
-
const { align } =
|
|
4101
|
+
const { align } = React18.useContext(MegaMenuContext);
|
|
3929
4102
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
3930
4103
|
if (!children) {
|
|
3931
4104
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
|
|
@@ -4010,8 +4183,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
4010
4183
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
4011
4184
|
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 });
|
|
4012
4185
|
}
|
|
4013
|
-
var elementsOfType = (children, type) =>
|
|
4014
|
-
(c) =>
|
|
4186
|
+
var elementsOfType = (children, type) => React18__default.default.Children.toArray(children).filter(
|
|
4187
|
+
(c) => React18__default.default.isValidElement(c) && c.type === type
|
|
4015
4188
|
);
|
|
4016
4189
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4017
4190
|
"svg",
|
|
@@ -4048,9 +4221,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
4048
4221
|
);
|
|
4049
4222
|
}
|
|
4050
4223
|
function MobilePanel({ panel, onNavigate }) {
|
|
4051
|
-
const nodes =
|
|
4224
|
+
const nodes = React18__default.default.Children.toArray(panel.props.children);
|
|
4052
4225
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
4053
|
-
if (!
|
|
4226
|
+
if (!React18__default.default.isValidElement(node)) return null;
|
|
4054
4227
|
const el = node;
|
|
4055
4228
|
if (el.type === MegaMenuSection) {
|
|
4056
4229
|
const { title, children } = el.props;
|
|
@@ -4069,8 +4242,8 @@ function MegaMenuMobile({
|
|
|
4069
4242
|
children,
|
|
4070
4243
|
label
|
|
4071
4244
|
}) {
|
|
4072
|
-
const [open, setOpen] =
|
|
4073
|
-
const [expanded, setExpanded] =
|
|
4245
|
+
const [open, setOpen] = React18.useState(false);
|
|
4246
|
+
const [expanded, setExpanded] = React18.useState(null);
|
|
4074
4247
|
const items = elementsOfType(children, MegaMenuItem);
|
|
4075
4248
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
4076
4249
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4143,17 +4316,17 @@ function AppShell({
|
|
|
4143
4316
|
children,
|
|
4144
4317
|
className = ""
|
|
4145
4318
|
}) {
|
|
4146
|
-
const [expanded, setExpanded] =
|
|
4147
|
-
const [isMobile, setIsMobile] =
|
|
4148
|
-
const [mobileOpen, setMobileOpen] =
|
|
4149
|
-
|
|
4319
|
+
const [expanded, setExpanded] = React18.useState(sidebarDefaultExpanded);
|
|
4320
|
+
const [isMobile, setIsMobile] = React18.useState(false);
|
|
4321
|
+
const [mobileOpen, setMobileOpen] = React18.useState(false);
|
|
4322
|
+
React18.useEffect(() => {
|
|
4150
4323
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
4151
4324
|
const update = (e) => setIsMobile(e.matches);
|
|
4152
4325
|
update(mq);
|
|
4153
4326
|
mq.addEventListener("change", update);
|
|
4154
4327
|
return () => mq.removeEventListener("change", update);
|
|
4155
4328
|
}, []);
|
|
4156
|
-
|
|
4329
|
+
React18.useEffect(() => {
|
|
4157
4330
|
if (!isMobile) setMobileOpen(false);
|
|
4158
4331
|
}, [isMobile]);
|
|
4159
4332
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -4343,10 +4516,10 @@ function ThemeProvider({
|
|
|
4343
4516
|
className = "",
|
|
4344
4517
|
style
|
|
4345
4518
|
}) {
|
|
4346
|
-
const id =
|
|
4519
|
+
const id = React18__default.default.useId().replace(/:/g, "");
|
|
4347
4520
|
const scopeClass = `geo-th-${id}`;
|
|
4348
|
-
const divRef =
|
|
4349
|
-
|
|
4521
|
+
const divRef = React18.useRef(null);
|
|
4522
|
+
React18.useEffect(() => {
|
|
4350
4523
|
const el = divRef.current;
|
|
4351
4524
|
if (!el) return;
|
|
4352
4525
|
if (colorScheme === "auto") return;
|
|
@@ -4361,8 +4534,8 @@ function ThemeProvider({
|
|
|
4361
4534
|
}
|
|
4362
4535
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
4363
4536
|
}, [colorScheme]);
|
|
4364
|
-
const lightVars =
|
|
4365
|
-
const darkVarStr =
|
|
4537
|
+
const lightVars = React18.useMemo(() => toCssVars(theme), [theme]);
|
|
4538
|
+
const darkVarStr = React18.useMemo(() => {
|
|
4366
4539
|
if (!darkTheme) return "";
|
|
4367
4540
|
const dvars = toCssVars(darkTheme);
|
|
4368
4541
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -4402,7 +4575,7 @@ function TextInput({
|
|
|
4402
4575
|
prefix,
|
|
4403
4576
|
suffix
|
|
4404
4577
|
}) {
|
|
4405
|
-
const errorId =
|
|
4578
|
+
const errorId = React18.useId();
|
|
4406
4579
|
const hasError = errorMessage != null;
|
|
4407
4580
|
const hasAdornment = prefix != null || suffix != null;
|
|
4408
4581
|
const input = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4472,7 +4645,7 @@ function NumberInput({
|
|
|
4472
4645
|
readOnly = false,
|
|
4473
4646
|
precision
|
|
4474
4647
|
}) {
|
|
4475
|
-
const errorId =
|
|
4648
|
+
const errorId = React18.useId();
|
|
4476
4649
|
const hasError = errorMessage != null;
|
|
4477
4650
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
4478
4651
|
const round = (n) => {
|
|
@@ -4603,8 +4776,8 @@ function Password({
|
|
|
4603
4776
|
showIcon,
|
|
4604
4777
|
hideIcon
|
|
4605
4778
|
}) {
|
|
4606
|
-
const [visible, setVisible] =
|
|
4607
|
-
const errorId =
|
|
4779
|
+
const [visible, setVisible] = React18.useState(false);
|
|
4780
|
+
const errorId = React18.useId();
|
|
4608
4781
|
const hasError = errorMessage != null;
|
|
4609
4782
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4610
4783
|
Field,
|
|
@@ -4677,7 +4850,7 @@ function Checkbox({
|
|
|
4677
4850
|
}) {
|
|
4678
4851
|
const isChecked = checked ?? value ?? false;
|
|
4679
4852
|
const labelFirst = labelPosition === "left";
|
|
4680
|
-
const errorId =
|
|
4853
|
+
const errorId = React18.useId();
|
|
4681
4854
|
const hasError = errorMessage != null;
|
|
4682
4855
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4683
4856
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -4785,8 +4958,8 @@ function RadioGroup({
|
|
|
4785
4958
|
className,
|
|
4786
4959
|
errorMessage
|
|
4787
4960
|
}) {
|
|
4788
|
-
const errorId =
|
|
4789
|
-
const groupId =
|
|
4961
|
+
const errorId = React18.useId();
|
|
4962
|
+
const groupId = React18.useId();
|
|
4790
4963
|
const hasError = errorMessage != null;
|
|
4791
4964
|
const labelFirst = labelPosition === "left";
|
|
4792
4965
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4886,11 +5059,11 @@ function Switch({
|
|
|
4886
5059
|
disabled,
|
|
4887
5060
|
errorMessage
|
|
4888
5061
|
}) {
|
|
4889
|
-
const id =
|
|
4890
|
-
const errorId =
|
|
5062
|
+
const id = React18.useId();
|
|
5063
|
+
const errorId = React18.useId();
|
|
4891
5064
|
const hasError = errorMessage != null;
|
|
4892
5065
|
const isControlled = checked !== void 0;
|
|
4893
|
-
const [internal, setInternal] =
|
|
5066
|
+
const [internal, setInternal] = React18.useState(defaultChecked);
|
|
4894
5067
|
const isOn = isControlled ? checked : internal;
|
|
4895
5068
|
const handle = (c) => {
|
|
4896
5069
|
if (!isControlled) setInternal(c);
|
|
@@ -4963,19 +5136,19 @@ function AutoComplete({
|
|
|
4963
5136
|
required,
|
|
4964
5137
|
htmlFor
|
|
4965
5138
|
}) {
|
|
4966
|
-
const errorId =
|
|
5139
|
+
const errorId = React18.useId();
|
|
4967
5140
|
const hasError = errorMessage != null;
|
|
4968
|
-
const [term, setTerm] =
|
|
4969
|
-
const [open, setOpen] =
|
|
4970
|
-
const [asyncItems, setAsyncItems] =
|
|
4971
|
-
const [loading, setLoading] =
|
|
5141
|
+
const [term, setTerm] = React18.useState("");
|
|
5142
|
+
const [open, setOpen] = React18.useState(false);
|
|
5143
|
+
const [asyncItems, setAsyncItems] = React18.useState([]);
|
|
5144
|
+
const [loading, setLoading] = React18.useState(false);
|
|
4972
5145
|
const isAsync = typeof onSearch === "function";
|
|
4973
|
-
const debounceRef =
|
|
4974
|
-
const requestIdRef =
|
|
5146
|
+
const debounceRef = React18.useRef(null);
|
|
5147
|
+
const requestIdRef = React18.useRef(0);
|
|
4975
5148
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
4976
5149
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
4977
5150
|
) : [];
|
|
4978
|
-
|
|
5151
|
+
React18.useEffect(() => {
|
|
4979
5152
|
if (!isAsync) return;
|
|
4980
5153
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
4981
5154
|
if (!term.trim()) {
|
|
@@ -5131,15 +5304,15 @@ function TreeSelect({
|
|
|
5131
5304
|
defaultExpandedKeys = [],
|
|
5132
5305
|
size = "md"
|
|
5133
5306
|
}) {
|
|
5134
|
-
const errorId =
|
|
5307
|
+
const errorId = React18.useId();
|
|
5135
5308
|
const hasError = errorMessage != null;
|
|
5136
|
-
const [open, setOpen] =
|
|
5137
|
-
const [expanded, setExpanded] =
|
|
5138
|
-
const [activeIndex, setActiveIndex] =
|
|
5139
|
-
const listRef =
|
|
5140
|
-
const visible =
|
|
5141
|
-
const didSyncOnOpenRef =
|
|
5142
|
-
|
|
5309
|
+
const [open, setOpen] = React18.useState(false);
|
|
5310
|
+
const [expanded, setExpanded] = React18.useState(() => new Set(defaultExpandedKeys));
|
|
5311
|
+
const [activeIndex, setActiveIndex] = React18.useState(0);
|
|
5312
|
+
const listRef = React18.useRef(null);
|
|
5313
|
+
const visible = React18.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
5314
|
+
const didSyncOnOpenRef = React18.useRef(false);
|
|
5315
|
+
React18.useEffect(() => {
|
|
5143
5316
|
if (!open) {
|
|
5144
5317
|
didSyncOnOpenRef.current = false;
|
|
5145
5318
|
return;
|
|
@@ -5149,7 +5322,7 @@ function TreeSelect({
|
|
|
5149
5322
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
5150
5323
|
didSyncOnOpenRef.current = true;
|
|
5151
5324
|
}, [open, value]);
|
|
5152
|
-
const selectedNode =
|
|
5325
|
+
const selectedNode = React18.useMemo(
|
|
5153
5326
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
5154
5327
|
[items, value]
|
|
5155
5328
|
);
|
|
@@ -5380,11 +5553,11 @@ function FileInput({
|
|
|
5380
5553
|
required,
|
|
5381
5554
|
icon
|
|
5382
5555
|
}) {
|
|
5383
|
-
const inputRef =
|
|
5384
|
-
const errorId =
|
|
5385
|
-
const [files, setFiles] =
|
|
5386
|
-
const [dragging, setDragging] =
|
|
5387
|
-
const [sizeError, setSizeError] =
|
|
5556
|
+
const inputRef = React18.useRef(null);
|
|
5557
|
+
const errorId = React18.useId();
|
|
5558
|
+
const [files, setFiles] = React18.useState([]);
|
|
5559
|
+
const [dragging, setDragging] = React18.useState(false);
|
|
5560
|
+
const [sizeError, setSizeError] = React18.useState(null);
|
|
5388
5561
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
5389
5562
|
const openPicker = () => {
|
|
5390
5563
|
if (!disabled) inputRef.current?.click();
|
|
@@ -5575,30 +5748,30 @@ function DatePicker({
|
|
|
5575
5748
|
size = "md",
|
|
5576
5749
|
className = ""
|
|
5577
5750
|
}) {
|
|
5578
|
-
const errorId =
|
|
5751
|
+
const errorId = React18.useId();
|
|
5579
5752
|
const hasError = errorMessage != null;
|
|
5580
|
-
const [open, setOpen] =
|
|
5581
|
-
const [viewMonth, setViewMonth] =
|
|
5582
|
-
const [focusDate, setFocusDate] =
|
|
5583
|
-
const [view, setView] =
|
|
5584
|
-
const gridRef =
|
|
5585
|
-
|
|
5753
|
+
const [open, setOpen] = React18.useState(false);
|
|
5754
|
+
const [viewMonth, setViewMonth] = React18.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
5755
|
+
const [focusDate, setFocusDate] = React18.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
5756
|
+
const [view, setView] = React18.useState("days");
|
|
5757
|
+
const gridRef = React18.useRef(null);
|
|
5758
|
+
React18.useEffect(() => {
|
|
5586
5759
|
if (!open) return;
|
|
5587
5760
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
5588
5761
|
setViewMonth(startOfMonth(target));
|
|
5589
5762
|
setFocusDate(target);
|
|
5590
5763
|
setView("days");
|
|
5591
5764
|
}, [open, value]);
|
|
5592
|
-
|
|
5765
|
+
React18.useEffect(() => {
|
|
5593
5766
|
if (!open) return;
|
|
5594
5767
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat(focusDate)}"]`);
|
|
5595
5768
|
cell?.focus();
|
|
5596
5769
|
}, [open, focusDate]);
|
|
5597
|
-
const weekdays =
|
|
5770
|
+
const weekdays = React18.useMemo(() => {
|
|
5598
5771
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5599
5772
|
return ordered;
|
|
5600
5773
|
}, [weekStartsOn]);
|
|
5601
|
-
const grid =
|
|
5774
|
+
const grid = React18.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5602
5775
|
const isDisabled = (d) => {
|
|
5603
5776
|
if (min && d < min) return true;
|
|
5604
5777
|
if (max && d > max) return true;
|
|
@@ -5888,10 +6061,10 @@ function TextArea({
|
|
|
5888
6061
|
style,
|
|
5889
6062
|
inputStyle
|
|
5890
6063
|
}) {
|
|
5891
|
-
const errorId =
|
|
6064
|
+
const errorId = React18.useId();
|
|
5892
6065
|
const hasError = errorMessage != null;
|
|
5893
|
-
const ref =
|
|
5894
|
-
|
|
6066
|
+
const ref = React18.useRef(null);
|
|
6067
|
+
React18.useLayoutEffect(() => {
|
|
5895
6068
|
if (!autoGrow) return;
|
|
5896
6069
|
const el = ref.current;
|
|
5897
6070
|
if (!el) return;
|
|
@@ -5938,7 +6111,7 @@ function TextArea({
|
|
|
5938
6111
|
}
|
|
5939
6112
|
);
|
|
5940
6113
|
}
|
|
5941
|
-
var
|
|
6114
|
+
var SIZE5 = {
|
|
5942
6115
|
sm: { h: "h-control-sm", text: "text-xs", pad: "px-2.5" },
|
|
5943
6116
|
md: { h: "h-control-md", text: "text-sm", pad: "px-3.5" },
|
|
5944
6117
|
lg: { h: "h-control-lg", text: "text-sm", pad: "px-4" }
|
|
@@ -5960,12 +6133,12 @@ function SegmentedControl({
|
|
|
5960
6133
|
errorMessage,
|
|
5961
6134
|
"aria-label": ariaLabel
|
|
5962
6135
|
}) {
|
|
5963
|
-
const sz =
|
|
5964
|
-
const groupId =
|
|
5965
|
-
const errorId =
|
|
6136
|
+
const sz = SIZE5[size];
|
|
6137
|
+
const groupId = React18.useId();
|
|
6138
|
+
const errorId = React18.useId();
|
|
5966
6139
|
const hasError = errorMessage != null;
|
|
5967
6140
|
const isControlled = value !== void 0;
|
|
5968
|
-
const [internal, setInternal] =
|
|
6141
|
+
const [internal, setInternal] = React18.useState(defaultValue);
|
|
5969
6142
|
const current = isControlled ? value : internal;
|
|
5970
6143
|
const handle = (v) => {
|
|
5971
6144
|
if (!v) return;
|
|
@@ -6059,14 +6232,14 @@ function Slider({
|
|
|
6059
6232
|
name,
|
|
6060
6233
|
htmlFor
|
|
6061
6234
|
}) {
|
|
6062
|
-
const errorId =
|
|
6235
|
+
const errorId = React18.useId();
|
|
6063
6236
|
const hasError = errorMessage != null;
|
|
6064
6237
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
6065
|
-
const [internal, setInternal] =
|
|
6238
|
+
const [internal, setInternal] = React18.useState(
|
|
6066
6239
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
6067
6240
|
);
|
|
6068
6241
|
const current = toArray(value) ?? internal;
|
|
6069
|
-
const [dragging, setDragging] =
|
|
6242
|
+
const [dragging, setDragging] = React18.useState(false);
|
|
6070
6243
|
const emit = (arr) => {
|
|
6071
6244
|
setInternal(arr);
|
|
6072
6245
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -6161,11 +6334,11 @@ function TagsInput({
|
|
|
6161
6334
|
validate,
|
|
6162
6335
|
separators = ["Enter", ","]
|
|
6163
6336
|
}) {
|
|
6164
|
-
const errorId =
|
|
6165
|
-
const inputRef =
|
|
6166
|
-
const [internal, setInternal] =
|
|
6167
|
-
const [draft, setDraft] =
|
|
6168
|
-
const [localError, setLocalError] =
|
|
6337
|
+
const errorId = React18.useId();
|
|
6338
|
+
const inputRef = React18.useRef(null);
|
|
6339
|
+
const [internal, setInternal] = React18.useState(defaultValue ?? []);
|
|
6340
|
+
const [draft, setDraft] = React18.useState("");
|
|
6341
|
+
const [localError, setLocalError] = React18.useState(null);
|
|
6169
6342
|
const tags = value ?? internal;
|
|
6170
6343
|
const hasError = errorMessage != null || localError != null;
|
|
6171
6344
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -6296,9 +6469,9 @@ function OtpInput({
|
|
|
6296
6469
|
className,
|
|
6297
6470
|
groupAfter
|
|
6298
6471
|
}) {
|
|
6299
|
-
const errorId =
|
|
6472
|
+
const errorId = React18.useId();
|
|
6300
6473
|
const hasError = errorMessage != null;
|
|
6301
|
-
const refs =
|
|
6474
|
+
const refs = React18.useRef([]);
|
|
6302
6475
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
6303
6476
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
6304
6477
|
const emit = (next) => {
|
|
@@ -6347,7 +6520,7 @@ function OtpInput({
|
|
|
6347
6520
|
emit(valid.join(""));
|
|
6348
6521
|
focusBox(valid.length);
|
|
6349
6522
|
};
|
|
6350
|
-
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(
|
|
6523
|
+
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(React18__default.default.Fragment, { children: [
|
|
6351
6524
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6352
6525
|
"input",
|
|
6353
6526
|
{
|
|
@@ -6405,9 +6578,9 @@ function Rating({
|
|
|
6405
6578
|
className,
|
|
6406
6579
|
required
|
|
6407
6580
|
}) {
|
|
6408
|
-
const errorId =
|
|
6409
|
-
const [internal, setInternal] =
|
|
6410
|
-
const [hover, setHover] =
|
|
6581
|
+
const errorId = React18.useId();
|
|
6582
|
+
const [internal, setInternal] = React18.useState(defaultValue);
|
|
6583
|
+
const [hover, setHover] = React18.useState(null);
|
|
6411
6584
|
const current = value ?? internal;
|
|
6412
6585
|
const display2 = hover ?? current;
|
|
6413
6586
|
const interactive = !readOnly && !disabled;
|
|
@@ -6530,9 +6703,9 @@ function TimePicker({
|
|
|
6530
6703
|
required,
|
|
6531
6704
|
style
|
|
6532
6705
|
}) {
|
|
6533
|
-
const errorId =
|
|
6706
|
+
const errorId = React18.useId();
|
|
6534
6707
|
const hasError = errorMessage != null;
|
|
6535
|
-
const [open, setOpen] =
|
|
6708
|
+
const [open, setOpen] = React18.useState(false);
|
|
6536
6709
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
6537
6710
|
const update = (next) => {
|
|
6538
6711
|
const merged = { ...parsed, ...next };
|
|
@@ -6656,13 +6829,13 @@ function DateRangePicker({
|
|
|
6656
6829
|
required,
|
|
6657
6830
|
style
|
|
6658
6831
|
}) {
|
|
6659
|
-
const errorId =
|
|
6832
|
+
const errorId = React18.useId();
|
|
6660
6833
|
const hasError = errorMessage != null;
|
|
6661
|
-
const [open, setOpen] =
|
|
6662
|
-
const [leftMonth, setLeftMonth] =
|
|
6663
|
-
const [pendingStart, setPendingStart] =
|
|
6664
|
-
const [hoverDate, setHoverDate] =
|
|
6665
|
-
const weekdays =
|
|
6834
|
+
const [open, setOpen] = React18.useState(false);
|
|
6835
|
+
const [leftMonth, setLeftMonth] = React18.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
6836
|
+
const [pendingStart, setPendingStart] = React18.useState(null);
|
|
6837
|
+
const [hoverDate, setHoverDate] = React18.useState(null);
|
|
6838
|
+
const weekdays = React18.useMemo(
|
|
6666
6839
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6667
6840
|
[weekStartsOn]
|
|
6668
6841
|
);
|
|
@@ -6838,10 +7011,10 @@ function ColorPicker({
|
|
|
6838
7011
|
required,
|
|
6839
7012
|
placeholder = "Pick a colour\u2026"
|
|
6840
7013
|
}) {
|
|
6841
|
-
const errorId =
|
|
7014
|
+
const errorId = React18.useId();
|
|
6842
7015
|
const hasError = errorMessage != null;
|
|
6843
|
-
const [open, setOpen] =
|
|
6844
|
-
const [draft, setDraft] =
|
|
7016
|
+
const [open, setOpen] = React18.useState(false);
|
|
7017
|
+
const [draft, setDraft] = React18.useState(value);
|
|
6845
7018
|
const valid = HEX_RE.test(value);
|
|
6846
7019
|
const pick = (hex) => {
|
|
6847
7020
|
onChange?.(hex);
|
|
@@ -7228,11 +7401,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
7228
7401
|
|
|
7229
7402
|
// src/form/useForm.ts
|
|
7230
7403
|
function useForm(options = {}) {
|
|
7231
|
-
const ref =
|
|
7404
|
+
const ref = React18.useRef(null);
|
|
7232
7405
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
7233
7406
|
const store = ref.current;
|
|
7234
|
-
|
|
7235
|
-
const make =
|
|
7407
|
+
React18.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7408
|
+
const make = React18.useCallback(
|
|
7236
7409
|
(kind) => (name, rules) => {
|
|
7237
7410
|
if (rules !== void 0) store.setRule(name, rules);
|
|
7238
7411
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -7261,9 +7434,9 @@ function useForm(options = {}) {
|
|
|
7261
7434
|
fieldTarget: make("target")
|
|
7262
7435
|
};
|
|
7263
7436
|
}
|
|
7264
|
-
var FormContext =
|
|
7437
|
+
var FormContext = React18.createContext(null);
|
|
7265
7438
|
function useFormStore() {
|
|
7266
|
-
const store =
|
|
7439
|
+
const store = React18.useContext(FormContext);
|
|
7267
7440
|
if (!store) {
|
|
7268
7441
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
7269
7442
|
}
|
|
@@ -7277,8 +7450,8 @@ function Form({
|
|
|
7277
7450
|
children,
|
|
7278
7451
|
...rest
|
|
7279
7452
|
}) {
|
|
7280
|
-
const ref =
|
|
7281
|
-
const bypass =
|
|
7453
|
+
const ref = React18.useRef(null);
|
|
7454
|
+
const bypass = React18.useRef(false);
|
|
7282
7455
|
const handleSubmit = async (e) => {
|
|
7283
7456
|
if (bypass.current) {
|
|
7284
7457
|
bypass.current = false;
|
|
@@ -7330,12 +7503,12 @@ function useFormField(name, options = {}) {
|
|
|
7330
7503
|
const store = useFormStore();
|
|
7331
7504
|
const { kind = "value", rules } = options;
|
|
7332
7505
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
7333
|
-
|
|
7506
|
+
React18.useEffect(() => {
|
|
7334
7507
|
return () => {
|
|
7335
7508
|
if (rules !== void 0) store.removeRule(name);
|
|
7336
7509
|
};
|
|
7337
7510
|
}, [store, name]);
|
|
7338
|
-
const snap =
|
|
7511
|
+
const snap = React18.useSyncExternalStore(
|
|
7339
7512
|
store.subscribe,
|
|
7340
7513
|
() => store.getFieldSnapshot(name)
|
|
7341
7514
|
);
|
|
@@ -7347,7 +7520,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
7347
7520
|
}
|
|
7348
7521
|
function useFieldArray(name) {
|
|
7349
7522
|
const store = useFormStore();
|
|
7350
|
-
|
|
7523
|
+
React18.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7351
7524
|
const arr = store.getValue(name) ?? [];
|
|
7352
7525
|
const keys = store.getKeys(name);
|
|
7353
7526
|
return {
|
|
@@ -7470,7 +7643,7 @@ function CreditCardForm({
|
|
|
7470
7643
|
className = "",
|
|
7471
7644
|
style
|
|
7472
7645
|
}) {
|
|
7473
|
-
const initial =
|
|
7646
|
+
const initial = React18.useRef({
|
|
7474
7647
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
7475
7648
|
name: defaultValue?.name ?? "",
|
|
7476
7649
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -7479,7 +7652,7 @@ function CreditCardForm({
|
|
|
7479
7652
|
const form = useForm({ initialValues: initial });
|
|
7480
7653
|
const numberStr = String(form.values.number ?? "");
|
|
7481
7654
|
const brand = detectBrand(numberStr);
|
|
7482
|
-
|
|
7655
|
+
React18.useEffect(() => {
|
|
7483
7656
|
onChange?.(toCard(form.values));
|
|
7484
7657
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
7485
7658
|
const numberBind = form.fieldNative("number", {
|
|
@@ -7598,6 +7771,7 @@ exports.CreditCardForm = CreditCardForm;
|
|
|
7598
7771
|
exports.DateRangePicker = DateRangePicker;
|
|
7599
7772
|
exports.Drawer = Drawer;
|
|
7600
7773
|
exports.Dropdown = Dropdown;
|
|
7774
|
+
exports.FAB = FAB;
|
|
7601
7775
|
exports.FadingBase = FadingBase;
|
|
7602
7776
|
exports.Field = Field;
|
|
7603
7777
|
exports.FieldHelpIcon = FieldHelpIcon;
|
|
@@ -7622,6 +7796,7 @@ exports.NumberInput = NumberInput;
|
|
|
7622
7796
|
exports.OpaqueGridCard = OpaqueGridCard;
|
|
7623
7797
|
exports.OtpInput = OtpInput;
|
|
7624
7798
|
exports.Password = Password;
|
|
7799
|
+
exports.PopConfirm = PopConfirm;
|
|
7625
7800
|
exports.Portal = Portal;
|
|
7626
7801
|
exports.RadioGroup = RadioGroup;
|
|
7627
7802
|
exports.Rating = Rating;
|