@geomak/ui 6.7.0 → 6.9.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 +356 -204
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +164 -14
- package/dist/index.js.map +1 -1
- package/dist/styles.css +37 -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 React17 = 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');
|
|
@@ -39,7 +39,7 @@ function _interopNamespace(e) {
|
|
|
39
39
|
return Object.freeze(n);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var React17__default = /*#__PURE__*/_interopDefault(React17);
|
|
43
43
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
44
44
|
var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
|
|
45
45
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
@@ -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] = React17.useState(null);
|
|
218
|
+
React17.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 = React17.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 = React17.createContext(null);
|
|
964
964
|
function useTabsContext() {
|
|
965
|
-
const ctx =
|
|
965
|
+
const ctx = React17.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] = React17.useState(defaultValue);
|
|
988
988
|
const current = isControlled ? value : internal;
|
|
989
989
|
const reduced = !!framerMotion.useReducedMotion();
|
|
990
|
-
const indicatorId =
|
|
991
|
-
const select =
|
|
990
|
+
const indicatorId = React17.useId();
|
|
991
|
+
const select = React17.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 = React17.useRef(/* @__PURE__ */ new Map());
|
|
996
|
+
const orderRef = React17.useRef(0);
|
|
997
|
+
const [, bump] = React17.useState(0);
|
|
998
|
+
const registerTab = React17.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 = React17.useCallback((val) => {
|
|
1004
1004
|
if (registry.current.delete(val)) bump((v) => v + 1);
|
|
1005
1005
|
}, []);
|
|
1006
|
-
const getTabs =
|
|
1006
|
+
const getTabs = React17.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 = React17.useRef(null);
|
|
1027
|
+
const [edges, setEdges] = React17.useState({ start: false, end: false });
|
|
1028
1028
|
const scrollable = variant !== "segmented";
|
|
1029
|
-
|
|
1029
|
+
React17.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 = React17.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
|
+
React17.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] = React17.useState(false);
|
|
1119
|
+
const wrapRef = React17.useRef(null);
|
|
1120
|
+
const timer = React17.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
|
+
React17.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
|
+
React17.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 = React17.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 } = React17.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] = React17.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(React17__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 = React17.useRef(null);
|
|
1743
|
+
const slides = React17__default.default.Children.toArray(children);
|
|
1744
|
+
const [active, setActive] = React17.useState(0);
|
|
1745
|
+
const [atStart, setAtStart] = React17.useState(true);
|
|
1746
|
+
const [atEnd, setAtEnd] = React17.useState(false);
|
|
1747
1747
|
const width = typeof itemWidth === "number" ? `${itemWidth}px` : itemWidth;
|
|
1748
|
-
const update =
|
|
1748
|
+
const update = React17.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
|
+
React17.useEffect(() => {
|
|
1759
1759
|
update();
|
|
1760
1760
|
const el = scrollerRef.current;
|
|
1761
1761
|
if (!el) return;
|
|
@@ -1809,7 +1809,157 @@ function CardCarousel({
|
|
|
1809
1809
|
)) })
|
|
1810
1810
|
] });
|
|
1811
1811
|
}
|
|
1812
|
-
var
|
|
1812
|
+
var VALUE_SIZE = {
|
|
1813
|
+
sm: "text-xl",
|
|
1814
|
+
md: "text-3xl",
|
|
1815
|
+
lg: "text-4xl"
|
|
1816
|
+
};
|
|
1817
|
+
var TONE2 = {
|
|
1818
|
+
good: "text-status-success",
|
|
1819
|
+
bad: "text-status-error",
|
|
1820
|
+
neutral: "text-foreground-muted"
|
|
1821
|
+
};
|
|
1822
|
+
var ArrowUp = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.2, "aria-hidden": "true", className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 19V5M5 12l7-7 7 7" }) });
|
|
1823
|
+
var ArrowDown = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.2, "aria-hidden": "true", className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 5v14M5 12l7 7 7-7" }) });
|
|
1824
|
+
function Statistic({
|
|
1825
|
+
label,
|
|
1826
|
+
value,
|
|
1827
|
+
prefix,
|
|
1828
|
+
suffix,
|
|
1829
|
+
icon,
|
|
1830
|
+
delta,
|
|
1831
|
+
helpText,
|
|
1832
|
+
size = "md",
|
|
1833
|
+
align = "left",
|
|
1834
|
+
className = "",
|
|
1835
|
+
style
|
|
1836
|
+
}) {
|
|
1837
|
+
const dir = delta?.direction ?? "neutral";
|
|
1838
|
+
const positiveIsGood = delta?.positiveIsGood ?? true;
|
|
1839
|
+
const deltaTone = dir === "neutral" ? "neutral" : dir === "up" === positiveIsGood ? "good" : "bad";
|
|
1840
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1841
|
+
"div",
|
|
1842
|
+
{
|
|
1843
|
+
className: ["flex gap-3", align === "center" ? "flex-col items-center text-center" : "items-start", className].filter(Boolean).join(" "),
|
|
1844
|
+
style,
|
|
1845
|
+
children: [
|
|
1846
|
+
icon && align === "left" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-accent/10 text-accent", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-5 w-5 inline-flex items-center justify-center", children: icon }) }),
|
|
1847
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
1848
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium uppercase tracking-wide text-foreground-muted", children: label }),
|
|
1849
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `mt-1 flex items-baseline gap-0.5 font-semibold text-foreground tabular-nums ${VALUE_SIZE[size]} ${align === "center" ? "justify-center" : ""}`, children: [
|
|
1850
|
+
prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-[0.6em] font-medium self-center", children: prefix }),
|
|
1851
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-none", children: value }),
|
|
1852
|
+
suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-[0.5em] font-medium self-center", children: suffix })
|
|
1853
|
+
] }),
|
|
1854
|
+
delta && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `mt-1.5 flex items-center gap-1 text-sm font-medium ${align === "center" ? "justify-center" : ""} ${TONE2[deltaTone]}`, children: [
|
|
1855
|
+
dir === "up" ? ArrowUp : dir === "down" ? ArrowDown : null,
|
|
1856
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: delta.value }),
|
|
1857
|
+
delta.label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted font-normal", children: delta.label })
|
|
1858
|
+
] }),
|
|
1859
|
+
helpText && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-foreground-muted", children: helpText })
|
|
1860
|
+
] })
|
|
1861
|
+
]
|
|
1862
|
+
}
|
|
1863
|
+
);
|
|
1864
|
+
}
|
|
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] = React17.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
|
+
var NotificationContext = React17.createContext({
|
|
1813
1963
|
open: () => void 0,
|
|
1814
1964
|
close: () => void 0
|
|
1815
1965
|
});
|
|
@@ -1867,26 +2017,26 @@ function NotificationItem({
|
|
|
1867
2017
|
onClose,
|
|
1868
2018
|
reduced
|
|
1869
2019
|
}) {
|
|
1870
|
-
const [paused, setPaused] =
|
|
2020
|
+
const [paused, setPaused] = React17.useState(false);
|
|
1871
2021
|
const duration = n.duration ?? 4e3;
|
|
1872
2022
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
1873
2023
|
const showProgress = !reduced && isAutoDismissing;
|
|
1874
|
-
const timerRef =
|
|
1875
|
-
const startTimeRef =
|
|
1876
|
-
const remainingRef =
|
|
1877
|
-
const clearTimer =
|
|
2024
|
+
const timerRef = React17.useRef(null);
|
|
2025
|
+
const startTimeRef = React17.useRef(0);
|
|
2026
|
+
const remainingRef = React17.useRef(duration);
|
|
2027
|
+
const clearTimer = React17.useCallback(() => {
|
|
1878
2028
|
if (timerRef.current !== null) {
|
|
1879
2029
|
clearTimeout(timerRef.current);
|
|
1880
2030
|
timerRef.current = null;
|
|
1881
2031
|
}
|
|
1882
2032
|
}, []);
|
|
1883
|
-
const scheduleDismiss =
|
|
2033
|
+
const scheduleDismiss = React17.useCallback((ms) => {
|
|
1884
2034
|
clearTimer();
|
|
1885
2035
|
if (!isAutoDismissing) return;
|
|
1886
2036
|
startTimeRef.current = Date.now();
|
|
1887
2037
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
1888
2038
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
1889
|
-
|
|
2039
|
+
React17.useEffect(() => {
|
|
1890
2040
|
if (paused || !isAutoDismissing) return;
|
|
1891
2041
|
scheduleDismiss(remainingRef.current);
|
|
1892
2042
|
return clearTimer;
|
|
@@ -1969,15 +2119,15 @@ function NotificationProvider({
|
|
|
1969
2119
|
children,
|
|
1970
2120
|
position = "top-right"
|
|
1971
2121
|
}) {
|
|
1972
|
-
const [notifications, setNotifications] =
|
|
2122
|
+
const [notifications, setNotifications] = React17.useState([]);
|
|
1973
2123
|
const reduced = framerMotion.useReducedMotion();
|
|
1974
|
-
const open =
|
|
2124
|
+
const open = React17.useCallback((payload) => {
|
|
1975
2125
|
setNotifications((prev) => [
|
|
1976
2126
|
...prev,
|
|
1977
2127
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
1978
2128
|
]);
|
|
1979
2129
|
}, []);
|
|
1980
|
-
const close =
|
|
2130
|
+
const close = React17.useCallback((id) => {
|
|
1981
2131
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
1982
2132
|
}, []);
|
|
1983
2133
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -2006,7 +2156,7 @@ function NotificationProvider({
|
|
|
2006
2156
|
] });
|
|
2007
2157
|
}
|
|
2008
2158
|
function useNotification() {
|
|
2009
|
-
const { open } =
|
|
2159
|
+
const { open } = React17.useContext(NotificationContext);
|
|
2010
2160
|
return {
|
|
2011
2161
|
info: (props) => open({ type: "info", ...props }),
|
|
2012
2162
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -2123,10 +2273,10 @@ function FadingBase({
|
|
|
2123
2273
|
isMounted = false,
|
|
2124
2274
|
children
|
|
2125
2275
|
}) {
|
|
2126
|
-
const [shouldRender, setShouldRender] =
|
|
2127
|
-
const [visible, setVisible] =
|
|
2128
|
-
const timerRef =
|
|
2129
|
-
|
|
2276
|
+
const [shouldRender, setShouldRender] = React17.useState(isMounted);
|
|
2277
|
+
const [visible, setVisible] = React17.useState(false);
|
|
2278
|
+
const timerRef = React17.useRef(null);
|
|
2279
|
+
React17.useEffect(() => {
|
|
2130
2280
|
if (isMounted) {
|
|
2131
2281
|
setShouldRender(true);
|
|
2132
2282
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -2224,8 +2374,8 @@ function ScalableContainer({
|
|
|
2224
2374
|
togglePosition = "top-right",
|
|
2225
2375
|
className = ""
|
|
2226
2376
|
}) {
|
|
2227
|
-
const containerRef =
|
|
2228
|
-
const [internalScaled, setInternalScaled] =
|
|
2377
|
+
const containerRef = React17.useRef(null);
|
|
2378
|
+
const [internalScaled, setInternalScaled] = React17.useState(false);
|
|
2229
2379
|
const isScaled = expanded ?? internalScaled;
|
|
2230
2380
|
const reduced = framerMotion.useReducedMotion();
|
|
2231
2381
|
const onToggle = () => {
|
|
@@ -2363,17 +2513,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
2363
2513
|
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)) });
|
|
2364
2514
|
}
|
|
2365
2515
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
2366
|
-
const [activeIndex, setActiveIndex] =
|
|
2367
|
-
const [indexPool, setIndexPool] =
|
|
2368
|
-
const cardRefs =
|
|
2369
|
-
const getIndexes =
|
|
2516
|
+
const [activeIndex, setActiveIndex] = React17.useState(0);
|
|
2517
|
+
const [indexPool, setIndexPool] = React17.useState([]);
|
|
2518
|
+
const cardRefs = React17.useRef([]);
|
|
2519
|
+
const getIndexes = React17.useMemo(() => {
|
|
2370
2520
|
let nextIndex = activeIndex + 1;
|
|
2371
2521
|
let previousIndex = activeIndex - 1;
|
|
2372
2522
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
2373
2523
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
2374
2524
|
return { previousIndex, nextIndex };
|
|
2375
2525
|
}, [activeIndex, items.length]);
|
|
2376
|
-
|
|
2526
|
+
React17.useEffect(() => {
|
|
2377
2527
|
const { nextIndex, previousIndex } = getIndexes;
|
|
2378
2528
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
2379
2529
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -2546,8 +2696,8 @@ function writeDismissed(key) {
|
|
|
2546
2696
|
}
|
|
2547
2697
|
}
|
|
2548
2698
|
function useTargetBbox(ref) {
|
|
2549
|
-
const [bbox, setBbox] =
|
|
2550
|
-
|
|
2699
|
+
const [bbox, setBbox] = React17.useState(null);
|
|
2700
|
+
React17.useLayoutEffect(() => {
|
|
2551
2701
|
const el = ref?.current;
|
|
2552
2702
|
if (!el) {
|
|
2553
2703
|
setBbox(null);
|
|
@@ -2577,7 +2727,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
2577
2727
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
2578
2728
|
}
|
|
2579
2729
|
function useFocusTrap(containerRef, active) {
|
|
2580
|
-
|
|
2730
|
+
React17.useEffect(() => {
|
|
2581
2731
|
if (!active) return;
|
|
2582
2732
|
const el = containerRef.current;
|
|
2583
2733
|
if (!el) return;
|
|
@@ -2616,16 +2766,16 @@ function Wizard({
|
|
|
2616
2766
|
onComplete,
|
|
2617
2767
|
onSkip
|
|
2618
2768
|
}) {
|
|
2619
|
-
const tooltipRef =
|
|
2620
|
-
const tooltipTitleId =
|
|
2621
|
-
const tooltipBodyId =
|
|
2769
|
+
const tooltipRef = React17.useRef(null);
|
|
2770
|
+
const tooltipTitleId = React17.useId();
|
|
2771
|
+
const tooltipBodyId = React17.useId();
|
|
2622
2772
|
const reduced = framerMotion.useReducedMotion();
|
|
2623
|
-
const [open, setOpen] =
|
|
2624
|
-
const [activeIndex, setActiveIndex] =
|
|
2773
|
+
const [open, setOpen] = React17.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
2774
|
+
const [activeIndex, setActiveIndex] = React17.useState(0);
|
|
2625
2775
|
const step = steps[activeIndex];
|
|
2626
2776
|
const bbox = useTargetBbox(step?.stepRef);
|
|
2627
2777
|
useFocusTrap(tooltipRef, open);
|
|
2628
|
-
|
|
2778
|
+
React17.useEffect(() => {
|
|
2629
2779
|
if (!open || !dismissible) return;
|
|
2630
2780
|
const onKey = (e) => {
|
|
2631
2781
|
if (e.key === "Escape") {
|
|
@@ -2636,12 +2786,12 @@ function Wizard({
|
|
|
2636
2786
|
document.addEventListener("keydown", onKey);
|
|
2637
2787
|
return () => document.removeEventListener("keydown", onKey);
|
|
2638
2788
|
}, [open, dismissible]);
|
|
2639
|
-
const handleSkip =
|
|
2789
|
+
const handleSkip = React17.useCallback(() => {
|
|
2640
2790
|
writeDismissed(storageKey);
|
|
2641
2791
|
setOpen(false);
|
|
2642
2792
|
onSkip?.();
|
|
2643
2793
|
}, [storageKey, onSkip]);
|
|
2644
|
-
const handleComplete =
|
|
2794
|
+
const handleComplete = React17.useCallback(() => {
|
|
2645
2795
|
writeDismissed(storageKey);
|
|
2646
2796
|
setOpen(false);
|
|
2647
2797
|
onComplete?.();
|
|
@@ -2912,7 +3062,7 @@ function Field({
|
|
|
2912
3062
|
);
|
|
2913
3063
|
}
|
|
2914
3064
|
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" }) });
|
|
2915
|
-
var SearchInput =
|
|
3065
|
+
var SearchInput = React17__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
2916
3066
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2917
3067
|
"div",
|
|
2918
3068
|
{
|
|
@@ -2966,11 +3116,11 @@ function MultiTagRow({
|
|
|
2966
3116
|
labelFor,
|
|
2967
3117
|
onRemove
|
|
2968
3118
|
}) {
|
|
2969
|
-
const wrapRef =
|
|
2970
|
-
const measureRef =
|
|
2971
|
-
const [visibleCount, setVisibleCount] =
|
|
3119
|
+
const wrapRef = React17.useRef(null);
|
|
3120
|
+
const measureRef = React17.useRef(null);
|
|
3121
|
+
const [visibleCount, setVisibleCount] = React17.useState(values.length);
|
|
2972
3122
|
const key = values.map(String).join("|");
|
|
2973
|
-
|
|
3123
|
+
React17.useLayoutEffect(() => {
|
|
2974
3124
|
const wrap = wrapRef.current;
|
|
2975
3125
|
const measure = measureRef.current;
|
|
2976
3126
|
if (!wrap || !measure) return;
|
|
@@ -3064,16 +3214,16 @@ function Dropdown({
|
|
|
3064
3214
|
size = "md",
|
|
3065
3215
|
className = ""
|
|
3066
3216
|
}) {
|
|
3067
|
-
const [open, setOpen] =
|
|
3068
|
-
const [selectedItems, setSelectedItems] =
|
|
3069
|
-
const [searchTerm, setSearchTerm] =
|
|
3070
|
-
const [innerItems, setInnerItems] =
|
|
3071
|
-
const errorId =
|
|
3217
|
+
const [open, setOpen] = React17.useState(false);
|
|
3218
|
+
const [selectedItems, setSelectedItems] = React17.useState([]);
|
|
3219
|
+
const [searchTerm, setSearchTerm] = React17.useState("");
|
|
3220
|
+
const [innerItems, setInnerItems] = React17.useState([]);
|
|
3221
|
+
const errorId = React17.useId();
|
|
3072
3222
|
const hasError = errorMessage != null;
|
|
3073
|
-
|
|
3223
|
+
React17.useEffect(() => {
|
|
3074
3224
|
setInnerItems(items);
|
|
3075
3225
|
}, [items]);
|
|
3076
|
-
|
|
3226
|
+
React17.useEffect(() => {
|
|
3077
3227
|
if (isMultiselect && Array.isArray(value)) {
|
|
3078
3228
|
setSelectedItems(value);
|
|
3079
3229
|
}
|
|
@@ -3398,7 +3548,7 @@ function TableBody({
|
|
|
3398
3548
|
expandRow,
|
|
3399
3549
|
getRowKey
|
|
3400
3550
|
}) {
|
|
3401
|
-
const [expanded, setExpanded] =
|
|
3551
|
+
const [expanded, setExpanded] = React17.useState(() => /* @__PURE__ */ new Set());
|
|
3402
3552
|
const reduced = framerMotion.useReducedMotion();
|
|
3403
3553
|
const toggleRow = (rowKey) => {
|
|
3404
3554
|
setExpanded((prev) => {
|
|
@@ -3413,7 +3563,7 @@ function TableBody({
|
|
|
3413
3563
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
3414
3564
|
const rowKey = getRowKey(row, i);
|
|
3415
3565
|
const isExpanded = expanded.has(rowKey);
|
|
3416
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3566
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React17__default.default.Fragment, { children: [
|
|
3417
3567
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3418
3568
|
"tr",
|
|
3419
3569
|
{
|
|
@@ -3469,9 +3619,9 @@ function Pagination({
|
|
|
3469
3619
|
const matchedOption = picker.find(
|
|
3470
3620
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
3471
3621
|
);
|
|
3472
|
-
const [perPageKey, setPerPageKey] =
|
|
3622
|
+
const [perPageKey, setPerPageKey] = React17.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
3473
3623
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
3474
|
-
|
|
3624
|
+
React17.useEffect(() => {
|
|
3475
3625
|
if (serverSide && options.perPage != null) {
|
|
3476
3626
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
3477
3627
|
if (next) setPerPageKey(next.key);
|
|
@@ -3535,14 +3685,14 @@ function Table({
|
|
|
3535
3685
|
className = "",
|
|
3536
3686
|
style
|
|
3537
3687
|
}) {
|
|
3538
|
-
const searchRef =
|
|
3539
|
-
const [searchTerm, setSearchTerm] =
|
|
3540
|
-
const [perPage, setPerPage] =
|
|
3688
|
+
const searchRef = React17.useRef(null);
|
|
3689
|
+
const [searchTerm, setSearchTerm] = React17.useState("");
|
|
3690
|
+
const [perPage, setPerPage] = React17.useState(
|
|
3541
3691
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
3542
3692
|
);
|
|
3543
|
-
const [activePage, setActivePage] =
|
|
3693
|
+
const [activePage, setActivePage] = React17.useState(0);
|
|
3544
3694
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
3545
|
-
const filteredRows =
|
|
3695
|
+
const filteredRows = React17.useMemo(() => {
|
|
3546
3696
|
if (isServerSide || !searchTerm) return rows;
|
|
3547
3697
|
const term = searchTerm.toLowerCase();
|
|
3548
3698
|
return rows.filter(
|
|
@@ -3551,29 +3701,29 @@ function Table({
|
|
|
3551
3701
|
)
|
|
3552
3702
|
);
|
|
3553
3703
|
}, [rows, searchTerm, isServerSide]);
|
|
3554
|
-
const datasets =
|
|
3704
|
+
const datasets = React17.useMemo(() => {
|
|
3555
3705
|
if (isServerSide) return [rows];
|
|
3556
3706
|
return createDatasets(filteredRows, pagination.enabled ? perPage : null);
|
|
3557
3707
|
}, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
3558
|
-
const MAX_PAGE =
|
|
3708
|
+
const MAX_PAGE = React17.useMemo(() => {
|
|
3559
3709
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
3560
3710
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
3561
3711
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
3562
3712
|
return datasets.length ? datasets.length - 1 : 0;
|
|
3563
3713
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
3564
|
-
const currentPageRows =
|
|
3714
|
+
const currentPageRows = React17.useMemo(() => {
|
|
3565
3715
|
if (isServerSide) return rows;
|
|
3566
3716
|
return datasets[activePage] ?? [];
|
|
3567
3717
|
}, [isServerSide, rows, datasets, activePage]);
|
|
3568
|
-
|
|
3718
|
+
React17.useEffect(() => {
|
|
3569
3719
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
3570
3720
|
setPerPage(pagination.perPage);
|
|
3571
3721
|
}
|
|
3572
3722
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
3573
|
-
|
|
3723
|
+
React17.useEffect(() => {
|
|
3574
3724
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
3575
3725
|
}, [isServerSide, pagination.perPage]);
|
|
3576
|
-
|
|
3726
|
+
React17.useEffect(() => {
|
|
3577
3727
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
3578
3728
|
setActivePage(pagination.page - 1);
|
|
3579
3729
|
}, [isServerSide, pagination.page]);
|
|
@@ -3657,7 +3807,7 @@ function TableSkeletonBody({
|
|
|
3657
3807
|
)) });
|
|
3658
3808
|
}
|
|
3659
3809
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
3660
|
-
const id =
|
|
3810
|
+
const id = React17.useId();
|
|
3661
3811
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3662
3812
|
SwitchPrimitive__namespace.Root,
|
|
3663
3813
|
{
|
|
@@ -3841,7 +3991,7 @@ function Sidebar({
|
|
|
3841
3991
|
}
|
|
3842
3992
|
) });
|
|
3843
3993
|
}
|
|
3844
|
-
var MegaMenuContext =
|
|
3994
|
+
var MegaMenuContext = React17.createContext({ align: "start" });
|
|
3845
3995
|
function MegaMenu({
|
|
3846
3996
|
children,
|
|
3847
3997
|
align = "start",
|
|
@@ -3872,7 +4022,7 @@ function MegaMenu({
|
|
|
3872
4022
|
}
|
|
3873
4023
|
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";
|
|
3874
4024
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
3875
|
-
const { align } =
|
|
4025
|
+
const { align } = React17.useContext(MegaMenuContext);
|
|
3876
4026
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
3877
4027
|
if (!children) {
|
|
3878
4028
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
|
|
@@ -3957,8 +4107,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
3957
4107
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
3958
4108
|
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 });
|
|
3959
4109
|
}
|
|
3960
|
-
var elementsOfType = (children, type) =>
|
|
3961
|
-
(c) =>
|
|
4110
|
+
var elementsOfType = (children, type) => React17__default.default.Children.toArray(children).filter(
|
|
4111
|
+
(c) => React17__default.default.isValidElement(c) && c.type === type
|
|
3962
4112
|
);
|
|
3963
4113
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3964
4114
|
"svg",
|
|
@@ -3995,9 +4145,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
3995
4145
|
);
|
|
3996
4146
|
}
|
|
3997
4147
|
function MobilePanel({ panel, onNavigate }) {
|
|
3998
|
-
const nodes =
|
|
4148
|
+
const nodes = React17__default.default.Children.toArray(panel.props.children);
|
|
3999
4149
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
4000
|
-
if (!
|
|
4150
|
+
if (!React17__default.default.isValidElement(node)) return null;
|
|
4001
4151
|
const el = node;
|
|
4002
4152
|
if (el.type === MegaMenuSection) {
|
|
4003
4153
|
const { title, children } = el.props;
|
|
@@ -4016,8 +4166,8 @@ function MegaMenuMobile({
|
|
|
4016
4166
|
children,
|
|
4017
4167
|
label
|
|
4018
4168
|
}) {
|
|
4019
|
-
const [open, setOpen] =
|
|
4020
|
-
const [expanded, setExpanded] =
|
|
4169
|
+
const [open, setOpen] = React17.useState(false);
|
|
4170
|
+
const [expanded, setExpanded] = React17.useState(null);
|
|
4021
4171
|
const items = elementsOfType(children, MegaMenuItem);
|
|
4022
4172
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
4023
4173
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4090,17 +4240,17 @@ function AppShell({
|
|
|
4090
4240
|
children,
|
|
4091
4241
|
className = ""
|
|
4092
4242
|
}) {
|
|
4093
|
-
const [expanded, setExpanded] =
|
|
4094
|
-
const [isMobile, setIsMobile] =
|
|
4095
|
-
const [mobileOpen, setMobileOpen] =
|
|
4096
|
-
|
|
4243
|
+
const [expanded, setExpanded] = React17.useState(sidebarDefaultExpanded);
|
|
4244
|
+
const [isMobile, setIsMobile] = React17.useState(false);
|
|
4245
|
+
const [mobileOpen, setMobileOpen] = React17.useState(false);
|
|
4246
|
+
React17.useEffect(() => {
|
|
4097
4247
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
4098
4248
|
const update = (e) => setIsMobile(e.matches);
|
|
4099
4249
|
update(mq);
|
|
4100
4250
|
mq.addEventListener("change", update);
|
|
4101
4251
|
return () => mq.removeEventListener("change", update);
|
|
4102
4252
|
}, []);
|
|
4103
|
-
|
|
4253
|
+
React17.useEffect(() => {
|
|
4104
4254
|
if (!isMobile) setMobileOpen(false);
|
|
4105
4255
|
}, [isMobile]);
|
|
4106
4256
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -4290,10 +4440,10 @@ function ThemeProvider({
|
|
|
4290
4440
|
className = "",
|
|
4291
4441
|
style
|
|
4292
4442
|
}) {
|
|
4293
|
-
const id =
|
|
4443
|
+
const id = React17__default.default.useId().replace(/:/g, "");
|
|
4294
4444
|
const scopeClass = `geo-th-${id}`;
|
|
4295
|
-
const divRef =
|
|
4296
|
-
|
|
4445
|
+
const divRef = React17.useRef(null);
|
|
4446
|
+
React17.useEffect(() => {
|
|
4297
4447
|
const el = divRef.current;
|
|
4298
4448
|
if (!el) return;
|
|
4299
4449
|
if (colorScheme === "auto") return;
|
|
@@ -4308,8 +4458,8 @@ function ThemeProvider({
|
|
|
4308
4458
|
}
|
|
4309
4459
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
4310
4460
|
}, [colorScheme]);
|
|
4311
|
-
const lightVars =
|
|
4312
|
-
const darkVarStr =
|
|
4461
|
+
const lightVars = React17.useMemo(() => toCssVars(theme), [theme]);
|
|
4462
|
+
const darkVarStr = React17.useMemo(() => {
|
|
4313
4463
|
if (!darkTheme) return "";
|
|
4314
4464
|
const dvars = toCssVars(darkTheme);
|
|
4315
4465
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -4349,7 +4499,7 @@ function TextInput({
|
|
|
4349
4499
|
prefix,
|
|
4350
4500
|
suffix
|
|
4351
4501
|
}) {
|
|
4352
|
-
const errorId =
|
|
4502
|
+
const errorId = React17.useId();
|
|
4353
4503
|
const hasError = errorMessage != null;
|
|
4354
4504
|
const hasAdornment = prefix != null || suffix != null;
|
|
4355
4505
|
const input = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4419,7 +4569,7 @@ function NumberInput({
|
|
|
4419
4569
|
readOnly = false,
|
|
4420
4570
|
precision
|
|
4421
4571
|
}) {
|
|
4422
|
-
const errorId =
|
|
4572
|
+
const errorId = React17.useId();
|
|
4423
4573
|
const hasError = errorMessage != null;
|
|
4424
4574
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
4425
4575
|
const round = (n) => {
|
|
@@ -4550,8 +4700,8 @@ function Password({
|
|
|
4550
4700
|
showIcon,
|
|
4551
4701
|
hideIcon
|
|
4552
4702
|
}) {
|
|
4553
|
-
const [visible, setVisible] =
|
|
4554
|
-
const errorId =
|
|
4703
|
+
const [visible, setVisible] = React17.useState(false);
|
|
4704
|
+
const errorId = React17.useId();
|
|
4555
4705
|
const hasError = errorMessage != null;
|
|
4556
4706
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4557
4707
|
Field,
|
|
@@ -4624,7 +4774,7 @@ function Checkbox({
|
|
|
4624
4774
|
}) {
|
|
4625
4775
|
const isChecked = checked ?? value ?? false;
|
|
4626
4776
|
const labelFirst = labelPosition === "left";
|
|
4627
|
-
const errorId =
|
|
4777
|
+
const errorId = React17.useId();
|
|
4628
4778
|
const hasError = errorMessage != null;
|
|
4629
4779
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4630
4780
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -4732,8 +4882,8 @@ function RadioGroup({
|
|
|
4732
4882
|
className,
|
|
4733
4883
|
errorMessage
|
|
4734
4884
|
}) {
|
|
4735
|
-
const errorId =
|
|
4736
|
-
const groupId =
|
|
4885
|
+
const errorId = React17.useId();
|
|
4886
|
+
const groupId = React17.useId();
|
|
4737
4887
|
const hasError = errorMessage != null;
|
|
4738
4888
|
const labelFirst = labelPosition === "left";
|
|
4739
4889
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4833,11 +4983,11 @@ function Switch({
|
|
|
4833
4983
|
disabled,
|
|
4834
4984
|
errorMessage
|
|
4835
4985
|
}) {
|
|
4836
|
-
const id =
|
|
4837
|
-
const errorId =
|
|
4986
|
+
const id = React17.useId();
|
|
4987
|
+
const errorId = React17.useId();
|
|
4838
4988
|
const hasError = errorMessage != null;
|
|
4839
4989
|
const isControlled = checked !== void 0;
|
|
4840
|
-
const [internal, setInternal] =
|
|
4990
|
+
const [internal, setInternal] = React17.useState(defaultChecked);
|
|
4841
4991
|
const isOn = isControlled ? checked : internal;
|
|
4842
4992
|
const handle = (c) => {
|
|
4843
4993
|
if (!isControlled) setInternal(c);
|
|
@@ -4910,19 +5060,19 @@ function AutoComplete({
|
|
|
4910
5060
|
required,
|
|
4911
5061
|
htmlFor
|
|
4912
5062
|
}) {
|
|
4913
|
-
const errorId =
|
|
5063
|
+
const errorId = React17.useId();
|
|
4914
5064
|
const hasError = errorMessage != null;
|
|
4915
|
-
const [term, setTerm] =
|
|
4916
|
-
const [open, setOpen] =
|
|
4917
|
-
const [asyncItems, setAsyncItems] =
|
|
4918
|
-
const [loading, setLoading] =
|
|
5065
|
+
const [term, setTerm] = React17.useState("");
|
|
5066
|
+
const [open, setOpen] = React17.useState(false);
|
|
5067
|
+
const [asyncItems, setAsyncItems] = React17.useState([]);
|
|
5068
|
+
const [loading, setLoading] = React17.useState(false);
|
|
4919
5069
|
const isAsync = typeof onSearch === "function";
|
|
4920
|
-
const debounceRef =
|
|
4921
|
-
const requestIdRef =
|
|
5070
|
+
const debounceRef = React17.useRef(null);
|
|
5071
|
+
const requestIdRef = React17.useRef(0);
|
|
4922
5072
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
4923
5073
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
4924
5074
|
) : [];
|
|
4925
|
-
|
|
5075
|
+
React17.useEffect(() => {
|
|
4926
5076
|
if (!isAsync) return;
|
|
4927
5077
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
4928
5078
|
if (!term.trim()) {
|
|
@@ -5078,15 +5228,15 @@ function TreeSelect({
|
|
|
5078
5228
|
defaultExpandedKeys = [],
|
|
5079
5229
|
size = "md"
|
|
5080
5230
|
}) {
|
|
5081
|
-
const errorId =
|
|
5231
|
+
const errorId = React17.useId();
|
|
5082
5232
|
const hasError = errorMessage != null;
|
|
5083
|
-
const [open, setOpen] =
|
|
5084
|
-
const [expanded, setExpanded] =
|
|
5085
|
-
const [activeIndex, setActiveIndex] =
|
|
5086
|
-
const listRef =
|
|
5087
|
-
const visible =
|
|
5088
|
-
const didSyncOnOpenRef =
|
|
5089
|
-
|
|
5233
|
+
const [open, setOpen] = React17.useState(false);
|
|
5234
|
+
const [expanded, setExpanded] = React17.useState(() => new Set(defaultExpandedKeys));
|
|
5235
|
+
const [activeIndex, setActiveIndex] = React17.useState(0);
|
|
5236
|
+
const listRef = React17.useRef(null);
|
|
5237
|
+
const visible = React17.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
5238
|
+
const didSyncOnOpenRef = React17.useRef(false);
|
|
5239
|
+
React17.useEffect(() => {
|
|
5090
5240
|
if (!open) {
|
|
5091
5241
|
didSyncOnOpenRef.current = false;
|
|
5092
5242
|
return;
|
|
@@ -5096,7 +5246,7 @@ function TreeSelect({
|
|
|
5096
5246
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
5097
5247
|
didSyncOnOpenRef.current = true;
|
|
5098
5248
|
}, [open, value]);
|
|
5099
|
-
const selectedNode =
|
|
5249
|
+
const selectedNode = React17.useMemo(
|
|
5100
5250
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
5101
5251
|
[items, value]
|
|
5102
5252
|
);
|
|
@@ -5327,11 +5477,11 @@ function FileInput({
|
|
|
5327
5477
|
required,
|
|
5328
5478
|
icon
|
|
5329
5479
|
}) {
|
|
5330
|
-
const inputRef =
|
|
5331
|
-
const errorId =
|
|
5332
|
-
const [files, setFiles] =
|
|
5333
|
-
const [dragging, setDragging] =
|
|
5334
|
-
const [sizeError, setSizeError] =
|
|
5480
|
+
const inputRef = React17.useRef(null);
|
|
5481
|
+
const errorId = React17.useId();
|
|
5482
|
+
const [files, setFiles] = React17.useState([]);
|
|
5483
|
+
const [dragging, setDragging] = React17.useState(false);
|
|
5484
|
+
const [sizeError, setSizeError] = React17.useState(null);
|
|
5335
5485
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
5336
5486
|
const openPicker = () => {
|
|
5337
5487
|
if (!disabled) inputRef.current?.click();
|
|
@@ -5522,30 +5672,30 @@ function DatePicker({
|
|
|
5522
5672
|
size = "md",
|
|
5523
5673
|
className = ""
|
|
5524
5674
|
}) {
|
|
5525
|
-
const errorId =
|
|
5675
|
+
const errorId = React17.useId();
|
|
5526
5676
|
const hasError = errorMessage != null;
|
|
5527
|
-
const [open, setOpen] =
|
|
5528
|
-
const [viewMonth, setViewMonth] =
|
|
5529
|
-
const [focusDate, setFocusDate] =
|
|
5530
|
-
const [view, setView] =
|
|
5531
|
-
const gridRef =
|
|
5532
|
-
|
|
5677
|
+
const [open, setOpen] = React17.useState(false);
|
|
5678
|
+
const [viewMonth, setViewMonth] = React17.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
5679
|
+
const [focusDate, setFocusDate] = React17.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
5680
|
+
const [view, setView] = React17.useState("days");
|
|
5681
|
+
const gridRef = React17.useRef(null);
|
|
5682
|
+
React17.useEffect(() => {
|
|
5533
5683
|
if (!open) return;
|
|
5534
5684
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
5535
5685
|
setViewMonth(startOfMonth(target));
|
|
5536
5686
|
setFocusDate(target);
|
|
5537
5687
|
setView("days");
|
|
5538
5688
|
}, [open, value]);
|
|
5539
|
-
|
|
5689
|
+
React17.useEffect(() => {
|
|
5540
5690
|
if (!open) return;
|
|
5541
5691
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat(focusDate)}"]`);
|
|
5542
5692
|
cell?.focus();
|
|
5543
5693
|
}, [open, focusDate]);
|
|
5544
|
-
const weekdays =
|
|
5694
|
+
const weekdays = React17.useMemo(() => {
|
|
5545
5695
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5546
5696
|
return ordered;
|
|
5547
5697
|
}, [weekStartsOn]);
|
|
5548
|
-
const grid =
|
|
5698
|
+
const grid = React17.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5549
5699
|
const isDisabled = (d) => {
|
|
5550
5700
|
if (min && d < min) return true;
|
|
5551
5701
|
if (max && d > max) return true;
|
|
@@ -5835,10 +5985,10 @@ function TextArea({
|
|
|
5835
5985
|
style,
|
|
5836
5986
|
inputStyle
|
|
5837
5987
|
}) {
|
|
5838
|
-
const errorId =
|
|
5988
|
+
const errorId = React17.useId();
|
|
5839
5989
|
const hasError = errorMessage != null;
|
|
5840
|
-
const ref =
|
|
5841
|
-
|
|
5990
|
+
const ref = React17.useRef(null);
|
|
5991
|
+
React17.useLayoutEffect(() => {
|
|
5842
5992
|
if (!autoGrow) return;
|
|
5843
5993
|
const el = ref.current;
|
|
5844
5994
|
if (!el) return;
|
|
@@ -5885,7 +6035,7 @@ function TextArea({
|
|
|
5885
6035
|
}
|
|
5886
6036
|
);
|
|
5887
6037
|
}
|
|
5888
|
-
var
|
|
6038
|
+
var SIZE5 = {
|
|
5889
6039
|
sm: { h: "h-control-sm", text: "text-xs", pad: "px-2.5" },
|
|
5890
6040
|
md: { h: "h-control-md", text: "text-sm", pad: "px-3.5" },
|
|
5891
6041
|
lg: { h: "h-control-lg", text: "text-sm", pad: "px-4" }
|
|
@@ -5907,12 +6057,12 @@ function SegmentedControl({
|
|
|
5907
6057
|
errorMessage,
|
|
5908
6058
|
"aria-label": ariaLabel
|
|
5909
6059
|
}) {
|
|
5910
|
-
const sz =
|
|
5911
|
-
const groupId =
|
|
5912
|
-
const errorId =
|
|
6060
|
+
const sz = SIZE5[size];
|
|
6061
|
+
const groupId = React17.useId();
|
|
6062
|
+
const errorId = React17.useId();
|
|
5913
6063
|
const hasError = errorMessage != null;
|
|
5914
6064
|
const isControlled = value !== void 0;
|
|
5915
|
-
const [internal, setInternal] =
|
|
6065
|
+
const [internal, setInternal] = React17.useState(defaultValue);
|
|
5916
6066
|
const current = isControlled ? value : internal;
|
|
5917
6067
|
const handle = (v) => {
|
|
5918
6068
|
if (!v) return;
|
|
@@ -6006,14 +6156,14 @@ function Slider({
|
|
|
6006
6156
|
name,
|
|
6007
6157
|
htmlFor
|
|
6008
6158
|
}) {
|
|
6009
|
-
const errorId =
|
|
6159
|
+
const errorId = React17.useId();
|
|
6010
6160
|
const hasError = errorMessage != null;
|
|
6011
6161
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
6012
|
-
const [internal, setInternal] =
|
|
6162
|
+
const [internal, setInternal] = React17.useState(
|
|
6013
6163
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
6014
6164
|
);
|
|
6015
6165
|
const current = toArray(value) ?? internal;
|
|
6016
|
-
const [dragging, setDragging] =
|
|
6166
|
+
const [dragging, setDragging] = React17.useState(false);
|
|
6017
6167
|
const emit = (arr) => {
|
|
6018
6168
|
setInternal(arr);
|
|
6019
6169
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -6108,11 +6258,11 @@ function TagsInput({
|
|
|
6108
6258
|
validate,
|
|
6109
6259
|
separators = ["Enter", ","]
|
|
6110
6260
|
}) {
|
|
6111
|
-
const errorId =
|
|
6112
|
-
const inputRef =
|
|
6113
|
-
const [internal, setInternal] =
|
|
6114
|
-
const [draft, setDraft] =
|
|
6115
|
-
const [localError, setLocalError] =
|
|
6261
|
+
const errorId = React17.useId();
|
|
6262
|
+
const inputRef = React17.useRef(null);
|
|
6263
|
+
const [internal, setInternal] = React17.useState(defaultValue ?? []);
|
|
6264
|
+
const [draft, setDraft] = React17.useState("");
|
|
6265
|
+
const [localError, setLocalError] = React17.useState(null);
|
|
6116
6266
|
const tags = value ?? internal;
|
|
6117
6267
|
const hasError = errorMessage != null || localError != null;
|
|
6118
6268
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -6243,9 +6393,9 @@ function OtpInput({
|
|
|
6243
6393
|
className,
|
|
6244
6394
|
groupAfter
|
|
6245
6395
|
}) {
|
|
6246
|
-
const errorId =
|
|
6396
|
+
const errorId = React17.useId();
|
|
6247
6397
|
const hasError = errorMessage != null;
|
|
6248
|
-
const refs =
|
|
6398
|
+
const refs = React17.useRef([]);
|
|
6249
6399
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
6250
6400
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
6251
6401
|
const emit = (next) => {
|
|
@@ -6294,7 +6444,7 @@ function OtpInput({
|
|
|
6294
6444
|
emit(valid.join(""));
|
|
6295
6445
|
focusBox(valid.length);
|
|
6296
6446
|
};
|
|
6297
|
-
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(
|
|
6447
|
+
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(React17__default.default.Fragment, { children: [
|
|
6298
6448
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6299
6449
|
"input",
|
|
6300
6450
|
{
|
|
@@ -6352,9 +6502,9 @@ function Rating({
|
|
|
6352
6502
|
className,
|
|
6353
6503
|
required
|
|
6354
6504
|
}) {
|
|
6355
|
-
const errorId =
|
|
6356
|
-
const [internal, setInternal] =
|
|
6357
|
-
const [hover, setHover] =
|
|
6505
|
+
const errorId = React17.useId();
|
|
6506
|
+
const [internal, setInternal] = React17.useState(defaultValue);
|
|
6507
|
+
const [hover, setHover] = React17.useState(null);
|
|
6358
6508
|
const current = value ?? internal;
|
|
6359
6509
|
const display2 = hover ?? current;
|
|
6360
6510
|
const interactive = !readOnly && !disabled;
|
|
@@ -6477,9 +6627,9 @@ function TimePicker({
|
|
|
6477
6627
|
required,
|
|
6478
6628
|
style
|
|
6479
6629
|
}) {
|
|
6480
|
-
const errorId =
|
|
6630
|
+
const errorId = React17.useId();
|
|
6481
6631
|
const hasError = errorMessage != null;
|
|
6482
|
-
const [open, setOpen] =
|
|
6632
|
+
const [open, setOpen] = React17.useState(false);
|
|
6483
6633
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
6484
6634
|
const update = (next) => {
|
|
6485
6635
|
const merged = { ...parsed, ...next };
|
|
@@ -6603,13 +6753,13 @@ function DateRangePicker({
|
|
|
6603
6753
|
required,
|
|
6604
6754
|
style
|
|
6605
6755
|
}) {
|
|
6606
|
-
const errorId =
|
|
6756
|
+
const errorId = React17.useId();
|
|
6607
6757
|
const hasError = errorMessage != null;
|
|
6608
|
-
const [open, setOpen] =
|
|
6609
|
-
const [leftMonth, setLeftMonth] =
|
|
6610
|
-
const [pendingStart, setPendingStart] =
|
|
6611
|
-
const [hoverDate, setHoverDate] =
|
|
6612
|
-
const weekdays =
|
|
6758
|
+
const [open, setOpen] = React17.useState(false);
|
|
6759
|
+
const [leftMonth, setLeftMonth] = React17.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
6760
|
+
const [pendingStart, setPendingStart] = React17.useState(null);
|
|
6761
|
+
const [hoverDate, setHoverDate] = React17.useState(null);
|
|
6762
|
+
const weekdays = React17.useMemo(
|
|
6613
6763
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6614
6764
|
[weekStartsOn]
|
|
6615
6765
|
);
|
|
@@ -6785,10 +6935,10 @@ function ColorPicker({
|
|
|
6785
6935
|
required,
|
|
6786
6936
|
placeholder = "Pick a colour\u2026"
|
|
6787
6937
|
}) {
|
|
6788
|
-
const errorId =
|
|
6938
|
+
const errorId = React17.useId();
|
|
6789
6939
|
const hasError = errorMessage != null;
|
|
6790
|
-
const [open, setOpen] =
|
|
6791
|
-
const [draft, setDraft] =
|
|
6940
|
+
const [open, setOpen] = React17.useState(false);
|
|
6941
|
+
const [draft, setDraft] = React17.useState(value);
|
|
6792
6942
|
const valid = HEX_RE.test(value);
|
|
6793
6943
|
const pick = (hex) => {
|
|
6794
6944
|
onChange?.(hex);
|
|
@@ -7175,11 +7325,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
7175
7325
|
|
|
7176
7326
|
// src/form/useForm.ts
|
|
7177
7327
|
function useForm(options = {}) {
|
|
7178
|
-
const ref =
|
|
7328
|
+
const ref = React17.useRef(null);
|
|
7179
7329
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
7180
7330
|
const store = ref.current;
|
|
7181
|
-
|
|
7182
|
-
const make =
|
|
7331
|
+
React17.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7332
|
+
const make = React17.useCallback(
|
|
7183
7333
|
(kind) => (name, rules) => {
|
|
7184
7334
|
if (rules !== void 0) store.setRule(name, rules);
|
|
7185
7335
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -7208,9 +7358,9 @@ function useForm(options = {}) {
|
|
|
7208
7358
|
fieldTarget: make("target")
|
|
7209
7359
|
};
|
|
7210
7360
|
}
|
|
7211
|
-
var FormContext =
|
|
7361
|
+
var FormContext = React17.createContext(null);
|
|
7212
7362
|
function useFormStore() {
|
|
7213
|
-
const store =
|
|
7363
|
+
const store = React17.useContext(FormContext);
|
|
7214
7364
|
if (!store) {
|
|
7215
7365
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
7216
7366
|
}
|
|
@@ -7224,8 +7374,8 @@ function Form({
|
|
|
7224
7374
|
children,
|
|
7225
7375
|
...rest
|
|
7226
7376
|
}) {
|
|
7227
|
-
const ref =
|
|
7228
|
-
const bypass =
|
|
7377
|
+
const ref = React17.useRef(null);
|
|
7378
|
+
const bypass = React17.useRef(false);
|
|
7229
7379
|
const handleSubmit = async (e) => {
|
|
7230
7380
|
if (bypass.current) {
|
|
7231
7381
|
bypass.current = false;
|
|
@@ -7277,12 +7427,12 @@ function useFormField(name, options = {}) {
|
|
|
7277
7427
|
const store = useFormStore();
|
|
7278
7428
|
const { kind = "value", rules } = options;
|
|
7279
7429
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
7280
|
-
|
|
7430
|
+
React17.useEffect(() => {
|
|
7281
7431
|
return () => {
|
|
7282
7432
|
if (rules !== void 0) store.removeRule(name);
|
|
7283
7433
|
};
|
|
7284
7434
|
}, [store, name]);
|
|
7285
|
-
const snap =
|
|
7435
|
+
const snap = React17.useSyncExternalStore(
|
|
7286
7436
|
store.subscribe,
|
|
7287
7437
|
() => store.getFieldSnapshot(name)
|
|
7288
7438
|
);
|
|
@@ -7294,7 +7444,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
7294
7444
|
}
|
|
7295
7445
|
function useFieldArray(name) {
|
|
7296
7446
|
const store = useFormStore();
|
|
7297
|
-
|
|
7447
|
+
React17.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7298
7448
|
const arr = store.getValue(name) ?? [];
|
|
7299
7449
|
const keys = store.getKeys(name);
|
|
7300
7450
|
return {
|
|
@@ -7417,7 +7567,7 @@ function CreditCardForm({
|
|
|
7417
7567
|
className = "",
|
|
7418
7568
|
style
|
|
7419
7569
|
}) {
|
|
7420
|
-
const initial =
|
|
7570
|
+
const initial = React17.useRef({
|
|
7421
7571
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
7422
7572
|
name: defaultValue?.name ?? "",
|
|
7423
7573
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -7426,7 +7576,7 @@ function CreditCardForm({
|
|
|
7426
7576
|
const form = useForm({ initialValues: initial });
|
|
7427
7577
|
const numberStr = String(form.values.number ?? "");
|
|
7428
7578
|
const brand = detectBrand(numberStr);
|
|
7429
|
-
|
|
7579
|
+
React17.useEffect(() => {
|
|
7430
7580
|
onChange?.(toCard(form.values));
|
|
7431
7581
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
7432
7582
|
const numberBind = form.fieldNative("number", {
|
|
@@ -7545,6 +7695,7 @@ exports.CreditCardForm = CreditCardForm;
|
|
|
7545
7695
|
exports.DateRangePicker = DateRangePicker;
|
|
7546
7696
|
exports.Drawer = Drawer;
|
|
7547
7697
|
exports.Dropdown = Dropdown;
|
|
7698
|
+
exports.FAB = FAB;
|
|
7548
7699
|
exports.FadingBase = FadingBase;
|
|
7549
7700
|
exports.Field = Field;
|
|
7550
7701
|
exports.FieldHelpIcon = FieldHelpIcon;
|
|
@@ -7581,6 +7732,7 @@ exports.SkeletonCard = SkeletonCard;
|
|
|
7581
7732
|
exports.SkeletonCircle = SkeletonCircle;
|
|
7582
7733
|
exports.SkeletonText = SkeletonText;
|
|
7583
7734
|
exports.Slider = Slider;
|
|
7735
|
+
exports.Statistic = Statistic;
|
|
7584
7736
|
exports.Switch = Switch;
|
|
7585
7737
|
exports.Table = Table;
|
|
7586
7738
|
exports.Tabs = Tabs_default;
|