@underverse-ui/underverse 0.2.110 → 0.2.112

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 CHANGED
@@ -8215,8 +8215,10 @@ var DateTimePicker = ({
8215
8215
  const locale = useLocale();
8216
8216
  const [open, setOpen] = React26.useState(false);
8217
8217
  const [tempDate, setTempDate] = React26.useState(value);
8218
+ const [calendarMonth, setCalendarMonth] = React26.useState(() => value ?? /* @__PURE__ */ new Date());
8218
8219
  React26.useEffect(() => {
8219
8220
  setTempDate(value);
8221
+ setCalendarMonth(value ?? /* @__PURE__ */ new Date());
8220
8222
  }, [value, open]);
8221
8223
  const getTimeString = (date) => {
8222
8224
  if (!date) return "";
@@ -8242,6 +8244,7 @@ var DateTimePicker = ({
8242
8244
  }
8243
8245
  return newDate;
8244
8246
  });
8247
+ setCalendarMonth(date);
8245
8248
  }
8246
8249
  };
8247
8250
  const handleTimeChange = (timeStr) => {
@@ -8365,9 +8368,8 @@ var DateTimePicker = ({
8365
8368
  value: tempDate,
8366
8369
  onSelect: handleDateSelect,
8367
8370
  selectMode: "single",
8368
- month: tempDate,
8369
- onMonthChange: (m) => {
8370
- },
8371
+ month: calendarMonth,
8372
+ onMonthChange: setCalendarMonth,
8371
8373
  minDate,
8372
8374
  maxDate,
8373
8375
  className: "border-0 shadow-none w-auto",
@@ -8406,7 +8408,7 @@ var DateTimePicker = ({
8406
8408
  };
8407
8409
 
8408
8410
  // ../../components/ui/CalendarTimeline/CalendarTimeline.tsx
8409
- var React31 = __toESM(require("react"), 1);
8411
+ var React32 = __toESM(require("react"), 1);
8410
8412
  var import_lucide_react21 = require("lucide-react");
8411
8413
 
8412
8414
  // ../../components/ui/CalendarTimeline/date.ts
@@ -8868,6 +8870,7 @@ function resourcesById(resources) {
8868
8870
  }
8869
8871
 
8870
8872
  // ../../components/ui/CalendarTimeline/CalendarTimelineHeader.tsx
8873
+ var React28 = __toESM(require("react"), 1);
8871
8874
  var import_lucide_react18 = require("lucide-react");
8872
8875
  var import_jsx_runtime34 = require("react/jsx-runtime");
8873
8876
  var VIEW_ICONS = {
@@ -8886,7 +8889,8 @@ function CalendarTimelineHeader(props) {
8886
8889
  activeView,
8887
8890
  sizeConfig,
8888
8891
  navigate,
8889
- goToday,
8892
+ now,
8893
+ onApplyDateTime,
8890
8894
  setView,
8891
8895
  effectiveResourceColumnWidth,
8892
8896
  canResizeColumn,
@@ -8894,10 +8898,68 @@ function CalendarTimelineHeader(props) {
8894
8898
  headerRef,
8895
8899
  slotHeaderNodes
8896
8900
  } = props;
8901
+ const dt = useTranslations("DateTimePicker");
8902
+ const locale = useLocale();
8903
+ const [todayOpen, setTodayOpen] = React28.useState(false);
8904
+ const [tempDate, setTempDate] = React28.useState(() => now);
8905
+ const [calendarMonth, setCalendarMonth] = React28.useState(() => now);
8906
+ React28.useEffect(() => {
8907
+ if (!todayOpen) return;
8908
+ setTempDate(now);
8909
+ setCalendarMonth(now);
8910
+ }, [now, todayOpen]);
8911
+ const monthLabel = React28.useCallback(
8912
+ (date) => date.toLocaleDateString(locale === "vi" ? "vi-VN" : "en-US", {
8913
+ month: "long",
8914
+ year: "numeric"
8915
+ }),
8916
+ [locale]
8917
+ );
8918
+ const weekdays = React28.useMemo(() => {
8919
+ switch (locale) {
8920
+ case "vi":
8921
+ return ["CN", "T2", "T3", "T4", "T5", "T6", "T7"];
8922
+ case "ko":
8923
+ return ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"];
8924
+ case "ja":
8925
+ return ["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"];
8926
+ default:
8927
+ return ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
8928
+ }
8929
+ }, [locale]);
8930
+ const getTimeString = React28.useCallback((date) => {
8931
+ const h = date.getHours();
8932
+ const m = date.getMinutes();
8933
+ return `${h.toString().padStart(2, "0")}:${m.toString().padStart(2, "0")}`;
8934
+ }, []);
8935
+ const handleDateSelect = React28.useCallback((date) => {
8936
+ if (!(date instanceof Date)) return;
8937
+ setTempDate((prev) => {
8938
+ const next = new Date(date);
8939
+ next.setHours(prev.getHours(), prev.getMinutes(), prev.getSeconds());
8940
+ return next;
8941
+ });
8942
+ }, []);
8943
+ const handleTimeChange = React28.useCallback((timeStr) => {
8944
+ if (!timeStr) return;
8945
+ const [hStr, mStr] = timeStr.split(":");
8946
+ const h = parseInt(hStr, 10);
8947
+ const m = parseInt(mStr, 10);
8948
+ if (!Number.isFinite(h) || !Number.isFinite(m)) return;
8949
+ setTempDate((prev) => {
8950
+ const next = new Date(prev);
8951
+ next.setHours(h, m, prev.getSeconds());
8952
+ return next;
8953
+ });
8954
+ }, []);
8955
+ const applyDateTime = React28.useCallback(() => {
8956
+ onApplyDateTime(tempDate);
8957
+ setTodayOpen(false);
8958
+ }, [onApplyDateTime, tempDate]);
8897
8959
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "sticky top-0 z-30 bg-linear-to-b from-background via-background to-background/95 border-b border-border/40 backdrop-blur-xl", children: [
8898
8960
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("flex items-center justify-between gap-4", sizeConfig.headerPaddingClass), children: [
8899
8961
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1.5 min-w-0", children: [
8900
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center bg-muted/40 rounded-xl p-1 gap-0.5", children: [
8962
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center bg-muted/40 rounded-full p-1 gap-0.5", children: [
8901
8963
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
8902
8964
  Button_default,
8903
8965
  {
@@ -8905,18 +8967,92 @@ function CalendarTimelineHeader(props) {
8905
8967
  size: "icon",
8906
8968
  onClick: () => navigate(-1),
8907
8969
  "aria-label": labels.prev,
8908
- className: cn(sizeConfig.controlButtonIconClass, "rounded-lg hover:bg-background/80 transition-all duration-200"),
8970
+ className: cn(sizeConfig.controlButtonIconClass, "rounded-full hover:bg-background/80 transition-all duration-200"),
8909
8971
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.ChevronLeft, { className: "h-4 w-4" })
8910
8972
  }
8911
8973
  ),
8912
8974
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
8913
- Button_default,
8975
+ Popover,
8914
8976
  {
8915
- variant: "ghost",
8916
- size: "sm",
8917
- onClick: goToday,
8918
- className: cn(sizeConfig.controlButtonTextClass, "rounded-lg hover:bg-background/80 font-medium transition-all duration-200"),
8919
- children: labels.today
8977
+ open: todayOpen,
8978
+ onOpenChange: setTodayOpen,
8979
+ placement: "bottom-start",
8980
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
8981
+ Button_default,
8982
+ {
8983
+ variant: "ghost",
8984
+ size: "sm",
8985
+ className: cn(sizeConfig.controlButtonTextClass, "rounded-full hover:bg-background/80 font-medium transition-all duration-200"),
8986
+ children: labels.today
8987
+ }
8988
+ ),
8989
+ contentClassName: cn(
8990
+ "w-auto p-0 rounded-2xl md:rounded-3xl overflow-hidden"
8991
+ ),
8992
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto", children: [
8993
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col lg:flex-row divide-y lg:divide-y-0 lg:divide-x divide-border", children: [
8994
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
8995
+ Calendar2,
8996
+ {
8997
+ value: tempDate,
8998
+ onSelect: handleDateSelect,
8999
+ selectMode: "single",
9000
+ month: calendarMonth,
9001
+ onMonthChange: setCalendarMonth,
9002
+ className: "border-0 shadow-none w-auto",
9003
+ size: "sm",
9004
+ labels: {
9005
+ month: monthLabel,
9006
+ weekdays
9007
+ }
9008
+ }
9009
+ ) }),
9010
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-2 flex flex-col gap-3", children: [
9011
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
9012
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-sm font-semibold text-muted-foreground", children: dt?.("time") || "Time" }),
9013
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9014
+ Button_default,
9015
+ {
9016
+ variant: "ghost",
9017
+ size: "sm",
9018
+ className: "rounded-full text-muted-foreground hover:text-foreground",
9019
+ onClick: () => setTempDate(now),
9020
+ children: labels.today
9021
+ }
9022
+ )
9023
+ ] }),
9024
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9025
+ TimePicker,
9026
+ {
9027
+ variant: "inline",
9028
+ value: getTimeString(tempDate),
9029
+ onChange: handleTimeChange,
9030
+ format: "24",
9031
+ includeSeconds: false,
9032
+ clearable: false,
9033
+ className: "border-0 shadow-none p-0 bg-transparent rounded-none",
9034
+ size: "sm"
9035
+ }
9036
+ )
9037
+ ] })
9038
+ ] }),
9039
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 border-t border-border flex justify-between items-center bg-muted/20", children: [
9040
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9041
+ Button_default,
9042
+ {
9043
+ variant: "ghost",
9044
+ size: "sm",
9045
+ className: "rounded-full text-muted-foreground hover:text-foreground",
9046
+ onClick: () => {
9047
+ setTempDate(now);
9048
+ setCalendarMonth(now);
9049
+ },
9050
+ children: labels.today
9051
+ }
9052
+ ),
9053
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button_default, { size: "sm", onClick: applyDateTime, className: "rounded-full", children: dt?.("done") || "Done" })
9054
+ ] })
9055
+ ] })
8920
9056
  }
8921
9057
  ),
8922
9058
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
@@ -8926,7 +9062,7 @@ function CalendarTimelineHeader(props) {
8926
9062
  size: "icon",
8927
9063
  onClick: () => navigate(1),
8928
9064
  "aria-label": labels.next,
8929
- className: cn(sizeConfig.controlButtonIconClass, "rounded-lg hover:bg-background/80 transition-all duration-200"),
9065
+ className: cn(sizeConfig.controlButtonIconClass, "rounded-full hover:bg-background/80 transition-all duration-200"),
8930
9066
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.ChevronRight, { className: "h-4 w-4" })
8931
9067
  }
8932
9068
  )
@@ -8942,11 +9078,11 @@ function CalendarTimelineHeader(props) {
8942
9078
  icon: import_lucide_react18.Plus,
8943
9079
  disabled: newEventDisabled,
8944
9080
  onClick: onNewEventClick,
8945
- className: cn(sizeConfig.controlButtonTextClass, "rounded-lg font-medium transition-all duration-200 gap-1.5"),
9081
+ className: cn(sizeConfig.controlButtonTextClass, "rounded-full font-medium transition-all duration-200 gap-1.5"),
8946
9082
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "hidden sm:inline", children: newEventLabel })
8947
9083
  }
8948
9084
  ) : null,
8949
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center bg-muted/40 rounded-xl p-1 gap-0.5", children: ["month", "week", "day"].map((v) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
9085
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center bg-muted/40 rounded-full p-1 gap-0.5", children: ["month", "week", "day"].map((v) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
8950
9086
  Button_default,
8951
9087
  {
8952
9088
  variant: activeView === v ? "default" : "ghost",
@@ -8954,7 +9090,7 @@ function CalendarTimelineHeader(props) {
8954
9090
  onClick: () => setView(v),
8955
9091
  className: cn(
8956
9092
  sizeConfig.controlButtonTextClass,
8957
- "rounded-lg font-medium transition-all duration-200 gap-1.5",
9093
+ "rounded-full font-medium transition-all duration-200 gap-1.5",
8958
9094
  activeView === v ? "bg-primary text-primary-foreground shadow-sm shadow-primary/25" : "hover:bg-background/80 text-muted-foreground hover:text-foreground"
8959
9095
  ),
8960
9096
  children: [
@@ -9079,9 +9215,9 @@ function ResourceRowCell(props) {
9079
9215
  }
9080
9216
 
9081
9217
  // ../../components/ui/CalendarTimeline/CalendarTimelineGridOverlay.tsx
9082
- var React28 = __toESM(require("react"), 1);
9218
+ var React29 = __toESM(require("react"), 1);
9083
9219
  var import_jsx_runtime36 = require("react/jsx-runtime");
9084
- var CalendarTimelineGridOverlay = React28.memo(function CalendarTimelineGridOverlay2(props) {
9220
+ var CalendarTimelineGridOverlay = React29.memo(function CalendarTimelineGridOverlay2(props) {
9085
9221
  const { gridWidth, height, slotLefts, slotWidths, activeView, todaySlotIdx, dayAnchor, weekendSlotIdxs, visibleStartIdx, visibleEndIdx, className } = props;
9086
9222
  const startIdx = Math.max(0, visibleStartIdx ?? 0);
9087
9223
  const endIdx = Math.min(slotWidths.length, visibleEndIdx ?? slotWidths.length);
@@ -9110,19 +9246,19 @@ var CalendarTimelineGridOverlay = React28.memo(function CalendarTimelineGridOver
9110
9246
  slotLefts.slice(startIdx, endIdx).map((left, j) => {
9111
9247
  const i = startIdx + j;
9112
9248
  const isAnchor = dayAnchor ? Boolean(dayAnchor[i]) : true;
9113
- const opacityClass = activeView === "day" && dayAnchor ? isAnchor ? "bg-border/25" : "bg-border/10" : "bg-border/20";
9249
+ const opacityClass = activeView === "day" && dayAnchor ? isAnchor ? "bg-border/35" : "bg-border/15" : "bg-border/30";
9114
9250
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cn("absolute top-0 h-full w-px", opacityClass), style: { left }, "aria-hidden": true }, i);
9115
9251
  })
9116
9252
  ] });
9117
9253
  });
9118
9254
 
9119
9255
  // ../../components/ui/CalendarTimeline/CalendarTimelineSlotHeaderCell.tsx
9120
- var React29 = __toESM(require("react"), 1);
9256
+ var React30 = __toESM(require("react"), 1);
9121
9257
  var import_lucide_react20 = require("lucide-react");
9122
9258
  var import_jsx_runtime37 = require("react/jsx-runtime");
9123
- var CalendarTimelineSlotHeaderCell = React29.memo(function CalendarTimelineSlotHeaderCell2(props) {
9259
+ var CalendarTimelineSlotHeaderCell = React30.memo(function CalendarTimelineSlotHeaderCell2(props) {
9124
9260
  const { width, activeView, isToday: isToday2, label, ariaLabel, borderClassName, dayHeaderMarks, idx, className } = props;
9125
- const content = React29.useMemo(() => {
9261
+ const content = React30.useMemo(() => {
9126
9262
  if (activeView === "day" && dayHeaderMarks) {
9127
9263
  if (dayHeaderMarks.showEllipsis[idx]) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-xs text-muted-foreground/70 select-none", children: "\u2026" });
9128
9264
  if (!dayHeaderMarks.showTime[idx]) return null;
@@ -9145,7 +9281,7 @@ var CalendarTimelineSlotHeaderCell = React29.memo(function CalendarTimelineSlotH
9145
9281
  });
9146
9282
 
9147
9283
  // ../../components/ui/CalendarTimeline/internal-hooks.ts
9148
- var React30 = __toESM(require("react"), 1);
9284
+ var React31 = __toESM(require("react"), 1);
9149
9285
  function useTimelineSlots(args) {
9150
9286
  const {
9151
9287
  activeView,
@@ -9159,7 +9295,7 @@ function useTimelineSlots(args) {
9159
9295
  resolvedNow,
9160
9296
  formatters
9161
9297
  } = args;
9162
- const { slots, range } = React30.useMemo(() => {
9298
+ const { slots, range } = React31.useMemo(() => {
9163
9299
  const { start, end, slotStarts: slotStarts2 } = computeSlotStarts({
9164
9300
  view: activeView,
9165
9301
  date: activeDate,
@@ -9181,9 +9317,9 @@ function useTimelineSlots(args) {
9181
9317
  }));
9182
9318
  return { slots: slotItems, range: { start, end } };
9183
9319
  }, [activeView, activeDate, dayRangeMode, dayTimeStepMinutes, formatters, resolvedLocale, resolvedNow, resolvedTimeZone, weekStartsOn, workHours]);
9184
- const slotStarts = React30.useMemo(() => slots.map((s) => s.start), [slots]);
9185
- const todaySlotIdx = React30.useMemo(() => slots.findIndex((s) => s.isToday), [slots]);
9186
- const weekendSlotIdxs = React30.useMemo(() => {
9320
+ const slotStarts = React31.useMemo(() => slots.map((s) => s.start), [slots]);
9321
+ const todaySlotIdx = React31.useMemo(() => slots.findIndex((s) => s.isToday), [slots]);
9322
+ const weekendSlotIdxs = React31.useMemo(() => {
9187
9323
  const out = [];
9188
9324
  for (let i = 0; i < slots.length; i++) if (slots[i]?.isWeekend) out.push(i);
9189
9325
  return out;
@@ -9192,16 +9328,16 @@ function useTimelineSlots(args) {
9192
9328
  }
9193
9329
  function useNormalizedEvents(args) {
9194
9330
  const { events, range, activeView, resolvedTimeZone, resources } = args;
9195
- const normalizedEvents = React30.useMemo(() => {
9331
+ const normalizedEvents = React31.useMemo(() => {
9196
9332
  return normalizeEvents({ events, range, view: activeView, timeZone: resolvedTimeZone });
9197
9333
  }, [activeView, events, range, resolvedTimeZone]);
9198
- const eventsByResource = React30.useMemo(() => eventsByResourceId(normalizedEvents), [normalizedEvents]);
9199
- const resourceById = React30.useMemo(() => resourcesById(resources), [resources]);
9334
+ const eventsByResource = React31.useMemo(() => eventsByResourceId(normalizedEvents), [normalizedEvents]);
9335
+ const resourceById = React31.useMemo(() => resourcesById(resources), [resources]);
9200
9336
  return { normalizedEvents, eventsByResource, resourceById };
9201
9337
  }
9202
9338
  function useDayHeaderMarks(args) {
9203
9339
  const { enabled, activeView, normalizedEvents, slotStarts, slotCount } = args;
9204
- return React30.useMemo(() => {
9340
+ return React31.useMemo(() => {
9205
9341
  if (!enabled) return null;
9206
9342
  if (activeView !== "day") return null;
9207
9343
  const n = slotCount;
@@ -9236,14 +9372,14 @@ function useSlotMetrics(args) {
9236
9372
  dayHeaderSmart,
9237
9373
  daySlotCompression
9238
9374
  } = args;
9239
- const fixedSlotWidth = React30.useMemo(() => {
9375
+ const fixedSlotWidth = React31.useMemo(() => {
9240
9376
  const baseSlotWidth = activeView === "month" || activeView === "day" ? effectiveSlotMinWidth * 3 : effectiveSlotMinWidth;
9241
9377
  if (activeView !== "week") return baseSlotWidth;
9242
9378
  if (bodyClientWidth <= 0) return baseSlotWidth;
9243
9379
  if (slotsLength <= 0) return baseSlotWidth;
9244
9380
  return Math.max(baseSlotWidth, bodyClientWidth / slotsLength);
9245
9381
  }, [activeView, bodyClientWidth, effectiveSlotMinWidth, slotsLength]);
9246
- const slotMetrics = React30.useMemo(() => {
9382
+ const slotMetrics = React31.useMemo(() => {
9247
9383
  const n = slotsLength;
9248
9384
  const widths = new Array(n).fill(fixedSlotWidth);
9249
9385
  const isAdaptiveView = activeView === "month" || activeView === "day";
@@ -9373,7 +9509,7 @@ function useSlotMetrics(args) {
9373
9509
  }
9374
9510
  function useLayoutsByResource(args) {
9375
9511
  const { eventsByResource, preview, slotStarts, slotsLength, slotLefts, getResourceRowHeight, laneGap, lanePaddingY, effectiveMaxLanesPerRow, eventHeight } = args;
9376
- return React30.useMemo(() => {
9512
+ return React31.useMemo(() => {
9377
9513
  const map = /* @__PURE__ */ new Map();
9378
9514
  for (const [resourceId, list] of eventsByResource.entries()) {
9379
9515
  const mapped = list.map((ev) => {
@@ -9420,9 +9556,9 @@ function lowerBound2(arr, target) {
9420
9556
  }
9421
9557
  function useVisibleSlotRange(args) {
9422
9558
  const { enabled, overscan, scrollRef, slotLefts, slotCount } = args;
9423
- const [scrollLeft, setScrollLeft] = React30.useState(0);
9424
- const [viewportWidth, setViewportWidth] = React30.useState(0);
9425
- React30.useEffect(() => {
9559
+ const [scrollLeft, setScrollLeft] = React31.useState(0);
9560
+ const [viewportWidth, setViewportWidth] = React31.useState(0);
9561
+ React31.useEffect(() => {
9426
9562
  if (!enabled) return;
9427
9563
  const el = scrollRef.current;
9428
9564
  if (!el) return;
@@ -9437,7 +9573,7 @@ function useVisibleSlotRange(args) {
9437
9573
  el.removeEventListener("scroll", onScroll);
9438
9574
  };
9439
9575
  }, [enabled, scrollRef]);
9440
- return React30.useMemo(() => {
9576
+ return React31.useMemo(() => {
9441
9577
  if (!enabled) return { startIdx: 0, endIdx: slotCount };
9442
9578
  if (slotCount <= 0) return { startIdx: 0, endIdx: 0 };
9443
9579
  if (viewportWidth <= 0) return { startIdx: 0, endIdx: slotCount };
@@ -9529,14 +9665,14 @@ function CalendarTimeline({
9529
9665
  }) {
9530
9666
  const t = useTranslations("CalendarTimeline");
9531
9667
  const detectedLocale = useLocale();
9532
- const resolvedLocale = React31.useMemo(() => localeToBCP47(locale ?? detectedLocale), [locale, detectedLocale]);
9533
- const resolvedTimeZone = React31.useMemo(() => timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC", [timeZone]);
9668
+ const resolvedLocale = React32.useMemo(() => localeToBCP47(locale ?? detectedLocale), [locale, detectedLocale]);
9669
+ const resolvedTimeZone = React32.useMemo(() => timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC", [timeZone]);
9534
9670
  const effectiveEnableEventSheet = enableEventSheet ?? Boolean(renderEventSheet);
9535
9671
  const isViewOnly = interactions?.mode === "view";
9536
9672
  const isControlledSelectedEventId = selectedEventId !== void 0;
9537
- const [internalSelectedEventId, setInternalSelectedEventId] = React31.useState(defaultSelectedEventId ?? null);
9673
+ const [internalSelectedEventId, setInternalSelectedEventId] = React32.useState(defaultSelectedEventId ?? null);
9538
9674
  const activeSelectedEventId = isControlledSelectedEventId ? selectedEventId : internalSelectedEventId;
9539
- const setSelectedEventId = React31.useCallback(
9675
+ const setSelectedEventId = React32.useCallback(
9540
9676
  (next) => {
9541
9677
  if (!isControlledSelectedEventId) setInternalSelectedEventId(next);
9542
9678
  onSelectedEventIdChange?.(next);
@@ -9544,9 +9680,9 @@ function CalendarTimeline({
9544
9680
  [isControlledSelectedEventId, onSelectedEventIdChange]
9545
9681
  );
9546
9682
  const isControlledEventSheetOpen = eventSheetOpen !== void 0;
9547
- const [internalEventSheetOpen, setInternalEventSheetOpen] = React31.useState(defaultEventSheetOpen ?? false);
9683
+ const [internalEventSheetOpen, setInternalEventSheetOpen] = React32.useState(defaultEventSheetOpen ?? false);
9548
9684
  const activeEventSheetOpen = isControlledEventSheetOpen ? Boolean(eventSheetOpen) : internalEventSheetOpen;
9549
- const setEventSheetOpen = React31.useCallback(
9685
+ const setEventSheetOpen = React32.useCallback(
9550
9686
  (next) => {
9551
9687
  if (!isControlledEventSheetOpen) setInternalEventSheetOpen(next);
9552
9688
  onEventSheetOpenChange?.(next);
@@ -9554,19 +9690,19 @@ function CalendarTimeline({
9554
9690
  },
9555
9691
  [isControlledEventSheetOpen, onEventSheetOpenChange, setSelectedEventId]
9556
9692
  );
9557
- const sizeConfig = React31.useMemo(() => getSizeConfig(size), [size]);
9693
+ const sizeConfig = React32.useMemo(() => getSizeConfig(size), [size]);
9558
9694
  const densityClass = sizeConfig.densityClass;
9559
9695
  const eventHeight = sizeConfig.eventHeight;
9560
9696
  const laneGap = sizeConfig.laneGap;
9561
9697
  const lanePaddingY = sizeConfig.lanePaddingY;
9562
- const canResizeColumn = React31.useMemo(() => {
9698
+ const canResizeColumn = React32.useMemo(() => {
9563
9699
  const cfg = enableLayoutResize;
9564
9700
  if (!cfg) return false;
9565
9701
  if (isViewOnly) return false;
9566
9702
  if (cfg === true) return true;
9567
9703
  return cfg.column !== false;
9568
9704
  }, [enableLayoutResize, isViewOnly]);
9569
- const canResizeRow = React31.useMemo(() => {
9705
+ const canResizeRow = React32.useMemo(() => {
9570
9706
  const cfg = enableLayoutResize;
9571
9707
  if (!cfg) return false;
9572
9708
  if (isViewOnly) return false;
@@ -9574,19 +9710,19 @@ function CalendarTimeline({
9574
9710
  return cfg.row !== false;
9575
9711
  }, [enableLayoutResize, isViewOnly]);
9576
9712
  const isControlledResourceColumnWidth = resourceColumnWidth !== void 0;
9577
- const [internalResourceColumnWidth, setInternalResourceColumnWidth] = React31.useState(() => {
9713
+ const [internalResourceColumnWidth, setInternalResourceColumnWidth] = React32.useState(() => {
9578
9714
  const init = defaultResourceColumnWidth ?? sizeConfig.resourceColumnWidth;
9579
9715
  return typeof init === "number" ? init : sizeConfig.resourceColumnWidth;
9580
9716
  });
9581
- React31.useEffect(() => {
9717
+ React32.useEffect(() => {
9582
9718
  if (isControlledResourceColumnWidth) return;
9583
9719
  if (defaultResourceColumnWidth == null) return;
9584
9720
  setInternalResourceColumnWidth(defaultResourceColumnWidth);
9585
9721
  }, [defaultResourceColumnWidth, isControlledResourceColumnWidth]);
9586
9722
  const effectiveResourceColumnWidth = isControlledResourceColumnWidth ? resourceColumnWidth : internalResourceColumnWidth;
9587
9723
  const isControlledRowHeight = rowHeight !== void 0;
9588
- const [internalRowHeight, setInternalRowHeight] = React31.useState(() => defaultRowHeight ?? sizeConfig.rowHeight);
9589
- React31.useEffect(() => {
9724
+ const [internalRowHeight, setInternalRowHeight] = React32.useState(() => defaultRowHeight ?? sizeConfig.rowHeight);
9725
+ React32.useEffect(() => {
9590
9726
  if (isControlledRowHeight) return;
9591
9727
  if (defaultRowHeight == null) return;
9592
9728
  setInternalRowHeight(defaultRowHeight);
@@ -9598,13 +9734,13 @@ function CalendarTimeline({
9598
9734
  const rowMin = minRowHeight ?? 36;
9599
9735
  const rowMax = maxRowHeight ?? 120;
9600
9736
  const isControlledView = view !== void 0;
9601
- const [internalView, setInternalView] = React31.useState(defaultView);
9737
+ const [internalView, setInternalView] = React32.useState(defaultView);
9602
9738
  const activeView = isControlledView ? view : internalView;
9603
9739
  const isControlledDate = date !== void 0;
9604
- const [internalDate, setInternalDate] = React31.useState(() => defaultDate ?? /* @__PURE__ */ new Date());
9740
+ const [internalDate, setInternalDate] = React32.useState(() => defaultDate ?? /* @__PURE__ */ new Date());
9605
9741
  const activeDate = isControlledDate ? date : internalDate;
9606
- const resolvedNow = now ?? /* @__PURE__ */ new Date();
9607
- const l = React31.useMemo(
9742
+ const resolvedNow = React32.useMemo(() => now ?? /* @__PURE__ */ new Date(), [now]);
9743
+ const l = React32.useMemo(
9608
9744
  () => ({
9609
9745
  today: labels?.today ?? t("today"),
9610
9746
  prev: labels?.prev ?? t("prev"),
@@ -9626,21 +9762,21 @@ function CalendarTimeline({
9626
9762
  }),
9627
9763
  [labels, t]
9628
9764
  );
9629
- const setView = React31.useCallback(
9765
+ const setView = React32.useCallback(
9630
9766
  (next) => {
9631
9767
  if (!isControlledView) setInternalView(next);
9632
9768
  onViewChange?.(next);
9633
9769
  },
9634
9770
  [isControlledView, onViewChange]
9635
9771
  );
9636
- const setDate = React31.useCallback(
9772
+ const setDate = React32.useCallback(
9637
9773
  (next) => {
9638
9774
  if (!isControlledDate) setInternalDate(next);
9639
9775
  onDateChange?.(next);
9640
9776
  },
9641
9777
  [isControlledDate, onDateChange]
9642
9778
  );
9643
- const navigate = React31.useCallback(
9779
+ const navigate = React32.useCallback(
9644
9780
  (dir) => {
9645
9781
  const base = activeDate;
9646
9782
  if (activeView === "month") {
@@ -9655,18 +9791,17 @@ function CalendarTimeline({
9655
9791
  },
9656
9792
  [activeDate, activeView, resolvedTimeZone, setDate]
9657
9793
  );
9658
- const goToday = React31.useCallback(() => setDate(resolvedNow), [resolvedNow, setDate]);
9659
- const [internalCollapsed, setInternalCollapsed] = React31.useState(() => defaultGroupCollapsed ?? {});
9794
+ const [internalCollapsed, setInternalCollapsed] = React32.useState(() => defaultGroupCollapsed ?? {});
9660
9795
  const collapsed = groupCollapsed ?? internalCollapsed;
9661
- const setCollapsed = React31.useCallback(
9796
+ const setCollapsed = React32.useCallback(
9662
9797
  (next) => {
9663
9798
  if (!groupCollapsed) setInternalCollapsed(next);
9664
9799
  onGroupCollapsedChange?.(next);
9665
9800
  },
9666
9801
  [groupCollapsed, onGroupCollapsedChange]
9667
9802
  );
9668
- const rows = React31.useMemo(() => buildRows({ resources, groups, collapsed }), [resources, groups, collapsed]);
9669
- const groupResourceCounts = React31.useMemo(() => getGroupResourceCounts(resources), [resources]);
9803
+ const rows = React32.useMemo(() => buildRows({ resources, groups, collapsed }), [resources, groups, collapsed]);
9804
+ const groupResourceCounts = React32.useMemo(() => getGroupResourceCounts(resources), [resources]);
9670
9805
  const { slots, range, slotStarts, todaySlotIdx, weekendSlotIdxs } = useTimelineSlots({
9671
9806
  activeView,
9672
9807
  activeDate,
@@ -9679,12 +9814,12 @@ function CalendarTimeline({
9679
9814
  resolvedNow,
9680
9815
  formatters
9681
9816
  });
9682
- React31.useEffect(() => {
9817
+ React32.useEffect(() => {
9683
9818
  onRangeChange?.(range);
9684
9819
  }, [range.start, range.end, onRangeChange]);
9685
- const leftRef = React31.useRef(null);
9686
- const bodyRef = React31.useRef(null);
9687
- const headerRef = React31.useRef(null);
9820
+ const leftRef = React32.useRef(null);
9821
+ const bodyRef = React32.useRef(null);
9822
+ const headerRef = React32.useRef(null);
9688
9823
  const bodyClientWidth = useClientWidth(bodyRef);
9689
9824
  const { normalizedEvents, eventsByResource, resourceById } = useNormalizedEvents({
9690
9825
  events,
@@ -9716,16 +9851,16 @@ function CalendarTimeline({
9716
9851
  slotLefts,
9717
9852
  slotCount: slots.length
9718
9853
  });
9719
- const selectedEvent = React31.useMemo(() => {
9854
+ const selectedEvent = React32.useMemo(() => {
9720
9855
  if (!activeSelectedEventId) return null;
9721
9856
  const found = normalizedEvents.find((e) => e.id === activeSelectedEventId);
9722
9857
  return found ?? null;
9723
9858
  }, [activeSelectedEventId, normalizedEvents]);
9724
- const selectedResource = React31.useMemo(() => {
9859
+ const selectedResource = React32.useMemo(() => {
9725
9860
  if (!selectedEvent) return void 0;
9726
9861
  return resourceById.get(selectedEvent.resourceId);
9727
9862
  }, [resourceById, selectedEvent]);
9728
- const selectedTimeText = React31.useMemo(() => {
9863
+ const selectedTimeText = React32.useMemo(() => {
9729
9864
  if (!selectedEvent) return "";
9730
9865
  return formatters?.eventTime?.({
9731
9866
  start: selectedEvent._start,
@@ -9735,7 +9870,7 @@ function CalendarTimeline({
9735
9870
  view: activeView
9736
9871
  }) ?? defaultEventTime({ start: selectedEvent._start, end: selectedEvent._end, locale: resolvedLocale, timeZone: resolvedTimeZone, view: activeView });
9737
9872
  }, [activeView, formatters, resolvedLocale, resolvedTimeZone, selectedEvent]);
9738
- React31.useEffect(() => {
9873
+ React32.useEffect(() => {
9739
9874
  if (!effectiveEnableEventSheet) return;
9740
9875
  if (activeEventSheetOpen && activeSelectedEventId && !selectedEvent) {
9741
9876
  setEventSheetOpen(false);
@@ -9745,24 +9880,24 @@ function CalendarTimeline({
9745
9880
  const virt = virtualization?.enabled;
9746
9881
  const overscan = virtualization?.overscan ?? 8;
9747
9882
  const isControlledRowHeights = rowHeights !== void 0;
9748
- const [internalRowHeights, setInternalRowHeights] = React31.useState(() => defaultRowHeights ?? {});
9749
- React31.useEffect(() => {
9883
+ const [internalRowHeights, setInternalRowHeights] = React32.useState(() => defaultRowHeights ?? {});
9884
+ React32.useEffect(() => {
9750
9885
  if (isControlledRowHeights) return;
9751
9886
  if (!defaultRowHeights) return;
9752
9887
  setInternalRowHeights(defaultRowHeights);
9753
9888
  }, [defaultRowHeights, isControlledRowHeights]);
9754
9889
  const activeRowHeights = isControlledRowHeights ? rowHeights : internalRowHeights;
9755
- const autoRowHeightCfg = React31.useMemo(() => {
9890
+ const autoRowHeightCfg = React32.useMemo(() => {
9756
9891
  if (!autoRowHeight) return null;
9757
9892
  return autoRowHeight === true ? {} : autoRowHeight;
9758
9893
  }, [autoRowHeight]);
9759
- const effectiveMaxLanesPerRow = React31.useMemo(() => {
9894
+ const effectiveMaxLanesPerRow = React32.useMemo(() => {
9760
9895
  if (!autoRowHeightCfg) return maxLanesPerRow;
9761
9896
  const maxLanes = autoRowHeightCfg.maxLanesPerRow;
9762
9897
  if (typeof maxLanes === "number" && Number.isFinite(maxLanes) && maxLanes > 0) return Math.floor(maxLanes);
9763
9898
  return Number.POSITIVE_INFINITY;
9764
9899
  }, [autoRowHeightCfg, maxLanesPerRow]);
9765
- const autoRowHeightsByResource = React31.useMemo(() => {
9900
+ const autoRowHeightsByResource = React32.useMemo(() => {
9766
9901
  if (!autoRowHeightCfg) return null;
9767
9902
  const maxRowHeight2 = autoRowHeightCfg.maxRowHeight;
9768
9903
  const out = /* @__PURE__ */ new Map();
@@ -9780,7 +9915,7 @@ function CalendarTimeline({
9780
9915
  }
9781
9916
  return out;
9782
9917
  }, [autoRowHeightCfg, eventHeight, eventsByResource, laneGap, lanePaddingY, slotStarts, slots.length, effectiveMaxLanesPerRow]);
9783
- const getResourceRowHeight = React31.useCallback(
9918
+ const getResourceRowHeight = React32.useCallback(
9784
9919
  (resourceId) => {
9785
9920
  const h = activeRowHeights[resourceId];
9786
9921
  const base = typeof h === "number" && Number.isFinite(h) && h > 0 ? h : effectiveRowHeight;
@@ -9790,7 +9925,7 @@ function CalendarTimeline({
9790
9925
  },
9791
9926
  [activeRowHeights, autoRowHeightsByResource, effectiveRowHeight]
9792
9927
  );
9793
- const setRowHeightForResource = React31.useCallback(
9928
+ const setRowHeightForResource = React32.useCallback(
9794
9929
  (resourceId, height) => {
9795
9930
  const clamped = clamp4(Math.round(height), rowMin, rowMax);
9796
9931
  onRowHeightChange?.(clamped);
@@ -9807,7 +9942,7 @@ function CalendarTimeline({
9807
9942
  },
9808
9943
  [activeRowHeights, isControlledRowHeights, onRowHeightChange, onRowHeightsChange, rowMax, rowMin]
9809
9944
  );
9810
- const rowHeightsArray = React31.useMemo(() => {
9945
+ const rowHeightsArray = React32.useMemo(() => {
9811
9946
  return rows.map((r) => {
9812
9947
  if (r.kind === "resource") return getResourceRowHeight(r.resource.id);
9813
9948
  return sizeConfig.groupRowHeight;
@@ -9823,13 +9958,13 @@ function CalendarTimeline({
9823
9958
  const endRow = virt ? virtualResult.endIndex : rows.length;
9824
9959
  const topSpacer = virt ? virtualResult.topSpacer : 0;
9825
9960
  const bottomSpacer = virt ? virtualResult.bottomSpacer : 0;
9826
- const renderedRowsHeight = React31.useMemo(() => {
9961
+ const renderedRowsHeight = React32.useMemo(() => {
9827
9962
  let h = 0;
9828
9963
  for (let i = startRow; i < endRow; i++) h += rowHeightsArray[i] ?? effectiveRowHeight;
9829
9964
  return h;
9830
9965
  }, [effectiveRowHeight, endRow, rowHeightsArray, startRow]);
9831
- const resizeRef = React31.useRef(null);
9832
- const setResourceColumnWidth = React31.useCallback(
9966
+ const resizeRef = React32.useRef(null);
9967
+ const setResourceColumnWidth = React32.useCallback(
9833
9968
  (next) => {
9834
9969
  const clamped = clamp4(Math.round(next), colMin, colMax);
9835
9970
  if (!isControlledResourceColumnWidth) setInternalResourceColumnWidth(clamped);
@@ -9837,7 +9972,7 @@ function CalendarTimeline({
9837
9972
  },
9838
9973
  [colMax, colMin, isControlledResourceColumnWidth, onResourceColumnWidthChange]
9839
9974
  );
9840
- const startResize = React31.useCallback(
9975
+ const startResize = React32.useCallback(
9841
9976
  (mode, e, args) => {
9842
9977
  if (e.button !== 0 || e.ctrlKey) return;
9843
9978
  resizeRef.current = {
@@ -9880,7 +10015,7 @@ function CalendarTimeline({
9880
10015
  },
9881
10016
  [setResourceColumnWidth, setRowHeightForResource]
9882
10017
  );
9883
- React31.useEffect(() => {
10018
+ React32.useEffect(() => {
9884
10019
  return () => {
9885
10020
  if (!resizeRef.current) return;
9886
10021
  resizeRef.current = null;
@@ -9888,7 +10023,7 @@ function CalendarTimeline({
9888
10023
  document.body.style.userSelect = "";
9889
10024
  };
9890
10025
  }, []);
9891
- const beginResizeColumn = React31.useCallback(
10026
+ const beginResizeColumn = React32.useCallback(
9892
10027
  (e) => {
9893
10028
  if (!canResizeColumn) return;
9894
10029
  if (typeof effectiveResourceColumnWidth !== "number") return;
@@ -9896,7 +10031,7 @@ function CalendarTimeline({
9896
10031
  },
9897
10032
  [canResizeColumn, effectiveResourceColumnWidth, effectiveRowHeight, startResize]
9898
10033
  );
9899
- const beginResizeResourceRow = React31.useCallback(
10034
+ const beginResizeResourceRow = React32.useCallback(
9900
10035
  (resourceId) => (e) => {
9901
10036
  if (!canResizeRow) return;
9902
10037
  startResize("row", e, {
@@ -9907,7 +10042,7 @@ function CalendarTimeline({
9907
10042
  },
9908
10043
  [canResizeRow, effectiveResourceColumnWidth, getResourceRowHeight, startResize]
9909
10044
  );
9910
- const title = React31.useMemo(() => {
10045
+ const title = React32.useMemo(() => {
9911
10046
  if (activeView === "month") {
9912
10047
  return formatters?.monthTitle?.(activeDate, { locale: resolvedLocale, timeZone: resolvedTimeZone }) ?? defaultMonthTitle(activeDate, resolvedLocale, resolvedTimeZone);
9913
10048
  }
@@ -9928,11 +10063,11 @@ function CalendarTimeline({
9928
10063
  }, [activeDate, activeView, formatters, l.week, range.end, range.start, resolvedLocale, resolvedTimeZone]);
9929
10064
  const createMode = interactions?.createMode ?? "drag";
9930
10065
  const canCreate = !isViewOnly && (interactions?.creatable ?? false) && !!onCreateEvent;
9931
- const [createOpen, setCreateOpen] = React31.useState(false);
9932
- const [createResourceId, setCreateResourceId] = React31.useState(null);
9933
- const [createStartIdx, setCreateStartIdx] = React31.useState(0);
9934
- const [createEndIdx, setCreateEndIdx] = React31.useState(1);
9935
- const resourceOptions = React31.useMemo(() => {
10066
+ const [createOpen, setCreateOpen] = React32.useState(false);
10067
+ const [createResourceId, setCreateResourceId] = React32.useState(null);
10068
+ const [createStartIdx, setCreateStartIdx] = React32.useState(0);
10069
+ const [createEndIdx, setCreateEndIdx] = React32.useState(1);
10070
+ const resourceOptions = React32.useMemo(() => {
9936
10071
  return resources.map((r) => ({
9937
10072
  label: typeof r.label === "string" ? r.label : r.id,
9938
10073
  value: r.id,
@@ -9940,12 +10075,12 @@ function CalendarTimeline({
9940
10075
  disabled: r.disabled ?? false
9941
10076
  }));
9942
10077
  }, [resources]);
9943
- const slotPickerLabel = React31.useMemo(() => {
10078
+ const slotPickerLabel = React32.useMemo(() => {
9944
10079
  const timeFmt = getDtf(resolvedLocale, resolvedTimeZone, { hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
9945
10080
  const dayFmt = getDtf(resolvedLocale, resolvedTimeZone, { weekday: "short", month: "short", day: "numeric" });
9946
10081
  return (d) => activeView === "day" ? timeFmt.format(d) : dayFmt.format(d);
9947
10082
  }, [activeView, resolvedLocale, resolvedTimeZone]);
9948
- const openCreate = React31.useCallback(() => {
10083
+ const openCreate = React32.useCallback(() => {
9949
10084
  if (!canCreate) return;
9950
10085
  if (activeEventSheetOpen) setEventSheetOpen(false);
9951
10086
  const firstResource = resources.find((r) => !r.disabled)?.id ?? resources[0]?.id ?? null;
@@ -9977,13 +10112,13 @@ function CalendarTimeline({
9977
10112
  slotStarts,
9978
10113
  slots.length
9979
10114
  ]);
9980
- React31.useEffect(() => {
10115
+ React32.useEffect(() => {
9981
10116
  setCreateEndIdx((prev) => Math.min(slots.length, Math.max(prev, createStartIdx + 1)));
9982
10117
  }, [createStartIdx, slots.length]);
9983
- const createStartOptions = React31.useMemo(() => {
10118
+ const createStartOptions = React32.useMemo(() => {
9984
10119
  return slotStarts.map((d, idx) => ({ label: slotPickerLabel(d), value: idx }));
9985
10120
  }, [slotStarts, slotPickerLabel]);
9986
- const createEndOptions = React31.useMemo(() => {
10121
+ const createEndOptions = React32.useMemo(() => {
9987
10122
  const out = [];
9988
10123
  for (let idx = createStartIdx + 1; idx <= slotStarts.length; idx++) {
9989
10124
  const boundary = idx >= slotStarts.length ? range.end : slotStarts[idx];
@@ -9991,7 +10126,7 @@ function CalendarTimeline({
9991
10126
  }
9992
10127
  return out;
9993
10128
  }, [createStartIdx, range.end, slotPickerLabel, slotStarts]);
9994
- const commitCreate = React31.useCallback(() => {
10129
+ const commitCreate = React32.useCallback(() => {
9995
10130
  if (!onCreateEvent) return;
9996
10131
  if (!createResourceId) return;
9997
10132
  const start = slotStarts[clamp4(createStartIdx, 0, Math.max(0, slotStarts.length - 1))];
@@ -10002,24 +10137,24 @@ function CalendarTimeline({
10002
10137
  onCreateEvent({ resourceId: createResourceId, start, end: endBoundary });
10003
10138
  setCreateOpen(false);
10004
10139
  }, [createEndIdx, createResourceId, createStartIdx, onCreateEvent, range.end, slotStarts]);
10005
- const dragRef = React31.useRef(null);
10006
- const [preview, setPreview] = React31.useState(null);
10007
- const suppressNextEventClickRef = React31.useRef(false);
10008
- const [hoverCell, setHoverCell] = React31.useState(null);
10009
- const autoScrollStateRef = React31.useRef({
10140
+ const dragRef = React32.useRef(null);
10141
+ const [preview, setPreview] = React32.useState(null);
10142
+ const suppressNextEventClickRef = React32.useRef(false);
10143
+ const [hoverCell, setHoverCell] = React32.useState(null);
10144
+ const autoScrollStateRef = React32.useRef({
10010
10145
  dir: 0,
10011
10146
  speed: 0,
10012
10147
  lastClientX: 0,
10013
10148
  lastClientY: 0
10014
10149
  });
10015
- const autoScrollRafRef = React31.useRef(null);
10016
- const stopAutoScroll = React31.useCallback(() => {
10150
+ const autoScrollRafRef = React32.useRef(null);
10151
+ const stopAutoScroll = React32.useCallback(() => {
10017
10152
  if (autoScrollRafRef.current != null) cancelAnimationFrame(autoScrollRafRef.current);
10018
10153
  autoScrollRafRef.current = null;
10019
10154
  autoScrollStateRef.current.dir = 0;
10020
10155
  autoScrollStateRef.current.speed = 0;
10021
10156
  }, []);
10022
- const getPointerContext = React31.useCallback(
10157
+ const getPointerContext = React32.useCallback(
10023
10158
  (clientX, clientY, opts) => {
10024
10159
  const body = bodyRef.current;
10025
10160
  if (!body) return null;
@@ -10037,7 +10172,7 @@ function CalendarTimeline({
10037
10172
  },
10038
10173
  [xToSlotIdx]
10039
10174
  );
10040
- const slotToDate = React31.useCallback(
10175
+ const slotToDate = React32.useCallback(
10041
10176
  (slotIdx) => {
10042
10177
  const start = slotStarts[clamp4(slotIdx, 0, slotStarts.length - 1)];
10043
10178
  if (activeView === "day") {
@@ -10048,7 +10183,7 @@ function CalendarTimeline({
10048
10183
  },
10049
10184
  [activeView, dayTimeStepMinutes, resolvedTimeZone, slotStarts]
10050
10185
  );
10051
- const updateDragPreview = React31.useCallback(
10186
+ const updateDragPreview = React32.useCallback(
10052
10187
  (clientX, clientY) => {
10053
10188
  const drag = dragRef.current;
10054
10189
  if (!drag) return;
@@ -10092,7 +10227,7 @@ function CalendarTimeline({
10092
10227
  },
10093
10228
  [getPointerContext, range.end, range.start, slotToDate, slots.length]
10094
10229
  );
10095
- const autoScrollTick = React31.useCallback(() => {
10230
+ const autoScrollTick = React32.useCallback(() => {
10096
10231
  const drag = dragRef.current;
10097
10232
  const body = bodyRef.current;
10098
10233
  const st = autoScrollStateRef.current;
@@ -10111,7 +10246,7 @@ function CalendarTimeline({
10111
10246
  updateDragPreview(st.lastClientX, st.lastClientY);
10112
10247
  autoScrollRafRef.current = requestAnimationFrame(autoScrollTick);
10113
10248
  }, [stopAutoScroll, updateDragPreview]);
10114
- const updateAutoScrollFromPointer = React31.useCallback(
10249
+ const updateAutoScrollFromPointer = React32.useCallback(
10115
10250
  (clientX, clientY) => {
10116
10251
  const body = bodyRef.current;
10117
10252
  if (!body) return;
@@ -10142,7 +10277,7 @@ function CalendarTimeline({
10142
10277
  },
10143
10278
  [autoScrollTick, stopAutoScroll]
10144
10279
  );
10145
- React31.useEffect(() => stopAutoScroll, [stopAutoScroll]);
10280
+ React32.useEffect(() => stopAutoScroll, [stopAutoScroll]);
10146
10281
  const onPointerDownEvent = (e, ev, mode) => {
10147
10282
  if (e.button !== 0 || e.ctrlKey) return;
10148
10283
  if (isViewOnly) return;
@@ -10294,7 +10429,7 @@ function CalendarTimeline({
10294
10429
  }
10295
10430
  );
10296
10431
  };
10297
- const slotHeaderNodes = React31.useMemo(() => {
10432
+ const slotHeaderNodes = React32.useMemo(() => {
10298
10433
  const startIdx = colVirtEnabled ? visibleSlots.startIdx : 0;
10299
10434
  const endIdx = colVirtEnabled ? visibleSlots.endIdx : slots.length;
10300
10435
  const leftSpacer = startIdx > 0 ? slotLefts[startIdx] ?? 0 : 0;
@@ -10364,7 +10499,8 @@ function CalendarTimeline({
10364
10499
  activeView,
10365
10500
  sizeConfig,
10366
10501
  navigate,
10367
- goToday,
10502
+ now: resolvedNow,
10503
+ onApplyDateTime: setDate,
10368
10504
  setView,
10369
10505
  effectiveResourceColumnWidth,
10370
10506
  canResizeColumn,
@@ -10389,7 +10525,7 @@ function CalendarTimeline({
10389
10525
  "div",
10390
10526
  {
10391
10527
  className: cn(
10392
- "border border-border/40 rounded-2xl overflow-hidden bg-background/95 backdrop-blur-sm",
10528
+ "border border-border/40 rounded-2xl md:rounded-3xl overflow-hidden bg-background/95 backdrop-blur-sm",
10393
10529
  "shadow-sm hover:shadow-md transition-shadow duration-300",
10394
10530
  densityClass,
10395
10531
  className
@@ -10531,16 +10667,19 @@ function CalendarTimeline({
10531
10667
  const resource = resourceById.get(ev.resourceId);
10532
10668
  const tooltipTitle = ev.title || ev.id;
10533
10669
  const shouldCompact = activeView === "day" && dayEventStyle === "compact";
10670
+ const eventInsetX = 2;
10671
+ const leftInset = left + eventInsetX;
10672
+ const widthInset = Math.max(1, width - eventInsetX * 2);
10534
10673
  const defaultMaxVisual = clamp4(Math.round(fixedSlotWidth * 1.2), 160, 360);
10535
10674
  const maxVisual = clamp4(Math.round(dayEventMaxWidth ?? defaultMaxVisual), 80, 1200);
10536
- const visualWidth = shouldCompact ? Math.min(width, maxVisual) : width;
10537
- const isClipped = shouldCompact && width > visualWidth + 1;
10675
+ const visualWidth = shouldCompact ? Math.min(widthInset, maxVisual) : widthInset;
10676
+ const isClipped = shouldCompact && widthInset > visualWidth + 1;
10538
10677
  const block = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
10539
10678
  "div",
10540
10679
  {
10541
10680
  className: cn("absolute select-none cursor-pointer", isPreview && "z-10"),
10542
10681
  "data-uv-ct-event": true,
10543
- style: { left, top, width, height: layout.eventHeight },
10682
+ style: { left: leftInset, top, width: widthInset, height: layout.eventHeight },
10544
10683
  role: "button",
10545
10684
  tabIndex: 0,
10546
10685
  "aria-label": aria,
@@ -10612,7 +10751,7 @@ function CalendarTimeline({
10612
10751
  ]
10613
10752
  }
10614
10753
  );
10615
- if (!enableEventTooltips) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(React31.Fragment, { children: block }, ev.id);
10754
+ if (!enableEventTooltips) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(React32.Fragment, { children: block }, ev.id);
10616
10755
  const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
10617
10756
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "font-semibold", children: tooltipTitle }),
10618
10757
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "text-xs opacity-80", children: timeText }),
@@ -10625,11 +10764,17 @@ function CalendarTimeline({
10625
10764
  const endIdx = clamp4(binarySearchFirstGE(slotStarts, preview.end), startIdx + 1, slots.length);
10626
10765
  const left = slotLefts[startIdx] ?? 0;
10627
10766
  const width = Math.max(1, (slotLefts[endIdx] ?? 0) - (slotLefts[startIdx] ?? 0));
10767
+ const eventInsetX = 2;
10628
10768
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
10629
10769
  "div",
10630
10770
  {
10631
10771
  className: "absolute rounded-lg border-2 border-dashed border-primary/60 bg-primary/10 backdrop-blur-sm animate-pulse",
10632
- style: { left, top: layout.baseTop, width, height: layout.eventHeight }
10772
+ style: {
10773
+ left: left + eventInsetX,
10774
+ top: layout.baseTop,
10775
+ width: Math.max(1, width - eventInsetX * 2),
10776
+ height: layout.eventHeight
10777
+ }
10633
10778
  }
10634
10779
  );
10635
10780
  })() : null,
@@ -10762,7 +10907,7 @@ function CalendarTimeline({
10762
10907
  }
10763
10908
 
10764
10909
  // ../../components/ui/MultiCombobox.tsx
10765
- var React32 = __toESM(require("react"), 1);
10910
+ var React33 = __toESM(require("react"), 1);
10766
10911
  var import_react16 = require("react");
10767
10912
  var import_lucide_react22 = require("lucide-react");
10768
10913
  var import_jsx_runtime39 = require("react/jsx-runtime");
@@ -10797,27 +10942,27 @@ var MultiCombobox = ({
10797
10942
  helperText,
10798
10943
  maxTagsVisible = 3
10799
10944
  }) => {
10800
- const [query, setQuery] = React32.useState("");
10801
- const [open, setOpen] = React32.useState(false);
10802
- const [activeIndex, setActiveIndex] = React32.useState(null);
10803
- const inputRef = React32.useRef(null);
10804
- const listRef = React32.useRef([]);
10805
- const triggerRef = React32.useRef(null);
10945
+ const [query, setQuery] = React33.useState("");
10946
+ const [open, setOpen] = React33.useState(false);
10947
+ const [activeIndex, setActiveIndex] = React33.useState(null);
10948
+ const inputRef = React33.useRef(null);
10949
+ const listRef = React33.useRef([]);
10950
+ const triggerRef = React33.useRef(null);
10806
10951
  useShadCNAnimations();
10807
- const normalizedOptions = React32.useMemo(
10952
+ const normalizedOptions = React33.useMemo(
10808
10953
  () => options.map(
10809
10954
  (o) => typeof o === "string" ? { value: o, label: o } : { value: o.value, label: o.label, icon: o.icon, description: o.description, disabled: o.disabled, group: o.group }
10810
10955
  ),
10811
10956
  [options]
10812
10957
  );
10813
10958
  const enableSearch = normalizedOptions.length > 10;
10814
- const filtered = React32.useMemo(
10959
+ const filtered = React33.useMemo(
10815
10960
  () => enableSearch ? normalizedOptions.filter(
10816
10961
  (opt) => opt.label.toLowerCase().includes(query.toLowerCase()) || opt.description?.toLowerCase().includes(query.toLowerCase())
10817
10962
  ) : normalizedOptions,
10818
10963
  [normalizedOptions, query, enableSearch]
10819
10964
  );
10820
- const groupedOptions = React32.useMemo(() => {
10965
+ const groupedOptions = React33.useMemo(() => {
10821
10966
  if (!groupBy) return null;
10822
10967
  const groups = /* @__PURE__ */ new Map();
10823
10968
  filtered.forEach((opt) => {
@@ -10853,7 +10998,7 @@ var MultiCombobox = ({
10853
10998
  const handleClearAll = () => {
10854
10999
  onChange([]);
10855
11000
  };
10856
- React32.useEffect(() => {
11001
+ React33.useEffect(() => {
10857
11002
  if (open && enableSearch) {
10858
11003
  setTimeout(() => {
10859
11004
  inputRef.current?.focus();
@@ -11078,7 +11223,7 @@ var MultiCombobox = ({
11078
11223
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex items-center gap-1.5 flex-wrap min-h-6 flex-1", children: value.length > 0 ? showTags ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
11079
11224
  visibleTags.map((option) => {
11080
11225
  if (renderTag) {
11081
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(React32.Fragment, { children: renderTag(option, () => handleRemove(option.value)) }, option.value);
11226
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(React33.Fragment, { children: renderTag(option, () => handleRemove(option.value)) }, option.value);
11082
11227
  }
11083
11228
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
11084
11229
  "span",
@@ -11219,17 +11364,17 @@ var MultiCombobox = ({
11219
11364
  };
11220
11365
 
11221
11366
  // ../../components/ui/RadioGroup.tsx
11222
- var React33 = __toESM(require("react"), 1);
11367
+ var React34 = __toESM(require("react"), 1);
11223
11368
  var import_jsx_runtime40 = require("react/jsx-runtime");
11224
- var RadioGroupContext = React33.createContext(void 0);
11369
+ var RadioGroupContext = React34.createContext(void 0);
11225
11370
  var useRadioGroup = () => {
11226
- const context = React33.useContext(RadioGroupContext);
11371
+ const context = React34.useContext(RadioGroupContext);
11227
11372
  if (!context) {
11228
11373
  throw new Error("RadioGroupItem must be used within a RadioGroup");
11229
11374
  }
11230
11375
  return context;
11231
11376
  };
11232
- var RadioGroup = React33.forwardRef(
11377
+ var RadioGroup = React34.forwardRef(
11233
11378
  ({
11234
11379
  value,
11235
11380
  defaultValue,
@@ -11245,7 +11390,7 @@ var RadioGroup = React33.forwardRef(
11245
11390
  error = false,
11246
11391
  errorMessage
11247
11392
  }, ref) => {
11248
- const [internalValue, setInternalValue] = React33.useState(defaultValue || "");
11393
+ const [internalValue, setInternalValue] = React34.useState(defaultValue || "");
11249
11394
  const isControlled = value !== void 0;
11250
11395
  const currentValue = isControlled ? value : internalValue;
11251
11396
  const handleValueChange = (newValue) => {
@@ -11256,7 +11401,7 @@ var RadioGroup = React33.forwardRef(
11256
11401
  onValueChange?.(newValue);
11257
11402
  }
11258
11403
  };
11259
- const uniqueId = React33.useId();
11404
+ const uniqueId = React34.useId();
11260
11405
  const radioName = name || `radio-group-${uniqueId}`;
11261
11406
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
11262
11407
  RadioGroupContext.Provider,
@@ -11314,7 +11459,7 @@ var sizeStyles7 = {
11314
11459
  padding: "p-4"
11315
11460
  }
11316
11461
  };
11317
- var RadioGroupItem = React33.forwardRef(
11462
+ var RadioGroupItem = React34.forwardRef(
11318
11463
  ({ value, id, disabled, className, children, label, description, icon }, ref) => {
11319
11464
  const { value: selectedValue, onValueChange, name, disabled: groupDisabled, size = "md", variant = "default" } = useRadioGroup();
11320
11465
  const isDisabled = disabled || groupDisabled;
@@ -11491,7 +11636,7 @@ var RadioGroupItem = React33.forwardRef(
11491
11636
  RadioGroupItem.displayName = "RadioGroupItem";
11492
11637
 
11493
11638
  // ../../components/ui/Slider.tsx
11494
- var React34 = __toESM(require("react"), 1);
11639
+ var React35 = __toESM(require("react"), 1);
11495
11640
  var import_jsx_runtime41 = require("react/jsx-runtime");
11496
11641
  var SIZE_STYLES = {
11497
11642
  sm: {
@@ -11511,7 +11656,7 @@ var SIZE_STYLES = {
11511
11656
  }
11512
11657
  };
11513
11658
  var clamp5 = (n, min, max) => Math.min(max, Math.max(min, n));
11514
- var Slider = React34.forwardRef(
11659
+ var Slider = React35.forwardRef(
11515
11660
  ({
11516
11661
  className,
11517
11662
  mode = "single",
@@ -11543,15 +11688,15 @@ var Slider = React34.forwardRef(
11543
11688
  ...props
11544
11689
  }, ref) => {
11545
11690
  const isRange = mode === "range";
11546
- const trackRef = React34.useRef(null);
11547
- const [internalValue, setInternalValue] = React34.useState(defaultValue);
11548
- const [internalRange, setInternalRange] = React34.useState(() => {
11691
+ const trackRef = React35.useRef(null);
11692
+ const [internalValue, setInternalValue] = React35.useState(defaultValue);
11693
+ const [internalRange, setInternalRange] = React35.useState(() => {
11549
11694
  if (defaultRangeValue) return defaultRangeValue;
11550
11695
  const v = clamp5(defaultValue, min, max);
11551
11696
  return [min, v];
11552
11697
  });
11553
- const [activeThumb, setActiveThumb] = React34.useState(null);
11554
- const dragRef = React34.useRef(null);
11698
+ const [activeThumb, setActiveThumb] = React35.useState(null);
11699
+ const dragRef = React35.useRef(null);
11555
11700
  const isControlled = value !== void 0;
11556
11701
  const currentValue = isControlled ? value : internalValue;
11557
11702
  const isRangeControlled = rangeValue !== void 0;
@@ -11559,7 +11704,7 @@ var Slider = React34.forwardRef(
11559
11704
  const rangeMin = clamp5(currentRange[0] ?? min, min, max);
11560
11705
  const rangeMax = clamp5(currentRange[1] ?? max, min, max);
11561
11706
  const normalizedRange = rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin];
11562
- const handleSingleChange = React34.useCallback(
11707
+ const handleSingleChange = React35.useCallback(
11563
11708
  (e) => {
11564
11709
  const newValue = Number(e.target.value);
11565
11710
  if (!isControlled) {
@@ -11570,14 +11715,14 @@ var Slider = React34.forwardRef(
11570
11715
  },
11571
11716
  [isControlled, onChange, onValueChange]
11572
11717
  );
11573
- const emitRange = React34.useCallback(
11718
+ const emitRange = React35.useCallback(
11574
11719
  (next) => {
11575
11720
  onRangeChange?.(next);
11576
11721
  onRangeValueChange?.(next);
11577
11722
  },
11578
11723
  [onRangeChange, onRangeValueChange]
11579
11724
  );
11580
- const handleRangeChange = React34.useCallback(
11725
+ const handleRangeChange = React35.useCallback(
11581
11726
  (thumb) => (e) => {
11582
11727
  const nextVal = Number(e.target.value);
11583
11728
  const [curMin, curMax] = normalizedRange;
@@ -11592,7 +11737,7 @@ var Slider = React34.forwardRef(
11592
11737
  const rangeStartPct = (normalizedRange[0] - min) / denom * 100;
11593
11738
  const rangeEndPct = (normalizedRange[1] - min) / denom * 100;
11594
11739
  const sizeStyles8 = SIZE_STYLES[size];
11595
- const displayValue = React34.useMemo(() => {
11740
+ const displayValue = React35.useMemo(() => {
11596
11741
  if (isRange) {
11597
11742
  const a = formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString();
11598
11743
  const b = formatValue ? formatValue(normalizedRange[1]) : normalizedRange[1].toString();
@@ -11600,7 +11745,7 @@ var Slider = React34.forwardRef(
11600
11745
  }
11601
11746
  return formatValue ? formatValue(currentValue) : currentValue.toString();
11602
11747
  }, [currentValue, formatValue, isRange, normalizedRange]);
11603
- const quantize = React34.useCallback(
11748
+ const quantize = React35.useCallback(
11604
11749
  (v) => {
11605
11750
  const stepped = Math.round((v - min) / step) * step + min;
11606
11751
  const fixed = Number(stepped.toFixed(10));
@@ -11608,7 +11753,7 @@ var Slider = React34.forwardRef(
11608
11753
  },
11609
11754
  [max, min, step]
11610
11755
  );
11611
- const valueFromClientX = React34.useCallback(
11756
+ const valueFromClientX = React35.useCallback(
11612
11757
  (clientX) => {
11613
11758
  const el = trackRef.current;
11614
11759
  if (!el) return min;
@@ -12712,7 +12857,7 @@ function ImageUpload({
12712
12857
  }
12713
12858
 
12714
12859
  // ../../components/ui/Carousel.tsx
12715
- var React37 = __toESM(require("react"), 1);
12860
+ var React38 = __toESM(require("react"), 1);
12716
12861
  var import_lucide_react26 = require("lucide-react");
12717
12862
  var import_jsx_runtime45 = require("react/jsx-runtime");
12718
12863
  function Carousel({
@@ -12735,19 +12880,19 @@ function Carousel({
12735
12880
  thumbnailRenderer,
12736
12881
  ariaLabel = "Carousel"
12737
12882
  }) {
12738
- const [currentIndex, setCurrentIndex] = React37.useState(0);
12739
- const [isPaused, setIsPaused] = React37.useState(false);
12740
- const [isDragging, setIsDragging] = React37.useState(false);
12741
- const [startPos, setStartPos] = React37.useState(0);
12742
- const [currentTranslate, setCurrentTranslate] = React37.useState(0);
12743
- const [prevTranslate, setPrevTranslate] = React37.useState(0);
12744
- const progressElRef = React37.useRef(null);
12745
- const carouselRef = React37.useRef(null);
12746
- const rafRef = React37.useRef(null);
12747
- const totalSlides = React37.Children.count(children);
12883
+ const [currentIndex, setCurrentIndex] = React38.useState(0);
12884
+ const [isPaused, setIsPaused] = React38.useState(false);
12885
+ const [isDragging, setIsDragging] = React38.useState(false);
12886
+ const [startPos, setStartPos] = React38.useState(0);
12887
+ const [currentTranslate, setCurrentTranslate] = React38.useState(0);
12888
+ const [prevTranslate, setPrevTranslate] = React38.useState(0);
12889
+ const progressElRef = React38.useRef(null);
12890
+ const carouselRef = React38.useRef(null);
12891
+ const rafRef = React38.useRef(null);
12892
+ const totalSlides = React38.Children.count(children);
12748
12893
  const maxIndex = Math.max(0, totalSlides - slidesToShow);
12749
12894
  const isHorizontal = orientation === "horizontal";
12750
- const scrollPrev = React37.useCallback(() => {
12895
+ const scrollPrev = React38.useCallback(() => {
12751
12896
  setCurrentIndex((prev) => {
12752
12897
  if (prev === 0) {
12753
12898
  return loop ? maxIndex : 0;
@@ -12755,7 +12900,7 @@ function Carousel({
12755
12900
  return Math.max(0, prev - slidesToScroll);
12756
12901
  });
12757
12902
  }, [loop, maxIndex, slidesToScroll]);
12758
- const scrollNext = React37.useCallback(() => {
12903
+ const scrollNext = React38.useCallback(() => {
12759
12904
  setCurrentIndex((prev) => {
12760
12905
  if (prev >= maxIndex) {
12761
12906
  return loop ? 0 : maxIndex;
@@ -12763,13 +12908,13 @@ function Carousel({
12763
12908
  return Math.min(maxIndex, prev + slidesToScroll);
12764
12909
  });
12765
12910
  }, [loop, maxIndex, slidesToScroll]);
12766
- const scrollTo = React37.useCallback(
12911
+ const scrollTo = React38.useCallback(
12767
12912
  (index) => {
12768
12913
  setCurrentIndex(Math.min(maxIndex, Math.max(0, index)));
12769
12914
  },
12770
12915
  [maxIndex]
12771
12916
  );
12772
- React37.useEffect(() => {
12917
+ React38.useEffect(() => {
12773
12918
  const handleKeyDown = (e) => {
12774
12919
  if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
12775
12920
  e.preventDefault();
@@ -12791,7 +12936,7 @@ function Carousel({
12791
12936
  return () => carousel.removeEventListener("keydown", handleKeyDown);
12792
12937
  }
12793
12938
  }, [scrollPrev, scrollNext, scrollTo, maxIndex]);
12794
- React37.useEffect(() => {
12939
+ React38.useEffect(() => {
12795
12940
  const stop = () => {
12796
12941
  if (rafRef.current != null) {
12797
12942
  cancelAnimationFrame(rafRef.current);
@@ -12850,7 +12995,7 @@ function Carousel({
12850
12995
  setCurrentTranslate(0);
12851
12996
  setPrevTranslate(0);
12852
12997
  };
12853
- React37.useEffect(() => {
12998
+ React38.useEffect(() => {
12854
12999
  onSlideChange?.(currentIndex);
12855
13000
  }, [currentIndex, onSlideChange]);
12856
13001
  const getAnimationStyles2 = () => {
@@ -12903,7 +13048,7 @@ function Carousel({
12903
13048
  role: "group",
12904
13049
  "aria-atomic": "false",
12905
13050
  "aria-live": autoScroll ? "off" : "polite",
12906
- children: React37.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
13051
+ children: React38.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
12907
13052
  "div",
12908
13053
  {
12909
13054
  className: cn(
@@ -12993,7 +13138,7 @@ function Carousel({
12993
13138
  "absolute bottom-0 left-0 right-0 flex gap-2 p-4 bg-linear-to-t from-black/50 to-transparent overflow-x-auto",
12994
13139
  isHorizontal ? "flex-row" : "flex-col"
12995
13140
  ),
12996
- children: React37.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
13141
+ children: React38.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
12997
13142
  "button",
12998
13143
  {
12999
13144
  onClick: () => scrollTo(idx),
@@ -13286,7 +13431,7 @@ function FallingIcons({
13286
13431
  }
13287
13432
 
13288
13433
  // ../../components/ui/List.tsx
13289
- var React39 = __toESM(require("react"), 1);
13434
+ var React40 = __toESM(require("react"), 1);
13290
13435
  var import_lucide_react27 = require("lucide-react");
13291
13436
  var import_jsx_runtime47 = require("react/jsx-runtime");
13292
13437
  var SIZE_STYLES2 = {
@@ -13312,7 +13457,7 @@ var ListItemSkeleton = ({ size }) => {
13312
13457
  ] })
13313
13458
  ] });
13314
13459
  };
13315
- var ListRoot = React39.forwardRef(
13460
+ var ListRoot = React40.forwardRef(
13316
13461
  ({
13317
13462
  as = "ul",
13318
13463
  ordered,
@@ -13332,7 +13477,7 @@ var ListRoot = React39.forwardRef(
13332
13477
  ...rest
13333
13478
  }, ref) => {
13334
13479
  const Comp = ordered ? "ol" : as;
13335
- const childCount = React39.Children.count(children);
13480
+ const childCount = React40.Children.count(children);
13336
13481
  const hasChildren = childCount > 0;
13337
13482
  const variantClasses2 = {
13338
13483
  plain: "",
@@ -13370,14 +13515,14 @@ var ListRoot = React39.forwardRef(
13370
13515
  className
13371
13516
  ),
13372
13517
  ...rest,
13373
- children: React39.Children.map(children, (child, idx) => {
13374
- if (!React39.isValidElement(child)) return child;
13518
+ children: React40.Children.map(children, (child, idx) => {
13519
+ if (!React40.isValidElement(child)) return child;
13375
13520
  const childClass = cn(
13376
13521
  child.props?.className,
13377
13522
  hoverable && variant !== "flush" && "hover:bg-accent/50 focus:bg-accent/60 focus:outline-none transition-colors",
13378
13523
  variant === "flush" && "hover:bg-accent/30"
13379
13524
  );
13380
- return React39.cloneElement(child, {
13525
+ return React40.cloneElement(child, {
13381
13526
  className: childClass,
13382
13527
  // Pass global item class to contentClassName of ListItem
13383
13528
  contentClassName: cn(itemClassName, child.props?.contentClassName),
@@ -13392,7 +13537,7 @@ var ListRoot = React39.forwardRef(
13392
13537
  }
13393
13538
  );
13394
13539
  ListRoot.displayName = "List";
13395
- var ListItem = React39.forwardRef(
13540
+ var ListItem = React40.forwardRef(
13396
13541
  ({
13397
13542
  as = "li",
13398
13543
  selected = false,
@@ -13415,7 +13560,7 @@ var ListItem = React39.forwardRef(
13415
13560
  children,
13416
13561
  ...rest
13417
13562
  }, ref) => {
13418
- const [internalExpanded, setInternalExpanded] = React39.useState(false);
13563
+ const [internalExpanded, setInternalExpanded] = React40.useState(false);
13419
13564
  const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
13420
13565
  const sizeAttr = rest["data-size"];
13421
13566
  const resolvedSize = sizeAttr && ["xs", "sm", "md", "lg"].includes(sizeAttr) ? sizeAttr : "md";
@@ -13483,7 +13628,7 @@ var List = Object.assign(ListRoot, { Item: ListItem });
13483
13628
  var List_default = List;
13484
13629
 
13485
13630
  // ../../components/ui/Watermark.tsx
13486
- var React40 = __toESM(require("react"), 1);
13631
+ var React41 = __toESM(require("react"), 1);
13487
13632
  var import_react_dom5 = require("react-dom");
13488
13633
  var import_jsx_runtime48 = require("react/jsx-runtime");
13489
13634
  var PRESETS2 = {
@@ -13495,8 +13640,8 @@ var PRESETS2 = {
13495
13640
  internal: { text: "INTERNAL USE ONLY", color: "rgba(156, 163, 175, 0.15)", rotate: -22, fontSize: 13, fontWeight: "600" }
13496
13641
  };
13497
13642
  function useWatermarkDataURL(opts) {
13498
- const [url, setUrl] = React40.useState(null);
13499
- React40.useEffect(() => {
13643
+ const [url, setUrl] = React41.useState(null);
13644
+ React41.useEffect(() => {
13500
13645
  let cancelled = false;
13501
13646
  const text = opts.text;
13502
13647
  const image = opts.image;
@@ -13673,9 +13818,9 @@ var Watermark = ({
13673
13818
  children,
13674
13819
  ...rest
13675
13820
  }) => {
13676
- const [visible, setVisible] = React40.useState(true);
13677
- const [isDark, setIsDark] = React40.useState(false);
13678
- React40.useEffect(() => {
13821
+ const [visible, setVisible] = React41.useState(true);
13822
+ const [isDark, setIsDark] = React41.useState(false);
13823
+ React41.useEffect(() => {
13679
13824
  if (!darkMode) return;
13680
13825
  const checkDarkMode = () => {
13681
13826
  const isDarkMode = document.documentElement.classList.contains("dark") || window.matchMedia("(prefers-color-scheme: dark)").matches;
@@ -13777,7 +13922,7 @@ var Watermark = ({
13777
13922
  var Watermark_default = Watermark;
13778
13923
 
13779
13924
  // ../../components/ui/Timeline.tsx
13780
- var React41 = __toESM(require("react"), 1);
13925
+ var React42 = __toESM(require("react"), 1);
13781
13926
  var import_lucide_react28 = require("lucide-react");
13782
13927
  var import_jsx_runtime49 = require("react/jsx-runtime");
13783
13928
  var SIZE_STYLE = {
@@ -13830,7 +13975,7 @@ var STATUS_COLOR = {
13830
13975
  error: "bg-destructive",
13831
13976
  info: "bg-info"
13832
13977
  };
13833
- var TimelineContext = React41.createContext(null);
13978
+ var TimelineContext = React42.createContext(null);
13834
13979
  var LINE_STYLE_MAP = {
13835
13980
  solid: "border-solid",
13836
13981
  dashed: "border-dashed",
@@ -13858,7 +14003,7 @@ var Marker = ({ index, last, size, color, status = "default", lineColor, lineSty
13858
14003
  !last && showLine && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn("flex-1 border-l-2", LINE_STYLE_MAP[lineStyle]), style: { borderColor: lineColor || "hsl(var(--border))" } })
13859
14004
  ] });
13860
14005
  };
13861
- var TimelineRoot = React41.forwardRef(
14006
+ var TimelineRoot = React42.forwardRef(
13862
14007
  ({
13863
14008
  align = "left",
13864
14009
  variant = "default",
@@ -13888,7 +14033,7 @@ var TimelineRoot = React41.forwardRef(
13888
14033
  }
13889
14034
  );
13890
14035
  TimelineRoot.displayName = "Timeline";
13891
- var TimelineItem = React41.forwardRef(
14036
+ var TimelineItem = React42.forwardRef(
13892
14037
  ({
13893
14038
  title,
13894
14039
  description,
@@ -13907,11 +14052,11 @@ var TimelineItem = React41.forwardRef(
13907
14052
  children,
13908
14053
  ...rest
13909
14054
  }, ref) => {
13910
- const ctx = React41.useContext(TimelineContext);
14055
+ const ctx = React42.useContext(TimelineContext);
13911
14056
  const idx = rest["data-index"];
13912
14057
  const isLast = Boolean(rest["data-last"]);
13913
14058
  const sz = SIZE_STYLE[ctx.size];
13914
- const [internalExpanded, setInternalExpanded] = React41.useState(false);
14059
+ const [internalExpanded, setInternalExpanded] = React42.useState(false);
13915
14060
  const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
13916
14061
  const toggleExpanded = () => {
13917
14062
  const newExpanded = !isExpanded;
@@ -14053,7 +14198,7 @@ var Timeline = Object.assign(TimelineRoot, { Item: TimelineItem });
14053
14198
  var Timeline_default = Timeline;
14054
14199
 
14055
14200
  // ../../components/ui/ColorPicker.tsx
14056
- var React42 = __toESM(require("react"), 1);
14201
+ var React43 = __toESM(require("react"), 1);
14057
14202
  var import_lucide_react29 = require("lucide-react");
14058
14203
  var import_jsx_runtime50 = require("react/jsx-runtime");
14059
14204
  var clamp6 = (n, min, max) => Math.max(min, Math.min(max, n));
@@ -14247,12 +14392,12 @@ function ColorPicker({
14247
14392
  }) {
14248
14393
  const isControlled = value !== void 0;
14249
14394
  const initial = parseAnyColor(isControlled ? value : defaultValue) || { r: 79, g: 70, b: 229, a: 1 };
14250
- const [rgba, setRgba] = React42.useState(initial);
14251
- const [open, setOpen] = React42.useState(false);
14252
- const [text, setText] = React42.useState(() => formatOutput(initial, withAlpha, format));
14253
- const [copied, setCopied] = React42.useState(false);
14254
- const [recentColors, setRecentColors] = React42.useState([]);
14255
- React42.useEffect(() => {
14395
+ const [rgba, setRgba] = React43.useState(initial);
14396
+ const [open, setOpen] = React43.useState(false);
14397
+ const [text, setText] = React43.useState(() => formatOutput(initial, withAlpha, format));
14398
+ const [copied, setCopied] = React43.useState(false);
14399
+ const [recentColors, setRecentColors] = React43.useState([]);
14400
+ React43.useEffect(() => {
14256
14401
  if (isControlled) {
14257
14402
  const parsed = parseAnyColor(value);
14258
14403
  if (parsed) {
@@ -17204,10 +17349,10 @@ function DataTable({
17204
17349
  var DataTable_default = DataTable;
17205
17350
 
17206
17351
  // ../../components/ui/Form.tsx
17207
- var React57 = __toESM(require("react"), 1);
17352
+ var React58 = __toESM(require("react"), 1);
17208
17353
  var import_react_hook_form = require("react-hook-form");
17209
17354
  var import_jsx_runtime66 = require("react/jsx-runtime");
17210
- var FormConfigContext = React57.createContext({ size: "md" });
17355
+ var FormConfigContext = React58.createContext({ size: "md" });
17211
17356
  var FormWrapper = ({
17212
17357
  children,
17213
17358
  onSubmit,
@@ -17220,7 +17365,7 @@ var FormWrapper = ({
17220
17365
  const methods = (0, import_react_hook_form.useForm)({
17221
17366
  defaultValues: initialValues
17222
17367
  });
17223
- React57.useEffect(() => {
17368
+ React58.useEffect(() => {
17224
17369
  if (initialValues) {
17225
17370
  methods.reset(initialValues);
17226
17371
  }
@@ -17229,15 +17374,15 @@ var FormWrapper = ({
17229
17374
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react_hook_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
17230
17375
  };
17231
17376
  var Form = FormWrapper;
17232
- var FormFieldContext = React57.createContext({});
17377
+ var FormFieldContext = React58.createContext({});
17233
17378
  var FormField = ({
17234
17379
  ...props
17235
17380
  }) => {
17236
17381
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react_hook_form.Controller, { ...props }) });
17237
17382
  };
17238
17383
  var useFormField = () => {
17239
- const fieldContext = React57.useContext(FormFieldContext);
17240
- const itemContext = React57.useContext(FormItemContext);
17384
+ const fieldContext = React58.useContext(FormFieldContext);
17385
+ const itemContext = React58.useContext(FormItemContext);
17241
17386
  const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
17242
17387
  if (!fieldContext) {
17243
17388
  try {
@@ -17258,16 +17403,16 @@ var useFormField = () => {
17258
17403
  ...fieldState
17259
17404
  };
17260
17405
  };
17261
- var FormItemContext = React57.createContext({});
17262
- var FormItem = React57.forwardRef(({ className, ...props }, ref) => {
17263
- const id = React57.useId();
17406
+ var FormItemContext = React58.createContext({});
17407
+ var FormItem = React58.forwardRef(({ className, ...props }, ref) => {
17408
+ const id = React58.useId();
17264
17409
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ref, className: cn("space-y-2", className), ...props }) });
17265
17410
  });
17266
17411
  FormItem.displayName = "FormItem";
17267
- var FormLabel = React57.forwardRef(
17412
+ var FormLabel = React58.forwardRef(
17268
17413
  ({ className, children, required, ...props }, ref) => {
17269
17414
  const { error, formItemId } = useFormField();
17270
- const config = React57.useContext(FormConfigContext);
17415
+ const config = React58.useContext(FormConfigContext);
17271
17416
  const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
17272
17417
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
17273
17418
  children,
@@ -17276,7 +17421,7 @@ var FormLabel = React57.forwardRef(
17276
17421
  }
17277
17422
  );
17278
17423
  FormLabel.displayName = "FormLabel";
17279
- var FormControl = React57.forwardRef(({ ...props }, ref) => {
17424
+ var FormControl = React58.forwardRef(({ ...props }, ref) => {
17280
17425
  const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
17281
17426
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
17282
17427
  "div",
@@ -17290,12 +17435,12 @@ var FormControl = React57.forwardRef(({ ...props }, ref) => {
17290
17435
  );
17291
17436
  });
17292
17437
  FormControl.displayName = "FormControl";
17293
- var FormDescription = React57.forwardRef(({ className, ...props }, ref) => {
17438
+ var FormDescription = React58.forwardRef(({ className, ...props }, ref) => {
17294
17439
  const { formDescriptionId } = useFormField();
17295
17440
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
17296
17441
  });
17297
17442
  FormDescription.displayName = "FormDescription";
17298
- var FormMessage = React57.forwardRef(({ className, children, ...props }, ref) => {
17443
+ var FormMessage = React58.forwardRef(({ className, children, ...props }, ref) => {
17299
17444
  const { error, formMessageId } = useFormField();
17300
17445
  const body = error ? String(error?.message) : children;
17301
17446
  if (!body) {
@@ -17304,7 +17449,7 @@ var FormMessage = React57.forwardRef(({ className, children, ...props }, ref) =>
17304
17449
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
17305
17450
  });
17306
17451
  FormMessage.displayName = "FormMessage";
17307
- var FormInput = React57.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
17452
+ var FormInput = React58.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
17308
17453
  FormField,
17309
17454
  {
17310
17455
  name,
@@ -17315,7 +17460,7 @@ var FormInput = React57.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */
17315
17460
  }
17316
17461
  ) }));
17317
17462
  FormInput.displayName = "FormInput";
17318
- var FormCheckbox = React57.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
17463
+ var FormCheckbox = React58.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
17319
17464
  FormField,
17320
17465
  {
17321
17466
  name,
@@ -17339,9 +17484,9 @@ var FormCheckbox = React57.forwardRef(({ name, ...props }, ref) => /* @__PURE__
17339
17484
  }
17340
17485
  ) }));
17341
17486
  FormCheckbox.displayName = "FormCheckbox";
17342
- var FormActions = React57.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
17487
+ var FormActions = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
17343
17488
  FormActions.displayName = "FormActions";
17344
- var FormSubmitButton = React57.forwardRef(
17489
+ var FormSubmitButton = React58.forwardRef(
17345
17490
  ({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) })
17346
17491
  );
17347
17492
  FormSubmitButton.displayName = "FormSubmitButton";
@@ -18123,7 +18268,7 @@ var VARIANT_STYLES_ALERT = {
18123
18268
  };
18124
18269
 
18125
18270
  // src/contexts/TranslationContext.tsx
18126
- var React59 = __toESM(require("react"), 1);
18271
+ var React60 = __toESM(require("react"), 1);
18127
18272
 
18128
18273
  // locales/en.json
18129
18274
  var en_default = {
@@ -18481,9 +18626,9 @@ var defaultTranslations2 = {
18481
18626
  ko: ko_default,
18482
18627
  ja: ja_default
18483
18628
  };
18484
- var TranslationContext2 = React59.createContext(null);
18629
+ var TranslationContext2 = React60.createContext(null);
18485
18630
  var TranslationProvider = ({ children, locale = "en", translations }) => {
18486
- const t = React59.useCallback(
18631
+ const t = React60.useCallback(
18487
18632
  (namespace) => {
18488
18633
  return (key) => {
18489
18634
  const mergedTranslations = {
@@ -18511,7 +18656,7 @@ var TranslationProvider = ({ children, locale = "en", translations }) => {
18511
18656
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TranslationContext2.Provider, { value: { locale, t }, children });
18512
18657
  };
18513
18658
  var useUnderverseTranslations = (namespace) => {
18514
- const context = React59.useContext(TranslationContext2);
18659
+ const context = React60.useContext(TranslationContext2);
18515
18660
  if (!context) {
18516
18661
  return (key) => {
18517
18662
  const parts = namespace.split(".");
@@ -18533,12 +18678,12 @@ var useUnderverseTranslations = (namespace) => {
18533
18678
  return context.t(namespace);
18534
18679
  };
18535
18680
  var useUnderverseLocale = () => {
18536
- const context = React59.useContext(TranslationContext2);
18681
+ const context = React60.useContext(TranslationContext2);
18537
18682
  return context?.locale || "en";
18538
18683
  };
18539
18684
 
18540
18685
  // src/hooks/useSmartTranslations.tsx
18541
- var React60 = __toESM(require("react"), 1);
18686
+ var React61 = __toESM(require("react"), 1);
18542
18687
  var import_jsx_runtime73 = require("react/jsx-runtime");
18543
18688
  var nextIntlHooks = null;
18544
18689
  try {
@@ -18550,12 +18695,12 @@ try {
18550
18695
  } catch {
18551
18696
  nextIntlHooks = null;
18552
18697
  }
18553
- var ForceInternalContext = React60.createContext(false);
18698
+ var ForceInternalContext = React61.createContext(false);
18554
18699
  var ForceInternalTranslationsProvider = ({ children }) => {
18555
18700
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ForceInternalContext.Provider, { value: true, children });
18556
18701
  };
18557
18702
  function useSmartTranslations(namespace) {
18558
- const forceInternal = React60.useContext(ForceInternalContext);
18703
+ const forceInternal = React61.useContext(ForceInternalContext);
18559
18704
  const internalT = useUnderverseTranslations(namespace);
18560
18705
  if (forceInternal || !nextIntlHooks?.useTranslations) {
18561
18706
  return internalT;
@@ -18568,7 +18713,7 @@ function useSmartTranslations(namespace) {
18568
18713
  }
18569
18714
  }
18570
18715
  function useSmartLocale() {
18571
- const forceInternal = React60.useContext(ForceInternalContext);
18716
+ const forceInternal = React61.useContext(ForceInternalContext);
18572
18717
  const internalLocale = useUnderverseLocale();
18573
18718
  if (forceInternal || !nextIntlHooks?.useLocale) {
18574
18719
  return internalLocale;