@geomak/ui 6.5.0 → 6.7.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 -196
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -1
- package/dist/index.d.ts +134 -1
- package/dist/index.js +169 -12
- package/dist/index.js.map +1 -1
- package/dist/styles.css +84 -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 React16 = 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 React16__default = /*#__PURE__*/_interopDefault(React16);
|
|
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] = React16.useState(null);
|
|
218
|
+
React16.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 = React16.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 = React16.createContext(null);
|
|
964
964
|
function useTabsContext() {
|
|
965
|
-
const ctx =
|
|
965
|
+
const ctx = React16.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] = React16.useState(defaultValue);
|
|
988
988
|
const current = isControlled ? value : internal;
|
|
989
989
|
const reduced = !!framerMotion.useReducedMotion();
|
|
990
|
-
const indicatorId =
|
|
991
|
-
const select =
|
|
990
|
+
const indicatorId = React16.useId();
|
|
991
|
+
const select = React16.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 = React16.useRef(/* @__PURE__ */ new Map());
|
|
996
|
+
const orderRef = React16.useRef(0);
|
|
997
|
+
const [, bump] = React16.useState(0);
|
|
998
|
+
const registerTab = React16.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 = React16.useCallback((val) => {
|
|
1004
1004
|
if (registry.current.delete(val)) bump((v) => v + 1);
|
|
1005
1005
|
}, []);
|
|
1006
|
-
const getTabs =
|
|
1006
|
+
const getTabs = React16.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 = React16.useRef(null);
|
|
1027
|
+
const [edges, setEdges] = React16.useState({ start: false, end: false });
|
|
1028
1028
|
const scrollable = variant !== "segmented";
|
|
1029
|
-
|
|
1029
|
+
React16.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 = React16.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
|
+
React16.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] = React16.useState(false);
|
|
1119
|
+
const wrapRef = React16.useRef(null);
|
|
1120
|
+
const timer = React16.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
|
+
React16.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
|
+
React16.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 = React16.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 } = React16.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] = React16.useState(false);
|
|
1526
1526
|
const shouldCollapse = maxItems > 0 && items.length > maxItems && !expanded;
|
|
1527
1527
|
const visible = [];
|
|
1528
1528
|
if (shouldCollapse) {
|
|
@@ -1652,7 +1652,164 @@ function Badge({
|
|
|
1652
1652
|
!hidden && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -top-1 -right-1 flex", children: indicator })
|
|
1653
1653
|
] });
|
|
1654
1654
|
}
|
|
1655
|
-
var
|
|
1655
|
+
var SIZE3 = {
|
|
1656
|
+
sm: "h-5 min-w-[20px] px-1.5 text-[11px]",
|
|
1657
|
+
md: "h-6 min-w-[24px] px-2 text-xs"
|
|
1658
|
+
};
|
|
1659
|
+
var cap = "inline-flex items-center justify-center rounded-md border border-border border-b-2 bg-surface-raised font-medium text-foreground-secondary leading-none select-none font-sans shadow-sm";
|
|
1660
|
+
function Kbd({
|
|
1661
|
+
children,
|
|
1662
|
+
keys,
|
|
1663
|
+
separator = "+",
|
|
1664
|
+
size = "md",
|
|
1665
|
+
className = "",
|
|
1666
|
+
style
|
|
1667
|
+
}) {
|
|
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(React16__default.default.Fragment, { children: [
|
|
1670
|
+
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-xs select-none", children: separator }),
|
|
1671
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: [cap, SIZE3[size]].join(" "), children: k })
|
|
1672
|
+
] }, `${k}-${i}`)) });
|
|
1673
|
+
}
|
|
1674
|
+
return /* @__PURE__ */ jsxRuntime.jsx("kbd", { className: [cap, SIZE3[size], className].filter(Boolean).join(" "), style, children });
|
|
1675
|
+
}
|
|
1676
|
+
var PAD = { none: "", sm: "p-3", md: "p-5", lg: "p-6" };
|
|
1677
|
+
function Card({ children, interactive, onClick, padding: padding2 = "none", flush, className = "", style }) {
|
|
1678
|
+
const base = [
|
|
1679
|
+
"rounded-xl overflow-hidden bg-surface",
|
|
1680
|
+
flush ? "" : "border border-border shadow-sm",
|
|
1681
|
+
PAD[padding2],
|
|
1682
|
+
interactive ? "transition-[transform,box-shadow] duration-200 ease-out hover:-translate-y-0.5 hover:shadow-md cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent" : "",
|
|
1683
|
+
className
|
|
1684
|
+
].filter(Boolean).join(" ");
|
|
1685
|
+
if (interactive && onClick) {
|
|
1686
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1687
|
+
"div",
|
|
1688
|
+
{
|
|
1689
|
+
role: "button",
|
|
1690
|
+
tabIndex: 0,
|
|
1691
|
+
onClick,
|
|
1692
|
+
onKeyDown: (e) => {
|
|
1693
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1694
|
+
e.preventDefault();
|
|
1695
|
+
onClick(e);
|
|
1696
|
+
}
|
|
1697
|
+
},
|
|
1698
|
+
className: base,
|
|
1699
|
+
style,
|
|
1700
|
+
children
|
|
1701
|
+
}
|
|
1702
|
+
);
|
|
1703
|
+
}
|
|
1704
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { onClick, className: base, style, children });
|
|
1705
|
+
}
|
|
1706
|
+
function CardMedia({ children, className = "" }) {
|
|
1707
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["[&>img]:block [&>img]:w-full [&>img]:object-cover", className].filter(Boolean).join(" "), children });
|
|
1708
|
+
}
|
|
1709
|
+
function CardHeader({ title, subtitle, action, avatar, children, className = "" }) {
|
|
1710
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["flex items-start gap-3 px-5 pt-5", children ? "pb-0" : "pb-3", className].filter(Boolean).join(" "), children: [
|
|
1711
|
+
avatar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0", children: avatar }),
|
|
1712
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1713
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-foreground leading-snug", children: title }),
|
|
1714
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-foreground-muted leading-snug mt-0.5", children: subtitle }),
|
|
1715
|
+
children
|
|
1716
|
+
] }),
|
|
1717
|
+
action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 -mt-1 -mr-1", children: action })
|
|
1718
|
+
] });
|
|
1719
|
+
}
|
|
1720
|
+
function CardBody({ children, className = "" }) {
|
|
1721
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["px-5 py-4 text-sm text-foreground-secondary leading-relaxed", className].filter(Boolean).join(" "), children });
|
|
1722
|
+
}
|
|
1723
|
+
function CardFooter({ children, noDivider, className = "" }) {
|
|
1724
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["flex items-center gap-2 px-5 py-3", noDivider ? "" : "border-t border-border", className].filter(Boolean).join(" "), children });
|
|
1725
|
+
}
|
|
1726
|
+
Card.Media = CardMedia;
|
|
1727
|
+
Card.Header = CardHeader;
|
|
1728
|
+
Card.Body = CardBody;
|
|
1729
|
+
Card.Footer = CardFooter;
|
|
1730
|
+
var Card_default = Card;
|
|
1731
|
+
var Arrow2 = ({ dir }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", className: "h-5 w-5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: dir === "left" ? "M15 19l-7-7 7-7" : "M9 5l7 7-7 7" }) });
|
|
1732
|
+
function CardCarousel({
|
|
1733
|
+
children,
|
|
1734
|
+
itemWidth = 280,
|
|
1735
|
+
gap = 16,
|
|
1736
|
+
showArrows = true,
|
|
1737
|
+
showDots = false,
|
|
1738
|
+
"aria-label": ariaLabel = "Carousel",
|
|
1739
|
+
className = "",
|
|
1740
|
+
style
|
|
1741
|
+
}) {
|
|
1742
|
+
const scrollerRef = React16.useRef(null);
|
|
1743
|
+
const slides = React16__default.default.Children.toArray(children);
|
|
1744
|
+
const [active, setActive] = React16.useState(0);
|
|
1745
|
+
const [atStart, setAtStart] = React16.useState(true);
|
|
1746
|
+
const [atEnd, setAtEnd] = React16.useState(false);
|
|
1747
|
+
const width = typeof itemWidth === "number" ? `${itemWidth}px` : itemWidth;
|
|
1748
|
+
const update = React16.useCallback(() => {
|
|
1749
|
+
const el = scrollerRef.current;
|
|
1750
|
+
if (!el) return;
|
|
1751
|
+
el.clientWidth;
|
|
1752
|
+
setAtStart(el.scrollLeft <= 1);
|
|
1753
|
+
setAtEnd(el.scrollLeft + el.clientWidth >= el.scrollWidth - 1);
|
|
1754
|
+
const first = el.firstElementChild;
|
|
1755
|
+
const slideW = first ? first.getBoundingClientRect().width + gap : el.clientWidth;
|
|
1756
|
+
setActive(Math.round(el.scrollLeft / slideW));
|
|
1757
|
+
}, [gap]);
|
|
1758
|
+
React16.useEffect(() => {
|
|
1759
|
+
update();
|
|
1760
|
+
const el = scrollerRef.current;
|
|
1761
|
+
if (!el) return;
|
|
1762
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
1763
|
+
window.addEventListener("resize", update);
|
|
1764
|
+
return () => {
|
|
1765
|
+
el.removeEventListener("scroll", update);
|
|
1766
|
+
window.removeEventListener("resize", update);
|
|
1767
|
+
};
|
|
1768
|
+
}, [update]);
|
|
1769
|
+
const scrollByDir = (dir) => {
|
|
1770
|
+
const el = scrollerRef.current;
|
|
1771
|
+
if (!el) return;
|
|
1772
|
+
const first = el.firstElementChild;
|
|
1773
|
+
const slideW = first ? first.getBoundingClientRect().width + gap : el.clientWidth;
|
|
1774
|
+
el.scrollBy({ left: dir * slideW, behavior: "smooth" });
|
|
1775
|
+
};
|
|
1776
|
+
const scrollTo = (i) => {
|
|
1777
|
+
const el = scrollerRef.current;
|
|
1778
|
+
if (!el) return;
|
|
1779
|
+
const first = el.firstElementChild;
|
|
1780
|
+
const slideW = first ? first.getBoundingClientRect().width + gap : el.clientWidth;
|
|
1781
|
+
el.scrollTo({ left: i * slideW, behavior: "smooth" });
|
|
1782
|
+
};
|
|
1783
|
+
const arrowBtn = "absolute top-1/2 -translate-y-1/2 z-10 flex h-9 w-9 items-center justify-center rounded-full border border-border bg-surface text-foreground-secondary shadow-md transition hover:text-foreground hover:bg-surface-raised disabled:opacity-0 disabled:pointer-events-none focus:outline-none focus-visible:ring-2 focus-visible:ring-accent";
|
|
1784
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": ariaLabel, className: ["relative", className].filter(Boolean).join(" "), style, children: [
|
|
1785
|
+
showArrows && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Previous", onClick: () => scrollByDir(-1), disabled: atStart, className: `${arrowBtn} left-1`, children: /* @__PURE__ */ jsxRuntime.jsx(Arrow2, { dir: "left" }) }),
|
|
1786
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1787
|
+
"div",
|
|
1788
|
+
{
|
|
1789
|
+
ref: scrollerRef,
|
|
1790
|
+
className: "flex overflow-x-auto snap-x snap-mandatory hidden-scrollbar scroll-smooth",
|
|
1791
|
+
style: { gap },
|
|
1792
|
+
children: slides.map((slide, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "snap-start flex-shrink-0", style: { width }, children: slide }, i))
|
|
1793
|
+
}
|
|
1794
|
+
),
|
|
1795
|
+
showArrows && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Next", onClick: () => scrollByDir(1), disabled: atEnd, className: `${arrowBtn} right-1`, children: /* @__PURE__ */ jsxRuntime.jsx(Arrow2, { dir: "right" }) }),
|
|
1796
|
+
showDots && slides.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 flex items-center justify-center gap-1.5", children: slides.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1797
|
+
"button",
|
|
1798
|
+
{
|
|
1799
|
+
type: "button",
|
|
1800
|
+
"aria-label": `Go to slide ${i + 1}`,
|
|
1801
|
+
"aria-current": i === active,
|
|
1802
|
+
onClick: () => scrollTo(i),
|
|
1803
|
+
className: [
|
|
1804
|
+
"h-1.5 rounded-full transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
1805
|
+
i === active ? "w-5 bg-accent" : "w-1.5 bg-border hover:bg-foreground-muted"
|
|
1806
|
+
].join(" ")
|
|
1807
|
+
},
|
|
1808
|
+
i
|
|
1809
|
+
)) })
|
|
1810
|
+
] });
|
|
1811
|
+
}
|
|
1812
|
+
var NotificationContext = React16.createContext({
|
|
1656
1813
|
open: () => void 0,
|
|
1657
1814
|
close: () => void 0
|
|
1658
1815
|
});
|
|
@@ -1710,26 +1867,26 @@ function NotificationItem({
|
|
|
1710
1867
|
onClose,
|
|
1711
1868
|
reduced
|
|
1712
1869
|
}) {
|
|
1713
|
-
const [paused, setPaused] =
|
|
1870
|
+
const [paused, setPaused] = React16.useState(false);
|
|
1714
1871
|
const duration = n.duration ?? 4e3;
|
|
1715
1872
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
1716
1873
|
const showProgress = !reduced && isAutoDismissing;
|
|
1717
|
-
const timerRef =
|
|
1718
|
-
const startTimeRef =
|
|
1719
|
-
const remainingRef =
|
|
1720
|
-
const clearTimer =
|
|
1874
|
+
const timerRef = React16.useRef(null);
|
|
1875
|
+
const startTimeRef = React16.useRef(0);
|
|
1876
|
+
const remainingRef = React16.useRef(duration);
|
|
1877
|
+
const clearTimer = React16.useCallback(() => {
|
|
1721
1878
|
if (timerRef.current !== null) {
|
|
1722
1879
|
clearTimeout(timerRef.current);
|
|
1723
1880
|
timerRef.current = null;
|
|
1724
1881
|
}
|
|
1725
1882
|
}, []);
|
|
1726
|
-
const scheduleDismiss =
|
|
1883
|
+
const scheduleDismiss = React16.useCallback((ms) => {
|
|
1727
1884
|
clearTimer();
|
|
1728
1885
|
if (!isAutoDismissing) return;
|
|
1729
1886
|
startTimeRef.current = Date.now();
|
|
1730
1887
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
1731
1888
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
1732
|
-
|
|
1889
|
+
React16.useEffect(() => {
|
|
1733
1890
|
if (paused || !isAutoDismissing) return;
|
|
1734
1891
|
scheduleDismiss(remainingRef.current);
|
|
1735
1892
|
return clearTimer;
|
|
@@ -1812,15 +1969,15 @@ function NotificationProvider({
|
|
|
1812
1969
|
children,
|
|
1813
1970
|
position = "top-right"
|
|
1814
1971
|
}) {
|
|
1815
|
-
const [notifications, setNotifications] =
|
|
1972
|
+
const [notifications, setNotifications] = React16.useState([]);
|
|
1816
1973
|
const reduced = framerMotion.useReducedMotion();
|
|
1817
|
-
const open =
|
|
1974
|
+
const open = React16.useCallback((payload) => {
|
|
1818
1975
|
setNotifications((prev) => [
|
|
1819
1976
|
...prev,
|
|
1820
1977
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
1821
1978
|
]);
|
|
1822
1979
|
}, []);
|
|
1823
|
-
const close =
|
|
1980
|
+
const close = React16.useCallback((id) => {
|
|
1824
1981
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
1825
1982
|
}, []);
|
|
1826
1983
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -1849,7 +2006,7 @@ function NotificationProvider({
|
|
|
1849
2006
|
] });
|
|
1850
2007
|
}
|
|
1851
2008
|
function useNotification() {
|
|
1852
|
-
const { open } =
|
|
2009
|
+
const { open } = React16.useContext(NotificationContext);
|
|
1853
2010
|
return {
|
|
1854
2011
|
info: (props) => open({ type: "info", ...props }),
|
|
1855
2012
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -1966,10 +2123,10 @@ function FadingBase({
|
|
|
1966
2123
|
isMounted = false,
|
|
1967
2124
|
children
|
|
1968
2125
|
}) {
|
|
1969
|
-
const [shouldRender, setShouldRender] =
|
|
1970
|
-
const [visible, setVisible] =
|
|
1971
|
-
const timerRef =
|
|
1972
|
-
|
|
2126
|
+
const [shouldRender, setShouldRender] = React16.useState(isMounted);
|
|
2127
|
+
const [visible, setVisible] = React16.useState(false);
|
|
2128
|
+
const timerRef = React16.useRef(null);
|
|
2129
|
+
React16.useEffect(() => {
|
|
1973
2130
|
if (isMounted) {
|
|
1974
2131
|
setShouldRender(true);
|
|
1975
2132
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -2067,8 +2224,8 @@ function ScalableContainer({
|
|
|
2067
2224
|
togglePosition = "top-right",
|
|
2068
2225
|
className = ""
|
|
2069
2226
|
}) {
|
|
2070
|
-
const containerRef =
|
|
2071
|
-
const [internalScaled, setInternalScaled] =
|
|
2227
|
+
const containerRef = React16.useRef(null);
|
|
2228
|
+
const [internalScaled, setInternalScaled] = React16.useState(false);
|
|
2072
2229
|
const isScaled = expanded ?? internalScaled;
|
|
2073
2230
|
const reduced = framerMotion.useReducedMotion();
|
|
2074
2231
|
const onToggle = () => {
|
|
@@ -2206,17 +2363,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
2206
2363
|
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)) });
|
|
2207
2364
|
}
|
|
2208
2365
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
2209
|
-
const [activeIndex, setActiveIndex] =
|
|
2210
|
-
const [indexPool, setIndexPool] =
|
|
2211
|
-
const cardRefs =
|
|
2212
|
-
const getIndexes =
|
|
2366
|
+
const [activeIndex, setActiveIndex] = React16.useState(0);
|
|
2367
|
+
const [indexPool, setIndexPool] = React16.useState([]);
|
|
2368
|
+
const cardRefs = React16.useRef([]);
|
|
2369
|
+
const getIndexes = React16.useMemo(() => {
|
|
2213
2370
|
let nextIndex = activeIndex + 1;
|
|
2214
2371
|
let previousIndex = activeIndex - 1;
|
|
2215
2372
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
2216
2373
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
2217
2374
|
return { previousIndex, nextIndex };
|
|
2218
2375
|
}, [activeIndex, items.length]);
|
|
2219
|
-
|
|
2376
|
+
React16.useEffect(() => {
|
|
2220
2377
|
const { nextIndex, previousIndex } = getIndexes;
|
|
2221
2378
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
2222
2379
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -2389,8 +2546,8 @@ function writeDismissed(key) {
|
|
|
2389
2546
|
}
|
|
2390
2547
|
}
|
|
2391
2548
|
function useTargetBbox(ref) {
|
|
2392
|
-
const [bbox, setBbox] =
|
|
2393
|
-
|
|
2549
|
+
const [bbox, setBbox] = React16.useState(null);
|
|
2550
|
+
React16.useLayoutEffect(() => {
|
|
2394
2551
|
const el = ref?.current;
|
|
2395
2552
|
if (!el) {
|
|
2396
2553
|
setBbox(null);
|
|
@@ -2420,7 +2577,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
2420
2577
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
2421
2578
|
}
|
|
2422
2579
|
function useFocusTrap(containerRef, active) {
|
|
2423
|
-
|
|
2580
|
+
React16.useEffect(() => {
|
|
2424
2581
|
if (!active) return;
|
|
2425
2582
|
const el = containerRef.current;
|
|
2426
2583
|
if (!el) return;
|
|
@@ -2459,16 +2616,16 @@ function Wizard({
|
|
|
2459
2616
|
onComplete,
|
|
2460
2617
|
onSkip
|
|
2461
2618
|
}) {
|
|
2462
|
-
const tooltipRef =
|
|
2463
|
-
const tooltipTitleId =
|
|
2464
|
-
const tooltipBodyId =
|
|
2619
|
+
const tooltipRef = React16.useRef(null);
|
|
2620
|
+
const tooltipTitleId = React16.useId();
|
|
2621
|
+
const tooltipBodyId = React16.useId();
|
|
2465
2622
|
const reduced = framerMotion.useReducedMotion();
|
|
2466
|
-
const [open, setOpen] =
|
|
2467
|
-
const [activeIndex, setActiveIndex] =
|
|
2623
|
+
const [open, setOpen] = React16.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
2624
|
+
const [activeIndex, setActiveIndex] = React16.useState(0);
|
|
2468
2625
|
const step = steps[activeIndex];
|
|
2469
2626
|
const bbox = useTargetBbox(step?.stepRef);
|
|
2470
2627
|
useFocusTrap(tooltipRef, open);
|
|
2471
|
-
|
|
2628
|
+
React16.useEffect(() => {
|
|
2472
2629
|
if (!open || !dismissible) return;
|
|
2473
2630
|
const onKey = (e) => {
|
|
2474
2631
|
if (e.key === "Escape") {
|
|
@@ -2479,12 +2636,12 @@ function Wizard({
|
|
|
2479
2636
|
document.addEventListener("keydown", onKey);
|
|
2480
2637
|
return () => document.removeEventListener("keydown", onKey);
|
|
2481
2638
|
}, [open, dismissible]);
|
|
2482
|
-
const handleSkip =
|
|
2639
|
+
const handleSkip = React16.useCallback(() => {
|
|
2483
2640
|
writeDismissed(storageKey);
|
|
2484
2641
|
setOpen(false);
|
|
2485
2642
|
onSkip?.();
|
|
2486
2643
|
}, [storageKey, onSkip]);
|
|
2487
|
-
const handleComplete =
|
|
2644
|
+
const handleComplete = React16.useCallback(() => {
|
|
2488
2645
|
writeDismissed(storageKey);
|
|
2489
2646
|
setOpen(false);
|
|
2490
2647
|
onComplete?.();
|
|
@@ -2755,7 +2912,7 @@ function Field({
|
|
|
2755
2912
|
);
|
|
2756
2913
|
}
|
|
2757
2914
|
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" }) });
|
|
2758
|
-
var SearchInput =
|
|
2915
|
+
var SearchInput = React16__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
2759
2916
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2760
2917
|
"div",
|
|
2761
2918
|
{
|
|
@@ -2809,11 +2966,11 @@ function MultiTagRow({
|
|
|
2809
2966
|
labelFor,
|
|
2810
2967
|
onRemove
|
|
2811
2968
|
}) {
|
|
2812
|
-
const wrapRef =
|
|
2813
|
-
const measureRef =
|
|
2814
|
-
const [visibleCount, setVisibleCount] =
|
|
2969
|
+
const wrapRef = React16.useRef(null);
|
|
2970
|
+
const measureRef = React16.useRef(null);
|
|
2971
|
+
const [visibleCount, setVisibleCount] = React16.useState(values.length);
|
|
2815
2972
|
const key = values.map(String).join("|");
|
|
2816
|
-
|
|
2973
|
+
React16.useLayoutEffect(() => {
|
|
2817
2974
|
const wrap = wrapRef.current;
|
|
2818
2975
|
const measure = measureRef.current;
|
|
2819
2976
|
if (!wrap || !measure) return;
|
|
@@ -2907,16 +3064,16 @@ function Dropdown({
|
|
|
2907
3064
|
size = "md",
|
|
2908
3065
|
className = ""
|
|
2909
3066
|
}) {
|
|
2910
|
-
const [open, setOpen] =
|
|
2911
|
-
const [selectedItems, setSelectedItems] =
|
|
2912
|
-
const [searchTerm, setSearchTerm] =
|
|
2913
|
-
const [innerItems, setInnerItems] =
|
|
2914
|
-
const errorId =
|
|
3067
|
+
const [open, setOpen] = React16.useState(false);
|
|
3068
|
+
const [selectedItems, setSelectedItems] = React16.useState([]);
|
|
3069
|
+
const [searchTerm, setSearchTerm] = React16.useState("");
|
|
3070
|
+
const [innerItems, setInnerItems] = React16.useState([]);
|
|
3071
|
+
const errorId = React16.useId();
|
|
2915
3072
|
const hasError = errorMessage != null;
|
|
2916
|
-
|
|
3073
|
+
React16.useEffect(() => {
|
|
2917
3074
|
setInnerItems(items);
|
|
2918
3075
|
}, [items]);
|
|
2919
|
-
|
|
3076
|
+
React16.useEffect(() => {
|
|
2920
3077
|
if (isMultiselect && Array.isArray(value)) {
|
|
2921
3078
|
setSelectedItems(value);
|
|
2922
3079
|
}
|
|
@@ -3241,7 +3398,7 @@ function TableBody({
|
|
|
3241
3398
|
expandRow,
|
|
3242
3399
|
getRowKey
|
|
3243
3400
|
}) {
|
|
3244
|
-
const [expanded, setExpanded] =
|
|
3401
|
+
const [expanded, setExpanded] = React16.useState(() => /* @__PURE__ */ new Set());
|
|
3245
3402
|
const reduced = framerMotion.useReducedMotion();
|
|
3246
3403
|
const toggleRow = (rowKey) => {
|
|
3247
3404
|
setExpanded((prev) => {
|
|
@@ -3256,7 +3413,7 @@ function TableBody({
|
|
|
3256
3413
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
3257
3414
|
const rowKey = getRowKey(row, i);
|
|
3258
3415
|
const isExpanded = expanded.has(rowKey);
|
|
3259
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3416
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React16__default.default.Fragment, { children: [
|
|
3260
3417
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3261
3418
|
"tr",
|
|
3262
3419
|
{
|
|
@@ -3312,9 +3469,9 @@ function Pagination({
|
|
|
3312
3469
|
const matchedOption = picker.find(
|
|
3313
3470
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
3314
3471
|
);
|
|
3315
|
-
const [perPageKey, setPerPageKey] =
|
|
3472
|
+
const [perPageKey, setPerPageKey] = React16.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
3316
3473
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
3317
|
-
|
|
3474
|
+
React16.useEffect(() => {
|
|
3318
3475
|
if (serverSide && options.perPage != null) {
|
|
3319
3476
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
3320
3477
|
if (next) setPerPageKey(next.key);
|
|
@@ -3378,14 +3535,14 @@ function Table({
|
|
|
3378
3535
|
className = "",
|
|
3379
3536
|
style
|
|
3380
3537
|
}) {
|
|
3381
|
-
const searchRef =
|
|
3382
|
-
const [searchTerm, setSearchTerm] =
|
|
3383
|
-
const [perPage, setPerPage] =
|
|
3538
|
+
const searchRef = React16.useRef(null);
|
|
3539
|
+
const [searchTerm, setSearchTerm] = React16.useState("");
|
|
3540
|
+
const [perPage, setPerPage] = React16.useState(
|
|
3384
3541
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
3385
3542
|
);
|
|
3386
|
-
const [activePage, setActivePage] =
|
|
3543
|
+
const [activePage, setActivePage] = React16.useState(0);
|
|
3387
3544
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
3388
|
-
const filteredRows =
|
|
3545
|
+
const filteredRows = React16.useMemo(() => {
|
|
3389
3546
|
if (isServerSide || !searchTerm) return rows;
|
|
3390
3547
|
const term = searchTerm.toLowerCase();
|
|
3391
3548
|
return rows.filter(
|
|
@@ -3394,29 +3551,29 @@ function Table({
|
|
|
3394
3551
|
)
|
|
3395
3552
|
);
|
|
3396
3553
|
}, [rows, searchTerm, isServerSide]);
|
|
3397
|
-
const datasets =
|
|
3554
|
+
const datasets = React16.useMemo(() => {
|
|
3398
3555
|
if (isServerSide) return [rows];
|
|
3399
3556
|
return createDatasets(filteredRows, pagination.enabled ? perPage : null);
|
|
3400
3557
|
}, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
3401
|
-
const MAX_PAGE =
|
|
3558
|
+
const MAX_PAGE = React16.useMemo(() => {
|
|
3402
3559
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
3403
3560
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
3404
3561
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
3405
3562
|
return datasets.length ? datasets.length - 1 : 0;
|
|
3406
3563
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
3407
|
-
const currentPageRows =
|
|
3564
|
+
const currentPageRows = React16.useMemo(() => {
|
|
3408
3565
|
if (isServerSide) return rows;
|
|
3409
3566
|
return datasets[activePage] ?? [];
|
|
3410
3567
|
}, [isServerSide, rows, datasets, activePage]);
|
|
3411
|
-
|
|
3568
|
+
React16.useEffect(() => {
|
|
3412
3569
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
3413
3570
|
setPerPage(pagination.perPage);
|
|
3414
3571
|
}
|
|
3415
3572
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
3416
|
-
|
|
3573
|
+
React16.useEffect(() => {
|
|
3417
3574
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
3418
3575
|
}, [isServerSide, pagination.perPage]);
|
|
3419
|
-
|
|
3576
|
+
React16.useEffect(() => {
|
|
3420
3577
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
3421
3578
|
setActivePage(pagination.page - 1);
|
|
3422
3579
|
}, [isServerSide, pagination.page]);
|
|
@@ -3500,7 +3657,7 @@ function TableSkeletonBody({
|
|
|
3500
3657
|
)) });
|
|
3501
3658
|
}
|
|
3502
3659
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
3503
|
-
const id =
|
|
3660
|
+
const id = React16.useId();
|
|
3504
3661
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3505
3662
|
SwitchPrimitive__namespace.Root,
|
|
3506
3663
|
{
|
|
@@ -3684,7 +3841,7 @@ function Sidebar({
|
|
|
3684
3841
|
}
|
|
3685
3842
|
) });
|
|
3686
3843
|
}
|
|
3687
|
-
var MegaMenuContext =
|
|
3844
|
+
var MegaMenuContext = React16.createContext({ align: "start" });
|
|
3688
3845
|
function MegaMenu({
|
|
3689
3846
|
children,
|
|
3690
3847
|
align = "start",
|
|
@@ -3715,7 +3872,7 @@ function MegaMenu({
|
|
|
3715
3872
|
}
|
|
3716
3873
|
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";
|
|
3717
3874
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
3718
|
-
const { align } =
|
|
3875
|
+
const { align } = React16.useContext(MegaMenuContext);
|
|
3719
3876
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
3720
3877
|
if (!children) {
|
|
3721
3878
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
|
|
@@ -3800,8 +3957,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
3800
3957
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
3801
3958
|
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 });
|
|
3802
3959
|
}
|
|
3803
|
-
var elementsOfType = (children, type) =>
|
|
3804
|
-
(c) =>
|
|
3960
|
+
var elementsOfType = (children, type) => React16__default.default.Children.toArray(children).filter(
|
|
3961
|
+
(c) => React16__default.default.isValidElement(c) && c.type === type
|
|
3805
3962
|
);
|
|
3806
3963
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3807
3964
|
"svg",
|
|
@@ -3838,9 +3995,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
3838
3995
|
);
|
|
3839
3996
|
}
|
|
3840
3997
|
function MobilePanel({ panel, onNavigate }) {
|
|
3841
|
-
const nodes =
|
|
3998
|
+
const nodes = React16__default.default.Children.toArray(panel.props.children);
|
|
3842
3999
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
3843
|
-
if (!
|
|
4000
|
+
if (!React16__default.default.isValidElement(node)) return null;
|
|
3844
4001
|
const el = node;
|
|
3845
4002
|
if (el.type === MegaMenuSection) {
|
|
3846
4003
|
const { title, children } = el.props;
|
|
@@ -3859,8 +4016,8 @@ function MegaMenuMobile({
|
|
|
3859
4016
|
children,
|
|
3860
4017
|
label
|
|
3861
4018
|
}) {
|
|
3862
|
-
const [open, setOpen] =
|
|
3863
|
-
const [expanded, setExpanded] =
|
|
4019
|
+
const [open, setOpen] = React16.useState(false);
|
|
4020
|
+
const [expanded, setExpanded] = React16.useState(null);
|
|
3864
4021
|
const items = elementsOfType(children, MegaMenuItem);
|
|
3865
4022
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
3866
4023
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3933,17 +4090,17 @@ function AppShell({
|
|
|
3933
4090
|
children,
|
|
3934
4091
|
className = ""
|
|
3935
4092
|
}) {
|
|
3936
|
-
const [expanded, setExpanded] =
|
|
3937
|
-
const [isMobile, setIsMobile] =
|
|
3938
|
-
const [mobileOpen, setMobileOpen] =
|
|
3939
|
-
|
|
4093
|
+
const [expanded, setExpanded] = React16.useState(sidebarDefaultExpanded);
|
|
4094
|
+
const [isMobile, setIsMobile] = React16.useState(false);
|
|
4095
|
+
const [mobileOpen, setMobileOpen] = React16.useState(false);
|
|
4096
|
+
React16.useEffect(() => {
|
|
3940
4097
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
3941
4098
|
const update = (e) => setIsMobile(e.matches);
|
|
3942
4099
|
update(mq);
|
|
3943
4100
|
mq.addEventListener("change", update);
|
|
3944
4101
|
return () => mq.removeEventListener("change", update);
|
|
3945
4102
|
}, []);
|
|
3946
|
-
|
|
4103
|
+
React16.useEffect(() => {
|
|
3947
4104
|
if (!isMobile) setMobileOpen(false);
|
|
3948
4105
|
}, [isMobile]);
|
|
3949
4106
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -4133,10 +4290,10 @@ function ThemeProvider({
|
|
|
4133
4290
|
className = "",
|
|
4134
4291
|
style
|
|
4135
4292
|
}) {
|
|
4136
|
-
const id =
|
|
4293
|
+
const id = React16__default.default.useId().replace(/:/g, "");
|
|
4137
4294
|
const scopeClass = `geo-th-${id}`;
|
|
4138
|
-
const divRef =
|
|
4139
|
-
|
|
4295
|
+
const divRef = React16.useRef(null);
|
|
4296
|
+
React16.useEffect(() => {
|
|
4140
4297
|
const el = divRef.current;
|
|
4141
4298
|
if (!el) return;
|
|
4142
4299
|
if (colorScheme === "auto") return;
|
|
@@ -4151,8 +4308,8 @@ function ThemeProvider({
|
|
|
4151
4308
|
}
|
|
4152
4309
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
4153
4310
|
}, [colorScheme]);
|
|
4154
|
-
const lightVars =
|
|
4155
|
-
const darkVarStr =
|
|
4311
|
+
const lightVars = React16.useMemo(() => toCssVars(theme), [theme]);
|
|
4312
|
+
const darkVarStr = React16.useMemo(() => {
|
|
4156
4313
|
if (!darkTheme) return "";
|
|
4157
4314
|
const dvars = toCssVars(darkTheme);
|
|
4158
4315
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -4192,7 +4349,7 @@ function TextInput({
|
|
|
4192
4349
|
prefix,
|
|
4193
4350
|
suffix
|
|
4194
4351
|
}) {
|
|
4195
|
-
const errorId =
|
|
4352
|
+
const errorId = React16.useId();
|
|
4196
4353
|
const hasError = errorMessage != null;
|
|
4197
4354
|
const hasAdornment = prefix != null || suffix != null;
|
|
4198
4355
|
const input = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4262,7 +4419,7 @@ function NumberInput({
|
|
|
4262
4419
|
readOnly = false,
|
|
4263
4420
|
precision
|
|
4264
4421
|
}) {
|
|
4265
|
-
const errorId =
|
|
4422
|
+
const errorId = React16.useId();
|
|
4266
4423
|
const hasError = errorMessage != null;
|
|
4267
4424
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
4268
4425
|
const round = (n) => {
|
|
@@ -4393,8 +4550,8 @@ function Password({
|
|
|
4393
4550
|
showIcon,
|
|
4394
4551
|
hideIcon
|
|
4395
4552
|
}) {
|
|
4396
|
-
const [visible, setVisible] =
|
|
4397
|
-
const errorId =
|
|
4553
|
+
const [visible, setVisible] = React16.useState(false);
|
|
4554
|
+
const errorId = React16.useId();
|
|
4398
4555
|
const hasError = errorMessage != null;
|
|
4399
4556
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4400
4557
|
Field,
|
|
@@ -4467,7 +4624,7 @@ function Checkbox({
|
|
|
4467
4624
|
}) {
|
|
4468
4625
|
const isChecked = checked ?? value ?? false;
|
|
4469
4626
|
const labelFirst = labelPosition === "left";
|
|
4470
|
-
const errorId =
|
|
4627
|
+
const errorId = React16.useId();
|
|
4471
4628
|
const hasError = errorMessage != null;
|
|
4472
4629
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4473
4630
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -4575,8 +4732,8 @@ function RadioGroup({
|
|
|
4575
4732
|
className,
|
|
4576
4733
|
errorMessage
|
|
4577
4734
|
}) {
|
|
4578
|
-
const errorId =
|
|
4579
|
-
const groupId =
|
|
4735
|
+
const errorId = React16.useId();
|
|
4736
|
+
const groupId = React16.useId();
|
|
4580
4737
|
const hasError = errorMessage != null;
|
|
4581
4738
|
const labelFirst = labelPosition === "left";
|
|
4582
4739
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4676,11 +4833,11 @@ function Switch({
|
|
|
4676
4833
|
disabled,
|
|
4677
4834
|
errorMessage
|
|
4678
4835
|
}) {
|
|
4679
|
-
const id =
|
|
4680
|
-
const errorId =
|
|
4836
|
+
const id = React16.useId();
|
|
4837
|
+
const errorId = React16.useId();
|
|
4681
4838
|
const hasError = errorMessage != null;
|
|
4682
4839
|
const isControlled = checked !== void 0;
|
|
4683
|
-
const [internal, setInternal] =
|
|
4840
|
+
const [internal, setInternal] = React16.useState(defaultChecked);
|
|
4684
4841
|
const isOn = isControlled ? checked : internal;
|
|
4685
4842
|
const handle = (c) => {
|
|
4686
4843
|
if (!isControlled) setInternal(c);
|
|
@@ -4753,19 +4910,19 @@ function AutoComplete({
|
|
|
4753
4910
|
required,
|
|
4754
4911
|
htmlFor
|
|
4755
4912
|
}) {
|
|
4756
|
-
const errorId =
|
|
4913
|
+
const errorId = React16.useId();
|
|
4757
4914
|
const hasError = errorMessage != null;
|
|
4758
|
-
const [term, setTerm] =
|
|
4759
|
-
const [open, setOpen] =
|
|
4760
|
-
const [asyncItems, setAsyncItems] =
|
|
4761
|
-
const [loading, setLoading] =
|
|
4915
|
+
const [term, setTerm] = React16.useState("");
|
|
4916
|
+
const [open, setOpen] = React16.useState(false);
|
|
4917
|
+
const [asyncItems, setAsyncItems] = React16.useState([]);
|
|
4918
|
+
const [loading, setLoading] = React16.useState(false);
|
|
4762
4919
|
const isAsync = typeof onSearch === "function";
|
|
4763
|
-
const debounceRef =
|
|
4764
|
-
const requestIdRef =
|
|
4920
|
+
const debounceRef = React16.useRef(null);
|
|
4921
|
+
const requestIdRef = React16.useRef(0);
|
|
4765
4922
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
4766
4923
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
4767
4924
|
) : [];
|
|
4768
|
-
|
|
4925
|
+
React16.useEffect(() => {
|
|
4769
4926
|
if (!isAsync) return;
|
|
4770
4927
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
4771
4928
|
if (!term.trim()) {
|
|
@@ -4921,15 +5078,15 @@ function TreeSelect({
|
|
|
4921
5078
|
defaultExpandedKeys = [],
|
|
4922
5079
|
size = "md"
|
|
4923
5080
|
}) {
|
|
4924
|
-
const errorId =
|
|
5081
|
+
const errorId = React16.useId();
|
|
4925
5082
|
const hasError = errorMessage != null;
|
|
4926
|
-
const [open, setOpen] =
|
|
4927
|
-
const [expanded, setExpanded] =
|
|
4928
|
-
const [activeIndex, setActiveIndex] =
|
|
4929
|
-
const listRef =
|
|
4930
|
-
const visible =
|
|
4931
|
-
const didSyncOnOpenRef =
|
|
4932
|
-
|
|
5083
|
+
const [open, setOpen] = React16.useState(false);
|
|
5084
|
+
const [expanded, setExpanded] = React16.useState(() => new Set(defaultExpandedKeys));
|
|
5085
|
+
const [activeIndex, setActiveIndex] = React16.useState(0);
|
|
5086
|
+
const listRef = React16.useRef(null);
|
|
5087
|
+
const visible = React16.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
5088
|
+
const didSyncOnOpenRef = React16.useRef(false);
|
|
5089
|
+
React16.useEffect(() => {
|
|
4933
5090
|
if (!open) {
|
|
4934
5091
|
didSyncOnOpenRef.current = false;
|
|
4935
5092
|
return;
|
|
@@ -4939,7 +5096,7 @@ function TreeSelect({
|
|
|
4939
5096
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
4940
5097
|
didSyncOnOpenRef.current = true;
|
|
4941
5098
|
}, [open, value]);
|
|
4942
|
-
const selectedNode =
|
|
5099
|
+
const selectedNode = React16.useMemo(
|
|
4943
5100
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
4944
5101
|
[items, value]
|
|
4945
5102
|
);
|
|
@@ -5170,11 +5327,11 @@ function FileInput({
|
|
|
5170
5327
|
required,
|
|
5171
5328
|
icon
|
|
5172
5329
|
}) {
|
|
5173
|
-
const inputRef =
|
|
5174
|
-
const errorId =
|
|
5175
|
-
const [files, setFiles] =
|
|
5176
|
-
const [dragging, setDragging] =
|
|
5177
|
-
const [sizeError, setSizeError] =
|
|
5330
|
+
const inputRef = React16.useRef(null);
|
|
5331
|
+
const errorId = React16.useId();
|
|
5332
|
+
const [files, setFiles] = React16.useState([]);
|
|
5333
|
+
const [dragging, setDragging] = React16.useState(false);
|
|
5334
|
+
const [sizeError, setSizeError] = React16.useState(null);
|
|
5178
5335
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
5179
5336
|
const openPicker = () => {
|
|
5180
5337
|
if (!disabled) inputRef.current?.click();
|
|
@@ -5365,30 +5522,30 @@ function DatePicker({
|
|
|
5365
5522
|
size = "md",
|
|
5366
5523
|
className = ""
|
|
5367
5524
|
}) {
|
|
5368
|
-
const errorId =
|
|
5525
|
+
const errorId = React16.useId();
|
|
5369
5526
|
const hasError = errorMessage != null;
|
|
5370
|
-
const [open, setOpen] =
|
|
5371
|
-
const [viewMonth, setViewMonth] =
|
|
5372
|
-
const [focusDate, setFocusDate] =
|
|
5373
|
-
const [view, setView] =
|
|
5374
|
-
const gridRef =
|
|
5375
|
-
|
|
5527
|
+
const [open, setOpen] = React16.useState(false);
|
|
5528
|
+
const [viewMonth, setViewMonth] = React16.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
5529
|
+
const [focusDate, setFocusDate] = React16.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
5530
|
+
const [view, setView] = React16.useState("days");
|
|
5531
|
+
const gridRef = React16.useRef(null);
|
|
5532
|
+
React16.useEffect(() => {
|
|
5376
5533
|
if (!open) return;
|
|
5377
5534
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
5378
5535
|
setViewMonth(startOfMonth(target));
|
|
5379
5536
|
setFocusDate(target);
|
|
5380
5537
|
setView("days");
|
|
5381
5538
|
}, [open, value]);
|
|
5382
|
-
|
|
5539
|
+
React16.useEffect(() => {
|
|
5383
5540
|
if (!open) return;
|
|
5384
5541
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat(focusDate)}"]`);
|
|
5385
5542
|
cell?.focus();
|
|
5386
5543
|
}, [open, focusDate]);
|
|
5387
|
-
const weekdays =
|
|
5544
|
+
const weekdays = React16.useMemo(() => {
|
|
5388
5545
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5389
5546
|
return ordered;
|
|
5390
5547
|
}, [weekStartsOn]);
|
|
5391
|
-
const grid =
|
|
5548
|
+
const grid = React16.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5392
5549
|
const isDisabled = (d) => {
|
|
5393
5550
|
if (min && d < min) return true;
|
|
5394
5551
|
if (max && d > max) return true;
|
|
@@ -5678,10 +5835,10 @@ function TextArea({
|
|
|
5678
5835
|
style,
|
|
5679
5836
|
inputStyle
|
|
5680
5837
|
}) {
|
|
5681
|
-
const errorId =
|
|
5838
|
+
const errorId = React16.useId();
|
|
5682
5839
|
const hasError = errorMessage != null;
|
|
5683
|
-
const ref =
|
|
5684
|
-
|
|
5840
|
+
const ref = React16.useRef(null);
|
|
5841
|
+
React16.useLayoutEffect(() => {
|
|
5685
5842
|
if (!autoGrow) return;
|
|
5686
5843
|
const el = ref.current;
|
|
5687
5844
|
if (!el) return;
|
|
@@ -5728,7 +5885,7 @@ function TextArea({
|
|
|
5728
5885
|
}
|
|
5729
5886
|
);
|
|
5730
5887
|
}
|
|
5731
|
-
var
|
|
5888
|
+
var SIZE4 = {
|
|
5732
5889
|
sm: { h: "h-control-sm", text: "text-xs", pad: "px-2.5" },
|
|
5733
5890
|
md: { h: "h-control-md", text: "text-sm", pad: "px-3.5" },
|
|
5734
5891
|
lg: { h: "h-control-lg", text: "text-sm", pad: "px-4" }
|
|
@@ -5750,12 +5907,12 @@ function SegmentedControl({
|
|
|
5750
5907
|
errorMessage,
|
|
5751
5908
|
"aria-label": ariaLabel
|
|
5752
5909
|
}) {
|
|
5753
|
-
const sz =
|
|
5754
|
-
const groupId =
|
|
5755
|
-
const errorId =
|
|
5910
|
+
const sz = SIZE4[size];
|
|
5911
|
+
const groupId = React16.useId();
|
|
5912
|
+
const errorId = React16.useId();
|
|
5756
5913
|
const hasError = errorMessage != null;
|
|
5757
5914
|
const isControlled = value !== void 0;
|
|
5758
|
-
const [internal, setInternal] =
|
|
5915
|
+
const [internal, setInternal] = React16.useState(defaultValue);
|
|
5759
5916
|
const current = isControlled ? value : internal;
|
|
5760
5917
|
const handle = (v) => {
|
|
5761
5918
|
if (!v) return;
|
|
@@ -5849,14 +6006,14 @@ function Slider({
|
|
|
5849
6006
|
name,
|
|
5850
6007
|
htmlFor
|
|
5851
6008
|
}) {
|
|
5852
|
-
const errorId =
|
|
6009
|
+
const errorId = React16.useId();
|
|
5853
6010
|
const hasError = errorMessage != null;
|
|
5854
6011
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
5855
|
-
const [internal, setInternal] =
|
|
6012
|
+
const [internal, setInternal] = React16.useState(
|
|
5856
6013
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
5857
6014
|
);
|
|
5858
6015
|
const current = toArray(value) ?? internal;
|
|
5859
|
-
const [dragging, setDragging] =
|
|
6016
|
+
const [dragging, setDragging] = React16.useState(false);
|
|
5860
6017
|
const emit = (arr) => {
|
|
5861
6018
|
setInternal(arr);
|
|
5862
6019
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -5951,11 +6108,11 @@ function TagsInput({
|
|
|
5951
6108
|
validate,
|
|
5952
6109
|
separators = ["Enter", ","]
|
|
5953
6110
|
}) {
|
|
5954
|
-
const errorId =
|
|
5955
|
-
const inputRef =
|
|
5956
|
-
const [internal, setInternal] =
|
|
5957
|
-
const [draft, setDraft] =
|
|
5958
|
-
const [localError, setLocalError] =
|
|
6111
|
+
const errorId = React16.useId();
|
|
6112
|
+
const inputRef = React16.useRef(null);
|
|
6113
|
+
const [internal, setInternal] = React16.useState(defaultValue ?? []);
|
|
6114
|
+
const [draft, setDraft] = React16.useState("");
|
|
6115
|
+
const [localError, setLocalError] = React16.useState(null);
|
|
5959
6116
|
const tags = value ?? internal;
|
|
5960
6117
|
const hasError = errorMessage != null || localError != null;
|
|
5961
6118
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -6086,9 +6243,9 @@ function OtpInput({
|
|
|
6086
6243
|
className,
|
|
6087
6244
|
groupAfter
|
|
6088
6245
|
}) {
|
|
6089
|
-
const errorId =
|
|
6246
|
+
const errorId = React16.useId();
|
|
6090
6247
|
const hasError = errorMessage != null;
|
|
6091
|
-
const refs =
|
|
6248
|
+
const refs = React16.useRef([]);
|
|
6092
6249
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
6093
6250
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
6094
6251
|
const emit = (next) => {
|
|
@@ -6137,7 +6294,7 @@ function OtpInput({
|
|
|
6137
6294
|
emit(valid.join(""));
|
|
6138
6295
|
focusBox(valid.length);
|
|
6139
6296
|
};
|
|
6140
|
-
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(
|
|
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(React16__default.default.Fragment, { children: [
|
|
6141
6298
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6142
6299
|
"input",
|
|
6143
6300
|
{
|
|
@@ -6195,9 +6352,9 @@ function Rating({
|
|
|
6195
6352
|
className,
|
|
6196
6353
|
required
|
|
6197
6354
|
}) {
|
|
6198
|
-
const errorId =
|
|
6199
|
-
const [internal, setInternal] =
|
|
6200
|
-
const [hover, setHover] =
|
|
6355
|
+
const errorId = React16.useId();
|
|
6356
|
+
const [internal, setInternal] = React16.useState(defaultValue);
|
|
6357
|
+
const [hover, setHover] = React16.useState(null);
|
|
6201
6358
|
const current = value ?? internal;
|
|
6202
6359
|
const display2 = hover ?? current;
|
|
6203
6360
|
const interactive = !readOnly && !disabled;
|
|
@@ -6320,9 +6477,9 @@ function TimePicker({
|
|
|
6320
6477
|
required,
|
|
6321
6478
|
style
|
|
6322
6479
|
}) {
|
|
6323
|
-
const errorId =
|
|
6480
|
+
const errorId = React16.useId();
|
|
6324
6481
|
const hasError = errorMessage != null;
|
|
6325
|
-
const [open, setOpen] =
|
|
6482
|
+
const [open, setOpen] = React16.useState(false);
|
|
6326
6483
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
6327
6484
|
const update = (next) => {
|
|
6328
6485
|
const merged = { ...parsed, ...next };
|
|
@@ -6446,13 +6603,13 @@ function DateRangePicker({
|
|
|
6446
6603
|
required,
|
|
6447
6604
|
style
|
|
6448
6605
|
}) {
|
|
6449
|
-
const errorId =
|
|
6606
|
+
const errorId = React16.useId();
|
|
6450
6607
|
const hasError = errorMessage != null;
|
|
6451
|
-
const [open, setOpen] =
|
|
6452
|
-
const [leftMonth, setLeftMonth] =
|
|
6453
|
-
const [pendingStart, setPendingStart] =
|
|
6454
|
-
const [hoverDate, setHoverDate] =
|
|
6455
|
-
const weekdays =
|
|
6608
|
+
const [open, setOpen] = React16.useState(false);
|
|
6609
|
+
const [leftMonth, setLeftMonth] = React16.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
6610
|
+
const [pendingStart, setPendingStart] = React16.useState(null);
|
|
6611
|
+
const [hoverDate, setHoverDate] = React16.useState(null);
|
|
6612
|
+
const weekdays = React16.useMemo(
|
|
6456
6613
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6457
6614
|
[weekStartsOn]
|
|
6458
6615
|
);
|
|
@@ -6628,10 +6785,10 @@ function ColorPicker({
|
|
|
6628
6785
|
required,
|
|
6629
6786
|
placeholder = "Pick a colour\u2026"
|
|
6630
6787
|
}) {
|
|
6631
|
-
const errorId =
|
|
6788
|
+
const errorId = React16.useId();
|
|
6632
6789
|
const hasError = errorMessage != null;
|
|
6633
|
-
const [open, setOpen] =
|
|
6634
|
-
const [draft, setDraft] =
|
|
6790
|
+
const [open, setOpen] = React16.useState(false);
|
|
6791
|
+
const [draft, setDraft] = React16.useState(value);
|
|
6635
6792
|
const valid = HEX_RE.test(value);
|
|
6636
6793
|
const pick = (hex) => {
|
|
6637
6794
|
onChange?.(hex);
|
|
@@ -7018,11 +7175,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
7018
7175
|
|
|
7019
7176
|
// src/form/useForm.ts
|
|
7020
7177
|
function useForm(options = {}) {
|
|
7021
|
-
const ref =
|
|
7178
|
+
const ref = React16.useRef(null);
|
|
7022
7179
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
7023
7180
|
const store = ref.current;
|
|
7024
|
-
|
|
7025
|
-
const make =
|
|
7181
|
+
React16.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7182
|
+
const make = React16.useCallback(
|
|
7026
7183
|
(kind) => (name, rules) => {
|
|
7027
7184
|
if (rules !== void 0) store.setRule(name, rules);
|
|
7028
7185
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -7051,9 +7208,9 @@ function useForm(options = {}) {
|
|
|
7051
7208
|
fieldTarget: make("target")
|
|
7052
7209
|
};
|
|
7053
7210
|
}
|
|
7054
|
-
var FormContext =
|
|
7211
|
+
var FormContext = React16.createContext(null);
|
|
7055
7212
|
function useFormStore() {
|
|
7056
|
-
const store =
|
|
7213
|
+
const store = React16.useContext(FormContext);
|
|
7057
7214
|
if (!store) {
|
|
7058
7215
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
7059
7216
|
}
|
|
@@ -7067,8 +7224,8 @@ function Form({
|
|
|
7067
7224
|
children,
|
|
7068
7225
|
...rest
|
|
7069
7226
|
}) {
|
|
7070
|
-
const ref =
|
|
7071
|
-
const bypass =
|
|
7227
|
+
const ref = React16.useRef(null);
|
|
7228
|
+
const bypass = React16.useRef(false);
|
|
7072
7229
|
const handleSubmit = async (e) => {
|
|
7073
7230
|
if (bypass.current) {
|
|
7074
7231
|
bypass.current = false;
|
|
@@ -7120,12 +7277,12 @@ function useFormField(name, options = {}) {
|
|
|
7120
7277
|
const store = useFormStore();
|
|
7121
7278
|
const { kind = "value", rules } = options;
|
|
7122
7279
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
7123
|
-
|
|
7280
|
+
React16.useEffect(() => {
|
|
7124
7281
|
return () => {
|
|
7125
7282
|
if (rules !== void 0) store.removeRule(name);
|
|
7126
7283
|
};
|
|
7127
7284
|
}, [store, name]);
|
|
7128
|
-
const snap =
|
|
7285
|
+
const snap = React16.useSyncExternalStore(
|
|
7129
7286
|
store.subscribe,
|
|
7130
7287
|
() => store.getFieldSnapshot(name)
|
|
7131
7288
|
);
|
|
@@ -7137,7 +7294,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
7137
7294
|
}
|
|
7138
7295
|
function useFieldArray(name) {
|
|
7139
7296
|
const store = useFormStore();
|
|
7140
|
-
|
|
7297
|
+
React16.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7141
7298
|
const arr = store.getValue(name) ?? [];
|
|
7142
7299
|
const keys = store.getKeys(name);
|
|
7143
7300
|
return {
|
|
@@ -7260,7 +7417,7 @@ function CreditCardForm({
|
|
|
7260
7417
|
className = "",
|
|
7261
7418
|
style
|
|
7262
7419
|
}) {
|
|
7263
|
-
const initial =
|
|
7420
|
+
const initial = React16.useRef({
|
|
7264
7421
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
7265
7422
|
name: defaultValue?.name ?? "",
|
|
7266
7423
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -7269,7 +7426,7 @@ function CreditCardForm({
|
|
|
7269
7426
|
const form = useForm({ initialValues: initial });
|
|
7270
7427
|
const numberStr = String(form.values.number ?? "");
|
|
7271
7428
|
const brand = detectBrand(numberStr);
|
|
7272
|
-
|
|
7429
|
+
React16.useEffect(() => {
|
|
7273
7430
|
onChange?.(toCard(form.values));
|
|
7274
7431
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
7275
7432
|
const numberBind = form.fieldNative("number", {
|
|
@@ -7376,6 +7533,8 @@ exports.Box = Box;
|
|
|
7376
7533
|
exports.Breadcrumbs = Breadcrumbs;
|
|
7377
7534
|
exports.Button = Button;
|
|
7378
7535
|
exports.CARD_BRANDS = CARD_BRANDS;
|
|
7536
|
+
exports.Card = Card_default;
|
|
7537
|
+
exports.CardCarousel = CardCarousel;
|
|
7379
7538
|
exports.Catalog = Catalog;
|
|
7380
7539
|
exports.CatalogCarousel = CatalogCarousel;
|
|
7381
7540
|
exports.CatalogGrid = CatalogGrid;
|
|
@@ -7400,6 +7559,7 @@ exports.Grid = Grid2;
|
|
|
7400
7559
|
exports.GridCard = GridCard;
|
|
7401
7560
|
exports.Icon = icons_default;
|
|
7402
7561
|
exports.IconButton = IconButton;
|
|
7562
|
+
exports.Kbd = Kbd;
|
|
7403
7563
|
exports.List = List2;
|
|
7404
7564
|
exports.LoadingSpinner = LoadingSpinner;
|
|
7405
7565
|
exports.MegaMenu = MegaMenu_default;
|