@geomak/ui 6.10.0 → 6.12.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 +424 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -1
- package/dist/index.d.ts +106 -1
- package/dist/index.js +230 -36
- package/dist/index.js.map +1 -1
- package/dist/styles.css +14 -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 React19 = 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 React19__default = /*#__PURE__*/_interopDefault(React19);
|
|
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] = React19.useState(null);
|
|
218
|
+
React19.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 = React19.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 = React19.createContext(null);
|
|
964
964
|
function useTabsContext() {
|
|
965
|
-
const ctx =
|
|
965
|
+
const ctx = React19.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] = React19.useState(defaultValue);
|
|
988
988
|
const current = isControlled ? value : internal;
|
|
989
989
|
const reduced = !!framerMotion.useReducedMotion();
|
|
990
|
-
const indicatorId =
|
|
991
|
-
const select =
|
|
990
|
+
const indicatorId = React19.useId();
|
|
991
|
+
const select = React19.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 = React19.useRef(/* @__PURE__ */ new Map());
|
|
996
|
+
const orderRef = React19.useRef(0);
|
|
997
|
+
const [, bump] = React19.useState(0);
|
|
998
|
+
const registerTab = React19.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 = React19.useCallback((val) => {
|
|
1004
1004
|
if (registry.current.delete(val)) bump((v) => v + 1);
|
|
1005
1005
|
}, []);
|
|
1006
|
-
const getTabs =
|
|
1006
|
+
const getTabs = React19.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 = React19.useRef(null);
|
|
1027
|
+
const [edges, setEdges] = React19.useState({ start: false, end: false });
|
|
1028
1028
|
const scrollable = variant !== "segmented";
|
|
1029
|
-
|
|
1029
|
+
React19.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 = React19.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
|
+
React19.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] = React19.useState(false);
|
|
1119
|
+
const wrapRef = React19.useRef(null);
|
|
1120
|
+
const timer = React19.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
|
+
React19.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
|
+
React19.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 = React19.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 } = React19.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] = React19.useState(false);
|
|
1526
1526
|
const shouldCollapse = maxItems > 0 && items.length > maxItems && !expanded;
|
|
1527
1527
|
const visible = [];
|
|
1528
1528
|
if (shouldCollapse) {
|
|
@@ -1666,7 +1666,7 @@ function Kbd({
|
|
|
1666
1666
|
style
|
|
1667
1667
|
}) {
|
|
1668
1668
|
if (keys && keys.length > 0) {
|
|
1669
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1669
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxRuntime.jsxs(React19__default.default.Fragment, { children: [
|
|
1670
1670
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-xs select-none", children: separator }),
|
|
1671
1671
|
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: [cap, SIZE3[size]].join(" "), children: k })
|
|
1672
1672
|
] }, `${k}-${i}`)) });
|
|
@@ -1739,13 +1739,13 @@ function CardCarousel({
|
|
|
1739
1739
|
className = "",
|
|
1740
1740
|
style
|
|
1741
1741
|
}) {
|
|
1742
|
-
const scrollerRef =
|
|
1743
|
-
const slides =
|
|
1744
|
-
const [active, setActive] =
|
|
1745
|
-
const [atStart, setAtStart] =
|
|
1746
|
-
const [atEnd, setAtEnd] =
|
|
1742
|
+
const scrollerRef = React19.useRef(null);
|
|
1743
|
+
const slides = React19__default.default.Children.toArray(children);
|
|
1744
|
+
const [active, setActive] = React19.useState(0);
|
|
1745
|
+
const [atStart, setAtStart] = React19.useState(true);
|
|
1746
|
+
const [atEnd, setAtEnd] = React19.useState(false);
|
|
1747
1747
|
const width = typeof itemWidth === "number" ? `${itemWidth}px` : itemWidth;
|
|
1748
|
-
const update =
|
|
1748
|
+
const update = React19.useCallback(() => {
|
|
1749
1749
|
const el = scrollerRef.current;
|
|
1750
1750
|
if (!el) return;
|
|
1751
1751
|
el.clientWidth;
|
|
@@ -1755,7 +1755,7 @@ function CardCarousel({
|
|
|
1755
1755
|
const slideW = first ? first.getBoundingClientRect().width + gap : el.clientWidth;
|
|
1756
1756
|
setActive(Math.round(el.scrollLeft / slideW));
|
|
1757
1757
|
}, [gap]);
|
|
1758
|
-
|
|
1758
|
+
React19.useEffect(() => {
|
|
1759
1759
|
update();
|
|
1760
1760
|
const el = scrollerRef.current;
|
|
1761
1761
|
if (!el) return;
|
|
@@ -1888,7 +1888,7 @@ function FAB({
|
|
|
1888
1888
|
className = "",
|
|
1889
1889
|
style
|
|
1890
1890
|
}) {
|
|
1891
|
-
const [open, setOpen] =
|
|
1891
|
+
const [open, setOpen] = React19.useState(false);
|
|
1892
1892
|
const reduced = framerMotion.useReducedMotion();
|
|
1893
1893
|
const hasDial = !!actions && actions.length > 0;
|
|
1894
1894
|
const bottom = position.startsWith("bottom");
|
|
@@ -1974,8 +1974,8 @@ function PopConfirm({
|
|
|
1974
1974
|
onOpenChange,
|
|
1975
1975
|
className = ""
|
|
1976
1976
|
}) {
|
|
1977
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
1978
|
-
const [loading, setLoading] =
|
|
1977
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React19.useState(false);
|
|
1978
|
+
const [loading, setLoading] = React19.useState(false);
|
|
1979
1979
|
const isOpen = open ?? uncontrolledOpen;
|
|
1980
1980
|
const setOpen = (next) => {
|
|
1981
1981
|
onOpenChange?.(next);
|
|
@@ -2035,7 +2035,201 @@ function PopConfirm({
|
|
|
2035
2035
|
) })
|
|
2036
2036
|
] });
|
|
2037
2037
|
}
|
|
2038
|
-
var
|
|
2038
|
+
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
2039
|
+
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
2040
|
+
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
2041
|
+
var sameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
2042
|
+
var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
2043
|
+
function buildGrid(month, weekStartsOn) {
|
|
2044
|
+
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
|
2045
|
+
const offset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
2046
|
+
const start = new Date(first);
|
|
2047
|
+
start.setDate(first.getDate() - offset);
|
|
2048
|
+
return Array.from({ length: 42 }, (_, i) => {
|
|
2049
|
+
const d = new Date(start);
|
|
2050
|
+
d.setDate(start.getDate() + i);
|
|
2051
|
+
return d;
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
var NavIcon = ({ dir }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: dir === "left" ? "M15 19l-7-7 7-7" : "M9 5l7 7-7 7" }) });
|
|
2055
|
+
function Calendar2({
|
|
2056
|
+
value,
|
|
2057
|
+
onChange,
|
|
2058
|
+
month,
|
|
2059
|
+
defaultMonth,
|
|
2060
|
+
onMonthChange,
|
|
2061
|
+
events,
|
|
2062
|
+
min,
|
|
2063
|
+
max,
|
|
2064
|
+
weekStartsOn = 0,
|
|
2065
|
+
className = "",
|
|
2066
|
+
style
|
|
2067
|
+
}) {
|
|
2068
|
+
const today = React19.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
2069
|
+
const [internalMonth, setInternalMonth] = React19.useState(() => month ?? defaultMonth ?? value ?? today);
|
|
2070
|
+
const visible = month ?? internalMonth;
|
|
2071
|
+
const setMonth = (next) => {
|
|
2072
|
+
onMonthChange?.(next);
|
|
2073
|
+
if (month === void 0) setInternalMonth(next);
|
|
2074
|
+
};
|
|
2075
|
+
const grid = React19.useMemo(() => buildGrid(visible, weekStartsOn), [visible, weekStartsOn]);
|
|
2076
|
+
const weekdays = React19.useMemo(() => Array.from({ length: 7 }, (_, i) => WEEKDAYS[(i + weekStartsOn) % 7]), [weekStartsOn]);
|
|
2077
|
+
const eventsByDay = React19.useMemo(() => {
|
|
2078
|
+
const map = /* @__PURE__ */ new Map();
|
|
2079
|
+
for (const ev of events ?? []) {
|
|
2080
|
+
const key = startOfDay(ev.date).toDateString();
|
|
2081
|
+
const arr = map.get(key) ?? [];
|
|
2082
|
+
arr.push(ev);
|
|
2083
|
+
map.set(key, arr);
|
|
2084
|
+
}
|
|
2085
|
+
return map;
|
|
2086
|
+
}, [events]);
|
|
2087
|
+
const disabled = (d) => min && d < startOfDay(min) || max && d > startOfDay(max);
|
|
2088
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["inline-block rounded-lg border border-border bg-surface p-3 select-none", className].filter(Boolean).join(" "), style, children: [
|
|
2089
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2 flex items-center justify-between px-1", children: [
|
|
2090
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2091
|
+
"button",
|
|
2092
|
+
{
|
|
2093
|
+
type: "button",
|
|
2094
|
+
"aria-label": "Previous month",
|
|
2095
|
+
onClick: () => setMonth(addMonths(visible, -1)),
|
|
2096
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground-secondary hover:bg-surface-raised hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
2097
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(NavIcon, { dir: "left" })
|
|
2098
|
+
}
|
|
2099
|
+
),
|
|
2100
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm font-semibold text-foreground", "aria-live": "polite", children: [
|
|
2101
|
+
MONTHS[visible.getMonth()],
|
|
2102
|
+
" ",
|
|
2103
|
+
visible.getFullYear()
|
|
2104
|
+
] }),
|
|
2105
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2106
|
+
"button",
|
|
2107
|
+
{
|
|
2108
|
+
type: "button",
|
|
2109
|
+
"aria-label": "Next month",
|
|
2110
|
+
onClick: () => setMonth(addMonths(visible, 1)),
|
|
2111
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground-secondary hover:bg-surface-raised hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
2112
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(NavIcon, { dir: "right" })
|
|
2113
|
+
}
|
|
2114
|
+
)
|
|
2115
|
+
] }),
|
|
2116
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 mb-1", children: weekdays.map((w) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[11px] font-medium uppercase tracking-wide text-foreground-muted py-1", children: w }, w)) }),
|
|
2117
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-0.5", role: "grid", children: grid.map((d, i) => {
|
|
2118
|
+
const inMonth = d.getMonth() === visible.getMonth();
|
|
2119
|
+
const isSelected = value != null && sameDay(d, value);
|
|
2120
|
+
const isToday = sameDay(d, today);
|
|
2121
|
+
const isDisabled = disabled(d);
|
|
2122
|
+
const dayEvents = eventsByDay.get(d.toDateString()) ?? [];
|
|
2123
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2124
|
+
"button",
|
|
2125
|
+
{
|
|
2126
|
+
type: "button",
|
|
2127
|
+
role: "gridcell",
|
|
2128
|
+
"aria-selected": isSelected,
|
|
2129
|
+
"aria-current": isToday ? "date" : void 0,
|
|
2130
|
+
disabled: isDisabled,
|
|
2131
|
+
onClick: () => onChange?.(startOfDay(d)),
|
|
2132
|
+
className: [
|
|
2133
|
+
"relative flex h-9 w-9 flex-col items-center justify-center rounded-md text-sm transition-colors",
|
|
2134
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
2135
|
+
isSelected ? "bg-accent text-accent-fg font-semibold" : inMonth ? "text-foreground hover:bg-surface-raised" : "text-foreground-muted hover:bg-surface-raised",
|
|
2136
|
+
isDisabled ? "opacity-40 cursor-not-allowed hover:bg-transparent" : "",
|
|
2137
|
+
!isSelected && isToday ? "ring-1 ring-inset ring-accent/60" : ""
|
|
2138
|
+
].filter(Boolean).join(" "),
|
|
2139
|
+
children: [
|
|
2140
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-none", children: d.getDate() }),
|
|
2141
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-1 flex gap-0.5", children: dayEvents.slice(0, 3).map((ev, j) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2142
|
+
"span",
|
|
2143
|
+
{
|
|
2144
|
+
title: ev.label,
|
|
2145
|
+
className: "h-1 w-1 rounded-full",
|
|
2146
|
+
style: { backgroundColor: ev.color ?? (isSelected ? "var(--color-accent-fg)" : "var(--color-accent)") }
|
|
2147
|
+
},
|
|
2148
|
+
j
|
|
2149
|
+
)) })
|
|
2150
|
+
]
|
|
2151
|
+
},
|
|
2152
|
+
i
|
|
2153
|
+
);
|
|
2154
|
+
}) })
|
|
2155
|
+
] });
|
|
2156
|
+
}
|
|
2157
|
+
var defaultFormat = (v) => `${v < 0 ? "-" : ""}$${Math.abs(v).toFixed(2)}`;
|
|
2158
|
+
var Stepper = ({
|
|
2159
|
+
quantity,
|
|
2160
|
+
max,
|
|
2161
|
+
onChange
|
|
2162
|
+
}) => {
|
|
2163
|
+
const btn = "flex h-7 w-7 items-center justify-center text-foreground-secondary hover:bg-surface-raised disabled:opacity-40 disabled:hover:bg-transparent focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset transition-colors";
|
|
2164
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center rounded-md border border-border overflow-hidden", children: [
|
|
2165
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Decrease quantity", disabled: quantity <= 1, onClick: () => onChange?.(quantity - 1), className: btn, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", d: "M5 12h14" }) }) }),
|
|
2166
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-8 text-center text-sm tabular-nums text-foreground select-none", children: quantity }),
|
|
2167
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Increase quantity", disabled: max != null && quantity >= max, onClick: () => onChange?.(quantity + 1), className: btn, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", d: "M12 5v14M5 12h14" }) }) })
|
|
2168
|
+
] });
|
|
2169
|
+
};
|
|
2170
|
+
function Cart({
|
|
2171
|
+
items,
|
|
2172
|
+
onQuantityChange,
|
|
2173
|
+
onRemove,
|
|
2174
|
+
summaryRows = [],
|
|
2175
|
+
formatPrice = defaultFormat,
|
|
2176
|
+
checkoutLabel = "Checkout",
|
|
2177
|
+
onCheckout,
|
|
2178
|
+
emptyState,
|
|
2179
|
+
className = "",
|
|
2180
|
+
style
|
|
2181
|
+
}) {
|
|
2182
|
+
const subtotal = items.reduce((sum, it) => sum + it.price * it.quantity, 0);
|
|
2183
|
+
const total = subtotal + summaryRows.reduce((sum, r) => sum + r.value, 0);
|
|
2184
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["flex flex-col rounded-xl border border-border bg-surface", className].filter(Boolean).join(" "), style, children: [
|
|
2185
|
+
items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-8 text-center text-sm text-foreground-muted", children: emptyState ?? "Your cart is empty." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "divide-y divide-border", children: items.map((it) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-center gap-3 p-3", children: [
|
|
2186
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-14 w-14 flex-shrink-0 overflow-hidden rounded-md bg-surface-raised", children: it.image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: it.image, alt: "", className: "h-full w-full object-cover" }) }),
|
|
2187
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
2188
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-sm font-medium text-foreground", children: it.name }),
|
|
2189
|
+
it.meta && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-xs text-foreground-muted mt-0.5", children: it.meta }),
|
|
2190
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1.5 flex items-center gap-3", children: [
|
|
2191
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stepper, { quantity: it.quantity, max: it.max, onChange: (q) => onQuantityChange?.(it.id, Math.max(1, q)) }),
|
|
2192
|
+
onRemove && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2193
|
+
"button",
|
|
2194
|
+
{
|
|
2195
|
+
type: "button",
|
|
2196
|
+
onClick: () => onRemove(it.id),
|
|
2197
|
+
className: "text-xs text-foreground-muted hover:text-status-error transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent rounded px-1",
|
|
2198
|
+
children: "Remove"
|
|
2199
|
+
}
|
|
2200
|
+
)
|
|
2201
|
+
] })
|
|
2202
|
+
] }),
|
|
2203
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 text-sm font-semibold text-foreground tabular-nums", children: formatPrice(it.price * it.quantity) })
|
|
2204
|
+
] }, it.id)) }),
|
|
2205
|
+
items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-4", children: [
|
|
2206
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "space-y-1.5", children: [
|
|
2207
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2208
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-foreground-secondary", children: "Subtotal" }),
|
|
2209
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "tabular-nums text-foreground", children: formatPrice(subtotal) })
|
|
2210
|
+
] }),
|
|
2211
|
+
summaryRows.map((r, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2212
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: r.muted ? "text-foreground-muted" : "text-foreground-secondary", children: r.label }),
|
|
2213
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: `tabular-nums ${r.value < 0 ? "text-status-success" : "text-foreground"}`, children: formatPrice(r.value) })
|
|
2214
|
+
] }, i)),
|
|
2215
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-t border-border pt-2 mt-1 text-base font-semibold", children: [
|
|
2216
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-foreground", children: "Total" }),
|
|
2217
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "tabular-nums text-foreground", children: formatPrice(total) })
|
|
2218
|
+
] })
|
|
2219
|
+
] }),
|
|
2220
|
+
onCheckout && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2221
|
+
"button",
|
|
2222
|
+
{
|
|
2223
|
+
type: "button",
|
|
2224
|
+
onClick: onCheckout,
|
|
2225
|
+
className: "mt-4 w-full rounded-lg bg-accent px-4 py-2.5 text-sm font-semibold text-accent-fg transition-colors hover:bg-accent-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",
|
|
2226
|
+
children: checkoutLabel
|
|
2227
|
+
}
|
|
2228
|
+
)
|
|
2229
|
+
] })
|
|
2230
|
+
] });
|
|
2231
|
+
}
|
|
2232
|
+
var NotificationContext = React19.createContext({
|
|
2039
2233
|
open: () => void 0,
|
|
2040
2234
|
close: () => void 0
|
|
2041
2235
|
});
|
|
@@ -2093,26 +2287,26 @@ function NotificationItem({
|
|
|
2093
2287
|
onClose,
|
|
2094
2288
|
reduced
|
|
2095
2289
|
}) {
|
|
2096
|
-
const [paused, setPaused] =
|
|
2290
|
+
const [paused, setPaused] = React19.useState(false);
|
|
2097
2291
|
const duration = n.duration ?? 4e3;
|
|
2098
2292
|
const isAutoDismissing = isFinite(duration) && duration > 0;
|
|
2099
2293
|
const showProgress = !reduced && isAutoDismissing;
|
|
2100
|
-
const timerRef =
|
|
2101
|
-
const startTimeRef =
|
|
2102
|
-
const remainingRef =
|
|
2103
|
-
const clearTimer =
|
|
2294
|
+
const timerRef = React19.useRef(null);
|
|
2295
|
+
const startTimeRef = React19.useRef(0);
|
|
2296
|
+
const remainingRef = React19.useRef(duration);
|
|
2297
|
+
const clearTimer = React19.useCallback(() => {
|
|
2104
2298
|
if (timerRef.current !== null) {
|
|
2105
2299
|
clearTimeout(timerRef.current);
|
|
2106
2300
|
timerRef.current = null;
|
|
2107
2301
|
}
|
|
2108
2302
|
}, []);
|
|
2109
|
-
const scheduleDismiss =
|
|
2303
|
+
const scheduleDismiss = React19.useCallback((ms) => {
|
|
2110
2304
|
clearTimer();
|
|
2111
2305
|
if (!isAutoDismissing) return;
|
|
2112
2306
|
startTimeRef.current = Date.now();
|
|
2113
2307
|
timerRef.current = setTimeout(() => onClose(n.id), ms);
|
|
2114
2308
|
}, [clearTimer, isAutoDismissing, n.id, onClose]);
|
|
2115
|
-
|
|
2309
|
+
React19.useEffect(() => {
|
|
2116
2310
|
if (paused || !isAutoDismissing) return;
|
|
2117
2311
|
scheduleDismiss(remainingRef.current);
|
|
2118
2312
|
return clearTimer;
|
|
@@ -2195,15 +2389,15 @@ function NotificationProvider({
|
|
|
2195
2389
|
children,
|
|
2196
2390
|
position = "top-right"
|
|
2197
2391
|
}) {
|
|
2198
|
-
const [notifications, setNotifications] =
|
|
2392
|
+
const [notifications, setNotifications] = React19.useState([]);
|
|
2199
2393
|
const reduced = framerMotion.useReducedMotion();
|
|
2200
|
-
const open =
|
|
2394
|
+
const open = React19.useCallback((payload) => {
|
|
2201
2395
|
setNotifications((prev) => [
|
|
2202
2396
|
...prev,
|
|
2203
2397
|
{ duration: 4e3, ...payload, id: Date.now() + Math.random() }
|
|
2204
2398
|
]);
|
|
2205
2399
|
}, []);
|
|
2206
|
-
const close =
|
|
2400
|
+
const close = React19.useCallback((id) => {
|
|
2207
2401
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
2208
2402
|
}, []);
|
|
2209
2403
|
return /* @__PURE__ */ jsxRuntime.jsxs(NotificationContext.Provider, { value: { open, close }, children: [
|
|
@@ -2232,7 +2426,7 @@ function NotificationProvider({
|
|
|
2232
2426
|
] });
|
|
2233
2427
|
}
|
|
2234
2428
|
function useNotification() {
|
|
2235
|
-
const { open } =
|
|
2429
|
+
const { open } = React19.useContext(NotificationContext);
|
|
2236
2430
|
return {
|
|
2237
2431
|
info: (props) => open({ type: "info", ...props }),
|
|
2238
2432
|
success: (props) => open({ type: "success", ...props }),
|
|
@@ -2349,10 +2543,10 @@ function FadingBase({
|
|
|
2349
2543
|
isMounted = false,
|
|
2350
2544
|
children
|
|
2351
2545
|
}) {
|
|
2352
|
-
const [shouldRender, setShouldRender] =
|
|
2353
|
-
const [visible, setVisible] =
|
|
2354
|
-
const timerRef =
|
|
2355
|
-
|
|
2546
|
+
const [shouldRender, setShouldRender] = React19.useState(isMounted);
|
|
2547
|
+
const [visible, setVisible] = React19.useState(false);
|
|
2548
|
+
const timerRef = React19.useRef(null);
|
|
2549
|
+
React19.useEffect(() => {
|
|
2356
2550
|
if (isMounted) {
|
|
2357
2551
|
setShouldRender(true);
|
|
2358
2552
|
const rafId = requestAnimationFrame(() => setVisible(true));
|
|
@@ -2450,8 +2644,8 @@ function ScalableContainer({
|
|
|
2450
2644
|
togglePosition = "top-right",
|
|
2451
2645
|
className = ""
|
|
2452
2646
|
}) {
|
|
2453
|
-
const containerRef =
|
|
2454
|
-
const [internalScaled, setInternalScaled] =
|
|
2647
|
+
const containerRef = React19.useRef(null);
|
|
2648
|
+
const [internalScaled, setInternalScaled] = React19.useState(false);
|
|
2455
2649
|
const isScaled = expanded ?? internalScaled;
|
|
2456
2650
|
const reduced = framerMotion.useReducedMotion();
|
|
2457
2651
|
const onToggle = () => {
|
|
@@ -2589,17 +2783,17 @@ function CatalogGrid({ items, buttonText, onOpen, className = "" }) {
|
|
|
2589
2783
|
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)) });
|
|
2590
2784
|
}
|
|
2591
2785
|
function CatalogCarousel({ items, buttonText, onOpen, className = "" }) {
|
|
2592
|
-
const [activeIndex, setActiveIndex] =
|
|
2593
|
-
const [indexPool, setIndexPool] =
|
|
2594
|
-
const cardRefs =
|
|
2595
|
-
const getIndexes =
|
|
2786
|
+
const [activeIndex, setActiveIndex] = React19.useState(0);
|
|
2787
|
+
const [indexPool, setIndexPool] = React19.useState([]);
|
|
2788
|
+
const cardRefs = React19.useRef([]);
|
|
2789
|
+
const getIndexes = React19.useMemo(() => {
|
|
2596
2790
|
let nextIndex = activeIndex + 1;
|
|
2597
2791
|
let previousIndex = activeIndex - 1;
|
|
2598
2792
|
if (activeIndex === 0) previousIndex = items.length - 1;
|
|
2599
2793
|
if (activeIndex === items.length - 1) nextIndex = 0;
|
|
2600
2794
|
return { previousIndex, nextIndex };
|
|
2601
2795
|
}, [activeIndex, items.length]);
|
|
2602
|
-
|
|
2796
|
+
React19.useEffect(() => {
|
|
2603
2797
|
const { nextIndex, previousIndex } = getIndexes;
|
|
2604
2798
|
let indexes = [previousIndex, activeIndex, nextIndex];
|
|
2605
2799
|
if (activeIndex !== 0 && activeIndex !== items.length - 1) {
|
|
@@ -2772,8 +2966,8 @@ function writeDismissed(key) {
|
|
|
2772
2966
|
}
|
|
2773
2967
|
}
|
|
2774
2968
|
function useTargetBbox(ref) {
|
|
2775
|
-
const [bbox, setBbox] =
|
|
2776
|
-
|
|
2969
|
+
const [bbox, setBbox] = React19.useState(null);
|
|
2970
|
+
React19.useLayoutEffect(() => {
|
|
2777
2971
|
const el = ref?.current;
|
|
2778
2972
|
if (!el) {
|
|
2779
2973
|
setBbox(null);
|
|
@@ -2803,7 +2997,7 @@ function tooltipStyleFor(bbox, placement) {
|
|
|
2803
2997
|
return { left: bbox.left + bbox.width / 2, top: bbox.top - TOOLTIP_GAP, transform: "translate(-50%, -100%)", width: TOOLTIP_WIDTH };
|
|
2804
2998
|
}
|
|
2805
2999
|
function useFocusTrap(containerRef, active) {
|
|
2806
|
-
|
|
3000
|
+
React19.useEffect(() => {
|
|
2807
3001
|
if (!active) return;
|
|
2808
3002
|
const el = containerRef.current;
|
|
2809
3003
|
if (!el) return;
|
|
@@ -2842,16 +3036,16 @@ function Wizard({
|
|
|
2842
3036
|
onComplete,
|
|
2843
3037
|
onSkip
|
|
2844
3038
|
}) {
|
|
2845
|
-
const tooltipRef =
|
|
2846
|
-
const tooltipTitleId =
|
|
2847
|
-
const tooltipBodyId =
|
|
3039
|
+
const tooltipRef = React19.useRef(null);
|
|
3040
|
+
const tooltipTitleId = React19.useId();
|
|
3041
|
+
const tooltipBodyId = React19.useId();
|
|
2848
3042
|
const reduced = framerMotion.useReducedMotion();
|
|
2849
|
-
const [open, setOpen] =
|
|
2850
|
-
const [activeIndex, setActiveIndex] =
|
|
3043
|
+
const [open, setOpen] = React19.useState(() => steps.length > 0 && !readDismissed(storageKey));
|
|
3044
|
+
const [activeIndex, setActiveIndex] = React19.useState(0);
|
|
2851
3045
|
const step = steps[activeIndex];
|
|
2852
3046
|
const bbox = useTargetBbox(step?.stepRef);
|
|
2853
3047
|
useFocusTrap(tooltipRef, open);
|
|
2854
|
-
|
|
3048
|
+
React19.useEffect(() => {
|
|
2855
3049
|
if (!open || !dismissible) return;
|
|
2856
3050
|
const onKey = (e) => {
|
|
2857
3051
|
if (e.key === "Escape") {
|
|
@@ -2862,12 +3056,12 @@ function Wizard({
|
|
|
2862
3056
|
document.addEventListener("keydown", onKey);
|
|
2863
3057
|
return () => document.removeEventListener("keydown", onKey);
|
|
2864
3058
|
}, [open, dismissible]);
|
|
2865
|
-
const handleSkip =
|
|
3059
|
+
const handleSkip = React19.useCallback(() => {
|
|
2866
3060
|
writeDismissed(storageKey);
|
|
2867
3061
|
setOpen(false);
|
|
2868
3062
|
onSkip?.();
|
|
2869
3063
|
}, [storageKey, onSkip]);
|
|
2870
|
-
const handleComplete =
|
|
3064
|
+
const handleComplete = React19.useCallback(() => {
|
|
2871
3065
|
writeDismissed(storageKey);
|
|
2872
3066
|
setOpen(false);
|
|
2873
3067
|
onComplete?.();
|
|
@@ -3138,7 +3332,7 @@ function Field({
|
|
|
3138
3332
|
);
|
|
3139
3333
|
}
|
|
3140
3334
|
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" }) });
|
|
3141
|
-
var SearchInput =
|
|
3335
|
+
var SearchInput = React19__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
3142
3336
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3143
3337
|
"div",
|
|
3144
3338
|
{
|
|
@@ -3192,11 +3386,11 @@ function MultiTagRow({
|
|
|
3192
3386
|
labelFor,
|
|
3193
3387
|
onRemove
|
|
3194
3388
|
}) {
|
|
3195
|
-
const wrapRef =
|
|
3196
|
-
const measureRef =
|
|
3197
|
-
const [visibleCount, setVisibleCount] =
|
|
3389
|
+
const wrapRef = React19.useRef(null);
|
|
3390
|
+
const measureRef = React19.useRef(null);
|
|
3391
|
+
const [visibleCount, setVisibleCount] = React19.useState(values.length);
|
|
3198
3392
|
const key = values.map(String).join("|");
|
|
3199
|
-
|
|
3393
|
+
React19.useLayoutEffect(() => {
|
|
3200
3394
|
const wrap = wrapRef.current;
|
|
3201
3395
|
const measure = measureRef.current;
|
|
3202
3396
|
if (!wrap || !measure) return;
|
|
@@ -3290,16 +3484,16 @@ function Dropdown({
|
|
|
3290
3484
|
size = "md",
|
|
3291
3485
|
className = ""
|
|
3292
3486
|
}) {
|
|
3293
|
-
const [open, setOpen] =
|
|
3294
|
-
const [selectedItems, setSelectedItems] =
|
|
3295
|
-
const [searchTerm, setSearchTerm] =
|
|
3296
|
-
const [innerItems, setInnerItems] =
|
|
3297
|
-
const errorId =
|
|
3487
|
+
const [open, setOpen] = React19.useState(false);
|
|
3488
|
+
const [selectedItems, setSelectedItems] = React19.useState([]);
|
|
3489
|
+
const [searchTerm, setSearchTerm] = React19.useState("");
|
|
3490
|
+
const [innerItems, setInnerItems] = React19.useState([]);
|
|
3491
|
+
const errorId = React19.useId();
|
|
3298
3492
|
const hasError = errorMessage != null;
|
|
3299
|
-
|
|
3493
|
+
React19.useEffect(() => {
|
|
3300
3494
|
setInnerItems(items);
|
|
3301
3495
|
}, [items]);
|
|
3302
|
-
|
|
3496
|
+
React19.useEffect(() => {
|
|
3303
3497
|
if (isMultiselect && Array.isArray(value)) {
|
|
3304
3498
|
setSelectedItems(value);
|
|
3305
3499
|
}
|
|
@@ -3624,7 +3818,7 @@ function TableBody({
|
|
|
3624
3818
|
expandRow,
|
|
3625
3819
|
getRowKey
|
|
3626
3820
|
}) {
|
|
3627
|
-
const [expanded, setExpanded] =
|
|
3821
|
+
const [expanded, setExpanded] = React19.useState(() => /* @__PURE__ */ new Set());
|
|
3628
3822
|
const reduced = framerMotion.useReducedMotion();
|
|
3629
3823
|
const toggleRow = (rowKey) => {
|
|
3630
3824
|
setExpanded((prev) => {
|
|
@@ -3639,7 +3833,7 @@ function TableBody({
|
|
|
3639
3833
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, i) => {
|
|
3640
3834
|
const rowKey = getRowKey(row, i);
|
|
3641
3835
|
const isExpanded = expanded.has(rowKey);
|
|
3642
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3836
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React19__default.default.Fragment, { children: [
|
|
3643
3837
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3644
3838
|
"tr",
|
|
3645
3839
|
{
|
|
@@ -3695,9 +3889,9 @@ function Pagination({
|
|
|
3695
3889
|
const matchedOption = picker.find(
|
|
3696
3890
|
(o) => o.label === options.perPage || o.value === options.perPage
|
|
3697
3891
|
);
|
|
3698
|
-
const [perPageKey, setPerPageKey] =
|
|
3892
|
+
const [perPageKey, setPerPageKey] = React19.useState(() => matchedOption?.key ?? picker[0]?.key);
|
|
3699
3893
|
const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
|
|
3700
|
-
|
|
3894
|
+
React19.useEffect(() => {
|
|
3701
3895
|
if (serverSide && options.perPage != null) {
|
|
3702
3896
|
const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
|
|
3703
3897
|
if (next) setPerPageKey(next.key);
|
|
@@ -3761,14 +3955,14 @@ function Table({
|
|
|
3761
3955
|
className = "",
|
|
3762
3956
|
style
|
|
3763
3957
|
}) {
|
|
3764
|
-
const searchRef =
|
|
3765
|
-
const [searchTerm, setSearchTerm] =
|
|
3766
|
-
const [perPage, setPerPage] =
|
|
3958
|
+
const searchRef = React19.useRef(null);
|
|
3959
|
+
const [searchTerm, setSearchTerm] = React19.useState("");
|
|
3960
|
+
const [perPage, setPerPage] = React19.useState(
|
|
3767
3961
|
typeof pagination.perPage === "number" ? pagination.perPage : 15
|
|
3768
3962
|
);
|
|
3769
|
-
const [activePage, setActivePage] =
|
|
3963
|
+
const [activePage, setActivePage] = React19.useState(0);
|
|
3770
3964
|
const isServerSide = !!(pagination.enabled && pagination.serverSide);
|
|
3771
|
-
const filteredRows =
|
|
3965
|
+
const filteredRows = React19.useMemo(() => {
|
|
3772
3966
|
if (isServerSide || !searchTerm) return rows;
|
|
3773
3967
|
const term = searchTerm.toLowerCase();
|
|
3774
3968
|
return rows.filter(
|
|
@@ -3777,29 +3971,29 @@ function Table({
|
|
|
3777
3971
|
)
|
|
3778
3972
|
);
|
|
3779
3973
|
}, [rows, searchTerm, isServerSide]);
|
|
3780
|
-
const datasets =
|
|
3974
|
+
const datasets = React19.useMemo(() => {
|
|
3781
3975
|
if (isServerSide) return [rows];
|
|
3782
3976
|
return createDatasets(filteredRows, pagination.enabled ? perPage : null);
|
|
3783
3977
|
}, [filteredRows, perPage, pagination.enabled, isServerSide, rows]);
|
|
3784
|
-
const MAX_PAGE =
|
|
3978
|
+
const MAX_PAGE = React19.useMemo(() => {
|
|
3785
3979
|
if (isServerSide && typeof pagination.maxPage === "number") return Math.max(0, pagination.maxPage);
|
|
3786
3980
|
if (isServerSide && typeof pagination.totalCount === "number")
|
|
3787
3981
|
return Math.max(0, Math.ceil(pagination.totalCount / perPage) - 1);
|
|
3788
3982
|
return datasets.length ? datasets.length - 1 : 0;
|
|
3789
3983
|
}, [isServerSide, pagination.maxPage, pagination.totalCount, perPage, datasets.length]);
|
|
3790
|
-
const currentPageRows =
|
|
3984
|
+
const currentPageRows = React19.useMemo(() => {
|
|
3791
3985
|
if (isServerSide) return rows;
|
|
3792
3986
|
return datasets[activePage] ?? [];
|
|
3793
3987
|
}, [isServerSide, rows, datasets, activePage]);
|
|
3794
|
-
|
|
3988
|
+
React19.useEffect(() => {
|
|
3795
3989
|
if (pagination.enabled && !isServerSide && typeof pagination.perPage === "number") {
|
|
3796
3990
|
setPerPage(pagination.perPage);
|
|
3797
3991
|
}
|
|
3798
3992
|
}, [pagination.enabled, pagination.perPage, isServerSide]);
|
|
3799
|
-
|
|
3993
|
+
React19.useEffect(() => {
|
|
3800
3994
|
if (isServerSide && typeof pagination.perPage === "number") setPerPage(pagination.perPage);
|
|
3801
3995
|
}, [isServerSide, pagination.perPage]);
|
|
3802
|
-
|
|
3996
|
+
React19.useEffect(() => {
|
|
3803
3997
|
if (isServerSide && typeof pagination.page === "number" && pagination.page >= 1)
|
|
3804
3998
|
setActivePage(pagination.page - 1);
|
|
3805
3999
|
}, [isServerSide, pagination.page]);
|
|
@@ -3883,7 +4077,7 @@ function TableSkeletonBody({
|
|
|
3883
4077
|
)) });
|
|
3884
4078
|
}
|
|
3885
4079
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode", className = "" }) {
|
|
3886
|
-
const id =
|
|
4080
|
+
const id = React19.useId();
|
|
3887
4081
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: `flex items-center gap-2 cursor-pointer select-none ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3888
4082
|
SwitchPrimitive__namespace.Root,
|
|
3889
4083
|
{
|
|
@@ -4067,7 +4261,7 @@ function Sidebar({
|
|
|
4067
4261
|
}
|
|
4068
4262
|
) });
|
|
4069
4263
|
}
|
|
4070
|
-
var MegaMenuContext =
|
|
4264
|
+
var MegaMenuContext = React19.createContext({ align: "start" });
|
|
4071
4265
|
function MegaMenu({
|
|
4072
4266
|
children,
|
|
4073
4267
|
align = "start",
|
|
@@ -4098,7 +4292,7 @@ function MegaMenu({
|
|
|
4098
4292
|
}
|
|
4099
4293
|
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";
|
|
4100
4294
|
function MegaMenuItem({ label, icon, href, children, className = "" }) {
|
|
4101
|
-
const { align } =
|
|
4295
|
+
const { align } = React19.useContext(MegaMenuContext);
|
|
4102
4296
|
const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
|
|
4103
4297
|
if (!children) {
|
|
4104
4298
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
|
|
@@ -4183,8 +4377,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
4183
4377
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
4184
4378
|
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 });
|
|
4185
4379
|
}
|
|
4186
|
-
var elementsOfType = (children, type) =>
|
|
4187
|
-
(c) =>
|
|
4380
|
+
var elementsOfType = (children, type) => React19__default.default.Children.toArray(children).filter(
|
|
4381
|
+
(c) => React19__default.default.isValidElement(c) && c.type === type
|
|
4188
4382
|
);
|
|
4189
4383
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4190
4384
|
"svg",
|
|
@@ -4221,9 +4415,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
4221
4415
|
);
|
|
4222
4416
|
}
|
|
4223
4417
|
function MobilePanel({ panel, onNavigate }) {
|
|
4224
|
-
const nodes =
|
|
4418
|
+
const nodes = React19__default.default.Children.toArray(panel.props.children);
|
|
4225
4419
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
4226
|
-
if (!
|
|
4420
|
+
if (!React19__default.default.isValidElement(node)) return null;
|
|
4227
4421
|
const el = node;
|
|
4228
4422
|
if (el.type === MegaMenuSection) {
|
|
4229
4423
|
const { title, children } = el.props;
|
|
@@ -4242,8 +4436,8 @@ function MegaMenuMobile({
|
|
|
4242
4436
|
children,
|
|
4243
4437
|
label
|
|
4244
4438
|
}) {
|
|
4245
|
-
const [open, setOpen] =
|
|
4246
|
-
const [expanded, setExpanded] =
|
|
4439
|
+
const [open, setOpen] = React19.useState(false);
|
|
4440
|
+
const [expanded, setExpanded] = React19.useState(null);
|
|
4247
4441
|
const items = elementsOfType(children, MegaMenuItem);
|
|
4248
4442
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden w-full", children: [
|
|
4249
4443
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4316,17 +4510,17 @@ function AppShell({
|
|
|
4316
4510
|
children,
|
|
4317
4511
|
className = ""
|
|
4318
4512
|
}) {
|
|
4319
|
-
const [expanded, setExpanded] =
|
|
4320
|
-
const [isMobile, setIsMobile] =
|
|
4321
|
-
const [mobileOpen, setMobileOpen] =
|
|
4322
|
-
|
|
4513
|
+
const [expanded, setExpanded] = React19.useState(sidebarDefaultExpanded);
|
|
4514
|
+
const [isMobile, setIsMobile] = React19.useState(false);
|
|
4515
|
+
const [mobileOpen, setMobileOpen] = React19.useState(false);
|
|
4516
|
+
React19.useEffect(() => {
|
|
4323
4517
|
const mq = window.matchMedia("(max-width: 767px)");
|
|
4324
4518
|
const update = (e) => setIsMobile(e.matches);
|
|
4325
4519
|
update(mq);
|
|
4326
4520
|
mq.addEventListener("change", update);
|
|
4327
4521
|
return () => mq.removeEventListener("change", update);
|
|
4328
4522
|
}, []);
|
|
4329
|
-
|
|
4523
|
+
React19.useEffect(() => {
|
|
4330
4524
|
if (!isMobile) setMobileOpen(false);
|
|
4331
4525
|
}, [isMobile]);
|
|
4332
4526
|
const hasSidebar = sidebarSections.length > 0;
|
|
@@ -4516,10 +4710,10 @@ function ThemeProvider({
|
|
|
4516
4710
|
className = "",
|
|
4517
4711
|
style
|
|
4518
4712
|
}) {
|
|
4519
|
-
const id =
|
|
4713
|
+
const id = React19__default.default.useId().replace(/:/g, "");
|
|
4520
4714
|
const scopeClass = `geo-th-${id}`;
|
|
4521
|
-
const divRef =
|
|
4522
|
-
|
|
4715
|
+
const divRef = React19.useRef(null);
|
|
4716
|
+
React19.useEffect(() => {
|
|
4523
4717
|
const el = divRef.current;
|
|
4524
4718
|
if (!el) return;
|
|
4525
4719
|
if (colorScheme === "auto") return;
|
|
@@ -4534,8 +4728,8 @@ function ThemeProvider({
|
|
|
4534
4728
|
}
|
|
4535
4729
|
el.classList.toggle("dark", colorScheme === "dark");
|
|
4536
4730
|
}, [colorScheme]);
|
|
4537
|
-
const lightVars =
|
|
4538
|
-
const darkVarStr =
|
|
4731
|
+
const lightVars = React19.useMemo(() => toCssVars(theme), [theme]);
|
|
4732
|
+
const darkVarStr = React19.useMemo(() => {
|
|
4539
4733
|
if (!darkTheme) return "";
|
|
4540
4734
|
const dvars = toCssVars(darkTheme);
|
|
4541
4735
|
if (!Object.keys(dvars).length) return "";
|
|
@@ -4575,7 +4769,7 @@ function TextInput({
|
|
|
4575
4769
|
prefix,
|
|
4576
4770
|
suffix
|
|
4577
4771
|
}) {
|
|
4578
|
-
const errorId =
|
|
4772
|
+
const errorId = React19.useId();
|
|
4579
4773
|
const hasError = errorMessage != null;
|
|
4580
4774
|
const hasAdornment = prefix != null || suffix != null;
|
|
4581
4775
|
const input = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4645,7 +4839,7 @@ function NumberInput({
|
|
|
4645
4839
|
readOnly = false,
|
|
4646
4840
|
precision
|
|
4647
4841
|
}) {
|
|
4648
|
-
const errorId =
|
|
4842
|
+
const errorId = React19.useId();
|
|
4649
4843
|
const hasError = errorMessage != null;
|
|
4650
4844
|
const inferredPrecision = precision ?? (Number.isInteger(step) ? 0 : String(step).split(".")[1]?.length ?? 0);
|
|
4651
4845
|
const round = (n) => {
|
|
@@ -4776,8 +4970,8 @@ function Password({
|
|
|
4776
4970
|
showIcon,
|
|
4777
4971
|
hideIcon
|
|
4778
4972
|
}) {
|
|
4779
|
-
const [visible, setVisible] =
|
|
4780
|
-
const errorId =
|
|
4973
|
+
const [visible, setVisible] = React19.useState(false);
|
|
4974
|
+
const errorId = React19.useId();
|
|
4781
4975
|
const hasError = errorMessage != null;
|
|
4782
4976
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4783
4977
|
Field,
|
|
@@ -4850,7 +5044,7 @@ function Checkbox({
|
|
|
4850
5044
|
}) {
|
|
4851
5045
|
const isChecked = checked ?? value ?? false;
|
|
4852
5046
|
const labelFirst = labelPosition === "left";
|
|
4853
|
-
const errorId =
|
|
5047
|
+
const errorId = React19.useId();
|
|
4854
5048
|
const hasError = errorMessage != null;
|
|
4855
5049
|
const box = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4856
5050
|
CheckboxPrimitive__namespace.Root,
|
|
@@ -4958,8 +5152,8 @@ function RadioGroup({
|
|
|
4958
5152
|
className,
|
|
4959
5153
|
errorMessage
|
|
4960
5154
|
}) {
|
|
4961
|
-
const errorId =
|
|
4962
|
-
const groupId =
|
|
5155
|
+
const errorId = React19.useId();
|
|
5156
|
+
const groupId = React19.useId();
|
|
4963
5157
|
const hasError = errorMessage != null;
|
|
4964
5158
|
const labelFirst = labelPosition === "left";
|
|
4965
5159
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5059,11 +5253,11 @@ function Switch({
|
|
|
5059
5253
|
disabled,
|
|
5060
5254
|
errorMessage
|
|
5061
5255
|
}) {
|
|
5062
|
-
const id =
|
|
5063
|
-
const errorId =
|
|
5256
|
+
const id = React19.useId();
|
|
5257
|
+
const errorId = React19.useId();
|
|
5064
5258
|
const hasError = errorMessage != null;
|
|
5065
5259
|
const isControlled = checked !== void 0;
|
|
5066
|
-
const [internal, setInternal] =
|
|
5260
|
+
const [internal, setInternal] = React19.useState(defaultChecked);
|
|
5067
5261
|
const isOn = isControlled ? checked : internal;
|
|
5068
5262
|
const handle = (c) => {
|
|
5069
5263
|
if (!isControlled) setInternal(c);
|
|
@@ -5136,19 +5330,19 @@ function AutoComplete({
|
|
|
5136
5330
|
required,
|
|
5137
5331
|
htmlFor
|
|
5138
5332
|
}) {
|
|
5139
|
-
const errorId =
|
|
5333
|
+
const errorId = React19.useId();
|
|
5140
5334
|
const hasError = errorMessage != null;
|
|
5141
|
-
const [term, setTerm] =
|
|
5142
|
-
const [open, setOpen] =
|
|
5143
|
-
const [asyncItems, setAsyncItems] =
|
|
5144
|
-
const [loading, setLoading] =
|
|
5335
|
+
const [term, setTerm] = React19.useState("");
|
|
5336
|
+
const [open, setOpen] = React19.useState(false);
|
|
5337
|
+
const [asyncItems, setAsyncItems] = React19.useState([]);
|
|
5338
|
+
const [loading, setLoading] = React19.useState(false);
|
|
5145
5339
|
const isAsync = typeof onSearch === "function";
|
|
5146
|
-
const debounceRef =
|
|
5147
|
-
const requestIdRef =
|
|
5340
|
+
const debounceRef = React19.useRef(null);
|
|
5341
|
+
const requestIdRef = React19.useRef(0);
|
|
5148
5342
|
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
5149
5343
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
5150
5344
|
) : [];
|
|
5151
|
-
|
|
5345
|
+
React19.useEffect(() => {
|
|
5152
5346
|
if (!isAsync) return;
|
|
5153
5347
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
5154
5348
|
if (!term.trim()) {
|
|
@@ -5304,15 +5498,15 @@ function TreeSelect({
|
|
|
5304
5498
|
defaultExpandedKeys = [],
|
|
5305
5499
|
size = "md"
|
|
5306
5500
|
}) {
|
|
5307
|
-
const errorId =
|
|
5501
|
+
const errorId = React19.useId();
|
|
5308
5502
|
const hasError = errorMessage != null;
|
|
5309
|
-
const [open, setOpen] =
|
|
5310
|
-
const [expanded, setExpanded] =
|
|
5311
|
-
const [activeIndex, setActiveIndex] =
|
|
5312
|
-
const listRef =
|
|
5313
|
-
const visible =
|
|
5314
|
-
const didSyncOnOpenRef =
|
|
5315
|
-
|
|
5503
|
+
const [open, setOpen] = React19.useState(false);
|
|
5504
|
+
const [expanded, setExpanded] = React19.useState(() => new Set(defaultExpandedKeys));
|
|
5505
|
+
const [activeIndex, setActiveIndex] = React19.useState(0);
|
|
5506
|
+
const listRef = React19.useRef(null);
|
|
5507
|
+
const visible = React19.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
|
|
5508
|
+
const didSyncOnOpenRef = React19.useRef(false);
|
|
5509
|
+
React19.useEffect(() => {
|
|
5316
5510
|
if (!open) {
|
|
5317
5511
|
didSyncOnOpenRef.current = false;
|
|
5318
5512
|
return;
|
|
@@ -5322,7 +5516,7 @@ function TreeSelect({
|
|
|
5322
5516
|
setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
|
|
5323
5517
|
didSyncOnOpenRef.current = true;
|
|
5324
5518
|
}, [open, value]);
|
|
5325
|
-
const selectedNode =
|
|
5519
|
+
const selectedNode = React19.useMemo(
|
|
5326
5520
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
5327
5521
|
[items, value]
|
|
5328
5522
|
);
|
|
@@ -5553,11 +5747,11 @@ function FileInput({
|
|
|
5553
5747
|
required,
|
|
5554
5748
|
icon
|
|
5555
5749
|
}) {
|
|
5556
|
-
const inputRef =
|
|
5557
|
-
const errorId =
|
|
5558
|
-
const [files, setFiles] =
|
|
5559
|
-
const [dragging, setDragging] =
|
|
5560
|
-
const [sizeError, setSizeError] =
|
|
5750
|
+
const inputRef = React19.useRef(null);
|
|
5751
|
+
const errorId = React19.useId();
|
|
5752
|
+
const [files, setFiles] = React19.useState([]);
|
|
5753
|
+
const [dragging, setDragging] = React19.useState(false);
|
|
5754
|
+
const [sizeError, setSizeError] = React19.useState(null);
|
|
5561
5755
|
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
5562
5756
|
const openPicker = () => {
|
|
5563
5757
|
if (!disabled) inputRef.current?.click();
|
|
@@ -5703,18 +5897,18 @@ function addDays(d, n) {
|
|
|
5703
5897
|
c.setDate(c.getDate() + n);
|
|
5704
5898
|
return c;
|
|
5705
5899
|
}
|
|
5706
|
-
function
|
|
5900
|
+
function addMonths2(d, n) {
|
|
5707
5901
|
const c = new Date(d);
|
|
5708
5902
|
c.setMonth(c.getMonth() + n);
|
|
5709
5903
|
return c;
|
|
5710
5904
|
}
|
|
5711
|
-
function
|
|
5905
|
+
function defaultFormat2(d) {
|
|
5712
5906
|
const y = d.getFullYear().toString().padStart(4, "0");
|
|
5713
5907
|
const m = (d.getMonth() + 1).toString().padStart(2, "0");
|
|
5714
5908
|
const day = d.getDate().toString().padStart(2, "0");
|
|
5715
5909
|
return `${y}-${m}-${day}`;
|
|
5716
5910
|
}
|
|
5717
|
-
function
|
|
5911
|
+
function buildGrid2(viewMonth, weekStartsOn) {
|
|
5718
5912
|
const first = startOfMonth(viewMonth);
|
|
5719
5913
|
const startOffset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
5720
5914
|
const gridStart = addDays(first, -startOffset);
|
|
@@ -5742,36 +5936,36 @@ function DatePicker({
|
|
|
5742
5936
|
min,
|
|
5743
5937
|
max,
|
|
5744
5938
|
style,
|
|
5745
|
-
format =
|
|
5939
|
+
format = defaultFormat2,
|
|
5746
5940
|
weekStartsOn = 0,
|
|
5747
5941
|
clearable = true,
|
|
5748
5942
|
size = "md",
|
|
5749
5943
|
className = ""
|
|
5750
5944
|
}) {
|
|
5751
|
-
const errorId =
|
|
5945
|
+
const errorId = React19.useId();
|
|
5752
5946
|
const hasError = errorMessage != null;
|
|
5753
|
-
const [open, setOpen] =
|
|
5754
|
-
const [viewMonth, setViewMonth] =
|
|
5755
|
-
const [focusDate, setFocusDate] =
|
|
5756
|
-
const [view, setView] =
|
|
5757
|
-
const gridRef =
|
|
5758
|
-
|
|
5947
|
+
const [open, setOpen] = React19.useState(false);
|
|
5948
|
+
const [viewMonth, setViewMonth] = React19.useState(() => startOfMonth(value ?? /* @__PURE__ */ new Date()));
|
|
5949
|
+
const [focusDate, setFocusDate] = React19.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
5950
|
+
const [view, setView] = React19.useState("days");
|
|
5951
|
+
const gridRef = React19.useRef(null);
|
|
5952
|
+
React19.useEffect(() => {
|
|
5759
5953
|
if (!open) return;
|
|
5760
5954
|
const target = value ?? /* @__PURE__ */ new Date();
|
|
5761
5955
|
setViewMonth(startOfMonth(target));
|
|
5762
5956
|
setFocusDate(target);
|
|
5763
5957
|
setView("days");
|
|
5764
5958
|
}, [open, value]);
|
|
5765
|
-
|
|
5959
|
+
React19.useEffect(() => {
|
|
5766
5960
|
if (!open) return;
|
|
5767
|
-
const cell = gridRef.current?.querySelector(`[data-day="${
|
|
5961
|
+
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat2(focusDate)}"]`);
|
|
5768
5962
|
cell?.focus();
|
|
5769
5963
|
}, [open, focusDate]);
|
|
5770
|
-
const weekdays =
|
|
5964
|
+
const weekdays = React19.useMemo(() => {
|
|
5771
5965
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5772
5966
|
return ordered;
|
|
5773
5967
|
}, [weekStartsOn]);
|
|
5774
|
-
const grid =
|
|
5968
|
+
const grid = React19.useMemo(() => buildGrid2(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5775
5969
|
const isDisabled = (d) => {
|
|
5776
5970
|
if (min && d < min) return true;
|
|
5777
5971
|
if (max && d > max) return true;
|
|
@@ -5802,14 +5996,14 @@ function DatePicker({
|
|
|
5802
5996
|
next(7);
|
|
5803
5997
|
} else if (e.key === "PageUp") {
|
|
5804
5998
|
e.preventDefault();
|
|
5805
|
-
const nm =
|
|
5999
|
+
const nm = addMonths2(viewMonth, -1);
|
|
5806
6000
|
setViewMonth(nm);
|
|
5807
|
-
setFocusDate((d) =>
|
|
6001
|
+
setFocusDate((d) => addMonths2(d, -1));
|
|
5808
6002
|
} else if (e.key === "PageDown") {
|
|
5809
6003
|
e.preventDefault();
|
|
5810
|
-
const nm =
|
|
6004
|
+
const nm = addMonths2(viewMonth, 1);
|
|
5811
6005
|
setViewMonth(nm);
|
|
5812
|
-
setFocusDate((d) =>
|
|
6006
|
+
setFocusDate((d) => addMonths2(d, 1));
|
|
5813
6007
|
} else if (e.key === "Home") {
|
|
5814
6008
|
e.preventDefault();
|
|
5815
6009
|
const dow = (focusDate.getDay() - weekStartsOn + 7) % 7;
|
|
@@ -5874,7 +6068,7 @@ function DatePicker({
|
|
|
5874
6068
|
{
|
|
5875
6069
|
type: "button",
|
|
5876
6070
|
onClick: () => {
|
|
5877
|
-
if (view === "days") setViewMonth(
|
|
6071
|
+
if (view === "days") setViewMonth(addMonths2(viewMonth, -1));
|
|
5878
6072
|
else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() - 1, viewMonth.getMonth(), 1));
|
|
5879
6073
|
else setViewMonth(new Date(viewMonth.getFullYear() - 10, viewMonth.getMonth(), 1));
|
|
5880
6074
|
},
|
|
@@ -5909,7 +6103,7 @@ function DatePicker({
|
|
|
5909
6103
|
{
|
|
5910
6104
|
type: "button",
|
|
5911
6105
|
onClick: () => {
|
|
5912
|
-
if (view === "days") setViewMonth(
|
|
6106
|
+
if (view === "days") setViewMonth(addMonths2(viewMonth, 1));
|
|
5913
6107
|
else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() + 1, viewMonth.getMonth(), 1));
|
|
5914
6108
|
else setViewMonth(new Date(viewMonth.getFullYear() + 10, viewMonth.getMonth(), 1));
|
|
5915
6109
|
},
|
|
@@ -5976,8 +6170,8 @@ function DatePicker({
|
|
|
5976
6170
|
type: "button",
|
|
5977
6171
|
disabled: dis,
|
|
5978
6172
|
tabIndex: focused ? 0 : -1,
|
|
5979
|
-
"data-day":
|
|
5980
|
-
"aria-label":
|
|
6173
|
+
"data-day": defaultFormat2(date),
|
|
6174
|
+
"aria-label": defaultFormat2(date),
|
|
5981
6175
|
"aria-selected": sel || void 0,
|
|
5982
6176
|
onClick: () => selectDate(date),
|
|
5983
6177
|
className: [
|
|
@@ -5988,7 +6182,7 @@ function DatePicker({
|
|
|
5988
6182
|
].join(" "),
|
|
5989
6183
|
children: date.getDate()
|
|
5990
6184
|
}
|
|
5991
|
-
) },
|
|
6185
|
+
) }, defaultFormat2(date));
|
|
5992
6186
|
}) }, ri)) })
|
|
5993
6187
|
]
|
|
5994
6188
|
}
|
|
@@ -6061,10 +6255,10 @@ function TextArea({
|
|
|
6061
6255
|
style,
|
|
6062
6256
|
inputStyle
|
|
6063
6257
|
}) {
|
|
6064
|
-
const errorId =
|
|
6258
|
+
const errorId = React19.useId();
|
|
6065
6259
|
const hasError = errorMessage != null;
|
|
6066
|
-
const ref =
|
|
6067
|
-
|
|
6260
|
+
const ref = React19.useRef(null);
|
|
6261
|
+
React19.useLayoutEffect(() => {
|
|
6068
6262
|
if (!autoGrow) return;
|
|
6069
6263
|
const el = ref.current;
|
|
6070
6264
|
if (!el) return;
|
|
@@ -6134,11 +6328,11 @@ function SegmentedControl({
|
|
|
6134
6328
|
"aria-label": ariaLabel
|
|
6135
6329
|
}) {
|
|
6136
6330
|
const sz = SIZE5[size];
|
|
6137
|
-
const groupId =
|
|
6138
|
-
const errorId =
|
|
6331
|
+
const groupId = React19.useId();
|
|
6332
|
+
const errorId = React19.useId();
|
|
6139
6333
|
const hasError = errorMessage != null;
|
|
6140
6334
|
const isControlled = value !== void 0;
|
|
6141
|
-
const [internal, setInternal] =
|
|
6335
|
+
const [internal, setInternal] = React19.useState(defaultValue);
|
|
6142
6336
|
const current = isControlled ? value : internal;
|
|
6143
6337
|
const handle = (v) => {
|
|
6144
6338
|
if (!v) return;
|
|
@@ -6232,14 +6426,14 @@ function Slider({
|
|
|
6232
6426
|
name,
|
|
6233
6427
|
htmlFor
|
|
6234
6428
|
}) {
|
|
6235
|
-
const errorId =
|
|
6429
|
+
const errorId = React19.useId();
|
|
6236
6430
|
const hasError = errorMessage != null;
|
|
6237
6431
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
6238
|
-
const [internal, setInternal] =
|
|
6432
|
+
const [internal, setInternal] = React19.useState(
|
|
6239
6433
|
() => toArray(value) ?? toArray(defaultValue) ?? [min]
|
|
6240
6434
|
);
|
|
6241
6435
|
const current = toArray(value) ?? internal;
|
|
6242
|
-
const [dragging, setDragging] =
|
|
6436
|
+
const [dragging, setDragging] = React19.useState(false);
|
|
6243
6437
|
const emit = (arr) => {
|
|
6244
6438
|
setInternal(arr);
|
|
6245
6439
|
const next = isRange ? [arr[0], arr[1]] : arr[0];
|
|
@@ -6334,11 +6528,11 @@ function TagsInput({
|
|
|
6334
6528
|
validate,
|
|
6335
6529
|
separators = ["Enter", ","]
|
|
6336
6530
|
}) {
|
|
6337
|
-
const errorId =
|
|
6338
|
-
const inputRef =
|
|
6339
|
-
const [internal, setInternal] =
|
|
6340
|
-
const [draft, setDraft] =
|
|
6341
|
-
const [localError, setLocalError] =
|
|
6531
|
+
const errorId = React19.useId();
|
|
6532
|
+
const inputRef = React19.useRef(null);
|
|
6533
|
+
const [internal, setInternal] = React19.useState(defaultValue ?? []);
|
|
6534
|
+
const [draft, setDraft] = React19.useState("");
|
|
6535
|
+
const [localError, setLocalError] = React19.useState(null);
|
|
6342
6536
|
const tags = value ?? internal;
|
|
6343
6537
|
const hasError = errorMessage != null || localError != null;
|
|
6344
6538
|
const errorText = errorMessage ?? localError ?? void 0;
|
|
@@ -6469,9 +6663,9 @@ function OtpInput({
|
|
|
6469
6663
|
className,
|
|
6470
6664
|
groupAfter
|
|
6471
6665
|
}) {
|
|
6472
|
-
const errorId =
|
|
6666
|
+
const errorId = React19.useId();
|
|
6473
6667
|
const hasError = errorMessage != null;
|
|
6474
|
-
const refs =
|
|
6668
|
+
const refs = React19.useRef([]);
|
|
6475
6669
|
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
6476
6670
|
const pattern = mode === "numeric" ? /[0-9]/ : /[a-zA-Z0-9]/;
|
|
6477
6671
|
const emit = (next) => {
|
|
@@ -6520,7 +6714,7 @@ function OtpInput({
|
|
|
6520
6714
|
emit(valid.join(""));
|
|
6521
6715
|
focusBox(valid.length);
|
|
6522
6716
|
};
|
|
6523
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", role: "group", "aria-label": typeof label === "string" ? label : "One-time code", children: chars.map((char, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6717
|
+
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(React19__default.default.Fragment, { children: [
|
|
6524
6718
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6525
6719
|
"input",
|
|
6526
6720
|
{
|
|
@@ -6578,9 +6772,9 @@ function Rating({
|
|
|
6578
6772
|
className,
|
|
6579
6773
|
required
|
|
6580
6774
|
}) {
|
|
6581
|
-
const errorId =
|
|
6582
|
-
const [internal, setInternal] =
|
|
6583
|
-
const [hover, setHover] =
|
|
6775
|
+
const errorId = React19.useId();
|
|
6776
|
+
const [internal, setInternal] = React19.useState(defaultValue);
|
|
6777
|
+
const [hover, setHover] = React19.useState(null);
|
|
6584
6778
|
const current = value ?? internal;
|
|
6585
6779
|
const display2 = hover ?? current;
|
|
6586
6780
|
const interactive = !readOnly && !disabled;
|
|
@@ -6703,9 +6897,9 @@ function TimePicker({
|
|
|
6703
6897
|
required,
|
|
6704
6898
|
style
|
|
6705
6899
|
}) {
|
|
6706
|
-
const errorId =
|
|
6900
|
+
const errorId = React19.useId();
|
|
6707
6901
|
const hasError = errorMessage != null;
|
|
6708
|
-
const [open, setOpen] =
|
|
6902
|
+
const [open, setOpen] = React19.useState(false);
|
|
6709
6903
|
const parsed = parse(value) ?? { h: 0, m: 0, s: 0 };
|
|
6710
6904
|
const update = (next) => {
|
|
6711
6905
|
const merged = { ...parsed, ...next };
|
|
@@ -6791,16 +6985,16 @@ function TimePicker({
|
|
|
6791
6985
|
var MONTH_NAMES2 = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
6792
6986
|
var WEEKDAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
6793
6987
|
var startOfMonth2 = (d) => new Date(d.getFullYear(), d.getMonth(), 1);
|
|
6794
|
-
var
|
|
6988
|
+
var addMonths3 = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
6795
6989
|
var addDays2 = (d, n) => {
|
|
6796
6990
|
const c = new Date(d);
|
|
6797
6991
|
c.setDate(c.getDate() + n);
|
|
6798
6992
|
return c;
|
|
6799
6993
|
};
|
|
6800
6994
|
var isSameDay2 = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
6801
|
-
var
|
|
6995
|
+
var startOfDay2 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
6802
6996
|
var defaultFmt = (d) => `${d.getFullYear()}-${`${d.getMonth() + 1}`.padStart(2, "0")}-${`${d.getDate()}`.padStart(2, "0")}`;
|
|
6803
|
-
function
|
|
6997
|
+
function buildGrid3(viewMonth, weekStartsOn) {
|
|
6804
6998
|
const first = startOfMonth2(viewMonth);
|
|
6805
6999
|
const offset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
6806
7000
|
const gridStart = addDays2(first, -offset);
|
|
@@ -6829,23 +7023,23 @@ function DateRangePicker({
|
|
|
6829
7023
|
required,
|
|
6830
7024
|
style
|
|
6831
7025
|
}) {
|
|
6832
|
-
const errorId =
|
|
7026
|
+
const errorId = React19.useId();
|
|
6833
7027
|
const hasError = errorMessage != null;
|
|
6834
|
-
const [open, setOpen] =
|
|
6835
|
-
const [leftMonth, setLeftMonth] =
|
|
6836
|
-
const [pendingStart, setPendingStart] =
|
|
6837
|
-
const [hoverDate, setHoverDate] =
|
|
6838
|
-
const weekdays =
|
|
7028
|
+
const [open, setOpen] = React19.useState(false);
|
|
7029
|
+
const [leftMonth, setLeftMonth] = React19.useState(() => startOfMonth2(value.start ?? /* @__PURE__ */ new Date()));
|
|
7030
|
+
const [pendingStart, setPendingStart] = React19.useState(null);
|
|
7031
|
+
const [hoverDate, setHoverDate] = React19.useState(null);
|
|
7032
|
+
const weekdays = React19.useMemo(
|
|
6839
7033
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6840
7034
|
[weekStartsOn]
|
|
6841
7035
|
);
|
|
6842
|
-
const isDisabled = (d) => min && d <
|
|
7036
|
+
const isDisabled = (d) => min && d < startOfDay2(min) || max && d > startOfDay2(max);
|
|
6843
7037
|
const effective = pendingStart ? { start: pendingStart, end: hoverDate } : value;
|
|
6844
7038
|
const inRange = (d) => {
|
|
6845
7039
|
const { start, end } = effective;
|
|
6846
7040
|
if (!start || !end) return false;
|
|
6847
7041
|
const [a, b] = start <= end ? [start, end] : [end, start];
|
|
6848
|
-
return d >=
|
|
7042
|
+
return d >= startOfDay2(a) && d <= startOfDay2(b);
|
|
6849
7043
|
};
|
|
6850
7044
|
const onDayClick = (d) => {
|
|
6851
7045
|
if (isDisabled(d)) return;
|
|
@@ -6863,7 +7057,7 @@ function DateRangePicker({
|
|
|
6863
7057
|
};
|
|
6864
7058
|
const triggerText = value.start && value.end ? `${format(value.start)} \u2013 ${format(value.end)}` : value.start ? `${format(value.start)} \u2013 \u2026` : "";
|
|
6865
7059
|
const renderMonth = (viewMonth) => {
|
|
6866
|
-
const cells =
|
|
7060
|
+
const cells = buildGrid3(viewMonth, weekStartsOn);
|
|
6867
7061
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6868
7062
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm font-semibold text-center mb-2 select-none", children: [
|
|
6869
7063
|
MONTH_NAMES2[viewMonth.getMonth()],
|
|
@@ -6952,7 +7146,7 @@ function DateRangePicker({
|
|
|
6952
7146
|
"button",
|
|
6953
7147
|
{
|
|
6954
7148
|
type: "button",
|
|
6955
|
-
onClick: () => setLeftMonth(
|
|
7149
|
+
onClick: () => setLeftMonth(addMonths3(leftMonth, -1)),
|
|
6956
7150
|
"aria-label": "Previous month",
|
|
6957
7151
|
className: "absolute -top-1 left-0 w-7 h-7 inline-flex items-center justify-center rounded-md hover:bg-surface-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
6958
7152
|
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19l-7-7 7-7" }) })
|
|
@@ -6965,13 +7159,13 @@ function DateRangePicker({
|
|
|
6965
7159
|
"button",
|
|
6966
7160
|
{
|
|
6967
7161
|
type: "button",
|
|
6968
|
-
onClick: () => setLeftMonth(
|
|
7162
|
+
onClick: () => setLeftMonth(addMonths3(leftMonth, 1)),
|
|
6969
7163
|
"aria-label": "Next month",
|
|
6970
7164
|
className: "absolute -top-1 right-0 w-7 h-7 inline-flex items-center justify-center rounded-md hover:bg-surface-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
6971
7165
|
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) })
|
|
6972
7166
|
}
|
|
6973
7167
|
),
|
|
6974
|
-
renderMonth(
|
|
7168
|
+
renderMonth(addMonths3(leftMonth, 1))
|
|
6975
7169
|
] })
|
|
6976
7170
|
] })
|
|
6977
7171
|
]
|
|
@@ -7011,10 +7205,10 @@ function ColorPicker({
|
|
|
7011
7205
|
required,
|
|
7012
7206
|
placeholder = "Pick a colour\u2026"
|
|
7013
7207
|
}) {
|
|
7014
|
-
const errorId =
|
|
7208
|
+
const errorId = React19.useId();
|
|
7015
7209
|
const hasError = errorMessage != null;
|
|
7016
|
-
const [open, setOpen] =
|
|
7017
|
-
const [draft, setDraft] =
|
|
7210
|
+
const [open, setOpen] = React19.useState(false);
|
|
7211
|
+
const [draft, setDraft] = React19.useState(value);
|
|
7018
7212
|
const valid = HEX_RE.test(value);
|
|
7019
7213
|
const pick = (hex) => {
|
|
7020
7214
|
onChange?.(hex);
|
|
@@ -7401,11 +7595,11 @@ function buildBindings(store, name, kind, snap) {
|
|
|
7401
7595
|
|
|
7402
7596
|
// src/form/useForm.ts
|
|
7403
7597
|
function useForm(options = {}) {
|
|
7404
|
-
const ref =
|
|
7598
|
+
const ref = React19.useRef(null);
|
|
7405
7599
|
if (ref.current === null) ref.current = new FormStore(options);
|
|
7406
7600
|
const store = ref.current;
|
|
7407
|
-
|
|
7408
|
-
const make =
|
|
7601
|
+
React19.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7602
|
+
const make = React19.useCallback(
|
|
7409
7603
|
(kind) => (name, rules) => {
|
|
7410
7604
|
if (rules !== void 0) store.setRule(name, rules);
|
|
7411
7605
|
return buildBindings(store, name, kind, store.getFieldSnapshot(name));
|
|
@@ -7434,9 +7628,9 @@ function useForm(options = {}) {
|
|
|
7434
7628
|
fieldTarget: make("target")
|
|
7435
7629
|
};
|
|
7436
7630
|
}
|
|
7437
|
-
var FormContext =
|
|
7631
|
+
var FormContext = React19.createContext(null);
|
|
7438
7632
|
function useFormStore() {
|
|
7439
|
-
const store =
|
|
7633
|
+
const store = React19.useContext(FormContext);
|
|
7440
7634
|
if (!store) {
|
|
7441
7635
|
throw new Error("useFormStore must be used within a <Form>. Did you forget to wrap your fields?");
|
|
7442
7636
|
}
|
|
@@ -7450,8 +7644,8 @@ function Form({
|
|
|
7450
7644
|
children,
|
|
7451
7645
|
...rest
|
|
7452
7646
|
}) {
|
|
7453
|
-
const ref =
|
|
7454
|
-
const bypass =
|
|
7647
|
+
const ref = React19.useRef(null);
|
|
7648
|
+
const bypass = React19.useRef(false);
|
|
7455
7649
|
const handleSubmit = async (e) => {
|
|
7456
7650
|
if (bypass.current) {
|
|
7457
7651
|
bypass.current = false;
|
|
@@ -7503,12 +7697,12 @@ function useFormField(name, options = {}) {
|
|
|
7503
7697
|
const store = useFormStore();
|
|
7504
7698
|
const { kind = "value", rules } = options;
|
|
7505
7699
|
if (rules !== void 0 && store.getRule(name) !== rules) store.setRule(name, rules);
|
|
7506
|
-
|
|
7700
|
+
React19.useEffect(() => {
|
|
7507
7701
|
return () => {
|
|
7508
7702
|
if (rules !== void 0) store.removeRule(name);
|
|
7509
7703
|
};
|
|
7510
7704
|
}, [store, name]);
|
|
7511
|
-
const snap =
|
|
7705
|
+
const snap = React19.useSyncExternalStore(
|
|
7512
7706
|
store.subscribe,
|
|
7513
7707
|
() => store.getFieldSnapshot(name)
|
|
7514
7708
|
);
|
|
@@ -7520,7 +7714,7 @@ function FormField({ name, kind, rules, children }) {
|
|
|
7520
7714
|
}
|
|
7521
7715
|
function useFieldArray(name) {
|
|
7522
7716
|
const store = useFormStore();
|
|
7523
|
-
|
|
7717
|
+
React19.useSyncExternalStore(store.subscribe, store.getRootSnapshot, store.getRootSnapshot);
|
|
7524
7718
|
const arr = store.getValue(name) ?? [];
|
|
7525
7719
|
const keys = store.getKeys(name);
|
|
7526
7720
|
return {
|
|
@@ -7643,7 +7837,7 @@ function CreditCardForm({
|
|
|
7643
7837
|
className = "",
|
|
7644
7838
|
style
|
|
7645
7839
|
}) {
|
|
7646
|
-
const initial =
|
|
7840
|
+
const initial = React19.useRef({
|
|
7647
7841
|
number: formatCardNumber(defaultValue?.number ?? ""),
|
|
7648
7842
|
name: defaultValue?.name ?? "",
|
|
7649
7843
|
expiry: formatExpiry(defaultValue?.expiry ?? ""),
|
|
@@ -7652,7 +7846,7 @@ function CreditCardForm({
|
|
|
7652
7846
|
const form = useForm({ initialValues: initial });
|
|
7653
7847
|
const numberStr = String(form.values.number ?? "");
|
|
7654
7848
|
const brand = detectBrand(numberStr);
|
|
7655
|
-
|
|
7849
|
+
React19.useEffect(() => {
|
|
7656
7850
|
onChange?.(toCard(form.values));
|
|
7657
7851
|
}, [form.values.number, form.values.name, form.values.expiry, form.values.cvv]);
|
|
7658
7852
|
const numberBind = form.fieldNative("number", {
|
|
@@ -7759,8 +7953,10 @@ exports.Box = Box;
|
|
|
7759
7953
|
exports.Breadcrumbs = Breadcrumbs;
|
|
7760
7954
|
exports.Button = Button;
|
|
7761
7955
|
exports.CARD_BRANDS = CARD_BRANDS;
|
|
7956
|
+
exports.Calendar = Calendar2;
|
|
7762
7957
|
exports.Card = Card_default;
|
|
7763
7958
|
exports.CardCarousel = CardCarousel;
|
|
7959
|
+
exports.Cart = Cart;
|
|
7764
7960
|
exports.Catalog = Catalog;
|
|
7765
7961
|
exports.CatalogCarousel = CatalogCarousel;
|
|
7766
7962
|
exports.CatalogGrid = CatalogGrid;
|