@geomak/ui 6.6.0 → 6.8.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 +387 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +156 -1
- package/dist/index.d.ts +156 -1
- package/dist/index.js +200 -11
- package/dist/index.js.map +1 -1
- package/dist/styles.css +78 -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) {
|
|
@@ -1666,14 +1666,203 @@ 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(React16__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}`)) });
|
|
1673
1673
|
}
|
|
1674
1674
|
return /* @__PURE__ */ jsxRuntime.jsx("kbd", { className: [cap, SIZE3[size], className].filter(Boolean).join(" "), style, children });
|
|
1675
1675
|
}
|
|
1676
|
-
var
|
|
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 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 NotificationContext = React16.createContext({
|
|
1677
1866
|
open: () => void 0,
|
|
1678
1867
|
close: () => void 0
|
|
1679
1868
|
});
|
|
@@ -1731,26 +1920,26 @@ function NotificationItem({
|
|
|
1731
1920
|
onClose,
|
|
1732
1921
|
reduced
|
|
1733
1922
|
}) {
|
|
1734
|
-
const [paused, setPaused] =
|
|
1923
|
+
const [paused, setPaused] = React16.useState(false);
|
|
1735
1924
|
const duration = n.duration ?? 4e3;
|
|
1736
1925
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
1737
1926
|
const showProgress = !reduced && isAutoDismissing;
|
|
1738
|
-
const timerRef =
|
|
1739
|
-
const startTimeRef =
|
|
1740
|
-
const remainingRef =
|
|
1741
|
-
const clearTimer =
|
|
1927
|
+
const timerRef = React16.useRef(null);
|
|
1928
|
+
const startTimeRef = React16.useRef(0);
|
|
1929
|
+
const remainingRef = React16.useRef(duration);
|
|
1930
|
+
const clearTimer = React16.useCallback(() => {
|
|
1742
1931
|
if (timerRef.current !== null) {
|
|
1743
1932
|
clearTimeout(timerRef.current);
|
|
1744
1933
|
timerRef.current = null;
|
|
1745
1934
|
}
|
|
1746
1935
|
}, []);
|
|
1747
|
-
const scheduleDismiss =
|
|
1936
|
+
const scheduleDismiss = React16.useCallback((ms) => {
|
|
1748
1937
|
clearTimer();
|
|
1749
1938
|
if (!isAutoDismissing) return;
|
|
1750
1939
|
startTimeRef.current = Date.now();
|
|
1751
1940
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
1752
1941
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
1753
|
-
|
|
1942
|
+
React16.useEffect(() => {
|
|
1754
1943
|
if (paused || !isAutoDismissing) return;
|
|
1755
1944
|
scheduleDismiss(remainingRef.current);
|
|
1756
1945
|
return clearTimer;
|
|
@@ -1833,15 +2022,15 @@ function NotificationProvider({
|
|
|
1833
2022
|
children,
|
|
1834
2023
|
position = "top-right"
|
|
1835
2024
|
}) {
|
|
1836
|
-
const [notifications, setNotifications] =
|
|
2025
|
+
const [notifications, setNotifications] = React16.useState([]);
|
|
1837
2026
|
const reduced = framerMotion.useReducedMotion();
|
|
1838
|
-
const open =
|
|
2027
|
+
const open = React16.useCallback((payload) => {
|
|
1839
2028
|
setNotifications((prev) => [
|
|
1840
2029
|
...prev,
|
|
1841
2030
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
1842
2031
|
]);
|
|
1843
2032
|
}, []);
|
|
1844
|
-
const close =
|
|
2033
|
+
const close = React16.useCallback((id) => {
|
|
1845
2034
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
1846
2035
|
}, []);
|
|
1847
2036
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -1870,7 +2059,7 @@ function NotificationProvider({
|
|
|
1870
2059
|
] });
|
|
1871
2060
|
}
|
|
1872
2061
|
function useNotification() {
|
|
1873
|
-
const { open } =
|
|
2062
|
+
const { open } = React16.useContext(NotificationContext);
|
|
1874
2063
|
return {
|
|
1875
2064
|
info: (props) => open({ type: "info", ...props }),
|
|
1876
2065
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -1987,10 +2176,10 @@ function FadingBase({
|
|
|
1987
2176
|
isMounted = false,
|
|
1988
2177
|
children
|
|
1989
2178
|
}) {
|
|
1990
|
-
const [shouldRender, setShouldRender] =
|
|
1991
|
-
const [visible, setVisible] =
|
|
1992
|
-
const timerRef =
|
|
1993
|
-
|
|
2179
|
+
const [shouldRender, setShouldRender] = React16.useState(isMounted);
|
|
2180
|
+
const [visible, setVisible] = React16.useState(false);
|
|
2181
|
+
const timerRef = React16.useRef(null);
|
|
2182
|
+
React16.useEffect(() => {
|
|
1994
2183
|
if (isMounted) {
|
|
1995
2184
|
setShouldRender(true);
|
|
1996
2185
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -2088,8 +2277,8 @@ function ScalableContainer({
|
|
|
2088
2277
|
togglePosition = "top-right",
|
|
2089
2278
|
className = ""
|
|
2090
2279
|
}) {
|
|
2091
|
-
const containerRef =
|
|
2092
|
-
const [internalScaled, setInternalScaled] =
|
|
2280
|
+
const containerRef = React16.useRef(null);
|
|
2281
|
+
const [internalScaled, setInternalScaled] = React16.useState(false);
|
|
2093
2282
|
const isScaled = expanded ?? internalScaled;
|
|
2094
2283
|
const reduced = framerMotion.useReducedMotion();
|
|
2095
2284
|
const onToggle = () => {
|
|
@@ -2227,17 +2416,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
2227
2416
|
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)) });
|
|
2228
2417
|
}
|
|
2229
2418
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
2230
|
-
const [activeIndex, setActiveIndex] =
|
|
2231
|
-
const [indexPool, setIndexPool] =
|
|
2232
|
-
const cardRefs =
|
|
2233
|
-
const getIndexes =
|
|
2419
|
+
const [activeIndex, setActiveIndex] = React16.useState(0);
|
|
2420
|
+
const [indexPool, setIndexPool] = React16.useState([]);
|
|
2421
|
+
const cardRefs = React16.useRef([]);
|
|
2422
|
+
const getIndexes = React16.useMemo(() => {
|
|
2234
2423
|
let nextIndex = activeIndex + 1;
|
|
2235
2424
|
let previousIndex = activeIndex - 1;
|
|
2236
2425
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
2237
2426
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
2238
2427
|
return { previousIndex, nextIndex };
|
|
2239
2428
|
}, [activeIndex, items.length]);
|
|
2240
|
-
|
|
2429
|
+
React16.useEffect(() => {
|
|
2241
2430
|
const { nextIndex, previousIndex } = getIndexes;
|
|
2242
2431
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
2243
2432
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -2410,8 +2599,8 @@ function writeDismissed(key) {
|
|
|
2410
2599
|
}
|
|
2411
2600
|
}
|
|
2412
2601
|
function useTargetBbox(ref) {
|
|
2413
|
-
const [bbox, setBbox] =
|
|
2414
|
-
|
|
2602
|
+
const [bbox, setBbox] = React16.useState(null);
|
|
2603
|
+
React16.useLayoutEffect(() => {
|
|
2415
2604
|
const el = ref?.current;
|
|
2416
2605
|
if (!el) {
|
|
2417
2606
|
setBbox(null);
|
|
@@ -2441,7 +2630,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
2441
2630
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
2442
2631
|
}
|
|
2443
2632
|
function useFocusTrap(containerRef, active) {
|
|
2444
|
-
|
|
2633
|
+
React16.useEffect(() => {
|
|
2445
2634
|
if (!active) return;
|
|
2446
2635
|
const el = containerRef.current;
|
|
2447
2636
|
if (!el) return;
|
|
@@ -2480,16 +2669,16 @@ function Wizard({
|
|
|
2480
2669
|
onComplete,
|
|
2481
2670
|
onSkip
|
|
2482
2671
|
}) {
|
|
2483
|
-
const tooltipRef =
|
|
2484
|
-
const tooltipTitleId =
|
|
2485
|
-
const tooltipBodyId =
|
|
2672
|
+
const tooltipRef = React16.useRef(null);
|
|
2673
|
+
const tooltipTitleId = React16.useId();
|
|
2674
|
+
const tooltipBodyId = React16.useId();
|
|
2486
2675
|
const reduced = framerMotion.useReducedMotion();
|
|
2487
|
-
const [open, setOpen] =
|
|
2488
|
-
const [activeIndex, setActiveIndex] =
|
|
2676
|
+
const [open, setOpen] = React16.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
2677
|
+
const [activeIndex, setActiveIndex] = React16.useState(0);
|
|
2489
2678
|
const step = steps[activeIndex];
|
|
2490
2679
|
const bbox = useTargetBbox(step?.stepRef);
|
|
2491
2680
|
useFocusTrap(tooltipRef, open);
|
|
2492
|
-
|
|
2681
|
+
React16.useEffect(() => {
|
|
2493
2682
|
if (!open || !dismissible) return;
|
|
2494
2683
|
const onKey = (e) => {
|
|
2495
2684
|
if (e.key === "Escape") {
|
|
@@ -2500,12 +2689,12 @@ function Wizard({
|
|
|
2500
2689
|
document.addEventListener("keydown", onKey);
|
|
2501
2690
|
return () => document.removeEventListener("keydown", onKey);
|
|
2502
2691
|
}, [open, dismissible]);
|
|
2503
|
-
const handleSkip =
|
|
2692
|
+
const handleSkip = React16.useCallback(() => {
|
|
2504
2693
|
writeDismissed(storageKey);
|
|
2505
2694
|
setOpen(false);
|
|
2506
2695
|
onSkip?.();
|
|
2507
2696
|
}, [storageKey, onSkip]);
|
|
2508
|
-
const handleComplete =
|
|
2697
|
+
const handleComplete = React16.useCallback(() => {
|
|
2509
2698
|
writeDismissed(storageKey);
|
|
2510
2699
|
setOpen(false);
|
|
2511
2700
|
onComplete?.();
|
|
@@ -2776,7 +2965,7 @@ function Field({
|
|
|
2776
2965
|
);
|
|
2777
2966
|
}
|
|
2778
2967
|
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" }) });
|
|
2779
|
-
var SearchInput =
|
|
2968
|
+
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) {
|
|
2780
2969
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2781
2970
|
"div",
|
|
2782
2971
|
{
|
|
@@ -2830,11 +3019,11 @@ function MultiTagRow({
|
|
|
2830
3019
|
labelFor,
|
|
2831
3020
|
onRemove
|
|
2832
3021
|
}) {
|
|
2833
|
-
const wrapRef =
|
|
2834
|
-
const measureRef =
|
|
2835
|
-
const [visibleCount, setVisibleCount] =
|
|
3022
|
+
const wrapRef = React16.useRef(null);
|
|
3023
|
+
const measureRef = React16.useRef(null);
|
|
3024
|
+
const [visibleCount, setVisibleCount] = React16.useState(values.length);
|
|
2836
3025
|
const key = values.map(String).join("|");
|
|
2837
|
-
|
|
3026
|
+
React16.useLayoutEffect(() => {
|
|
2838
3027
|
const wrap = wrapRef.current;
|
|
2839
3028
|
const measure = measureRef.current;
|
|
2840
3029
|
if (!wrap || !measure) return;
|
|
@@ -2928,16 +3117,16 @@ function Dropdown({
|
|
|
2928
3117
|
size = "md",
|
|
2929
3118
|
className = ""
|
|
2930
3119
|
}) {
|
|
2931
|
-
const [open, setOpen] =
|
|
2932
|
-
const [selectedItems, setSelectedItems] =
|
|
2933
|
-
const [searchTerm, setSearchTerm] =
|
|
2934
|
-
const [innerItems, setInnerItems] =
|
|
2935
|
-
const errorId =
|
|
3120
|
+
const [open, setOpen] = React16.useState(false);
|
|
3121
|
+
const [selectedItems, setSelectedItems] = React16.useState([]);
|
|
3122
|
+
const [searchTerm, setSearchTerm] = React16.useState("");
|
|
3123
|
+
const [innerItems, setInnerItems] = React16.useState([]);
|
|
3124
|
+
const errorId = React16.useId();
|
|
2936
3125
|
const hasError = errorMessage != null;
|
|
2937
|
-
|
|
3126
|
+
React16.useEffect(() => {
|
|
2938
3127
|
setInnerItems(items);
|
|
2939
3128
|
}, [items]);
|
|
2940
|
-
|
|
3129
|
+
React16.useEffect(() => {
|
|
2941
3130
|
if (isMultiselect && Array.isArray(value)) {
|
|
2942
3131
|
setSelectedItems(value);
|
|
2943
3132
|
}
|
|
@@ -3262,7 +3451,7 @@ function TableBody({
|
|
|
3262
3451
|
expandRow,
|
|
3263
3452
|
getRowKey
|
|
3264
3453
|
}) {
|
|
3265
|
-
const [expanded, setExpanded] =
|
|
3454
|
+
const [expanded, setExpanded] = React16.useState(() => /* @__PURE__ */ new Set());
|
|
3266
3455
|
const reduced = framerMotion.useReducedMotion();
|
|
3267
3456
|
const toggleRow = (rowKey) => {
|
|
3268
3457
|
setExpanded((prev) => {
|
|
@@ -3277,7 +3466,7 @@ function TableBody({
|
|
|
3277
3466
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
3278
3467
|
const rowKey = getRowKey(row, i);
|
|
3279
3468
|
const isExpanded = expanded.has(rowKey);
|
|
3280
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3469
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React16__default.default.Fragment, { children: [
|
|
3281
3470
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3282
3471
|
"tr",
|
|
3283
3472
|
{
|
|
@@ -3333,9 +3522,9 @@ function Pagination({
|
|
|
3333
3522
|
const matchedOption = picker.find(
|
|
3334
3523
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
3335
3524
|
);
|
|
3336
|
-
const [perPageKey, setPerPageKey] =
|
|
3525
|
+
const [perPageKey, setPerPageKey] = React16.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
3337
3526
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
3338
|
-
|
|
3527
|
+
React16.useEffect(() => {
|
|
3339
3528
|
if (serverSide && options.perPage != null) {
|
|
3340
3529
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
3341
3530
|
if (next) setPerPageKey(next.key);
|
|
@@ -3399,14 +3588,14 @@ function Table({
|
|
|
3399
3588
|
className = "",
|
|
3400
3589
|
style
|
|
3401
3590
|
}) {
|
|
3402
|
-
const searchRef =
|
|
3403
|
-
const [searchTerm, setSearchTerm] =
|
|
3404
|
-
const [perPage, setPerPage] =
|
|
3591
|
+
const searchRef = React16.useRef(null);
|
|
3592
|
+
const [searchTerm, setSearchTerm] = React16.useState("");
|
|
3593
|
+
const [perPage, setPerPage] = React16.useState(
|
|
3405
3594
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
3406
3595
|
);
|
|
3407
|
-
const [activePage, setActivePage] =
|
|
3596
|
+
const [activePage, setActivePage] = React16.useState(0);
|
|
3408
3597
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
3409
|
-
const filteredRows =
|
|
3598
|
+
const filteredRows = React16.useMemo(() => {
|
|
3410
3599
|
if (isServerSide || !searchTerm) return rows;
|
|
3411
3600
|
const term = searchTerm.toLowerCase();
|
|
3412
3601
|
return rows.filter(
|
|
@@ -3415,29 +3604,29 @@ function Table({
|
|
|
3415
3604
|
)
|
|
3416
3605
|
);
|
|
3417
3606
|
}, [rows, searchTerm, isServerSide]);
|
|
3418
|
-
const datasets =
|
|
3607
|
+
const datasets = React16.useMemo(() => {
|
|
3419
3608
|
if (isServerSide) return [rows];
|
|
3420
3609
|
return createDatasets(filteredRows, pagination.enabled ? perPage : null);
|
|
3421
3610
|
}, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
3422
|
-
const MAX_PAGE =
|
|
3611
|
+
const MAX_PAGE = React16.useMemo(() => {
|
|
3423
3612
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
3424
3613
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
3425
3614
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
3426
3615
|
return datasets.length ? datasets.length - 1 : 0;
|
|
3427
3616
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
3428
|
-
const currentPageRows =
|
|
3617
|
+
const currentPageRows = React16.useMemo(() => {
|
|
3429
3618
|
if (isServerSide) return rows;
|
|
3430
3619
|
return datasets[activePage] ?? [];
|
|
3431
3620
|
}, [isServerSide, rows, datasets, activePage]);
|
|
3432
|
-
|
|
3621
|
+
React16.useEffect(() => {
|
|
3433
3622
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
3434
3623
|
setPerPage(pagination.perPage);
|
|
3435
3624
|
}
|
|
3436
3625
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
3437
|
-
|
|
3626
|
+
React16.useEffect(() => {
|
|
3438
3627
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
3439
3628
|
}, [isServerSide, pagination.perPage]);
|
|
3440
|
-
|
|
3629
|
+
React16.useEffect(() => {
|
|
3441
3630
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
3442
3631
|
setActivePage(pagination.page - 1);
|
|
3443
3632
|
}, [isServerSide, pagination.page]);
|
|
@@ -3521,7 +3710,7 @@ function TableSkeletonBody({
|
|
|
3521
3710
|
)) });
|
|
3522
3711
|
}
|
|
3523
3712
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
3524
|
-
const id =
|
|
3713
|
+
const id = React16.useId();
|
|
3525
3714
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3526
3715
|
SwitchPrimitive__namespace.Root,
|
|
3527
3716
|
{
|
|
@@ -3705,7 +3894,7 @@ function Sidebar({
|
|
|
3705
3894
|
}
|
|
3706
3895
|
) });
|
|
3707
3896
|
}
|
|
3708
|
-
var MegaMenuContext =
|
|
3897
|
+
var MegaMenuContext = React16.createContext({ align: "start" });
|
|
3709
3898
|
function MegaMenu({
|
|
3710
3899
|
children,
|
|
3711
3900
|
align = "start",
|
|
@@ -3736,7 +3925,7 @@ function MegaMenu({
|
|
|
3736
3925
|
}
|
|
3737
3926
|
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";
|
|
3738
3927
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
3739
|
-
const { align } =
|
|
3928
|
+
const { align } = React16.useContext(MegaMenuContext);
|
|
3740
3929
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
3741
3930
|
if (!children) {
|
|
3742
3931
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
|
|
@@ -3821,8 +4010,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
3821
4010
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
3822
4011
|
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 });
|
|
3823
4012
|
}
|
|
3824
|
-
var elementsOfType = (children, type) =>
|
|
3825
|
-
(c) =>
|
|
4013
|
+
var elementsOfType = (children, type) => React16__default.default.Children.toArray(children).filter(
|
|
4014
|
+
(c) => React16__default.default.isValidElement(c) && c.type === type
|
|
3826
4015
|
);
|
|
3827
4016
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3828
4017
|
"svg",
|
|
@@ -3859,9 +4048,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
3859
4048
|
);
|
|
3860
4049
|
}
|
|
3861
4050
|
function MobilePanel({ panel, onNavigate }) {
|
|
3862
|
-
const nodes =
|
|
4051
|
+
const nodes = React16__default.default.Children.toArray(panel.props.children);
|
|
3863
4052
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
3864
|
-
if (!
|
|
4053
|
+
if (!React16__default.default.isValidElement(node)) return null;
|
|
3865
4054
|
const el = node;
|
|
3866
4055
|
if (el.type === MegaMenuSection) {
|
|
3867
4056
|
const { title, children } = el.props;
|
|
@@ -3880,8 +4069,8 @@ function MegaMenuMobile({
|
|
|
3880
4069
|
children,
|
|
3881
4070
|
label
|
|
3882
4071
|
}) {
|
|
3883
|
-
const [open, setOpen] =
|
|
3884
|
-
const [expanded, setExpanded] =
|
|
4072
|
+
const [open, setOpen] = React16.useState(false);
|
|
4073
|
+
const [expanded, setExpanded] = React16.useState(null);
|
|
3885
4074
|
const items = elementsOfType(children, MegaMenuItem);
|
|
3886
4075
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
3887
4076
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3954,17 +4143,17 @@ function AppShell({
|
|
|
3954
4143
|
children,
|
|
3955
4144
|
className = ""
|
|
3956
4145
|
}) {
|
|
3957
|
-
const [expanded, setExpanded] =
|
|
3958
|
-
const [isMobile, setIsMobile] =
|
|
3959
|
-
const [mobileOpen, setMobileOpen] =
|
|
3960
|
-
|
|
4146
|
+
const [expanded, setExpanded] = React16.useState(sidebarDefaultExpanded);
|
|
4147
|
+
const [isMobile, setIsMobile] = React16.useState(false);
|
|
4148
|
+
const [mobileOpen, setMobileOpen] = React16.useState(false);
|
|
4149
|
+
React16.useEffect(() => {
|
|
3961
4150
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
3962
4151
|
const update = (e) => setIsMobile(e.matches);
|
|
3963
4152
|
update(mq);
|
|
3964
4153
|
mq.addEventListener("change", update);
|
|
3965
4154
|
return () => mq.removeEventListener("change", update);
|
|
3966
4155
|
}, []);
|
|
3967
|
-
|
|
4156
|
+
React16.useEffect(() => {
|
|
3968
4157
|
if (!isMobile) setMobileOpen(false);
|
|
3969
4158
|
}, [isMobile]);
|
|
3970
4159
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -4154,10 +4343,10 @@ function ThemeProvider({
|
|
|
4154
4343
|
className = "",
|
|
4155
4344
|
style
|
|
4156
4345
|
}) {
|
|
4157
|
-
const id =
|
|
4346
|
+
const id = React16__default.default.useId().replace(/:/g, "");
|
|
4158
4347
|
const scopeClass = `geo-th-${id}`;
|
|
4159
|
-
const divRef =
|
|
4160
|
-
|
|
4348
|
+
const divRef = React16.useRef(null);
|
|
4349
|
+
React16.useEffect(() => {
|
|
4161
4350
|
const el = divRef.current;
|
|
4162
4351
|
if (!el) return;
|
|
4163
4352
|
if (colorScheme === "auto") return;
|
|
@@ -4172,8 +4361,8 @@ function ThemeProvider({
|
|
|
4172
4361
|
}
|
|
4173
4362
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
4174
4363
|
}, [colorScheme]);
|
|
4175
|
-
const lightVars =
|
|
4176
|
-
const darkVarStr =
|
|
4364
|
+
const lightVars = React16.useMemo(() => toCssVars(theme), [theme]);
|
|
4365
|
+
const darkVarStr = React16.useMemo(() => {
|
|
4177
4366
|
if (!darkTheme) return "";
|
|
4178
4367
|
const dvars = toCssVars(darkTheme);
|
|
4179
4368
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -4213,7 +4402,7 @@ function TextInput({
|
|
|
4213
4402
|
prefix,
|
|
4214
4403
|
suffix
|
|
4215
4404
|
}) {
|
|
4216
|
-
const errorId =
|
|
4405
|
+
const errorId = React16.useId();
|
|
4217
4406
|
const hasError = errorMessage != null;
|
|
4218
4407
|
const hasAdornment = prefix != null || suffix != null;
|
|
4219
4408
|
const input = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4283,7 +4472,7 @@ function NumberInput({
|
|
|
4283
4472
|
readOnly = false,
|
|
4284
4473
|
precision
|
|
4285
4474
|
}) {
|
|
4286
|
-
const errorId =
|
|
4475
|
+
const errorId = React16.useId();
|
|
4287
4476
|
const hasError = errorMessage != null;
|
|
4288
4477
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
4289
4478
|
const round = (n) => {
|
|
@@ -4414,8 +4603,8 @@ function Password({
|
|
|
4414
4603
|
showIcon,
|
|
4415
4604
|
hideIcon
|
|
4416
4605
|
}) {
|
|
4417
|
-
const [visible, setVisible] =
|
|
4418
|
-
const errorId =
|
|
4606
|
+
const [visible, setVisible] = React16.useState(false);
|
|
4607
|
+
const errorId = React16.useId();
|
|
4419
4608
|
const hasError = errorMessage != null;
|
|
4420
4609
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4421
4610
|
Field,
|
|
@@ -4488,7 +4677,7 @@ function Checkbox({
|
|
|
4488
4677
|
}) {
|
|
4489
4678
|
const isChecked = checked ?? value ?? false;
|
|
4490
4679
|
const labelFirst = labelPosition === "left";
|
|
4491
|
-
const errorId =
|
|
4680
|
+
const errorId = React16.useId();
|
|
4492
4681
|
const hasError = errorMessage != null;
|
|
4493
4682
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4494
4683
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -4596,8 +4785,8 @@ function RadioGroup({
|
|
|
4596
4785
|
className,
|
|
4597
4786
|
errorMessage
|
|
4598
4787
|
}) {
|
|
4599
|
-
const errorId =
|
|
4600
|
-
const groupId =
|
|
4788
|
+
const errorId = React16.useId();
|
|
4789
|
+
const groupId = React16.useId();
|
|
4601
4790
|
const hasError = errorMessage != null;
|
|
4602
4791
|
const labelFirst = labelPosition === "left";
|
|
4603
4792
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4697,11 +4886,11 @@ function Switch({
|
|
|
4697
4886
|
disabled,
|
|
4698
4887
|
errorMessage
|
|
4699
4888
|
}) {
|
|
4700
|
-
const id =
|
|
4701
|
-
const errorId =
|
|
4889
|
+
const id = React16.useId();
|
|
4890
|
+
const errorId = React16.useId();
|
|
4702
4891
|
const hasError = errorMessage != null;
|
|
4703
4892
|
const isControlled = checked !== void 0;
|
|
4704
|
-
const [internal, setInternal] =
|
|
4893
|
+
const [internal, setInternal] = React16.useState(defaultChecked);
|
|
4705
4894
|
const isOn = isControlled ? checked : internal;
|
|
4706
4895
|
const handle = (c) => {
|
|
4707
4896
|
if (!isControlled) setInternal(c);
|
|
@@ -4774,19 +4963,19 @@ function AutoComplete({
|
|
|
4774
4963
|
required,
|
|
4775
4964
|
htmlFor
|
|
4776
4965
|
}) {
|
|
4777
|
-
const errorId =
|
|
4966
|
+
const errorId = React16.useId();
|
|
4778
4967
|
const hasError = errorMessage != null;
|
|
4779
|
-
const [term, setTerm] =
|
|
4780
|
-
const [open, setOpen] =
|
|
4781
|
-
const [asyncItems, setAsyncItems] =
|
|
4782
|
-
const [loading, setLoading] =
|
|
4968
|
+
const [term, setTerm] = React16.useState("");
|
|
4969
|
+
const [open, setOpen] = React16.useState(false);
|
|
4970
|
+
const [asyncItems, setAsyncItems] = React16.useState([]);
|
|
4971
|
+
const [loading, setLoading] = React16.useState(false);
|
|
4783
4972
|
const isAsync = typeof onSearch === "function";
|
|
4784
|
-
const debounceRef =
|
|
4785
|
-
const requestIdRef =
|
|
4973
|
+
const debounceRef = React16.useRef(null);
|
|
4974
|
+
const requestIdRef = React16.useRef(0);
|
|
4786
4975
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
4787
4976
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
4788
4977
|
) : [];
|
|
4789
|
-
|
|
4978
|
+
React16.useEffect(() => {
|
|
4790
4979
|
if (!isAsync) return;
|
|
4791
4980
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
4792
4981
|
if (!term.trim()) {
|
|
@@ -4942,15 +5131,15 @@ function TreeSelect({
|
|
|
4942
5131
|
defaultExpandedKeys = [],
|
|
4943
5132
|
size = "md"
|
|
4944
5133
|
}) {
|
|
4945
|
-
const errorId =
|
|
5134
|
+
const errorId = React16.useId();
|
|
4946
5135
|
const hasError = errorMessage != null;
|
|
4947
|
-
const [open, setOpen] =
|
|
4948
|
-
const [expanded, setExpanded] =
|
|
4949
|
-
const [activeIndex, setActiveIndex] =
|
|
4950
|
-
const listRef =
|
|
4951
|
-
const visible =
|
|
4952
|
-
const didSyncOnOpenRef =
|
|
4953
|
-
|
|
5136
|
+
const [open, setOpen] = React16.useState(false);
|
|
5137
|
+
const [expanded, setExpanded] = React16.useState(() => new Set(defaultExpandedKeys));
|
|
5138
|
+
const [activeIndex, setActiveIndex] = React16.useState(0);
|
|
5139
|
+
const listRef = React16.useRef(null);
|
|
5140
|
+
const visible = React16.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
5141
|
+
const didSyncOnOpenRef = React16.useRef(false);
|
|
5142
|
+
React16.useEffect(() => {
|
|
4954
5143
|
if (!open) {
|
|
4955
5144
|
didSyncOnOpenRef.current = false;
|
|
4956
5145
|
return;
|
|
@@ -4960,7 +5149,7 @@ function TreeSelect({
|
|
|
4960
5149
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
4961
5150
|
didSyncOnOpenRef.current = true;
|
|
4962
5151
|
}, [open, value]);
|
|
4963
|
-
const selectedNode =
|
|
5152
|
+
const selectedNode = React16.useMemo(
|
|
4964
5153
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
4965
5154
|
[items, value]
|
|
4966
5155
|
);
|
|
@@ -5191,11 +5380,11 @@ function FileInput({
|
|
|
5191
5380
|
required,
|
|
5192
5381
|
icon
|
|
5193
5382
|
}) {
|
|
5194
|
-
const inputRef =
|
|
5195
|
-
const errorId =
|
|
5196
|
-
const [files, setFiles] =
|
|
5197
|
-
const [dragging, setDragging] =
|
|
5198
|
-
const [sizeError, setSizeError] =
|
|
5383
|
+
const inputRef = React16.useRef(null);
|
|
5384
|
+
const errorId = React16.useId();
|
|
5385
|
+
const [files, setFiles] = React16.useState([]);
|
|
5386
|
+
const [dragging, setDragging] = React16.useState(false);
|
|
5387
|
+
const [sizeError, setSizeError] = React16.useState(null);
|
|
5199
5388
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
5200
5389
|
const openPicker = () => {
|
|
5201
5390
|
if (!disabled) inputRef.current?.click();
|
|
@@ -5386,30 +5575,30 @@ function DatePicker({
|
|
|
5386
5575
|
size = "md",
|
|
5387
5576
|
className = ""
|
|
5388
5577
|
}) {
|
|
5389
|
-
const errorId =
|
|
5578
|
+
const errorId = React16.useId();
|
|
5390
5579
|
const hasError = errorMessage != null;
|
|
5391
|
-
const [open, setOpen] =
|
|
5392
|
-
const [viewMonth, setViewMonth] =
|
|
5393
|
-
const [focusDate, setFocusDate] =
|
|
5394
|
-
const [view, setView] =
|
|
5395
|
-
const gridRef =
|
|
5396
|
-
|
|
5580
|
+
const [open, setOpen] = React16.useState(false);
|
|
5581
|
+
const [viewMonth, setViewMonth] = React16.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
5582
|
+
const [focusDate, setFocusDate] = React16.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
5583
|
+
const [view, setView] = React16.useState("days");
|
|
5584
|
+
const gridRef = React16.useRef(null);
|
|
5585
|
+
React16.useEffect(() => {
|
|
5397
5586
|
if (!open) return;
|
|
5398
5587
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
5399
5588
|
setViewMonth(startOfMonth(target));
|
|
5400
5589
|
setFocusDate(target);
|
|
5401
5590
|
setView("days");
|
|
5402
5591
|
}, [open, value]);
|
|
5403
|
-
|
|
5592
|
+
React16.useEffect(() => {
|
|
5404
5593
|
if (!open) return;
|
|
5405
5594
|
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat(focusDate)}"]`);
|
|
5406
5595
|
cell?.focus();
|
|
5407
5596
|
}, [open, focusDate]);
|
|
5408
|
-
const weekdays =
|
|
5597
|
+
const weekdays = React16.useMemo(() => {
|
|
5409
5598
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5410
5599
|
return ordered;
|
|
5411
5600
|
}, [weekStartsOn]);
|
|
5412
|
-
const grid =
|
|
5601
|
+
const grid = React16.useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5413
5602
|
const isDisabled = (d) => {
|
|
5414
5603
|
if (min && d < min) return true;
|
|
5415
5604
|
if (max && d > max) return true;
|
|
@@ -5699,10 +5888,10 @@ function TextArea({
|
|
|
5699
5888
|
style,
|
|
5700
5889
|
inputStyle
|
|
5701
5890
|
}) {
|
|
5702
|
-
const errorId =
|
|
5891
|
+
const errorId = React16.useId();
|
|
5703
5892
|
const hasError = errorMessage != null;
|
|
5704
|
-
const ref =
|
|
5705
|
-
|
|
5893
|
+
const ref = React16.useRef(null);
|
|
5894
|
+
React16.useLayoutEffect(() => {
|
|
5706
5895
|
if (!autoGrow) return;
|
|
5707
5896
|
const el = ref.current;
|
|
5708
5897
|
if (!el) return;
|
|
@@ -5772,11 +5961,11 @@ function SegmentedControl({
|
|
|
5772
5961
|
"aria-label": ariaLabel
|
|
5773
5962
|
}) {
|
|
5774
5963
|
const sz = SIZE4[size];
|
|
5775
|
-
const groupId =
|
|
5776
|
-
const errorId =
|
|
5964
|
+
const groupId = React16.useId();
|
|
5965
|
+
const errorId = React16.useId();
|
|
5777
5966
|
const hasError = errorMessage != null;
|
|
5778
5967
|
const isControlled = value !== void 0;
|
|
5779
|
-
const [internal, setInternal] =
|
|
5968
|
+
const [internal, setInternal] = React16.useState(defaultValue);
|
|
5780
5969
|
const current = isControlled ? value : internal;
|
|
5781
5970
|
const handle = (v) => {
|
|
5782
5971
|
if (!v) return;
|
|
@@ -5870,14 +6059,14 @@ function Slider({
|
|
|
5870
6059
|
name,
|
|
5871
6060
|
htmlFor
|
|
5872
6061
|
}) {
|
|
5873
|
-
const errorId =
|
|
6062
|
+
const errorId = React16.useId();
|
|
5874
6063
|
const hasError = errorMessage != null;
|
|
5875
6064
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
5876
|
-
const [internal, setInternal] =
|
|
6065
|
+
const [internal, setInternal] = React16.useState(
|
|
5877
6066
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
5878
6067
|
);
|
|
5879
6068
|
const current = toArray(value) ?? internal;
|
|
5880
|
-
const [dragging, setDragging] =
|
|
6069
|
+
const [dragging, setDragging] = React16.useState(false);
|
|
5881
6070
|
const emit = (arr) => {
|
|
5882
6071
|
setInternal(arr);
|
|
5883
6072
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -5972,11 +6161,11 @@ function TagsInput({
|
|
|
5972
6161
|
validate,
|
|
5973
6162
|
separators = ["Enter", ","]
|
|
5974
6163
|
}) {
|
|
5975
|
-
const errorId =
|
|
5976
|
-
const inputRef =
|
|
5977
|
-
const [internal, setInternal] =
|
|
5978
|
-
const [draft, setDraft] =
|
|
5979
|
-
const [localError, setLocalError] =
|
|
6164
|
+
const errorId = React16.useId();
|
|
6165
|
+
const inputRef = React16.useRef(null);
|
|
6166
|
+
const [internal, setInternal] = React16.useState(defaultValue ?? []);
|
|
6167
|
+
const [draft, setDraft] = React16.useState("");
|
|
6168
|
+
const [localError, setLocalError] = React16.useState(null);
|
|
5980
6169
|
const tags = value ?? internal;
|
|
5981
6170
|
const hasError = errorMessage != null || localError != null;
|
|
5982
6171
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -6107,9 +6296,9 @@ function OtpInput({
|
|
|
6107
6296
|
className,
|
|
6108
6297
|
groupAfter
|
|
6109
6298
|
}) {
|
|
6110
|
-
const errorId =
|
|
6299
|
+
const errorId = React16.useId();
|
|
6111
6300
|
const hasError = errorMessage != null;
|
|
6112
|
-
const refs =
|
|
6301
|
+
const refs = React16.useRef([]);
|
|
6113
6302
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
6114
6303
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
6115
6304
|
const emit = (next) => {
|
|
@@ -6158,7 +6347,7 @@ function OtpInput({
|
|
|
6158
6347
|
emit(valid.join(""));
|
|
6159
6348
|
focusBox(valid.length);
|
|
6160
6349
|
};
|
|
6161
|
-
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(
|
|
6350
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React16__default.default.Fragment, { children: [
|
|
6162
6351
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6163
6352
|
"input",
|
|
6164
6353
|
{
|
|
@@ -6216,9 +6405,9 @@ function Rating({
|
|
|
6216
6405
|
className,
|
|
6217
6406
|
required
|
|
6218
6407
|
}) {
|
|
6219
|
-
const errorId =
|
|
6220
|
-
const [internal, setInternal] =
|
|
6221
|
-
const [hover, setHover] =
|
|
6408
|
+
const errorId = React16.useId();
|
|
6409
|
+
const [internal, setInternal] = React16.useState(defaultValue);
|
|
6410
|
+
const [hover, setHover] = React16.useState(null);
|
|
6222
6411
|
const current = value ?? internal;
|
|
6223
6412
|
const display2 = hover ?? current;
|
|
6224
6413
|
const interactive = !readOnly && !disabled;
|
|
@@ -6341,9 +6530,9 @@ function TimePicker({
|
|
|
6341
6530
|
required,
|
|
6342
6531
|
style
|
|
6343
6532
|
}) {
|
|
6344
|
-
const errorId =
|
|
6533
|
+
const errorId = React16.useId();
|
|
6345
6534
|
const hasError = errorMessage != null;
|
|
6346
|
-
const [open, setOpen] =
|
|
6535
|
+
const [open, setOpen] = React16.useState(false);
|
|
6347
6536
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
6348
6537
|
const update = (next) => {
|
|
6349
6538
|
const merged = { ...parsed, ...next };
|
|
@@ -6467,13 +6656,13 @@ function DateRangePicker({
|
|
|
6467
6656
|
required,
|
|
6468
6657
|
style
|
|
6469
6658
|
}) {
|
|
6470
|
-
const errorId =
|
|
6659
|
+
const errorId = React16.useId();
|
|
6471
6660
|
const hasError = errorMessage != null;
|
|
6472
|
-
const [open, setOpen] =
|
|
6473
|
-
const [leftMonth, setLeftMonth] =
|
|
6474
|
-
const [pendingStart, setPendingStart] =
|
|
6475
|
-
const [hoverDate, setHoverDate] =
|
|
6476
|
-
const weekdays =
|
|
6661
|
+
const [open, setOpen] = React16.useState(false);
|
|
6662
|
+
const [leftMonth, setLeftMonth] = React16.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
6663
|
+
const [pendingStart, setPendingStart] = React16.useState(null);
|
|
6664
|
+
const [hoverDate, setHoverDate] = React16.useState(null);
|
|
6665
|
+
const weekdays = React16.useMemo(
|
|
6477
6666
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6478
6667
|
[weekStartsOn]
|
|
6479
6668
|
);
|
|
@@ -6649,10 +6838,10 @@ function ColorPicker({
|
|
|
6649
6838
|
required,
|
|
6650
6839
|
placeholder = "Pick a colour\u2026"
|
|
6651
6840
|
}) {
|
|
6652
|
-
const errorId =
|
|
6841
|
+
const errorId = React16.useId();
|
|
6653
6842
|
const hasError = errorMessage != null;
|
|
6654
|
-
const [open, setOpen] =
|
|
6655
|
-
const [draft, setDraft] =
|
|
6843
|
+
const [open, setOpen] = React16.useState(false);
|
|
6844
|
+
const [draft, setDraft] = React16.useState(value);
|
|
6656
6845
|
const valid = HEX_RE.test(value);
|
|
6657
6846
|
const pick = (hex) => {
|
|
6658
6847
|
onChange?.(hex);
|
|
@@ -7039,11 +7228,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
7039
7228
|
|
|
7040
7229
|
// src/form/useForm.ts
|
|
7041
7230
|
function useForm(options = {}) {
|
|
7042
|
-
const ref =
|
|
7231
|
+
const ref = React16.useRef(null);
|
|
7043
7232
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
7044
7233
|
const store = ref.current;
|
|
7045
|
-
|
|
7046
|
-
const make =
|
|
7234
|
+
React16.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7235
|
+
const make = React16.useCallback(
|
|
7047
7236
|
(kind) => (name, rules) => {
|
|
7048
7237
|
if (rules !== void 0) store.setRule(name, rules);
|
|
7049
7238
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -7072,9 +7261,9 @@ function useForm(options = {}) {
|
|
|
7072
7261
|
fieldTarget: make("target")
|
|
7073
7262
|
};
|
|
7074
7263
|
}
|
|
7075
|
-
var FormContext =
|
|
7264
|
+
var FormContext = React16.createContext(null);
|
|
7076
7265
|
function useFormStore() {
|
|
7077
|
-
const store =
|
|
7266
|
+
const store = React16.useContext(FormContext);
|
|
7078
7267
|
if (!store) {
|
|
7079
7268
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
7080
7269
|
}
|
|
@@ -7088,8 +7277,8 @@ function Form({
|
|
|
7088
7277
|
children,
|
|
7089
7278
|
...rest
|
|
7090
7279
|
}) {
|
|
7091
|
-
const ref =
|
|
7092
|
-
const bypass =
|
|
7280
|
+
const ref = React16.useRef(null);
|
|
7281
|
+
const bypass = React16.useRef(false);
|
|
7093
7282
|
const handleSubmit = async (e) => {
|
|
7094
7283
|
if (bypass.current) {
|
|
7095
7284
|
bypass.current = false;
|
|
@@ -7141,12 +7330,12 @@ function useFormField(name, options = {}) {
|
|
|
7141
7330
|
const store = useFormStore();
|
|
7142
7331
|
const { kind = "value", rules } = options;
|
|
7143
7332
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
7144
|
-
|
|
7333
|
+
React16.useEffect(() => {
|
|
7145
7334
|
return () => {
|
|
7146
7335
|
if (rules !== void 0) store.removeRule(name);
|
|
7147
7336
|
};
|
|
7148
7337
|
}, [store, name]);
|
|
7149
|
-
const snap =
|
|
7338
|
+
const snap = React16.useSyncExternalStore(
|
|
7150
7339
|
store.subscribe,
|
|
7151
7340
|
() => store.getFieldSnapshot(name)
|
|
7152
7341
|
);
|
|
@@ -7158,7 +7347,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
7158
7347
|
}
|
|
7159
7348
|
function useFieldArray(name) {
|
|
7160
7349
|
const store = useFormStore();
|
|
7161
|
-
|
|
7350
|
+
React16.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7162
7351
|
const arr = store.getValue(name) ?? [];
|
|
7163
7352
|
const keys = store.getKeys(name);
|
|
7164
7353
|
return {
|
|
@@ -7281,7 +7470,7 @@ function CreditCardForm({
|
|
|
7281
7470
|
className = "",
|
|
7282
7471
|
style
|
|
7283
7472
|
}) {
|
|
7284
|
-
const initial =
|
|
7473
|
+
const initial = React16.useRef({
|
|
7285
7474
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
7286
7475
|
name: defaultValue?.name ?? "",
|
|
7287
7476
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -7290,7 +7479,7 @@ function CreditCardForm({
|
|
|
7290
7479
|
const form = useForm({ initialValues: initial });
|
|
7291
7480
|
const numberStr = String(form.values.number ?? "");
|
|
7292
7481
|
const brand = detectBrand(numberStr);
|
|
7293
|
-
|
|
7482
|
+
React16.useEffect(() => {
|
|
7294
7483
|
onChange?.(toCard(form.values));
|
|
7295
7484
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
7296
7485
|
const numberBind = form.fieldNative("number", {
|
|
@@ -7397,6 +7586,8 @@ exports.Box = Box;
|
|
|
7397
7586
|
exports.Breadcrumbs = Breadcrumbs;
|
|
7398
7587
|
exports.Button = Button;
|
|
7399
7588
|
exports.CARD_BRANDS = CARD_BRANDS;
|
|
7589
|
+
exports.Card = Card_default;
|
|
7590
|
+
exports.CardCarousel = CardCarousel;
|
|
7400
7591
|
exports.Catalog = Catalog;
|
|
7401
7592
|
exports.CatalogCarousel = CatalogCarousel;
|
|
7402
7593
|
exports.CatalogGrid = CatalogGrid;
|
|
@@ -7443,6 +7634,7 @@ exports.SkeletonCard = SkeletonCard;
|
|
|
7443
7634
|
exports.SkeletonCircle = SkeletonCircle;
|
|
7444
7635
|
exports.SkeletonText = SkeletonText;
|
|
7445
7636
|
exports.Slider = Slider;
|
|
7637
|
+
exports.Statistic = Statistic;
|
|
7446
7638
|
exports.Switch = Switch;
|
|
7447
7639
|
exports.Table = Table;
|
|
7448
7640
|
exports.Tabs = Tabs_default;
|