@geomak/ui 6.9.0 → 6.11.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 +419 -222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +226 -31
- package/dist/index.js.map +1 -1
- package/dist/styles.css +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { colors_default } from './chunk-GKXP6OJJ.js';
|
|
2
2
|
export { colors_default as COLORS, PALETTE as palette, semanticTokens, vars } from './chunk-GKXP6OJJ.js';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import
|
|
4
|
+
import React19, { createContext, useState, useEffect, useMemo, useId, useCallback, useRef, useContext, useLayoutEffect, useSyncExternalStore } from 'react';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
7
7
|
import * as Dialog from '@radix-ui/react-dialog';
|
|
@@ -9,8 +9,8 @@ import { useReducedMotion, AnimatePresence, motion } from 'framer-motion';
|
|
|
9
9
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
10
10
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
11
11
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
12
|
-
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
13
12
|
import * as Popover from '@radix-ui/react-popover';
|
|
13
|
+
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
14
14
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
15
15
|
import * as NavigationMenu from '@radix-ui/react-navigation-menu';
|
|
16
16
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
@@ -1630,7 +1630,7 @@ function Kbd({
|
|
|
1630
1630
|
style
|
|
1631
1631
|
}) {
|
|
1632
1632
|
if (keys && keys.length > 0) {
|
|
1633
|
-
return /* @__PURE__ */ jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxs(
|
|
1633
|
+
return /* @__PURE__ */ jsx("span", { className: ["inline-flex items-center gap-1", className].filter(Boolean).join(" "), style, children: keys.map((k, i) => /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
1634
1634
|
i > 0 && /* @__PURE__ */ jsx("span", { className: "text-foreground-muted text-xs select-none", children: separator }),
|
|
1635
1635
|
/* @__PURE__ */ jsx("kbd", { className: [cap, SIZE3[size]].join(" "), children: k })
|
|
1636
1636
|
] }, `${k}-${i}`)) });
|
|
@@ -1704,7 +1704,7 @@ function CardCarousel({
|
|
|
1704
1704
|
style
|
|
1705
1705
|
}) {
|
|
1706
1706
|
const scrollerRef = useRef(null);
|
|
1707
|
-
const slides =
|
|
1707
|
+
const slides = React19.Children.toArray(children);
|
|
1708
1708
|
const [active, setActive] = useState(0);
|
|
1709
1709
|
const [atStart, setAtStart] = useState(true);
|
|
1710
1710
|
const [atEnd, setAtEnd] = useState(false);
|
|
@@ -1923,6 +1923,201 @@ function FAB({
|
|
|
1923
1923
|
}
|
|
1924
1924
|
);
|
|
1925
1925
|
}
|
|
1926
|
+
function PopConfirm({
|
|
1927
|
+
children,
|
|
1928
|
+
title,
|
|
1929
|
+
description,
|
|
1930
|
+
onConfirm,
|
|
1931
|
+
onCancel,
|
|
1932
|
+
confirmText = "Confirm",
|
|
1933
|
+
cancelText = "Cancel",
|
|
1934
|
+
tone = "default",
|
|
1935
|
+
icon,
|
|
1936
|
+
side = "top",
|
|
1937
|
+
open,
|
|
1938
|
+
onOpenChange,
|
|
1939
|
+
className = ""
|
|
1940
|
+
}) {
|
|
1941
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
1942
|
+
const [loading, setLoading] = useState(false);
|
|
1943
|
+
const isOpen = open ?? uncontrolledOpen;
|
|
1944
|
+
const setOpen = (next) => {
|
|
1945
|
+
onOpenChange?.(next);
|
|
1946
|
+
if (open === void 0) setUncontrolledOpen(next);
|
|
1947
|
+
};
|
|
1948
|
+
const handleConfirm = async () => {
|
|
1949
|
+
try {
|
|
1950
|
+
setLoading(true);
|
|
1951
|
+
await onConfirm?.();
|
|
1952
|
+
setOpen(false);
|
|
1953
|
+
} finally {
|
|
1954
|
+
setLoading(false);
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
const handleCancel = () => {
|
|
1958
|
+
onCancel?.();
|
|
1959
|
+
setOpen(false);
|
|
1960
|
+
};
|
|
1961
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { open: isOpen, onOpenChange: (o) => o ? setOpen(true) : handleCancel(), children: [
|
|
1962
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children }),
|
|
1963
|
+
/* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1964
|
+
Popover.Content,
|
|
1965
|
+
{
|
|
1966
|
+
side,
|
|
1967
|
+
sideOffset: 8,
|
|
1968
|
+
collisionPadding: 12,
|
|
1969
|
+
className: [
|
|
1970
|
+
"z-[400] w-64 rounded-lg border border-border bg-surface p-3.5 shadow-lg",
|
|
1971
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
1972
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
1973
|
+
className
|
|
1974
|
+
].filter(Boolean).join(" "),
|
|
1975
|
+
children: [
|
|
1976
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2.5", children: [
|
|
1977
|
+
icon && /* @__PURE__ */ jsx("span", { className: `mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center ${tone === "danger" ? "text-status-error" : "text-status-warning"}`, children: icon }),
|
|
1978
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
1979
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-foreground", children: title }),
|
|
1980
|
+
description && /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-foreground-secondary leading-snug", children: description })
|
|
1981
|
+
] })
|
|
1982
|
+
] }),
|
|
1983
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex justify-end gap-2", children: [
|
|
1984
|
+
/* @__PURE__ */ jsx(Button, { content: cancelText, size: "sm", variant: "ghost", onClick: handleCancel }),
|
|
1985
|
+
/* @__PURE__ */ jsx(
|
|
1986
|
+
Button,
|
|
1987
|
+
{
|
|
1988
|
+
content: confirmText,
|
|
1989
|
+
size: "sm",
|
|
1990
|
+
variant: tone === "danger" ? "danger" : "primary",
|
|
1991
|
+
loading,
|
|
1992
|
+
onClick: handleConfirm
|
|
1993
|
+
}
|
|
1994
|
+
)
|
|
1995
|
+
] }),
|
|
1996
|
+
/* @__PURE__ */ jsx(Popover.Arrow, { className: "fill-surface" })
|
|
1997
|
+
]
|
|
1998
|
+
}
|
|
1999
|
+
) })
|
|
2000
|
+
] });
|
|
2001
|
+
}
|
|
2002
|
+
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
2003
|
+
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
2004
|
+
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
2005
|
+
var sameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
2006
|
+
var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
2007
|
+
function buildGrid(month, weekStartsOn) {
|
|
2008
|
+
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
|
2009
|
+
const offset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
2010
|
+
const start = new Date(first);
|
|
2011
|
+
start.setDate(first.getDate() - offset);
|
|
2012
|
+
return Array.from({ length: 42 }, (_, i) => {
|
|
2013
|
+
const d = new Date(start);
|
|
2014
|
+
d.setDate(start.getDate() + i);
|
|
2015
|
+
return d;
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
var NavIcon = ({ dir }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", className: "h-4 w-4", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: dir === "left" ? "M15 19l-7-7 7-7" : "M9 5l7 7-7 7" }) });
|
|
2019
|
+
function Calendar2({
|
|
2020
|
+
value,
|
|
2021
|
+
onChange,
|
|
2022
|
+
month,
|
|
2023
|
+
defaultMonth,
|
|
2024
|
+
onMonthChange,
|
|
2025
|
+
events,
|
|
2026
|
+
min,
|
|
2027
|
+
max,
|
|
2028
|
+
weekStartsOn = 0,
|
|
2029
|
+
className = "",
|
|
2030
|
+
style
|
|
2031
|
+
}) {
|
|
2032
|
+
const today = useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
2033
|
+
const [internalMonth, setInternalMonth] = useState(() => month ?? defaultMonth ?? value ?? today);
|
|
2034
|
+
const visible = month ?? internalMonth;
|
|
2035
|
+
const setMonth = (next) => {
|
|
2036
|
+
onMonthChange?.(next);
|
|
2037
|
+
if (month === void 0) setInternalMonth(next);
|
|
2038
|
+
};
|
|
2039
|
+
const grid = useMemo(() => buildGrid(visible, weekStartsOn), [visible, weekStartsOn]);
|
|
2040
|
+
const weekdays = useMemo(() => Array.from({ length: 7 }, (_, i) => WEEKDAYS[(i + weekStartsOn) % 7]), [weekStartsOn]);
|
|
2041
|
+
const eventsByDay = useMemo(() => {
|
|
2042
|
+
const map = /* @__PURE__ */ new Map();
|
|
2043
|
+
for (const ev of events ?? []) {
|
|
2044
|
+
const key = startOfDay(ev.date).toDateString();
|
|
2045
|
+
const arr = map.get(key) ?? [];
|
|
2046
|
+
arr.push(ev);
|
|
2047
|
+
map.set(key, arr);
|
|
2048
|
+
}
|
|
2049
|
+
return map;
|
|
2050
|
+
}, [events]);
|
|
2051
|
+
const disabled = (d) => min && d < startOfDay(min) || max && d > startOfDay(max);
|
|
2052
|
+
return /* @__PURE__ */ jsxs("div", { className: ["inline-block rounded-lg border border-border bg-surface p-3 select-none", className].filter(Boolean).join(" "), style, children: [
|
|
2053
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between px-1", children: [
|
|
2054
|
+
/* @__PURE__ */ jsx(
|
|
2055
|
+
"button",
|
|
2056
|
+
{
|
|
2057
|
+
type: "button",
|
|
2058
|
+
"aria-label": "Previous month",
|
|
2059
|
+
onClick: () => setMonth(addMonths(visible, -1)),
|
|
2060
|
+
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",
|
|
2061
|
+
children: /* @__PURE__ */ jsx(NavIcon, { dir: "left" })
|
|
2062
|
+
}
|
|
2063
|
+
),
|
|
2064
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm font-semibold text-foreground", "aria-live": "polite", children: [
|
|
2065
|
+
MONTHS[visible.getMonth()],
|
|
2066
|
+
" ",
|
|
2067
|
+
visible.getFullYear()
|
|
2068
|
+
] }),
|
|
2069
|
+
/* @__PURE__ */ jsx(
|
|
2070
|
+
"button",
|
|
2071
|
+
{
|
|
2072
|
+
type: "button",
|
|
2073
|
+
"aria-label": "Next month",
|
|
2074
|
+
onClick: () => setMonth(addMonths(visible, 1)),
|
|
2075
|
+
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",
|
|
2076
|
+
children: /* @__PURE__ */ jsx(NavIcon, { dir: "right" })
|
|
2077
|
+
}
|
|
2078
|
+
)
|
|
2079
|
+
] }),
|
|
2080
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 mb-1", children: weekdays.map((w) => /* @__PURE__ */ jsx("div", { className: "text-center text-[11px] font-medium uppercase tracking-wide text-foreground-muted py-1", children: w }, w)) }),
|
|
2081
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-0.5", role: "grid", children: grid.map((d, i) => {
|
|
2082
|
+
const inMonth = d.getMonth() === visible.getMonth();
|
|
2083
|
+
const isSelected = value != null && sameDay(d, value);
|
|
2084
|
+
const isToday = sameDay(d, today);
|
|
2085
|
+
const isDisabled = disabled(d);
|
|
2086
|
+
const dayEvents = eventsByDay.get(d.toDateString()) ?? [];
|
|
2087
|
+
return /* @__PURE__ */ jsxs(
|
|
2088
|
+
"button",
|
|
2089
|
+
{
|
|
2090
|
+
type: "button",
|
|
2091
|
+
role: "gridcell",
|
|
2092
|
+
"aria-selected": isSelected,
|
|
2093
|
+
"aria-current": isToday ? "date" : void 0,
|
|
2094
|
+
disabled: isDisabled,
|
|
2095
|
+
onClick: () => onChange?.(startOfDay(d)),
|
|
2096
|
+
className: [
|
|
2097
|
+
"relative flex h-9 w-9 flex-col items-center justify-center rounded-md text-sm transition-colors",
|
|
2098
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
2099
|
+
isSelected ? "bg-accent text-accent-fg font-semibold" : inMonth ? "text-foreground hover:bg-surface-raised" : "text-foreground-muted hover:bg-surface-raised",
|
|
2100
|
+
isDisabled ? "opacity-40 cursor-not-allowed hover:bg-transparent" : "",
|
|
2101
|
+
!isSelected && isToday ? "ring-1 ring-inset ring-accent/60" : ""
|
|
2102
|
+
].filter(Boolean).join(" "),
|
|
2103
|
+
children: [
|
|
2104
|
+
/* @__PURE__ */ jsx("span", { className: "leading-none", children: d.getDate() }),
|
|
2105
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsx("span", { className: "absolute bottom-1 flex gap-0.5", children: dayEvents.slice(0, 3).map((ev, j) => /* @__PURE__ */ jsx(
|
|
2106
|
+
"span",
|
|
2107
|
+
{
|
|
2108
|
+
title: ev.label,
|
|
2109
|
+
className: "h-1 w-1 rounded-full",
|
|
2110
|
+
style: { backgroundColor: ev.color ?? (isSelected ? "var(--color-accent-fg)" : "var(--color-accent)") }
|
|
2111
|
+
},
|
|
2112
|
+
j
|
|
2113
|
+
)) })
|
|
2114
|
+
]
|
|
2115
|
+
},
|
|
2116
|
+
i
|
|
2117
|
+
);
|
|
2118
|
+
}) })
|
|
2119
|
+
] });
|
|
2120
|
+
}
|
|
1926
2121
|
var NotificationContext = createContext({
|
|
1927
2122
|
open: () => void 0,
|
|
1928
2123
|
close: () => void 0
|
|
@@ -3026,7 +3221,7 @@ function Field({
|
|
|
3026
3221
|
);
|
|
3027
3222
|
}
|
|
3028
3223
|
var SearchIcon = /* @__PURE__ */ 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__ */ 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" }) });
|
|
3029
|
-
var SearchInput =
|
|
3224
|
+
var SearchInput = React19.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
3030
3225
|
return /* @__PURE__ */ jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxs(
|
|
3031
3226
|
"div",
|
|
3032
3227
|
{
|
|
@@ -3527,7 +3722,7 @@ function TableBody({
|
|
|
3527
3722
|
return /* @__PURE__ */ jsx("tbody", { children: rows.map((row, i) => {
|
|
3528
3723
|
const rowKey = getRowKey(row, i);
|
|
3529
3724
|
const isExpanded = expanded.has(rowKey);
|
|
3530
|
-
return /* @__PURE__ */ jsxs(
|
|
3725
|
+
return /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
3531
3726
|
/* @__PURE__ */ jsxs(
|
|
3532
3727
|
"tr",
|
|
3533
3728
|
{
|
|
@@ -4071,8 +4266,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
4071
4266
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
4072
4267
|
return /* @__PURE__ */ jsx("div", { className: ["min-w-0 rounded-lg bg-surface-raised border border-border p-4 flex flex-col", className].filter(Boolean).join(" "), children });
|
|
4073
4268
|
}
|
|
4074
|
-
var elementsOfType = (children, type) =>
|
|
4075
|
-
(c) =>
|
|
4269
|
+
var elementsOfType = (children, type) => React19.Children.toArray(children).filter(
|
|
4270
|
+
(c) => React19.isValidElement(c) && c.type === type
|
|
4076
4271
|
);
|
|
4077
4272
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsx(
|
|
4078
4273
|
"svg",
|
|
@@ -4109,9 +4304,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
4109
4304
|
);
|
|
4110
4305
|
}
|
|
4111
4306
|
function MobilePanel({ panel, onNavigate }) {
|
|
4112
|
-
const nodes =
|
|
4307
|
+
const nodes = React19.Children.toArray(panel.props.children);
|
|
4113
4308
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
4114
|
-
if (!
|
|
4309
|
+
if (!React19.isValidElement(node)) return null;
|
|
4115
4310
|
const el = node;
|
|
4116
4311
|
if (el.type === MegaMenuSection) {
|
|
4117
4312
|
const { title, children } = el.props;
|
|
@@ -4404,7 +4599,7 @@ function ThemeProvider({
|
|
|
4404
4599
|
className = "",
|
|
4405
4600
|
style
|
|
4406
4601
|
}) {
|
|
4407
|
-
const id =
|
|
4602
|
+
const id = React19.useId().replace(/:/g, "");
|
|
4408
4603
|
const scopeClass = `geo-th-${id}`;
|
|
4409
4604
|
const divRef = useRef(null);
|
|
4410
4605
|
useEffect(() => {
|
|
@@ -5591,7 +5786,7 @@ function addDays(d, n) {
|
|
|
5591
5786
|
c.setDate(c.getDate() + n);
|
|
5592
5787
|
return c;
|
|
5593
5788
|
}
|
|
5594
|
-
function
|
|
5789
|
+
function addMonths2(d, n) {
|
|
5595
5790
|
const c = new Date(d);
|
|
5596
5791
|
c.setMonth(c.getMonth() + n);
|
|
5597
5792
|
return c;
|
|
@@ -5602,7 +5797,7 @@ function defaultFormat(d) {
|
|
|
5602
5797
|
const day = d.getDate().toString().padStart(2, "0");
|
|
5603
5798
|
return `${y}-${m}-${day}`;
|
|
5604
5799
|
}
|
|
5605
|
-
function
|
|
5800
|
+
function buildGrid2(viewMonth, weekStartsOn) {
|
|
5606
5801
|
const first = startOfMonth(viewMonth);
|
|
5607
5802
|
const startOffset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
5608
5803
|
const gridStart = addDays(first, -startOffset);
|
|
@@ -5659,7 +5854,7 @@ function DatePicker({
|
|
|
5659
5854
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5660
5855
|
return ordered;
|
|
5661
5856
|
}, [weekStartsOn]);
|
|
5662
|
-
const grid = useMemo(() =>
|
|
5857
|
+
const grid = useMemo(() => buildGrid2(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5663
5858
|
const isDisabled = (d) => {
|
|
5664
5859
|
if (min && d < min) return true;
|
|
5665
5860
|
if (max && d > max) return true;
|
|
@@ -5690,14 +5885,14 @@ function DatePicker({
|
|
|
5690
5885
|
next(7);
|
|
5691
5886
|
} else if (e.key === "PageUp") {
|
|
5692
5887
|
e.preventDefault();
|
|
5693
|
-
const nm =
|
|
5888
|
+
const nm = addMonths2(viewMonth, -1);
|
|
5694
5889
|
setViewMonth(nm);
|
|
5695
|
-
setFocusDate((d) =>
|
|
5890
|
+
setFocusDate((d) => addMonths2(d, -1));
|
|
5696
5891
|
} else if (e.key === "PageDown") {
|
|
5697
5892
|
e.preventDefault();
|
|
5698
|
-
const nm =
|
|
5893
|
+
const nm = addMonths2(viewMonth, 1);
|
|
5699
5894
|
setViewMonth(nm);
|
|
5700
|
-
setFocusDate((d) =>
|
|
5895
|
+
setFocusDate((d) => addMonths2(d, 1));
|
|
5701
5896
|
} else if (e.key === "Home") {
|
|
5702
5897
|
e.preventDefault();
|
|
5703
5898
|
const dow = (focusDate.getDay() - weekStartsOn + 7) % 7;
|
|
@@ -5762,7 +5957,7 @@ function DatePicker({
|
|
|
5762
5957
|
{
|
|
5763
5958
|
type: "button",
|
|
5764
5959
|
onClick: () => {
|
|
5765
|
-
if (view === "days") setViewMonth(
|
|
5960
|
+
if (view === "days") setViewMonth(addMonths2(viewMonth, -1));
|
|
5766
5961
|
else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() - 1, viewMonth.getMonth(), 1));
|
|
5767
5962
|
else setViewMonth(new Date(viewMonth.getFullYear() - 10, viewMonth.getMonth(), 1));
|
|
5768
5963
|
},
|
|
@@ -5797,7 +5992,7 @@ function DatePicker({
|
|
|
5797
5992
|
{
|
|
5798
5993
|
type: "button",
|
|
5799
5994
|
onClick: () => {
|
|
5800
|
-
if (view === "days") setViewMonth(
|
|
5995
|
+
if (view === "days") setViewMonth(addMonths2(viewMonth, 1));
|
|
5801
5996
|
else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() + 1, viewMonth.getMonth(), 1));
|
|
5802
5997
|
else setViewMonth(new Date(viewMonth.getFullYear() + 10, viewMonth.getMonth(), 1));
|
|
5803
5998
|
},
|
|
@@ -6408,7 +6603,7 @@ function OtpInput({
|
|
|
6408
6603
|
emit(valid.join(""));
|
|
6409
6604
|
focusBox(valid.length);
|
|
6410
6605
|
};
|
|
6411
|
-
return /* @__PURE__ */ jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ 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__ */ jsxs(
|
|
6606
|
+
return /* @__PURE__ */ jsx(Field, { className, label, htmlFor, errorId, errorMessage, required, layout, helperText, children: /* @__PURE__ */ 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__ */ jsxs(React19.Fragment, { children: [
|
|
6412
6607
|
/* @__PURE__ */ jsx(
|
|
6413
6608
|
"input",
|
|
6414
6609
|
{
|
|
@@ -6679,16 +6874,16 @@ function TimePicker({
|
|
|
6679
6874
|
var MONTH_NAMES2 = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
6680
6875
|
var WEEKDAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
6681
6876
|
var startOfMonth2 = (d) => new Date(d.getFullYear(), d.getMonth(), 1);
|
|
6682
|
-
var
|
|
6877
|
+
var addMonths3 = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
6683
6878
|
var addDays2 = (d, n) => {
|
|
6684
6879
|
const c = new Date(d);
|
|
6685
6880
|
c.setDate(c.getDate() + n);
|
|
6686
6881
|
return c;
|
|
6687
6882
|
};
|
|
6688
6883
|
var isSameDay2 = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
6689
|
-
var
|
|
6884
|
+
var startOfDay2 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
6690
6885
|
var defaultFmt = (d) => `${d.getFullYear()}-${`${d.getMonth() + 1}`.padStart(2, "0")}-${`${d.getDate()}`.padStart(2, "0")}`;
|
|
6691
|
-
function
|
|
6886
|
+
function buildGrid3(viewMonth, weekStartsOn) {
|
|
6692
6887
|
const first = startOfMonth2(viewMonth);
|
|
6693
6888
|
const offset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
6694
6889
|
const gridStart = addDays2(first, -offset);
|
|
@@ -6727,13 +6922,13 @@ function DateRangePicker({
|
|
|
6727
6922
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6728
6923
|
[weekStartsOn]
|
|
6729
6924
|
);
|
|
6730
|
-
const isDisabled = (d) => min && d <
|
|
6925
|
+
const isDisabled = (d) => min && d < startOfDay2(min) || max && d > startOfDay2(max);
|
|
6731
6926
|
const effective = pendingStart ? { start: pendingStart, end: hoverDate } : value;
|
|
6732
6927
|
const inRange = (d) => {
|
|
6733
6928
|
const { start, end } = effective;
|
|
6734
6929
|
if (!start || !end) return false;
|
|
6735
6930
|
const [a, b] = start <= end ? [start, end] : [end, start];
|
|
6736
|
-
return d >=
|
|
6931
|
+
return d >= startOfDay2(a) && d <= startOfDay2(b);
|
|
6737
6932
|
};
|
|
6738
6933
|
const onDayClick = (d) => {
|
|
6739
6934
|
if (isDisabled(d)) return;
|
|
@@ -6751,7 +6946,7 @@ function DateRangePicker({
|
|
|
6751
6946
|
};
|
|
6752
6947
|
const triggerText = value.start && value.end ? `${format(value.start)} \u2013 ${format(value.end)}` : value.start ? `${format(value.start)} \u2013 \u2026` : "";
|
|
6753
6948
|
const renderMonth = (viewMonth) => {
|
|
6754
|
-
const cells =
|
|
6949
|
+
const cells = buildGrid3(viewMonth, weekStartsOn);
|
|
6755
6950
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6756
6951
|
/* @__PURE__ */ jsxs("div", { className: "text-sm font-semibold text-center mb-2 select-none", children: [
|
|
6757
6952
|
MONTH_NAMES2[viewMonth.getMonth()],
|
|
@@ -6840,7 +7035,7 @@ function DateRangePicker({
|
|
|
6840
7035
|
"button",
|
|
6841
7036
|
{
|
|
6842
7037
|
type: "button",
|
|
6843
|
-
onClick: () => setLeftMonth(
|
|
7038
|
+
onClick: () => setLeftMonth(addMonths3(leftMonth, -1)),
|
|
6844
7039
|
"aria-label": "Previous month",
|
|
6845
7040
|
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",
|
|
6846
7041
|
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19l-7-7 7-7" }) })
|
|
@@ -6853,13 +7048,13 @@ function DateRangePicker({
|
|
|
6853
7048
|
"button",
|
|
6854
7049
|
{
|
|
6855
7050
|
type: "button",
|
|
6856
|
-
onClick: () => setLeftMonth(
|
|
7051
|
+
onClick: () => setLeftMonth(addMonths3(leftMonth, 1)),
|
|
6857
7052
|
"aria-label": "Next month",
|
|
6858
7053
|
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",
|
|
6859
7054
|
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "w-4 h-4", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) })
|
|
6860
7055
|
}
|
|
6861
7056
|
),
|
|
6862
|
-
renderMonth(
|
|
7057
|
+
renderMonth(addMonths3(leftMonth, 1))
|
|
6863
7058
|
] })
|
|
6864
7059
|
] })
|
|
6865
7060
|
]
|
|
@@ -7622,6 +7817,6 @@ function CreditCardForm({
|
|
|
7622
7817
|
);
|
|
7623
7818
|
}
|
|
7624
7819
|
|
|
7625
|
-
export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Box, Breadcrumbs, Button, CARD_BRANDS, Card_default as Card, CardCarousel, Catalog, CatalogCarousel, CatalogGrid, Checkbox, ColorPicker, ContextMenu, CreditCardForm, DateRangePicker, Drawer, Dropdown, FAB, FadingBase, Field, FieldHelpIcon, FieldLabel, FileInput, Flex, Form, FormContext, FormField, FormStore, Grid2 as Grid, GridCard, icons_default as Icon, IconButton, Kbd, List2 as List, LoadingSpinner, MegaMenu_default as MegaMenu, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Password, Portal, RadioGroup, Rating, ScalableContainer, SearchInput_default as SearchInput, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, Slider, Statistic, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Wizard, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useFieldArray, useForm, useFormField, useFormStore, useNotification };
|
|
7820
|
+
export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Box, Breadcrumbs, Button, CARD_BRANDS, Calendar2 as Calendar, Card_default as Card, CardCarousel, Catalog, CatalogCarousel, CatalogGrid, Checkbox, ColorPicker, ContextMenu, CreditCardForm, DateRangePicker, Drawer, Dropdown, FAB, FadingBase, Field, FieldHelpIcon, FieldLabel, FileInput, Flex, Form, FormContext, FormField, FormStore, Grid2 as Grid, GridCard, icons_default as Icon, IconButton, Kbd, List2 as List, LoadingSpinner, MegaMenu_default as MegaMenu, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Password, PopConfirm, Portal, RadioGroup, Rating, ScalableContainer, SearchInput_default as SearchInput, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, Slider, Statistic, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Wizard, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useFieldArray, useForm, useFormField, useFormStore, useNotification };
|
|
7626
7821
|
//# sourceMappingURL=index.js.map
|
|
7627
7822
|
//# sourceMappingURL=index.js.map
|