@geomak/ui 6.28.0 → 6.29.1

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { colors_default } from './chunk-I2P4JJDB.js';
2
2
  export { colors_default as COLORS, PALETTE as palette, semanticTokens, vars } from './chunk-I2P4JJDB.js';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
- import React28, { createContext, useState, useEffect, useMemo, useId, useCallback, useRef, useContext, useSyncExternalStore, useLayoutEffect } from 'react';
4
+ import React28, { createContext, useState, useEffect, useMemo, useId, useCallback, useRef, useLayoutEffect, useContext, useSyncExternalStore } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
7
7
  import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
@@ -470,8 +470,8 @@ function Avatar({
470
470
  if (fallback) return fallback;
471
471
  if (alt) {
472
472
  const parts = alt.trim().split(/\s+/).slice(0, 2);
473
- const initials = parts.map((p) => p[0]?.toUpperCase() ?? "").join("");
474
- if (initials) return initials;
473
+ const initials2 = parts.map((p) => p[0]?.toUpperCase() ?? "").join("");
474
+ if (initials2) return initials2;
475
475
  }
476
476
  return /* @__PURE__ */ jsx(PersonSilhouette, {});
477
477
  })();
@@ -2131,6 +2131,300 @@ function RotatingCarousel({
2131
2131
  }
2132
2132
  );
2133
2133
  }
2134
+ var FIELD_SIZE = {
2135
+ sm: { control: "h-control-sm", text: "text-xs", padX: "px-2.5", gap: "gap-1.5" },
2136
+ md: { control: "h-control-md", text: "text-sm", padX: "px-3", gap: "gap-2" },
2137
+ lg: { control: "h-control-lg", text: "text-sm", padX: "px-3.5", gap: "gap-2.5" }
2138
+ };
2139
+ var FOCUS_WITHIN = "focus-within:outline-none focus-within:border-accent";
2140
+ var FOCUS_ELEMENT = "focus:outline-none focus:border-accent data-[state=open]:border-accent";
2141
+ var FOCUS_WITHIN_ERROR = "focus-within:border-status-error";
2142
+ var FOCUS_ELEMENT_ERROR = "focus:border-status-error data-[state=open]:border-status-error";
2143
+ function fieldShell({
2144
+ size = "md",
2145
+ hasError = false,
2146
+ disabled = false,
2147
+ focusWithin = false,
2148
+ sized = true
2149
+ } = {}) {
2150
+ const s = FIELD_SIZE[size];
2151
+ return [
2152
+ "w-full rounded-lg border bg-surface text-foreground",
2153
+ "transition-[color,box-shadow,border-color] duration-150",
2154
+ s.text,
2155
+ sized ? `${s.control} ${s.padX}` : "",
2156
+ // resting border
2157
+ hasError ? "border-status-error" : "border-border",
2158
+ // hover (only when interactive + no error)
2159
+ disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : hasError ? "" : "hover:border-border-strong",
2160
+ // focus
2161
+ focusWithin ? FOCUS_WITHIN : FOCUS_ELEMENT,
2162
+ hasError ? focusWithin ? FOCUS_WITHIN_ERROR : FOCUS_ELEMENT_ERROR : "",
2163
+ // placeholder colour for native inputs
2164
+ "placeholder:text-foreground-muted"
2165
+ ].filter(Boolean).join(" ");
2166
+ }
2167
+ function FieldHelpIcon({ text }) {
2168
+ return /* @__PURE__ */ jsx(Tooltip, { title: text, placement: "top", children: /* @__PURE__ */ jsx(
2169
+ "button",
2170
+ {
2171
+ type: "button",
2172
+ "aria-label": "More information",
2173
+ className: "inline-flex items-center justify-center rounded-full text-foreground-muted transition-colors hover:text-foreground focus:outline-none focus-visible:text-accent",
2174
+ children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: 1.5, "aria-hidden": "true", children: [
2175
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.25" }),
2176
+ /* @__PURE__ */ jsx("path", { strokeLinecap: "round", d: "M8 7.4v3.4" }),
2177
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "5.1", r: "0.65", fill: "currentColor", stroke: "none" })
2178
+ ] })
2179
+ }
2180
+ ) });
2181
+ }
2182
+ function FieldLabel({
2183
+ label,
2184
+ htmlFor,
2185
+ required,
2186
+ helperText,
2187
+ horizontal = false,
2188
+ align = "start",
2189
+ style,
2190
+ width,
2191
+ className = ""
2192
+ }) {
2193
+ if (label == null && helperText == null) return null;
2194
+ return /* @__PURE__ */ jsxs(
2195
+ "div",
2196
+ {
2197
+ style: { width: horizontal ? width : void 0, ...style },
2198
+ className: [
2199
+ "flex items-center gap-1",
2200
+ horizontal ? "flex-shrink-0 whitespace-nowrap" : "",
2201
+ // Only the 'start' alignment needs the top nudge; 'center' relies
2202
+ // on the row's items-center to line up with a short control.
2203
+ horizontal && align === "start" ? "mt-2" : "",
2204
+ className
2205
+ ].filter(Boolean).join(" "),
2206
+ children: [
2207
+ label != null && /* @__PURE__ */ jsxs("label", { htmlFor, className: "text-sm font-medium text-foreground select-none", children: [
2208
+ label,
2209
+ required && /* @__PURE__ */ jsx("span", { className: "text-status-error ml-0.5", "aria-hidden": "true", children: "*" })
2210
+ ] }),
2211
+ helperText != null && /* @__PURE__ */ jsx(FieldHelpIcon, { text: helperText })
2212
+ ]
2213
+ }
2214
+ );
2215
+ }
2216
+ function Field({
2217
+ label,
2218
+ htmlFor,
2219
+ errorId,
2220
+ errorMessage,
2221
+ layout = "vertical",
2222
+ required,
2223
+ helperText,
2224
+ labelAlign = "start",
2225
+ labelStyle,
2226
+ labelWidth,
2227
+ className = "",
2228
+ children
2229
+ }) {
2230
+ const hasError = errorMessage != null;
2231
+ const horizontal = layout === "horizontal";
2232
+ return /* @__PURE__ */ jsxs(
2233
+ "div",
2234
+ {
2235
+ className: [
2236
+ "flex",
2237
+ horizontal ? `flex-row gap-3 ${labelAlign === "center" ? "items-center" : "items-start"}` : "flex-col gap-1.5",
2238
+ className
2239
+ ].filter(Boolean).join(" "),
2240
+ children: [
2241
+ /* @__PURE__ */ jsx(
2242
+ FieldLabel,
2243
+ {
2244
+ label,
2245
+ htmlFor,
2246
+ required,
2247
+ helperText,
2248
+ horizontal,
2249
+ align: labelAlign,
2250
+ style: labelStyle,
2251
+ width: labelWidth
2252
+ }
2253
+ ),
2254
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
2255
+ children,
2256
+ hasError && /* @__PURE__ */ jsx("div", { id: errorId, className: "text-status-error text-xs mt-1", children: errorMessage })
2257
+ ] })
2258
+ ]
2259
+ }
2260
+ );
2261
+ }
2262
+ var toDate = (d) => d instanceof Date ? d : new Date(d);
2263
+ var timeLabel = (d) => `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
2264
+ var initials = (name) => (name ?? "").trim().split(/\s+/).slice(0, 2).map((w) => w[0]?.toUpperCase() ?? "").join("") || void 0;
2265
+ var SendIcon = () => /* @__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: "M22 2 11 13M22 2l-7 20-4-9-9-4 20-7z" }) });
2266
+ var ArrowDown = () => /* @__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: "M12 5v14M5 12l7 7 7-7" }) });
2267
+ function TypingDots() {
2268
+ return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1", "aria-hidden": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-foreground-muted", style: { animationDelay: `${i * 0.15}s` } }, i)) });
2269
+ }
2270
+ function Chat({
2271
+ messages,
2272
+ currentUserId,
2273
+ onSend,
2274
+ typingNames = [],
2275
+ title,
2276
+ subtitle,
2277
+ avatar,
2278
+ headerActions,
2279
+ placeholder = "Write a message\u2026",
2280
+ disabled = false,
2281
+ hideComposer = false,
2282
+ emptyState,
2283
+ height = 480,
2284
+ className = "",
2285
+ style
2286
+ }) {
2287
+ const listRef = useRef(null);
2288
+ const atBottomRef = useRef(true);
2289
+ const [showJump, setShowJump] = useState(false);
2290
+ const [draft, setDraft] = useState("");
2291
+ const taRef = useRef(null);
2292
+ const hasHeader = title != null || subtitle != null || avatar != null || headerActions != null;
2293
+ const isTyping = typingNames.length > 0;
2294
+ const scrollToBottom = useCallback((smooth = true) => {
2295
+ const el = listRef.current;
2296
+ if (!el) return;
2297
+ if (typeof el.scrollTo === "function") el.scrollTo({ top: el.scrollHeight, behavior: smooth ? "smooth" : "auto" });
2298
+ else el.scrollTop = el.scrollHeight;
2299
+ }, []);
2300
+ const onScroll = () => {
2301
+ const el = listRef.current;
2302
+ if (!el) return;
2303
+ const near = el.scrollHeight - el.scrollTop - el.clientHeight < 80;
2304
+ atBottomRef.current = near;
2305
+ setShowJump(!near);
2306
+ };
2307
+ useEffect(() => {
2308
+ if (atBottomRef.current) scrollToBottom(messages.length > 0);
2309
+ }, [messages.length, isTyping]);
2310
+ useEffect(() => {
2311
+ scrollToBottom(false);
2312
+ }, [scrollToBottom]);
2313
+ useLayoutEffect(() => {
2314
+ const ta = taRef.current;
2315
+ if (!ta) return;
2316
+ ta.style.height = "auto";
2317
+ ta.style.height = `${Math.min(ta.scrollHeight, 120)}px`;
2318
+ }, [draft]);
2319
+ const send = () => {
2320
+ const text = draft.trim();
2321
+ if (!text || disabled) return;
2322
+ onSend?.(text);
2323
+ setDraft("");
2324
+ };
2325
+ const onKeyDown = (e) => {
2326
+ if (e.key === "Enter" && !e.shiftKey) {
2327
+ e.preventDefault();
2328
+ send();
2329
+ }
2330
+ };
2331
+ return /* @__PURE__ */ jsxs(
2332
+ "div",
2333
+ {
2334
+ className: ["flex flex-col overflow-hidden rounded-xl border border-border bg-surface", className].filter(Boolean).join(" "),
2335
+ style: { height, ...style },
2336
+ children: [
2337
+ hasHeader && /* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 items-center gap-3 border-b border-border px-4 py-3", children: [
2338
+ avatar != null && /* @__PURE__ */ jsx(Avatar, { src: avatar, alt: typeof title === "string" ? title : "Conversation", size: "sm" }),
2339
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2340
+ title != null && /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-semibold text-foreground", children: title }),
2341
+ subtitle != null && /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-foreground-muted", children: subtitle })
2342
+ ] }),
2343
+ headerActions != null && /* @__PURE__ */ jsx("div", { className: "flex flex-shrink-0 items-center gap-1", children: headerActions })
2344
+ ] }),
2345
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-1 overflow-hidden", children: [
2346
+ /* @__PURE__ */ jsxs("div", { ref: listRef, onScroll, className: "flex h-full flex-col gap-1 overflow-y-auto bg-background px-4 py-3", children: [
2347
+ messages.length === 0 && !isTyping ? /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center text-center text-sm text-foreground-muted", children: emptyState ?? "No messages yet. Say hello \u{1F44B}" }) : messages.map((m, i) => {
2348
+ const own = m.authorId === currentUserId;
2349
+ const prev = messages[i - 1];
2350
+ const next = messages[i + 1];
2351
+ const firstOfGroup = !prev || prev.authorId !== m.authorId;
2352
+ const lastOfGroup = !next || next.authorId !== m.authorId;
2353
+ const ts = m.timestamp ? toDate(m.timestamp) : null;
2354
+ return /* @__PURE__ */ jsxs("div", { className: ["flex items-end gap-2", own ? "flex-row-reverse" : "", firstOfGroup ? "mt-2 first:mt-0" : ""].filter(Boolean).join(" "), children: [
2355
+ !own && /* @__PURE__ */ jsx("div", { className: "w-7 flex-shrink-0", children: lastOfGroup && /* @__PURE__ */ jsx(Avatar, { src: m.avatar, alt: m.authorName ?? "User", fallback: initials(m.authorName), size: "xs" }) }),
2356
+ /* @__PURE__ */ jsxs("div", { className: ["flex max-w-[78%] flex-col", own ? "items-end" : "items-start"].join(" "), children: [
2357
+ firstOfGroup && !own && m.authorName && /* @__PURE__ */ jsx("span", { className: "mb-0.5 px-1 text-[11px] font-medium text-foreground-muted", children: m.authorName }),
2358
+ /* @__PURE__ */ jsx(
2359
+ "div",
2360
+ {
2361
+ className: [
2362
+ "whitespace-pre-wrap break-words px-3 py-1.5 text-sm leading-snug",
2363
+ own ? "rounded-2xl bg-accent text-accent-fg" : "rounded-2xl border border-border bg-surface text-foreground",
2364
+ lastOfGroup ? own ? "rounded-br-md" : "rounded-bl-md" : ""
2365
+ ].filter(Boolean).join(" "),
2366
+ children: m.text
2367
+ }
2368
+ ),
2369
+ lastOfGroup && (ts || own && m.status) && /* @__PURE__ */ jsxs("span", { className: "mt-0.5 px-1 text-[10px] text-foreground-muted", children: [
2370
+ ts && timeLabel(ts),
2371
+ own && m.status && /* @__PURE__ */ jsxs("span", { className: "ml-1 capitalize", children: [
2372
+ "\xB7 ",
2373
+ m.status
2374
+ ] })
2375
+ ] })
2376
+ ] })
2377
+ ] }, m.id);
2378
+ }),
2379
+ isTyping && /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-end gap-2", children: [
2380
+ /* @__PURE__ */ jsx("div", { className: "w-7 flex-shrink-0" }),
2381
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-2xl rounded-bl-md border border-border bg-surface px-3 py-2", children: [
2382
+ /* @__PURE__ */ jsx(TypingDots, {}),
2383
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-foreground-muted", children: typingNames.length === 1 ? `${typingNames[0]} is typing` : `${typingNames.length} people are typing` })
2384
+ ] })
2385
+ ] })
2386
+ ] }),
2387
+ showJump && /* @__PURE__ */ jsx(
2388
+ "button",
2389
+ {
2390
+ type: "button",
2391
+ onClick: () => scrollToBottom(true),
2392
+ "aria-label": "Jump to latest",
2393
+ className: "absolute bottom-3 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-surface text-foreground-secondary shadow-md transition-colors hover:bg-surface-raised hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
2394
+ children: /* @__PURE__ */ jsx(ArrowDown, {})
2395
+ }
2396
+ )
2397
+ ] }),
2398
+ !hideComposer && /* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 items-end gap-2 border-t border-border p-3", children: [
2399
+ /* @__PURE__ */ jsx(
2400
+ "textarea",
2401
+ {
2402
+ ref: taRef,
2403
+ rows: 1,
2404
+ value: draft,
2405
+ disabled,
2406
+ placeholder,
2407
+ onChange: (e) => setDraft(e.target.value),
2408
+ onKeyDown,
2409
+ "aria-label": "Message",
2410
+ className: `${fieldShell({ size: "md", hasError: false, disabled, sized: false })} max-h-[120px] flex-1 resize-none px-3 py-2 leading-snug`
2411
+ }
2412
+ ),
2413
+ /* @__PURE__ */ jsx(
2414
+ IconButton,
2415
+ {
2416
+ type: "primary",
2417
+ icon: /* @__PURE__ */ jsx(SendIcon, {}),
2418
+ title: "Send",
2419
+ disabled: disabled || draft.trim().length === 0,
2420
+ onClick: send
2421
+ }
2422
+ )
2423
+ ] })
2424
+ ]
2425
+ }
2426
+ );
2427
+ }
2134
2428
  var VALUE_SIZE = {
2135
2429
  sm: "text-xl",
2136
2430
  md: "text-3xl",
@@ -2142,7 +2436,7 @@ var TONE2 = {
2142
2436
  neutral: "text-foreground-muted"
2143
2437
  };
2144
2438
  var ArrowUp = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.2, "aria-hidden": "true", className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 19V5M5 12l7-7 7 7" }) });
2145
- var ArrowDown = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.2, "aria-hidden": "true", className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 5v14M5 12l7 7 7-7" }) });
2439
+ var ArrowDown2 = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.2, "aria-hidden": "true", className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 5v14M5 12l7 7 7-7" }) });
2146
2440
  function Statistic({
2147
2441
  label,
2148
2442
  value,
@@ -2174,7 +2468,7 @@ function Statistic({
2174
2468
  suffix && /* @__PURE__ */ jsx("span", { className: "text-foreground-muted text-[0.5em] font-medium self-center", children: suffix })
2175
2469
  ] }),
2176
2470
  delta && /* @__PURE__ */ jsxs("div", { className: `mt-1.5 flex items-center gap-1 text-sm font-medium ${align === "center" ? "justify-center" : ""} ${TONE2[deltaTone]}`, children: [
2177
- dir === "up" ? ArrowUp : dir === "down" ? ArrowDown : null,
2471
+ dir === "up" ? ArrowUp : dir === "down" ? ArrowDown2 : null,
2178
2472
  /* @__PURE__ */ jsx("span", { children: delta.value }),
2179
2473
  delta.label && /* @__PURE__ */ jsx("span", { className: "text-foreground-muted font-normal", children: delta.label })
2180
2474
  ] }),
@@ -2492,253 +2786,6 @@ function LogoutTimer({
2492
2786
  ] })
2493
2787
  ] }) });
2494
2788
  }
2495
- var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
2496
- var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
2497
- var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
2498
- var sameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
2499
- var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
2500
- function buildGrid(month, weekStartsOn) {
2501
- const first = new Date(month.getFullYear(), month.getMonth(), 1);
2502
- const offset = (first.getDay() - weekStartsOn + 7) % 7;
2503
- const start = new Date(first);
2504
- start.setDate(first.getDate() - offset);
2505
- return Array.from({ length: 42 }, (_, i) => {
2506
- const d = new Date(start);
2507
- d.setDate(start.getDate() + i);
2508
- return d;
2509
- });
2510
- }
2511
- 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" }) });
2512
- function Calendar2({
2513
- value,
2514
- onChange,
2515
- month,
2516
- defaultMonth,
2517
- onMonthChange,
2518
- events,
2519
- min,
2520
- max,
2521
- weekStartsOn = 0,
2522
- className = "",
2523
- style
2524
- }) {
2525
- const today = useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
2526
- const [internalMonth, setInternalMonth] = useState(() => month ?? defaultMonth ?? value ?? today);
2527
- const visible = month ?? internalMonth;
2528
- const setMonth = (next) => {
2529
- onMonthChange?.(next);
2530
- if (month === void 0) setInternalMonth(next);
2531
- };
2532
- const grid = useMemo(() => buildGrid(visible, weekStartsOn), [visible, weekStartsOn]);
2533
- const weekdays = useMemo(() => Array.from({ length: 7 }, (_, i) => WEEKDAYS[(i + weekStartsOn) % 7]), [weekStartsOn]);
2534
- const eventsByDay = useMemo(() => {
2535
- const map = /* @__PURE__ */ new Map();
2536
- for (const ev of events ?? []) {
2537
- const key = startOfDay(ev.date).toDateString();
2538
- const arr = map.get(key) ?? [];
2539
- arr.push(ev);
2540
- map.set(key, arr);
2541
- }
2542
- return map;
2543
- }, [events]);
2544
- const disabled = (d) => min && d < startOfDay(min) || max && d > startOfDay(max);
2545
- return /* @__PURE__ */ jsxs("div", { className: ["inline-block rounded-lg border border-border bg-surface p-3 select-none", className].filter(Boolean).join(" "), style, children: [
2546
- /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between px-1", children: [
2547
- /* @__PURE__ */ jsx(
2548
- "button",
2549
- {
2550
- type: "button",
2551
- "aria-label": "Previous month",
2552
- onClick: () => setMonth(addMonths(visible, -1)),
2553
- 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",
2554
- children: /* @__PURE__ */ jsx(NavIcon, { dir: "left" })
2555
- }
2556
- ),
2557
- /* @__PURE__ */ jsxs("div", { className: "text-sm font-semibold text-foreground", "aria-live": "polite", children: [
2558
- MONTHS[visible.getMonth()],
2559
- " ",
2560
- visible.getFullYear()
2561
- ] }),
2562
- /* @__PURE__ */ jsx(
2563
- "button",
2564
- {
2565
- type: "button",
2566
- "aria-label": "Next month",
2567
- onClick: () => setMonth(addMonths(visible, 1)),
2568
- 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",
2569
- children: /* @__PURE__ */ jsx(NavIcon, { dir: "right" })
2570
- }
2571
- )
2572
- ] }),
2573
- /* @__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)) }),
2574
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-0.5", role: "grid", children: grid.map((d, i) => {
2575
- const inMonth = d.getMonth() === visible.getMonth();
2576
- const isSelected = value != null && sameDay(d, value);
2577
- const isToday2 = sameDay(d, today);
2578
- const isDisabled = disabled(d);
2579
- const dayEvents = eventsByDay.get(d.toDateString()) ?? [];
2580
- return /* @__PURE__ */ jsxs(
2581
- "button",
2582
- {
2583
- type: "button",
2584
- role: "gridcell",
2585
- "aria-selected": isSelected,
2586
- "aria-current": isToday2 ? "date" : void 0,
2587
- disabled: isDisabled,
2588
- onClick: () => onChange?.(startOfDay(d)),
2589
- className: [
2590
- "relative flex h-9 w-9 flex-col items-center justify-center rounded-md text-sm transition-colors",
2591
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
2592
- isSelected ? "bg-accent text-accent-fg font-semibold" : inMonth ? "text-foreground hover:bg-surface-raised" : "text-foreground-muted hover:bg-surface-raised",
2593
- isDisabled ? "opacity-40 cursor-not-allowed hover:bg-transparent" : "",
2594
- !isSelected && isToday2 ? "ring-1 ring-inset ring-accent/60" : ""
2595
- ].filter(Boolean).join(" "),
2596
- children: [
2597
- /* @__PURE__ */ jsx("span", { className: "leading-none", children: d.getDate() }),
2598
- dayEvents.length > 0 && /* @__PURE__ */ jsx("span", { className: "absolute bottom-1 flex gap-0.5", children: dayEvents.slice(0, 3).map((ev, j) => /* @__PURE__ */ jsx(
2599
- "span",
2600
- {
2601
- title: ev.label,
2602
- className: "h-1 w-1 rounded-full",
2603
- style: { backgroundColor: ev.color ?? (isSelected ? "var(--color-accent-fg)" : "var(--color-accent)") }
2604
- },
2605
- j
2606
- )) })
2607
- ]
2608
- },
2609
- i
2610
- );
2611
- }) })
2612
- ] });
2613
- }
2614
- var FIELD_SIZE = {
2615
- sm: { control: "h-control-sm", text: "text-xs", padX: "px-2.5", gap: "gap-1.5" },
2616
- md: { control: "h-control-md", text: "text-sm", padX: "px-3", gap: "gap-2" },
2617
- lg: { control: "h-control-lg", text: "text-sm", padX: "px-3.5", gap: "gap-2.5" }
2618
- };
2619
- var FOCUS_WITHIN = "focus-within:outline-none focus-within:border-accent";
2620
- var FOCUS_ELEMENT = "focus:outline-none focus:border-accent data-[state=open]:border-accent";
2621
- var FOCUS_WITHIN_ERROR = "focus-within:border-status-error";
2622
- var FOCUS_ELEMENT_ERROR = "focus:border-status-error data-[state=open]:border-status-error";
2623
- function fieldShell({
2624
- size = "md",
2625
- hasError = false,
2626
- disabled = false,
2627
- focusWithin = false,
2628
- sized = true
2629
- } = {}) {
2630
- const s = FIELD_SIZE[size];
2631
- return [
2632
- "w-full rounded-lg border bg-surface text-foreground",
2633
- "transition-[color,box-shadow,border-color] duration-150",
2634
- s.text,
2635
- sized ? `${s.control} ${s.padX}` : "",
2636
- // resting border
2637
- hasError ? "border-status-error" : "border-border",
2638
- // hover (only when interactive + no error)
2639
- disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : hasError ? "" : "hover:border-border-strong",
2640
- // focus
2641
- focusWithin ? FOCUS_WITHIN : FOCUS_ELEMENT,
2642
- hasError ? focusWithin ? FOCUS_WITHIN_ERROR : FOCUS_ELEMENT_ERROR : "",
2643
- // placeholder colour for native inputs
2644
- "placeholder:text-foreground-muted"
2645
- ].filter(Boolean).join(" ");
2646
- }
2647
- function FieldHelpIcon({ text }) {
2648
- return /* @__PURE__ */ jsx(Tooltip, { title: text, placement: "top", children: /* @__PURE__ */ jsx(
2649
- "button",
2650
- {
2651
- type: "button",
2652
- "aria-label": "More information",
2653
- className: "inline-flex items-center justify-center rounded-full text-foreground-muted transition-colors hover:text-foreground focus:outline-none focus-visible:text-accent",
2654
- children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: 1.5, "aria-hidden": "true", children: [
2655
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.25" }),
2656
- /* @__PURE__ */ jsx("path", { strokeLinecap: "round", d: "M8 7.4v3.4" }),
2657
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "5.1", r: "0.65", fill: "currentColor", stroke: "none" })
2658
- ] })
2659
- }
2660
- ) });
2661
- }
2662
- function FieldLabel({
2663
- label,
2664
- htmlFor,
2665
- required,
2666
- helperText,
2667
- horizontal = false,
2668
- align = "start",
2669
- style,
2670
- width,
2671
- className = ""
2672
- }) {
2673
- if (label == null && helperText == null) return null;
2674
- return /* @__PURE__ */ jsxs(
2675
- "div",
2676
- {
2677
- style: { width: horizontal ? width : void 0, ...style },
2678
- className: [
2679
- "flex items-center gap-1",
2680
- horizontal ? "flex-shrink-0 whitespace-nowrap" : "",
2681
- // Only the 'start' alignment needs the top nudge; 'center' relies
2682
- // on the row's items-center to line up with a short control.
2683
- horizontal && align === "start" ? "mt-2" : "",
2684
- className
2685
- ].filter(Boolean).join(" "),
2686
- children: [
2687
- label != null && /* @__PURE__ */ jsxs("label", { htmlFor, className: "text-sm font-medium text-foreground select-none", children: [
2688
- label,
2689
- required && /* @__PURE__ */ jsx("span", { className: "text-status-error ml-0.5", "aria-hidden": "true", children: "*" })
2690
- ] }),
2691
- helperText != null && /* @__PURE__ */ jsx(FieldHelpIcon, { text: helperText })
2692
- ]
2693
- }
2694
- );
2695
- }
2696
- function Field({
2697
- label,
2698
- htmlFor,
2699
- errorId,
2700
- errorMessage,
2701
- layout = "vertical",
2702
- required,
2703
- helperText,
2704
- labelAlign = "start",
2705
- labelStyle,
2706
- labelWidth,
2707
- className = "",
2708
- children
2709
- }) {
2710
- const hasError = errorMessage != null;
2711
- const horizontal = layout === "horizontal";
2712
- return /* @__PURE__ */ jsxs(
2713
- "div",
2714
- {
2715
- className: [
2716
- "flex",
2717
- horizontal ? `flex-row gap-3 ${labelAlign === "center" ? "items-center" : "items-start"}` : "flex-col gap-1.5",
2718
- className
2719
- ].filter(Boolean).join(" "),
2720
- children: [
2721
- /* @__PURE__ */ jsx(
2722
- FieldLabel,
2723
- {
2724
- label,
2725
- htmlFor,
2726
- required,
2727
- helperText,
2728
- horizontal,
2729
- align: labelAlign,
2730
- style: labelStyle,
2731
- width: labelWidth
2732
- }
2733
- ),
2734
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
2735
- children,
2736
- hasError && /* @__PURE__ */ jsx("div", { id: errorId, className: "text-status-error text-xs mt-1", children: errorMessage })
2737
- ] })
2738
- ]
2739
- }
2740
- );
2741
- }
2742
2789
  var SIZE5 = {
2743
2790
  sm: { h: "h-control-sm", text: "text-xs", pad: "px-2.5" },
2744
2791
  md: { h: "h-control-md", text: "text-sm", pad: "px-3.5" },
@@ -2837,7 +2884,7 @@ function SegmentedControl({
2837
2884
  }
2838
2885
 
2839
2886
  // src/components/core/scheduler.utils.ts
2840
- var MONTHS2 = [
2887
+ var MONTHS = [
2841
2888
  "January",
2842
2889
  "February",
2843
2890
  "March",
@@ -2851,23 +2898,23 @@ var MONTHS2 = [
2851
2898
  "November",
2852
2899
  "December"
2853
2900
  ];
2854
- var MONTHS_SHORT = MONTHS2.map((m) => m.slice(0, 3));
2855
- var WEEKDAYS2 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
2856
- var toDate = (d) => d instanceof Date ? d : new Date(d);
2857
- var startOfDay2 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
2901
+ var MONTHS_SHORT = MONTHS.map((m) => m.slice(0, 3));
2902
+ var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
2903
+ var toDate2 = (d) => d instanceof Date ? d : new Date(d);
2904
+ var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
2858
2905
  var addDays = (d, n) => {
2859
2906
  const x = new Date(d);
2860
2907
  x.setDate(x.getDate() + n);
2861
2908
  return x;
2862
2909
  };
2863
- var addMonths2 = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
2864
- var sameDay2 = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
2865
- var isToday = (d) => sameDay2(d, /* @__PURE__ */ new Date());
2910
+ var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
2911
+ var sameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
2912
+ var isToday = (d) => sameDay(d, /* @__PURE__ */ new Date());
2866
2913
  var isSameMonth = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
2867
2914
  var startOfMonth = (d) => new Date(d.getFullYear(), d.getMonth(), 1);
2868
2915
  var endOfMonth = (d) => new Date(d.getFullYear(), d.getMonth() + 1, 0);
2869
2916
  var startOfWeek = (d, weekStartsOn) => {
2870
- const x = startOfDay2(d);
2917
+ const x = startOfDay(d);
2871
2918
  const diff = (x.getDay() - weekStartsOn + 7) % 7;
2872
2919
  return addDays(x, -diff);
2873
2920
  };
@@ -2887,12 +2934,12 @@ var weekRange = (cursor, weekStartsOn) => {
2887
2934
  const from = startOfWeek(cursor, weekStartsOn);
2888
2935
  return { from, to: addDays(from, 6) };
2889
2936
  };
2890
- var weekdayLabels = (weekStartsOn) => Array.from({ length: 7 }, (_, i) => WEEKDAYS2[(i + weekStartsOn) % 7]);
2891
- var monthYearLabel = (d) => `${MONTHS2[d.getMonth()]} ${d.getFullYear()}`;
2937
+ var weekdayLabels = (weekStartsOn) => Array.from({ length: 7 }, (_, i) => WEEKDAYS[(i + weekStartsOn) % 7]);
2938
+ var monthYearLabel = (d) => `${MONTHS[d.getMonth()]} ${d.getFullYear()}`;
2892
2939
  var weekLabel = (cursor, weekStartsOn) => {
2893
2940
  const from = startOfWeek(cursor, weekStartsOn);
2894
2941
  const to = addDays(from, 6);
2895
- const m = (d) => MONTHS2[d.getMonth()].slice(0, 3);
2942
+ const m = (d) => MONTHS[d.getMonth()].slice(0, 3);
2896
2943
  if (from.getMonth() === to.getMonth()) {
2897
2944
  return `${m(from)} ${from.getDate()} \u2013 ${to.getDate()}, ${to.getFullYear()}`;
2898
2945
  }
@@ -2901,10 +2948,10 @@ var weekLabel = (cursor, weekStartsOn) => {
2901
2948
  };
2902
2949
  var minutesIntoDay = (d) => d.getHours() * 60 + d.getMinutes();
2903
2950
  var hourLabel = (hour) => `${String(hour).padStart(2, "0")}:00`;
2904
- var timeLabel = (d) => `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
2951
+ var timeLabel2 = (d) => `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
2905
2952
  var normalize = (e) => {
2906
- const start = toDate(e.start);
2907
- const end = e.end ? toDate(e.end) : new Date(start.getTime() + 36e5);
2953
+ const start = toDate2(e.start);
2954
+ const end = e.end ? toDate2(e.end) : new Date(start.getTime() + 36e5);
2908
2955
  return { ...e, start, end };
2909
2956
  };
2910
2957
  var Spinner2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", className: "h-5 w-5 animate-spin text-accent", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.755 10.059a7.5 7.5 0 0112.548-3.364l1.903 1.903h-3.183a.75.75 0 100 1.5h4.992a.75.75 0 00.75-.75V4.356a.75.75 0 00-1.5 0v3.18l-1.9-1.9A9 9 0 003.306 9.67a.75.75 0 101.45.388zm15.408 3.352a.75.75 0 00-.919.53 7.5 7.5 0 01-12.548 3.364l-1.902-1.903h3.183a.75.75 0 000-1.5H2.984a.75.75 0 00-.75.75v4.992a.75.75 0 001.5 0v-3.18l1.9 1.9a9 9 0 0015.059-4.035.75.75 0 00-.53-.918z" }) });
@@ -2968,7 +3015,7 @@ function Scheduler({
2968
3015
  );
2969
3016
  const go = useCallback((delta) => {
2970
3017
  setDir(delta);
2971
- setCursor((c) => view === "month" ? addMonths2(c, delta) : addDays(c, delta * 7));
3018
+ setCursor((c) => view === "month" ? addMonths(c, delta) : addDays(c, delta * 7));
2972
3019
  }, [view]);
2973
3020
  const goToday = useCallback(() => {
2974
3021
  setDir(0);
@@ -3151,7 +3198,7 @@ function MonthView({
3151
3198
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 border-b border-border", children: labels.map((l) => /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-center text-[11px] font-medium uppercase tracking-wide text-foreground-muted", children: l }, l)) }),
3152
3199
  /* @__PURE__ */ jsx("div", { className: "grid flex-1 grid-cols-7 grid-rows-6", children: grid.map((day, i) => {
3153
3200
  const inMonth = isSameMonth(day, cursor);
3154
- const dayEvents = events.filter((e) => sameDay2(e.start, day));
3201
+ const dayEvents = events.filter((e) => sameDay(e.start, day));
3155
3202
  const today = isToday(day);
3156
3203
  return /* @__PURE__ */ jsxs(
3157
3204
  "button",
@@ -3201,7 +3248,7 @@ function EventChip({ event, onSelect }) {
3201
3248
  e.stopPropagation();
3202
3249
  onSelect?.(event);
3203
3250
  },
3204
- title: `${event.title} \xB7 ${timeLabel(event.start)}`,
3251
+ title: `${event.title} \xB7 ${timeLabel2(event.start)}`,
3205
3252
  className: "flex items-center gap-1.5 truncate rounded px-1 py-0.5 text-left text-[11px] font-medium text-foreground hover:opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
3206
3253
  children: [
3207
3254
  /* @__PURE__ */ jsx("span", { className: "h-2 w-2 flex-shrink-0 rounded-full", style: { backgroundColor: color } }),
@@ -3240,7 +3287,7 @@ function WeekView({
3240
3287
  /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "grid", style: { gridTemplateColumns: `3.5rem repeat(7, 1fr)`, height: gridHeight }, children: [
3241
3288
  /* @__PURE__ */ jsx("div", { className: "relative border-r border-border", children: hours.map((h, i) => /* @__PURE__ */ jsx("div", { className: "absolute right-1 -translate-y-1/2 text-[10px] tabular-nums text-foreground-muted", style: { top: i * hourHeight }, children: i === 0 ? "" : hourLabel(h) }, h)) }),
3242
3289
  days.map((day) => {
3243
- const dayEvents = events.filter((e) => sameDay2(e.start, day) && !e.allDay);
3290
+ const dayEvents = events.filter((e) => sameDay(e.start, day) && !e.allDay);
3244
3291
  return /* @__PURE__ */ jsxs("div", { className: "relative border-r border-border last:border-r-0", children: [
3245
3292
  hours.map((h, i) => /* @__PURE__ */ jsx(
3246
3293
  "button",
@@ -3266,7 +3313,7 @@ function WeekView({
3266
3313
  ev.stopPropagation();
3267
3314
  onSelectEvent?.(e);
3268
3315
  },
3269
- title: `${e.title} \xB7 ${timeLabel(e.start)}\u2013${timeLabel(e.end)}`,
3316
+ title: `${e.title} \xB7 ${timeLabel2(e.start)}\u2013${timeLabel2(e.end)}`,
3270
3317
  className: "absolute left-0.5 right-0.5 overflow-hidden rounded-md border px-1.5 py-0.5 text-left text-[11px] leading-tight text-foreground shadow-sm transition-shadow hover:shadow-md focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
3271
3318
  style: {
3272
3319
  top: Math.max(0, top),
@@ -3276,7 +3323,7 @@ function WeekView({
3276
3323
  },
3277
3324
  children: [
3278
3325
  /* @__PURE__ */ jsx("div", { className: "truncate font-medium", children: e.title }),
3279
- /* @__PURE__ */ jsx("div", { className: "truncate", style: { color }, children: timeLabel(e.start) })
3326
+ /* @__PURE__ */ jsx("div", { className: "truncate", style: { color }, children: timeLabel2(e.start) })
3280
3327
  ]
3281
3328
  },
3282
3329
  e.id
@@ -5478,7 +5525,7 @@ function Pagination({
5478
5525
  }, [serverSide, options.perPage, picker]);
5479
5526
  const currentOpt = picker.find((o) => o.key === displayPerPageKey);
5480
5527
  const currentPerPageLabel = currentOpt?.label ?? currentOpt?.value ?? options.perPage ?? "";
5481
- const navBtn = (icon, disabled, onClick, title) => /* @__PURE__ */ jsx(Button_default, { variant: "outline", size: "sm", disabled, onClick, icon, className: "w-7 !px-0 focus-visible:!ring-offset-0", "aria-label": title, title });
5528
+ const navBtn = (icon, disabled, onClick, title) => /* @__PURE__ */ jsx(Button_default, { variant: "outline", size: "sm", disabled, onClick, icon, className: "w-7 !px-0 focus-visible:!ring-[3px] focus-visible:!ring-focus-ring focus-visible:!ring-offset-0", "aria-label": title, title });
5482
5529
  const chevronRight = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
5483
5530
  const doubleChevronRight = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 5l7 7-7 7M5 5l7 7-7 7" }) });
5484
5531
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-end gap-x-4 gap-y-3", children: [
@@ -5490,7 +5537,7 @@ function Pagination({
5490
5537
  variant: "outline",
5491
5538
  size: "sm",
5492
5539
  side: "top",
5493
- className: "focus-visible:!ring-offset-0",
5540
+ className: "focus-visible:!ring-[3px] focus-visible:!ring-focus-ring focus-visible:!ring-offset-0",
5494
5541
  label: String(currentPerPageLabel),
5495
5542
  items: picker.map((o) => ({
5496
5543
  key: o.key,
@@ -7825,7 +7872,7 @@ function addDays2(d, n) {
7825
7872
  c.setDate(c.getDate() + n);
7826
7873
  return c;
7827
7874
  }
7828
- function addMonths3(d, n) {
7875
+ function addMonths2(d, n) {
7829
7876
  const c = new Date(d);
7830
7877
  c.setMonth(c.getMonth() + n);
7831
7878
  return c;
@@ -7836,7 +7883,7 @@ function defaultFormat3(d) {
7836
7883
  const day = d.getDate().toString().padStart(2, "0");
7837
7884
  return `${y}-${m}-${day}`;
7838
7885
  }
7839
- function buildGrid2(viewMonth, weekStartsOn) {
7886
+ function buildGrid(viewMonth, weekStartsOn) {
7840
7887
  const first = startOfMonth2(viewMonth);
7841
7888
  const startOffset = (first.getDay() - weekStartsOn + 7) % 7;
7842
7889
  const gridStart = addDays2(first, -startOffset);
@@ -7893,7 +7940,7 @@ function DatePicker({
7893
7940
  const ordered = WEEKDAY_SHORT.slice(weekStartsOn).concat(WEEKDAY_SHORT.slice(0, weekStartsOn));
7894
7941
  return ordered;
7895
7942
  }, [weekStartsOn]);
7896
- const grid = useMemo(() => buildGrid2(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
7943
+ const grid = useMemo(() => buildGrid(viewMonth, weekStartsOn), [viewMonth, weekStartsOn]);
7897
7944
  const isDisabled = (d) => {
7898
7945
  if (min && d < min) return true;
7899
7946
  if (max && d > max) return true;
@@ -7924,14 +7971,14 @@ function DatePicker({
7924
7971
  next(7);
7925
7972
  } else if (e.key === "PageUp") {
7926
7973
  e.preventDefault();
7927
- const nm = addMonths3(viewMonth, -1);
7974
+ const nm = addMonths2(viewMonth, -1);
7928
7975
  setViewMonth(nm);
7929
- setFocusDate((d) => addMonths3(d, -1));
7976
+ setFocusDate((d) => addMonths2(d, -1));
7930
7977
  } else if (e.key === "PageDown") {
7931
7978
  e.preventDefault();
7932
- const nm = addMonths3(viewMonth, 1);
7979
+ const nm = addMonths2(viewMonth, 1);
7933
7980
  setViewMonth(nm);
7934
- setFocusDate((d) => addMonths3(d, 1));
7981
+ setFocusDate((d) => addMonths2(d, 1));
7935
7982
  } else if (e.key === "Home") {
7936
7983
  e.preventDefault();
7937
7984
  const dow = (focusDate.getDay() - weekStartsOn + 7) % 7;
@@ -7996,7 +8043,7 @@ function DatePicker({
7996
8043
  {
7997
8044
  type: "button",
7998
8045
  onClick: () => {
7999
- if (view === "days") setViewMonth(addMonths3(viewMonth, -1));
8046
+ if (view === "days") setViewMonth(addMonths2(viewMonth, -1));
8000
8047
  else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() - 1, viewMonth.getMonth(), 1));
8001
8048
  else setViewMonth(new Date(viewMonth.getFullYear() - 10, viewMonth.getMonth(), 1));
8002
8049
  },
@@ -8031,7 +8078,7 @@ function DatePicker({
8031
8078
  {
8032
8079
  type: "button",
8033
8080
  onClick: () => {
8034
- if (view === "days") setViewMonth(addMonths3(viewMonth, 1));
8081
+ if (view === "days") setViewMonth(addMonths2(viewMonth, 1));
8035
8082
  else if (view === "months") setViewMonth(new Date(viewMonth.getFullYear() + 1, viewMonth.getMonth(), 1));
8036
8083
  else setViewMonth(new Date(viewMonth.getFullYear() + 10, viewMonth.getMonth(), 1));
8037
8084
  },
@@ -8817,16 +8864,16 @@ function TimePicker({
8817
8864
  var MONTH_NAMES2 = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
8818
8865
  var WEEKDAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
8819
8866
  var startOfMonth3 = (d) => new Date(d.getFullYear(), d.getMonth(), 1);
8820
- var addMonths4 = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
8867
+ var addMonths3 = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
8821
8868
  var addDays3 = (d, n) => {
8822
8869
  const c = new Date(d);
8823
8870
  c.setDate(c.getDate() + n);
8824
8871
  return c;
8825
8872
  };
8826
8873
  var isSameDay2 = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
8827
- var startOfDay3 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
8874
+ var startOfDay2 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
8828
8875
  var defaultFmt = (d) => `${d.getFullYear()}-${`${d.getMonth() + 1}`.padStart(2, "0")}-${`${d.getDate()}`.padStart(2, "0")}`;
8829
- function buildGrid3(viewMonth, weekStartsOn) {
8876
+ function buildGrid2(viewMonth, weekStartsOn) {
8830
8877
  const first = startOfMonth3(viewMonth);
8831
8878
  const offset = (first.getDay() - weekStartsOn + 7) % 7;
8832
8879
  const gridStart = addDays3(first, -offset);
@@ -8865,13 +8912,13 @@ function DateRangePicker({
8865
8912
  () => WEEKDAY.slice(weekStartsOn).concat(WEEKDAY.slice(0, weekStartsOn)),
8866
8913
  [weekStartsOn]
8867
8914
  );
8868
- const isDisabled = (d) => min && d < startOfDay3(min) || max && d > startOfDay3(max);
8915
+ const isDisabled = (d) => min && d < startOfDay2(min) || max && d > startOfDay2(max);
8869
8916
  const effective = pendingStart ? { start: pendingStart, end: hoverDate } : value;
8870
8917
  const inRange = (d) => {
8871
8918
  const { start, end } = effective;
8872
8919
  if (!start || !end) return false;
8873
8920
  const [a, b] = start <= end ? [start, end] : [end, start];
8874
- return d >= startOfDay3(a) && d <= startOfDay3(b);
8921
+ return d >= startOfDay2(a) && d <= startOfDay2(b);
8875
8922
  };
8876
8923
  const onDayClick = (d) => {
8877
8924
  if (isDisabled(d)) return;
@@ -8889,7 +8936,7 @@ function DateRangePicker({
8889
8936
  };
8890
8937
  const triggerText = value.start && value.end ? `${format(value.start)} \u2013 ${format(value.end)}` : value.start ? `${format(value.start)} \u2013 \u2026` : "";
8891
8938
  const renderMonth = (viewMonth) => {
8892
- const cells = buildGrid3(viewMonth, weekStartsOn);
8939
+ const cells = buildGrid2(viewMonth, weekStartsOn);
8893
8940
  return /* @__PURE__ */ jsxs("div", { children: [
8894
8941
  /* @__PURE__ */ jsxs("div", { className: "text-sm font-semibold text-center mb-2 select-none", children: [
8895
8942
  MONTH_NAMES2[viewMonth.getMonth()],
@@ -8978,7 +9025,7 @@ function DateRangePicker({
8978
9025
  "button",
8979
9026
  {
8980
9027
  type: "button",
8981
- onClick: () => setLeftMonth(addMonths4(leftMonth, -1)),
9028
+ onClick: () => setLeftMonth(addMonths3(leftMonth, -1)),
8982
9029
  "aria-label": "Previous month",
8983
9030
  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",
8984
9031
  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" }) })
@@ -8991,13 +9038,13 @@ function DateRangePicker({
8991
9038
  "button",
8992
9039
  {
8993
9040
  type: "button",
8994
- onClick: () => setLeftMonth(addMonths4(leftMonth, 1)),
9041
+ onClick: () => setLeftMonth(addMonths3(leftMonth, 1)),
8995
9042
  "aria-label": "Next month",
8996
9043
  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",
8997
9044
  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" }) })
8998
9045
  }
8999
9046
  ),
9000
- renderMonth(addMonths4(leftMonth, 1))
9047
+ renderMonth(addMonths3(leftMonth, 1))
9001
9048
  ] })
9002
9049
  ] })
9003
9050
  ]
@@ -9236,6 +9283,6 @@ function useJwt(token) {
9236
9283
  return { payload: decoded.payload, header: decoded.header, expiresAt, isExpired, isValid, raw: token ?? null };
9237
9284
  }
9238
9285
 
9239
- export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Box, Breadcrumbs, Button_default as Button, CARD_BRANDS, Calendar2 as Calendar, Card_default as Card, CardCarousel, Cart, CartButton, CartProvider, Catalog, CatalogCarousel, CatalogGrid, Checkbox, Checkout, ColorPicker, ContextMenu, CreditCardForm, DateRangePicker, Drawer, Dropdown, EmptyCart, 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, LogoutTimer, MegaMenu_default as MegaMenu, MenuButton, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Password, PopConfirm, Portal, RadioGroup, Rating, ScalableContainer, Scheduler, SearchInput_default as SearchInput, SecureLayout, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, Slider, Statistic, Stepper, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Timeline, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Wizard, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
9286
+ export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Box, Breadcrumbs, Button_default as Button, CARD_BRANDS, Card_default as Card, CardCarousel, Cart, CartButton, CartProvider, Catalog, CatalogCarousel, CatalogGrid, Chat, Checkbox, Checkout, ColorPicker, ContextMenu, CreditCardForm, DateRangePicker, Drawer, Dropdown, EmptyCart, 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, LogoutTimer, MegaMenu_default as MegaMenu, MenuButton, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Password, PopConfirm, Portal, RadioGroup, Rating, ScalableContainer, Scheduler, SearchInput_default as SearchInput, SecureLayout, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, Slider, Statistic, Stepper, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Timeline, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Wizard, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
9240
9287
  //# sourceMappingURL=index.js.map
9241
9288
  //# sourceMappingURL=index.js.map