@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.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';
|
|
@@ -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);
|
|
@@ -1999,6 +1999,200 @@ function PopConfirm({
|
|
|
1999
1999
|
) })
|
|
2000
2000
|
] });
|
|
2001
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
|
+
}
|
|
2121
|
+
var defaultFormat = (v) => `${v < 0 ? "-" : ""}$${Math.abs(v).toFixed(2)}`;
|
|
2122
|
+
var Stepper = ({
|
|
2123
|
+
quantity,
|
|
2124
|
+
max,
|
|
2125
|
+
onChange
|
|
2126
|
+
}) => {
|
|
2127
|
+
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";
|
|
2128
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center rounded-md border border-border overflow-hidden", children: [
|
|
2129
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Decrease quantity", disabled: quantity <= 1, onClick: () => onChange?.(quantity - 1), className: btn, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", d: "M5 12h14" }) }) }),
|
|
2130
|
+
/* @__PURE__ */ jsx("span", { className: "w-8 text-center text-sm tabular-nums text-foreground select-none", children: quantity }),
|
|
2131
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Increase quantity", disabled: max != null && quantity >= max, onClick: () => onChange?.(quantity + 1), className: btn, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", d: "M12 5v14M5 12h14" }) }) })
|
|
2132
|
+
] });
|
|
2133
|
+
};
|
|
2134
|
+
function Cart({
|
|
2135
|
+
items,
|
|
2136
|
+
onQuantityChange,
|
|
2137
|
+
onRemove,
|
|
2138
|
+
summaryRows = [],
|
|
2139
|
+
formatPrice = defaultFormat,
|
|
2140
|
+
checkoutLabel = "Checkout",
|
|
2141
|
+
onCheckout,
|
|
2142
|
+
emptyState,
|
|
2143
|
+
className = "",
|
|
2144
|
+
style
|
|
2145
|
+
}) {
|
|
2146
|
+
const subtotal = items.reduce((sum, it) => sum + it.price * it.quantity, 0);
|
|
2147
|
+
const total = subtotal + summaryRows.reduce((sum, r) => sum + r.value, 0);
|
|
2148
|
+
return /* @__PURE__ */ jsxs("div", { className: ["flex flex-col rounded-xl border border-border bg-surface", className].filter(Boolean).join(" "), style, children: [
|
|
2149
|
+
items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-8 text-center text-sm text-foreground-muted", children: emptyState ?? "Your cart is empty." }) : /* @__PURE__ */ jsx("ul", { className: "divide-y divide-border", children: items.map((it) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3 p-3", children: [
|
|
2150
|
+
/* @__PURE__ */ jsx("div", { className: "h-14 w-14 flex-shrink-0 overflow-hidden rounded-md bg-surface-raised", children: it.image && /* @__PURE__ */ jsx("img", { src: it.image, alt: "", className: "h-full w-full object-cover" }) }),
|
|
2151
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
2152
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-sm font-medium text-foreground", children: it.name }),
|
|
2153
|
+
it.meta && /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-foreground-muted mt-0.5", children: it.meta }),
|
|
2154
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-center gap-3", children: [
|
|
2155
|
+
/* @__PURE__ */ jsx(Stepper, { quantity: it.quantity, max: it.max, onChange: (q) => onQuantityChange?.(it.id, Math.max(1, q)) }),
|
|
2156
|
+
onRemove && /* @__PURE__ */ jsx(
|
|
2157
|
+
"button",
|
|
2158
|
+
{
|
|
2159
|
+
type: "button",
|
|
2160
|
+
onClick: () => onRemove(it.id),
|
|
2161
|
+
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",
|
|
2162
|
+
children: "Remove"
|
|
2163
|
+
}
|
|
2164
|
+
)
|
|
2165
|
+
] })
|
|
2166
|
+
] }),
|
|
2167
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 text-sm font-semibold text-foreground tabular-nums", children: formatPrice(it.price * it.quantity) })
|
|
2168
|
+
] }, it.id)) }),
|
|
2169
|
+
items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "border-t border-border p-4", children: [
|
|
2170
|
+
/* @__PURE__ */ jsxs("dl", { className: "space-y-1.5", children: [
|
|
2171
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2172
|
+
/* @__PURE__ */ jsx("dt", { className: "text-foreground-secondary", children: "Subtotal" }),
|
|
2173
|
+
/* @__PURE__ */ jsx("dd", { className: "tabular-nums text-foreground", children: formatPrice(subtotal) })
|
|
2174
|
+
] }),
|
|
2175
|
+
summaryRows.map((r, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2176
|
+
/* @__PURE__ */ jsx("dt", { className: r.muted ? "text-foreground-muted" : "text-foreground-secondary", children: r.label }),
|
|
2177
|
+
/* @__PURE__ */ jsx("dd", { className: `tabular-nums ${r.value < 0 ? "text-status-success" : "text-foreground"}`, children: formatPrice(r.value) })
|
|
2178
|
+
] }, i)),
|
|
2179
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-t border-border pt-2 mt-1 text-base font-semibold", children: [
|
|
2180
|
+
/* @__PURE__ */ jsx("dt", { className: "text-foreground", children: "Total" }),
|
|
2181
|
+
/* @__PURE__ */ jsx("dd", { className: "tabular-nums text-foreground", children: formatPrice(total) })
|
|
2182
|
+
] })
|
|
2183
|
+
] }),
|
|
2184
|
+
onCheckout && /* @__PURE__ */ jsx(
|
|
2185
|
+
"button",
|
|
2186
|
+
{
|
|
2187
|
+
type: "button",
|
|
2188
|
+
onClick: onCheckout,
|
|
2189
|
+
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",
|
|
2190
|
+
children: checkoutLabel
|
|
2191
|
+
}
|
|
2192
|
+
)
|
|
2193
|
+
] })
|
|
2194
|
+
] });
|
|
2195
|
+
}
|
|
2002
2196
|
var NotificationContext = createContext({
|
|
2003
2197
|
open: () => void 0,
|
|
2004
2198
|
close: () => void 0
|
|
@@ -3102,7 +3296,7 @@ function Field({
|
|
|
3102
3296
|
);
|
|
3103
3297
|
}
|
|
3104
3298
|
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" }) });
|
|
3105
|
-
var SearchInput =
|
|
3299
|
+
var SearchInput = React19.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon, helperText, className }, ref) {
|
|
3106
3300
|
return /* @__PURE__ */ jsx(Field, { className, label, htmlFor, layout, helperText, children: /* @__PURE__ */ jsxs(
|
|
3107
3301
|
"div",
|
|
3108
3302
|
{
|
|
@@ -3603,7 +3797,7 @@ function TableBody({
|
|
|
3603
3797
|
return /* @__PURE__ */ jsx("tbody", { children: rows.map((row, i) => {
|
|
3604
3798
|
const rowKey = getRowKey(row, i);
|
|
3605
3799
|
const isExpanded = expanded.has(rowKey);
|
|
3606
|
-
return /* @__PURE__ */ jsxs(
|
|
3800
|
+
return /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
3607
3801
|
/* @__PURE__ */ jsxs(
|
|
3608
3802
|
"tr",
|
|
3609
3803
|
{
|
|
@@ -4147,8 +4341,8 @@ function MegaMenuLink({ href, icon, description, active, onClick, children, clas
|
|
|
4147
4341
|
function MegaMenuFeatured({ children, className = "" }) {
|
|
4148
4342
|
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 });
|
|
4149
4343
|
}
|
|
4150
|
-
var elementsOfType = (children, type) =>
|
|
4151
|
-
(c) =>
|
|
4344
|
+
var elementsOfType = (children, type) => React19.Children.toArray(children).filter(
|
|
4345
|
+
(c) => React19.isValidElement(c) && c.type === type
|
|
4152
4346
|
);
|
|
4153
4347
|
var MOBILE_CHEVRON = /* @__PURE__ */ jsx(
|
|
4154
4348
|
"svg",
|
|
@@ -4185,9 +4379,9 @@ function MobileLinkRow({ link, onNavigate }) {
|
|
|
4185
4379
|
);
|
|
4186
4380
|
}
|
|
4187
4381
|
function MobilePanel({ panel, onNavigate }) {
|
|
4188
|
-
const nodes =
|
|
4382
|
+
const nodes = React19.Children.toArray(panel.props.children);
|
|
4189
4383
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 px-2 pb-3 pt-1", children: nodes.map((node, i) => {
|
|
4190
|
-
if (!
|
|
4384
|
+
if (!React19.isValidElement(node)) return null;
|
|
4191
4385
|
const el = node;
|
|
4192
4386
|
if (el.type === MegaMenuSection) {
|
|
4193
4387
|
const { title, children } = el.props;
|
|
@@ -4480,7 +4674,7 @@ function ThemeProvider({
|
|
|
4480
4674
|
className = "",
|
|
4481
4675
|
style
|
|
4482
4676
|
}) {
|
|
4483
|
-
const id =
|
|
4677
|
+
const id = React19.useId().replace(/:/g, "");
|
|
4484
4678
|
const scopeClass = `geo-th-${id}`;
|
|
4485
4679
|
const divRef = useRef(null);
|
|
4486
4680
|
useEffect(() => {
|
|
@@ -5667,18 +5861,18 @@ function addDays(d, n) {
|
|
|
5667
5861
|
c.setDate(c.getDate() + n);
|
|
5668
5862
|
return c;
|
|
5669
5863
|
}
|
|
5670
|
-
function
|
|
5864
|
+
function addMonths2(d, n) {
|
|
5671
5865
|
const c = new Date(d);
|
|
5672
5866
|
c.setMonth(c.getMonth() + n);
|
|
5673
5867
|
return c;
|
|
5674
5868
|
}
|
|
5675
|
-
function
|
|
5869
|
+
function defaultFormat2(d) {
|
|
5676
5870
|
const y = d.getFullYear().toString().padStart(4, "0");
|
|
5677
5871
|
const m = (d.getMonth() + 1).toString().padStart(2, "0");
|
|
5678
5872
|
const day = d.getDate().toString().padStart(2, "0");
|
|
5679
5873
|
return `${y}-${m}-${day}`;
|
|
5680
5874
|
}
|
|
5681
|
-
function
|
|
5875
|
+
function buildGrid2(viewMonth, weekStartsOn) {
|
|
5682
5876
|
const first = startOfMonth(viewMonth);
|
|
5683
5877
|
const startOffset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
5684
5878
|
const gridStart = addDays(first, -startOffset);
|
|
@@ -5706,7 +5900,7 @@ function DatePicker({
|
|
|
5706
5900
|
min,
|
|
5707
5901
|
max,
|
|
5708
5902
|
style,
|
|
5709
|
-
format =
|
|
5903
|
+
format = defaultFormat2,
|
|
5710
5904
|
weekStartsOn = 0,
|
|
5711
5905
|
clearable = true,
|
|
5712
5906
|
size = "md",
|
|
@@ -5728,14 +5922,14 @@ function DatePicker({
|
|
|
5728
5922
|
}, [open, value]);
|
|
5729
5923
|
useEffect(() => {
|
|
5730
5924
|
if (!open) return;
|
|
5731
|
-
const cell = gridRef.current?.querySelector(`[data-day="${
|
|
5925
|
+
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat2(focusDate)}"]`);
|
|
5732
5926
|
cell?.focus();
|
|
5733
5927
|
}, [open, focusDate]);
|
|
5734
5928
|
const weekdays = useMemo(() => {
|
|
5735
5929
|
const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
|
|
5736
5930
|
return ordered;
|
|
5737
5931
|
}, [weekStartsOn]);
|
|
5738
|
-
const grid = useMemo(() =>
|
|
5932
|
+
const grid = useMemo(() => buildGrid2(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
|
|
5739
5933
|
const isDisabled = (d) => {
|
|
5740
5934
|
if (min && d < min) return true;
|
|
5741
5935
|
if (max && d > max) return true;
|
|
@@ -5766,14 +5960,14 @@ function DatePicker({
|
|
|
5766
5960
|
next(7);
|
|
5767
5961
|
} else if (e.key === "PageUp") {
|
|
5768
5962
|
e.preventDefault();
|
|
5769
|
-
const nm =
|
|
5963
|
+
const nm = addMonths2(viewMonth, -1);
|
|
5770
5964
|
setViewMonth(nm);
|
|
5771
|
-
setFocusDate((d) =>
|
|
5965
|
+
setFocusDate((d) => addMonths2(d, -1));
|
|
5772
5966
|
} else if (e.key === "PageDown") {
|
|
5773
5967
|
e.preventDefault();
|
|
5774
|
-
const nm =
|
|
5968
|
+
const nm = addMonths2(viewMonth, 1);
|
|
5775
5969
|
setViewMonth(nm);
|
|
5776
|
-
setFocusDate((d) =>
|
|
5970
|
+
setFocusDate((d) => addMonths2(d, 1));
|
|
5777
5971
|
} else if (e.key === "Home") {
|
|
5778
5972
|
e.preventDefault();
|
|
5779
5973
|
const dow = (focusDate.getDay() - weekStartsOn + 7) % 7;
|
|
@@ -5838,7 +6032,7 @@ function DatePicker({
|
|
|
5838
6032
|
{
|
|
5839
6033
|
type: "button",
|
|
5840
6034
|
onClick: () => {
|
|
5841
|
-
if (view === "days") setViewMonth(
|
|
6035
|
+
if (view === "days") setViewMonth(addMonths2(viewMonth, -1));
|
|
5842
6036
|
else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() - 1, viewMonth.getMonth(), 1));
|
|
5843
6037
|
else setViewMonth(new Date(viewMonth.getFullYear() - 10, viewMonth.getMonth(), 1));
|
|
5844
6038
|
},
|
|
@@ -5873,7 +6067,7 @@ function DatePicker({
|
|
|
5873
6067
|
{
|
|
5874
6068
|
type: "button",
|
|
5875
6069
|
onClick: () => {
|
|
5876
|
-
if (view === "days") setViewMonth(
|
|
6070
|
+
if (view === "days") setViewMonth(addMonths2(viewMonth, 1));
|
|
5877
6071
|
else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() + 1, viewMonth.getMonth(), 1));
|
|
5878
6072
|
else setViewMonth(new Date(viewMonth.getFullYear() + 10, viewMonth.getMonth(), 1));
|
|
5879
6073
|
},
|
|
@@ -5940,8 +6134,8 @@ function DatePicker({
|
|
|
5940
6134
|
type: "button",
|
|
5941
6135
|
disabled: dis,
|
|
5942
6136
|
tabIndex: focused ? 0 : -1,
|
|
5943
|
-
"data-day":
|
|
5944
|
-
"aria-label":
|
|
6137
|
+
"data-day": defaultFormat2(date),
|
|
6138
|
+
"aria-label": defaultFormat2(date),
|
|
5945
6139
|
"aria-selected": sel || void 0,
|
|
5946
6140
|
onClick: () => selectDate(date),
|
|
5947
6141
|
className: [
|
|
@@ -5952,7 +6146,7 @@ function DatePicker({
|
|
|
5952
6146
|
].join(" "),
|
|
5953
6147
|
children: date.getDate()
|
|
5954
6148
|
}
|
|
5955
|
-
) },
|
|
6149
|
+
) }, defaultFormat2(date));
|
|
5956
6150
|
}) }, ri)) })
|
|
5957
6151
|
]
|
|
5958
6152
|
}
|
|
@@ -6484,7 +6678,7 @@ function OtpInput({
|
|
|
6484
6678
|
emit(valid.join(""));
|
|
6485
6679
|
focusBox(valid.length);
|
|
6486
6680
|
};
|
|
6487
|
-
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(
|
|
6681
|
+
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: [
|
|
6488
6682
|
/* @__PURE__ */ jsx(
|
|
6489
6683
|
"input",
|
|
6490
6684
|
{
|
|
@@ -6755,16 +6949,16 @@ function TimePicker({
|
|
|
6755
6949
|
var MONTH_NAMES2 = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
6756
6950
|
var WEEKDAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
6757
6951
|
var startOfMonth2 = (d) => new Date(d.getFullYear(), d.getMonth(), 1);
|
|
6758
|
-
var
|
|
6952
|
+
var addMonths3 = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
6759
6953
|
var addDays2 = (d, n) => {
|
|
6760
6954
|
const c = new Date(d);
|
|
6761
6955
|
c.setDate(c.getDate() + n);
|
|
6762
6956
|
return c;
|
|
6763
6957
|
};
|
|
6764
6958
|
var isSameDay2 = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
6765
|
-
var
|
|
6959
|
+
var startOfDay2 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
6766
6960
|
var defaultFmt = (d) => `${d.getFullYear()}-${`${d.getMonth() + 1}`.padStart(2, "0")}-${`${d.getDate()}`.padStart(2, "0")}`;
|
|
6767
|
-
function
|
|
6961
|
+
function buildGrid3(viewMonth, weekStartsOn) {
|
|
6768
6962
|
const first = startOfMonth2(viewMonth);
|
|
6769
6963
|
const offset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
6770
6964
|
const gridStart = addDays2(first, -offset);
|
|
@@ -6803,13 +6997,13 @@ function DateRangePicker({
|
|
|
6803
6997
|
() => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
|
|
6804
6998
|
[weekStartsOn]
|
|
6805
6999
|
);
|
|
6806
|
-
const isDisabled = (d) => min && d <
|
|
7000
|
+
const isDisabled = (d) => min && d < startOfDay2(min) || max && d > startOfDay2(max);
|
|
6807
7001
|
const effective = pendingStart ? { start: pendingStart, end: hoverDate } : value;
|
|
6808
7002
|
const inRange = (d) => {
|
|
6809
7003
|
const { start, end } = effective;
|
|
6810
7004
|
if (!start || !end) return false;
|
|
6811
7005
|
const [a, b] = start <= end ? [start, end] : [end, start];
|
|
6812
|
-
return d >=
|
|
7006
|
+
return d >= startOfDay2(a) && d <= startOfDay2(b);
|
|
6813
7007
|
};
|
|
6814
7008
|
const onDayClick = (d) => {
|
|
6815
7009
|
if (isDisabled(d)) return;
|
|
@@ -6827,7 +7021,7 @@ function DateRangePicker({
|
|
|
6827
7021
|
};
|
|
6828
7022
|
const triggerText = value.start && value.end ? `${format(value.start)} \u2013 ${format(value.end)}` : value.start ? `${format(value.start)} \u2013 \u2026` : "";
|
|
6829
7023
|
const renderMonth = (viewMonth) => {
|
|
6830
|
-
const cells =
|
|
7024
|
+
const cells = buildGrid3(viewMonth, weekStartsOn);
|
|
6831
7025
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6832
7026
|
/* @__PURE__ */ jsxs("div", { className: "text-sm font-semibold text-center mb-2 select-none", children: [
|
|
6833
7027
|
MONTH_NAMES2[viewMonth.getMonth()],
|
|
@@ -6916,7 +7110,7 @@ function DateRangePicker({
|
|
|
6916
7110
|
"button",
|
|
6917
7111
|
{
|
|
6918
7112
|
type: "button",
|
|
6919
|
-
onClick: () => setLeftMonth(
|
|
7113
|
+
onClick: () => setLeftMonth(addMonths3(leftMonth, -1)),
|
|
6920
7114
|
"aria-label": "Previous month",
|
|
6921
7115
|
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",
|
|
6922
7116
|
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" }) })
|
|
@@ -6929,13 +7123,13 @@ function DateRangePicker({
|
|
|
6929
7123
|
"button",
|
|
6930
7124
|
{
|
|
6931
7125
|
type: "button",
|
|
6932
|
-
onClick: () => setLeftMonth(
|
|
7126
|
+
onClick: () => setLeftMonth(addMonths3(leftMonth, 1)),
|
|
6933
7127
|
"aria-label": "Next month",
|
|
6934
7128
|
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",
|
|
6935
7129
|
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" }) })
|
|
6936
7130
|
}
|
|
6937
7131
|
),
|
|
6938
|
-
renderMonth(
|
|
7132
|
+
renderMonth(addMonths3(leftMonth, 1))
|
|
6939
7133
|
] })
|
|
6940
7134
|
] })
|
|
6941
7135
|
]
|
|
@@ -7698,6 +7892,6 @@ function CreditCardForm({
|
|
|
7698
7892
|
);
|
|
7699
7893
|
}
|
|
7700
7894
|
|
|
7701
|
-
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, 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 };
|
|
7895
|
+
export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Box, Breadcrumbs, Button, CARD_BRANDS, Calendar2 as Calendar, Card_default as Card, CardCarousel, Cart, 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 };
|
|
7702
7896
|
//# sourceMappingURL=index.js.map
|
|
7703
7897
|
//# sourceMappingURL=index.js.map
|