@super-calendar/dom 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -409,6 +409,15 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
409
409
  * band stays non-interactive and hidden from assistive tech.
410
410
  */
411
411
  renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
412
+ /**
413
+ * A component that draws a `display: "background"` event's band in place of
414
+ * the themed shade. Rendered like `renderEvent`, it receives the event, the
415
+ * mode, `continuesBefore` / `continuesAfter` for a multi-day event, and
416
+ * `onPress`, which fires `onPressEvent`. The band then takes pointer events and
417
+ * is no longer hidden from assistive tech; cell clicks and drag-to-create are
418
+ * unreachable underneath it. Without it the band stays a shaded, inert range.
419
+ */
420
+ renderBackgroundEvent?: DomRenderEvent<T>;
412
421
  /** Show the current-time indicator on today's column (default true). */
413
422
  showNowIndicator?: boolean;
414
423
  /** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
@@ -417,6 +426,8 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
417
426
  timeZone?: string;
418
427
  /** Show the all-day lane above the grid (default true). */
419
428
  showAllDayEventCell?: boolean;
429
+ /** Show the "all-day" text beside the lane (default false). */
430
+ showAllDayLabel?: boolean;
420
431
  /** Tint Saturday/Sunday columns with the weekend background (default true). Set
421
432
  * false to treat weekends like any other day. */
422
433
  highlightWeekends?: boolean;
@@ -490,7 +501,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
490
501
  * <TimeGrid mode="week" date={new Date()} events={events} />
491
502
  * ```
492
503
  */
493
- declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, minEventHeight, eventGap, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, hiddenDays, keyboardEventNavigation, businessHours, renderBusinessHours, showNowIndicator, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, now: nowProp, timeZone, showAllDayEventCell, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
504
+ declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, minEventHeight, eventGap, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, hiddenDays, keyboardEventNavigation, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, now: nowProp, timeZone, showAllDayEventCell, showAllDayLabel, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
494
505
  //#endregion
495
506
  //#region src/Calendar.d.ts
496
507
  /**
@@ -597,10 +608,17 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
597
608
  * band stays non-interactive and hidden from assistive tech.
598
609
  */
599
610
  renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
611
+ /**
612
+ * A component that draws a `display: "background"` event's band in place of
613
+ * the themed shade; see `TimeGrid`'s prop of the same name.
614
+ */
615
+ renderBackgroundEvent?: DomRenderEvent<T>;
600
616
  /** Show the current-time indicator (default true). */
601
617
  showNowIndicator?: boolean;
602
618
  /** Show the all-day lane (default true). */
603
619
  showAllDayEventCell?: boolean;
620
+ /** Show the "all-day" text beside the lane (default false). */
621
+ showAllDayLabel?: boolean;
604
622
  /** Tint weekend columns (default true). Set false to treat weekends normally. */
605
623
  highlightWeekends?: boolean;
606
624
  /** Allow moving events by default (per-event `startEditable` overrides). Default true. */
@@ -695,7 +713,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
695
713
  * <Calendar mode="week" date={new Date()} events={events} />
696
714
  * ```
697
715
  */
698
- declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
716
+ declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator, showAllDayEventCell, showAllDayLabel, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
699
717
  //#endregion
700
718
  //#region src/MonthList.d.ts
701
719
  /**
package/dist/index.d.ts CHANGED
@@ -409,6 +409,15 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
409
409
  * band stays non-interactive and hidden from assistive tech.
410
410
  */
411
411
  renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
412
+ /**
413
+ * A component that draws a `display: "background"` event's band in place of
414
+ * the themed shade. Rendered like `renderEvent`, it receives the event, the
415
+ * mode, `continuesBefore` / `continuesAfter` for a multi-day event, and
416
+ * `onPress`, which fires `onPressEvent`. The band then takes pointer events and
417
+ * is no longer hidden from assistive tech; cell clicks and drag-to-create are
418
+ * unreachable underneath it. Without it the band stays a shaded, inert range.
419
+ */
420
+ renderBackgroundEvent?: DomRenderEvent<T>;
412
421
  /** Show the current-time indicator on today's column (default true). */
413
422
  showNowIndicator?: boolean;
414
423
  /** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
@@ -417,6 +426,8 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
417
426
  timeZone?: string;
418
427
  /** Show the all-day lane above the grid (default true). */
419
428
  showAllDayEventCell?: boolean;
429
+ /** Show the "all-day" text beside the lane (default false). */
430
+ showAllDayLabel?: boolean;
420
431
  /** Tint Saturday/Sunday columns with the weekend background (default true). Set
421
432
  * false to treat weekends like any other day. */
422
433
  highlightWeekends?: boolean;
@@ -490,7 +501,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
490
501
  * <TimeGrid mode="week" date={new Date()} events={events} />
491
502
  * ```
492
503
  */
493
- declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, minEventHeight, eventGap, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, hiddenDays, keyboardEventNavigation, businessHours, renderBusinessHours, showNowIndicator, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, now: nowProp, timeZone, showAllDayEventCell, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
504
+ declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, minEventHeight, eventGap, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, hiddenDays, keyboardEventNavigation, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, now: nowProp, timeZone, showAllDayEventCell, showAllDayLabel, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
494
505
  //#endregion
495
506
  //#region src/Calendar.d.ts
496
507
  /**
@@ -597,10 +608,17 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
597
608
  * band stays non-interactive and hidden from assistive tech.
598
609
  */
599
610
  renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
611
+ /**
612
+ * A component that draws a `display: "background"` event's band in place of
613
+ * the themed shade; see `TimeGrid`'s prop of the same name.
614
+ */
615
+ renderBackgroundEvent?: DomRenderEvent<T>;
600
616
  /** Show the current-time indicator (default true). */
601
617
  showNowIndicator?: boolean;
602
618
  /** Show the all-day lane (default true). */
603
619
  showAllDayEventCell?: boolean;
620
+ /** Show the "all-day" text beside the lane (default false). */
621
+ showAllDayLabel?: boolean;
604
622
  /** Tint weekend columns (default true). Set false to treat weekends normally. */
605
623
  highlightWeekends?: boolean;
606
624
  /** Allow moving events by default (per-event `startEditable` overrides). Default true. */
@@ -695,7 +713,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
695
713
  * <Calendar mode="week" date={new Date()} events={events} />
696
714
  * ```
697
715
  */
698
- declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
716
+ declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator, showAllDayEventCell, showAllDayLabel, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
699
717
  //#endregion
700
718
  //#region src/MonthList.d.ts
701
719
  /**
package/dist/index.js CHANGED
@@ -1378,7 +1378,7 @@ function DefaultDomEvent({ event, mode, isAllDay, boxHeight, ampm = false, theme
1378
1378
  * <TimeGrid mode="week" date={new Date()} events={events} />
1379
1379
  * ```
1380
1380
  */
1381
- function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStartsOn = 0, weekdayFormat = "short", hourHeight: initialHourHeight = 48, scrollOffsetMinutes = 480, zoomable = true, minHourHeight = 24, maxHourHeight = 160, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, dragStepMinutes = 15, ampm = false, timeslots = 1, minHour = 0, maxHour = 24, hideHours = false, showWeekNumber = false, weekNumberPrefix = "W", hiddenDays, keyboardEventNavigation = false, businessHours, renderBusinessHours, showNowIndicator = true, highlightWeekends = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, now: nowProp, timeZone, showAllDayEventCell = true, locale, theme: themeOverrides, height = 600, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }) {
1381
+ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStartsOn = 0, weekdayFormat = "short", hourHeight: initialHourHeight = 48, scrollOffsetMinutes = 480, zoomable = true, minHourHeight = 24, maxHourHeight = 160, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, dragStepMinutes = 15, ampm = false, timeslots = 1, minHour = 0, maxHour = 24, hideHours = false, showWeekNumber = false, weekNumberPrefix = "W", hiddenDays, keyboardEventNavigation = false, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator = true, highlightWeekends = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, now: nowProp, timeZone, showAllDayEventCell = true, showAllDayLabel = false, locale, theme: themeOverrides, height = 600, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }) {
1382
1382
  const theme = (0, react.useMemo)(() => mergeDomTheme(themeOverrides), [themeOverrides]);
1383
1383
  const slot = createSlots({
1384
1384
  classNames,
@@ -1392,6 +1392,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
1392
1392
  const windowEnd = Math.max(windowStart + 1, Math.min(maxHour, 24));
1393
1393
  const windowHours = windowEnd - windowStart;
1394
1394
  const gutterWidth = hideHours ? 0 : GUTTER_WIDTH$1;
1395
+ const RenderBackground = renderBackgroundEvent;
1395
1396
  const visibleHours = (0, react.useMemo)(() => Array.from({ length: windowHours }, (_, i) => windowStart + i), [windowStart, windowHours]);
1396
1397
  const now = (0, _super_calendar_core.useNow)(showNowIndicator, {
1397
1398
  now: nowProp,
@@ -1852,11 +1853,22 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
1852
1853
  windowStart,
1853
1854
  windowEnd
1854
1855
  ]);
1855
- const backgroundByDay = (0, react.useMemo)(() => days.map((day) => (0, _super_calendar_core.backgroundBandsForDay)(events, day).map((b) => ({
1856
- ...b,
1857
- startHours: Math.max(b.startHours, windowStart),
1858
- endHours: Math.min(b.endHours, windowEnd)
1859
- })).filter((b) => b.endHours > b.startHours)), [
1856
+ const backgroundByDay = (0, react.useMemo)(() => days.map((day) => {
1857
+ const seen = /* @__PURE__ */ new Map();
1858
+ return (0, _super_calendar_core.backgroundBandsForDay)(events, day).map((b) => ({
1859
+ ...b,
1860
+ startHours: Math.max(b.startHours, windowStart),
1861
+ endHours: Math.min(b.endHours, windowEnd)
1862
+ })).filter((b) => b.endHours > b.startHours).map((b) => {
1863
+ const base = `bg-${b.event.start.toISOString()}-${b.event.end.toISOString()}`;
1864
+ const nth = (seen.get(base) ?? 0) + 1;
1865
+ seen.set(base, nth);
1866
+ return {
1867
+ ...b,
1868
+ key: nth === 1 ? base : `${base}-${nth}`
1869
+ };
1870
+ });
1871
+ }), [
1860
1872
  days,
1861
1873
  events,
1862
1874
  windowStart,
@@ -1991,7 +2003,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
1991
2003
  padding: "4px 6px 0 0"
1992
2004
  }
1993
2005
  }),
1994
- children: "all-day"
2006
+ children: showAllDayLabel ? "all-day" : null
1995
2007
  }), allDayByDay.map((list, i) => {
1996
2008
  const dayStart = (0, date_fns.startOfDay)(days[i]);
1997
2009
  const dayEnd = (0, date_fns.addDays)(dayStart, 1);
@@ -2136,22 +2148,46 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
2136
2148
  end: b.end
2137
2149
  })
2138
2150
  }, b.start)),
2139
- backgroundByDay[dayIndex].map((b, bandIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2140
- "aria-hidden": true,
2141
- title: b.event.title,
2142
- ...slot("backgroundEvent", {
2143
- base: {
2144
- position: "absolute",
2145
- left: 0,
2146
- right: 0,
2147
- top: (b.startHours - windowStart) * hourHeight,
2148
- height: (b.endHours - b.startHours) * hourHeight,
2149
- pointerEvents: "none",
2150
- zIndex: 0
2151
- },
2152
- themed: { background: theme.backgroundEvent }
2153
- })
2154
- }, `bg-${bandIndex}`)),
2151
+ backgroundByDay[dayIndex].map((b) => {
2152
+ const { key } = b;
2153
+ const geometry = {
2154
+ position: "absolute",
2155
+ left: 0,
2156
+ right: 0,
2157
+ top: (b.startHours - windowStart) * hourHeight,
2158
+ height: (b.endHours - b.startHours) * hourHeight,
2159
+ zIndex: 0,
2160
+ overflow: "hidden"
2161
+ };
2162
+ if (!RenderBackground) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2163
+ "aria-hidden": true,
2164
+ title: b.event.title,
2165
+ ...slot("backgroundEvent", {
2166
+ base: {
2167
+ ...geometry,
2168
+ pointerEvents: "none"
2169
+ },
2170
+ themed: { background: theme.backgroundEvent }
2171
+ })
2172
+ }, key);
2173
+ const dayStart = (0, date_fns.startOfDay)(days[dayIndex]);
2174
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2175
+ ...slot("backgroundEvent", { base: {
2176
+ ...geometry,
2177
+ pointerEvents: "auto"
2178
+ } }),
2179
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderBackground, {
2180
+ event: b.event,
2181
+ mode,
2182
+ isAllDay: false,
2183
+ boxHeight: geometry.height,
2184
+ continuesBefore: b.event.start < dayStart,
2185
+ continuesAfter: b.event.end > (0, date_fns.addDays)(dayStart, 1),
2186
+ ampm,
2187
+ onPress: () => onPressEvent?.(b.event)
2188
+ })
2189
+ }, key);
2190
+ }),
2155
2191
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2156
2192
  "aria-hidden": true,
2157
2193
  ...slot("gridLines", {
@@ -2236,7 +2272,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
2236
2272
  canResize && !pe.continuesBefore ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2237
2273
  onPointerDown: (e) => {
2238
2274
  e.stopPropagation();
2239
- beginDrag(e, pe, key, "resize-start", dayIndex);
2275
+ beginDrag(e, pe, key, "resize-start", dayIndex, canMove ? onPress : void 0);
2240
2276
  },
2241
2277
  style: {
2242
2278
  position: "absolute",
@@ -2251,7 +2287,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
2251
2287
  canResize && !pe.continuesAfter ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2252
2288
  onPointerDown: (e) => {
2253
2289
  e.stopPropagation();
2254
- beginDrag(e, pe, key, "resize", dayIndex);
2290
+ beginDrag(e, pe, key, "resize", dayIndex, canMove ? onPress : void 0);
2255
2291
  },
2256
2292
  style: {
2257
2293
  position: "absolute",
@@ -2426,7 +2462,7 @@ function pageStep(mode, date, direction, weekStartsOn, numberOfDays) {
2426
2462
  * <Calendar mode="week" date={new Date()} events={events} />
2427
2463
  * ```
2428
2464
  */
2429
- function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }) {
2465
+ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator, showAllDayEventCell, showAllDayLabel, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }) {
2430
2466
  const displayEvents = (0, react.useMemo)(() => {
2431
2467
  let out = events ?? EMPTY_EVENTS;
2432
2468
  if (out.some((e) => e.recurrence)) {
@@ -2562,8 +2598,10 @@ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0,
2562
2598
  weekNumberPrefix,
2563
2599
  businessHours,
2564
2600
  renderBusinessHours,
2601
+ renderBackgroundEvent,
2565
2602
  showNowIndicator,
2566
2603
  showAllDayEventCell,
2604
+ showAllDayLabel,
2567
2605
  highlightWeekends,
2568
2606
  eventStartEditable,
2569
2607
  eventDurationEditable,
package/dist/index.mjs CHANGED
@@ -1377,7 +1377,7 @@ function DefaultDomEvent({ event, mode, isAllDay, boxHeight, ampm = false, theme
1377
1377
  * <TimeGrid mode="week" date={new Date()} events={events} />
1378
1378
  * ```
1379
1379
  */
1380
- function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStartsOn = 0, weekdayFormat = "short", hourHeight: initialHourHeight = 48, scrollOffsetMinutes = 480, zoomable = true, minHourHeight = 24, maxHourHeight = 160, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, dragStepMinutes = 15, ampm = false, timeslots = 1, minHour = 0, maxHour = 24, hideHours = false, showWeekNumber = false, weekNumberPrefix = "W", hiddenDays, keyboardEventNavigation = false, businessHours, renderBusinessHours, showNowIndicator = true, highlightWeekends = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, now: nowProp, timeZone, showAllDayEventCell = true, locale, theme: themeOverrides, height = 600, renderEvent, eventAccessibilityLabel: eventAccessibilityLabel$1, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }) {
1380
+ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStartsOn = 0, weekdayFormat = "short", hourHeight: initialHourHeight = 48, scrollOffsetMinutes = 480, zoomable = true, minHourHeight = 24, maxHourHeight = 160, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, dragStepMinutes = 15, ampm = false, timeslots = 1, minHour = 0, maxHour = 24, hideHours = false, showWeekNumber = false, weekNumberPrefix = "W", hiddenDays, keyboardEventNavigation = false, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator = true, highlightWeekends = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, now: nowProp, timeZone, showAllDayEventCell = true, showAllDayLabel = false, locale, theme: themeOverrides, height = 600, renderEvent, eventAccessibilityLabel: eventAccessibilityLabel$1, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }) {
1381
1381
  const theme = useMemo(() => mergeDomTheme(themeOverrides), [themeOverrides]);
1382
1382
  const slot = createSlots({
1383
1383
  classNames,
@@ -1391,6 +1391,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
1391
1391
  const windowEnd = Math.max(windowStart + 1, Math.min(maxHour, 24));
1392
1392
  const windowHours = windowEnd - windowStart;
1393
1393
  const gutterWidth = hideHours ? 0 : GUTTER_WIDTH$1;
1394
+ const RenderBackground = renderBackgroundEvent;
1394
1395
  const visibleHours = useMemo(() => Array.from({ length: windowHours }, (_, i) => windowStart + i), [windowStart, windowHours]);
1395
1396
  const now = useNow$1(showNowIndicator, {
1396
1397
  now: nowProp,
@@ -1851,11 +1852,22 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
1851
1852
  windowStart,
1852
1853
  windowEnd
1853
1854
  ]);
1854
- const backgroundByDay = useMemo(() => days.map((day) => backgroundBandsForDay$1(events, day).map((b) => ({
1855
- ...b,
1856
- startHours: Math.max(b.startHours, windowStart),
1857
- endHours: Math.min(b.endHours, windowEnd)
1858
- })).filter((b) => b.endHours > b.startHours)), [
1855
+ const backgroundByDay = useMemo(() => days.map((day) => {
1856
+ const seen = /* @__PURE__ */ new Map();
1857
+ return backgroundBandsForDay$1(events, day).map((b) => ({
1858
+ ...b,
1859
+ startHours: Math.max(b.startHours, windowStart),
1860
+ endHours: Math.min(b.endHours, windowEnd)
1861
+ })).filter((b) => b.endHours > b.startHours).map((b) => {
1862
+ const base = `bg-${b.event.start.toISOString()}-${b.event.end.toISOString()}`;
1863
+ const nth = (seen.get(base) ?? 0) + 1;
1864
+ seen.set(base, nth);
1865
+ return {
1866
+ ...b,
1867
+ key: nth === 1 ? base : `${base}-${nth}`
1868
+ };
1869
+ });
1870
+ }), [
1859
1871
  days,
1860
1872
  events,
1861
1873
  windowStart,
@@ -1990,7 +2002,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
1990
2002
  padding: "4px 6px 0 0"
1991
2003
  }
1992
2004
  }),
1993
- children: "all-day"
2005
+ children: showAllDayLabel ? "all-day" : null
1994
2006
  }), allDayByDay.map((list, i) => {
1995
2007
  const dayStart = startOfDay(days[i]);
1996
2008
  const dayEnd = addDays(dayStart, 1);
@@ -2135,22 +2147,46 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
2135
2147
  end: b.end
2136
2148
  })
2137
2149
  }, b.start)),
2138
- backgroundByDay[dayIndex].map((b, bandIndex) => /* @__PURE__ */ jsx("div", {
2139
- "aria-hidden": true,
2140
- title: b.event.title,
2141
- ...slot("backgroundEvent", {
2142
- base: {
2143
- position: "absolute",
2144
- left: 0,
2145
- right: 0,
2146
- top: (b.startHours - windowStart) * hourHeight,
2147
- height: (b.endHours - b.startHours) * hourHeight,
2148
- pointerEvents: "none",
2149
- zIndex: 0
2150
- },
2151
- themed: { background: theme.backgroundEvent }
2152
- })
2153
- }, `bg-${bandIndex}`)),
2150
+ backgroundByDay[dayIndex].map((b) => {
2151
+ const { key } = b;
2152
+ const geometry = {
2153
+ position: "absolute",
2154
+ left: 0,
2155
+ right: 0,
2156
+ top: (b.startHours - windowStart) * hourHeight,
2157
+ height: (b.endHours - b.startHours) * hourHeight,
2158
+ zIndex: 0,
2159
+ overflow: "hidden"
2160
+ };
2161
+ if (!RenderBackground) return /* @__PURE__ */ jsx("div", {
2162
+ "aria-hidden": true,
2163
+ title: b.event.title,
2164
+ ...slot("backgroundEvent", {
2165
+ base: {
2166
+ ...geometry,
2167
+ pointerEvents: "none"
2168
+ },
2169
+ themed: { background: theme.backgroundEvent }
2170
+ })
2171
+ }, key);
2172
+ const dayStart = startOfDay(days[dayIndex]);
2173
+ return /* @__PURE__ */ jsx("div", {
2174
+ ...slot("backgroundEvent", { base: {
2175
+ ...geometry,
2176
+ pointerEvents: "auto"
2177
+ } }),
2178
+ children: /* @__PURE__ */ jsx(RenderBackground, {
2179
+ event: b.event,
2180
+ mode,
2181
+ isAllDay: false,
2182
+ boxHeight: geometry.height,
2183
+ continuesBefore: b.event.start < dayStart,
2184
+ continuesAfter: b.event.end > addDays(dayStart, 1),
2185
+ ampm,
2186
+ onPress: () => onPressEvent?.(b.event)
2187
+ })
2188
+ }, key);
2189
+ }),
2154
2190
  /* @__PURE__ */ jsx("div", {
2155
2191
  "aria-hidden": true,
2156
2192
  ...slot("gridLines", {
@@ -2235,7 +2271,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
2235
2271
  canResize && !pe.continuesBefore ? /* @__PURE__ */ jsx("div", {
2236
2272
  onPointerDown: (e) => {
2237
2273
  e.stopPropagation();
2238
- beginDrag(e, pe, key, "resize-start", dayIndex);
2274
+ beginDrag(e, pe, key, "resize-start", dayIndex, canMove ? onPress : void 0);
2239
2275
  },
2240
2276
  style: {
2241
2277
  position: "absolute",
@@ -2250,7 +2286,7 @@ function TimeGrid({ date, events = [], mode = "day", numberOfDays = 1, weekStart
2250
2286
  canResize && !pe.continuesAfter ? /* @__PURE__ */ jsx("div", {
2251
2287
  onPointerDown: (e) => {
2252
2288
  e.stopPropagation();
2253
- beginDrag(e, pe, key, "resize", dayIndex);
2289
+ beginDrag(e, pe, key, "resize", dayIndex, canMove ? onPress : void 0);
2254
2290
  },
2255
2291
  style: {
2256
2292
  position: "absolute",
@@ -2425,7 +2461,7 @@ function pageStep(mode, date, direction, weekStartsOn, numberOfDays) {
2425
2461
  * <Calendar mode="week" date={new Date()} events={events} />
2426
2462
  * ```
2427
2463
  */
2428
- function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }) {
2464
+ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, minEventHeight, eventGap, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, renderBackgroundEvent, showNowIndicator, showAllDayEventCell, showAllDayLabel, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }) {
2429
2465
  const displayEvents = useMemo(() => {
2430
2466
  let out = events ?? EMPTY_EVENTS;
2431
2467
  if (out.some((e) => e.recurrence)) {
@@ -2561,8 +2597,10 @@ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0,
2561
2597
  weekNumberPrefix,
2562
2598
  businessHours,
2563
2599
  renderBusinessHours,
2600
+ renderBackgroundEvent,
2564
2601
  showNowIndicator,
2565
2602
  showAllDayEventCell,
2603
+ showAllDayLabel,
2566
2604
  highlightWeekends,
2567
2605
  eventStartEditable,
2568
2606
  eventDurationEditable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-calendar/dom",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "Virtualized month / week / day calendar and date picker for react-dom. No React Native, no react-native-web.",
5
5
  "keywords": [
6
6
  "calendar",
@@ -48,7 +48,7 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@super-calendar/core": "2.10.0"
51
+ "@super-calendar/core": "2.11.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@legendapp/list": ">=3",
package/src/Calendar.tsx CHANGED
@@ -149,10 +149,17 @@ export interface CalendarProps<T = unknown>
149
149
  * band stays non-interactive and hidden from assistive tech.
150
150
  */
151
151
  renderBusinessHours?: (band: BusinessHoursBand) => ReactNode;
152
+ /**
153
+ * A component that draws a `display: "background"` event's band in place of
154
+ * the themed shade; see `TimeGrid`'s prop of the same name.
155
+ */
156
+ renderBackgroundEvent?: DomRenderEvent<T>;
152
157
  /** Show the current-time indicator (default true). */
153
158
  showNowIndicator?: boolean;
154
159
  /** Show the all-day lane (default true). */
155
160
  showAllDayEventCell?: boolean;
161
+ /** Show the "all-day" text beside the lane (default false). */
162
+ showAllDayLabel?: boolean;
156
163
  /** Tint weekend columns (default true). Set false to treat weekends normally. */
157
164
  highlightWeekends?: boolean;
158
165
  /** Allow moving events by default (per-event `startEditable` overrides). Default true. */
@@ -332,8 +339,10 @@ export function Calendar<T = unknown>({
332
339
  weekNumberPrefix,
333
340
  businessHours,
334
341
  renderBusinessHours,
342
+ renderBackgroundEvent,
335
343
  showNowIndicator,
336
344
  showAllDayEventCell,
345
+ showAllDayLabel,
337
346
  highlightWeekends,
338
347
  eventStartEditable,
339
348
  eventDurationEditable,
@@ -517,8 +526,10 @@ export function Calendar<T = unknown>({
517
526
  weekNumberPrefix={weekNumberPrefix}
518
527
  businessHours={businessHours}
519
528
  renderBusinessHours={renderBusinessHours}
529
+ renderBackgroundEvent={renderBackgroundEvent}
520
530
  showNowIndicator={showNowIndicator}
521
531
  showAllDayEventCell={showAllDayEventCell}
532
+ showAllDayLabel={showAllDayLabel}
522
533
  highlightWeekends={highlightWeekends}
523
534
  eventStartEditable={eventStartEditable}
524
535
  eventDurationEditable={eventDurationEditable}
package/src/TimeGrid.tsx CHANGED
@@ -195,6 +195,15 @@ export interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot>
195
195
  * band stays non-interactive and hidden from assistive tech.
196
196
  */
197
197
  renderBusinessHours?: (band: BusinessHoursBand) => ReactNode;
198
+ /**
199
+ * A component that draws a `display: "background"` event's band in place of
200
+ * the themed shade. Rendered like `renderEvent`, it receives the event, the
201
+ * mode, `continuesBefore` / `continuesAfter` for a multi-day event, and
202
+ * `onPress`, which fires `onPressEvent`. The band then takes pointer events and
203
+ * is no longer hidden from assistive tech; cell clicks and drag-to-create are
204
+ * unreachable underneath it. Without it the band stays a shaded, inert range.
205
+ */
206
+ renderBackgroundEvent?: DomRenderEvent<T>;
198
207
  /** Show the current-time indicator on today's column (default true). */
199
208
  showNowIndicator?: boolean;
200
209
  /** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
@@ -203,6 +212,8 @@ export interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot>
203
212
  timeZone?: string;
204
213
  /** Show the all-day lane above the grid (default true). */
205
214
  showAllDayEventCell?: boolean;
215
+ /** Show the "all-day" text beside the lane (default false). */
216
+ showAllDayLabel?: boolean;
206
217
  /** Tint Saturday/Sunday columns with the weekend background (default true). Set
207
218
  * false to treat weekends like any other day. */
208
219
  highlightWeekends?: boolean;
@@ -423,6 +434,7 @@ export function TimeGrid<T = unknown>({
423
434
  keyboardEventNavigation = false,
424
435
  businessHours,
425
436
  renderBusinessHours,
437
+ renderBackgroundEvent,
426
438
  showNowIndicator = true,
427
439
  highlightWeekends = true,
428
440
  eventStartEditable = true,
@@ -431,6 +443,7 @@ export function TimeGrid<T = unknown>({
431
443
  now: nowProp,
432
444
  timeZone,
433
445
  showAllDayEventCell = true,
446
+ showAllDayLabel = false,
434
447
  locale,
435
448
  theme: themeOverrides,
436
449
  height = 600,
@@ -464,6 +477,7 @@ export function TimeGrid<T = unknown>({
464
477
  const windowEnd = Math.max(windowStart + 1, Math.min(maxHour, 24));
465
478
  const windowHours = windowEnd - windowStart;
466
479
  const gutterWidth = hideHours ? 0 : GUTTER_WIDTH;
480
+ const RenderBackground = renderBackgroundEvent;
467
481
  const visibleHours = useMemo(
468
482
  () => Array.from({ length: windowHours }, (_, i) => windowStart + i),
469
483
  [windowStart, windowHours],
@@ -1110,15 +1124,22 @@ export function TimeGrid<T = unknown>({
1110
1124
  // `display: "background"` events, sliced per day and clipped to the window.
1111
1125
  const backgroundByDay = useMemo(
1112
1126
  () =>
1113
- days.map((day) =>
1114
- backgroundBandsForDay(events, day)
1127
+ days.map((day) => {
1128
+ const seen = new Map<string, number>();
1129
+ return backgroundBandsForDay(events, day)
1115
1130
  .map((b) => ({
1116
1131
  ...b,
1117
1132
  startHours: Math.max(b.startHours, windowStart),
1118
1133
  endHours: Math.min(b.endHours, windowEnd),
1119
1134
  }))
1120
- .filter((b) => b.endHours > b.startHours),
1121
- ),
1135
+ .filter((b) => b.endHours > b.startHours)
1136
+ .map((b) => {
1137
+ const base = `bg-${b.event.start.toISOString()}-${b.event.end.toISOString()}`;
1138
+ const nth = (seen.get(base) ?? 0) + 1;
1139
+ seen.set(base, nth);
1140
+ return { ...b, key: nth === 1 ? base : `${base}-${nth}` };
1141
+ });
1142
+ }),
1122
1143
  [days, events, windowStart, windowEnd],
1123
1144
  );
1124
1145
  const gridLines = useMemo(() => {
@@ -1261,7 +1282,7 @@ export function TimeGrid<T = unknown>({
1261
1282
  themed: { fontSize: 10, color: theme.textMuted, padding: "4px 6px 0 0" },
1262
1283
  })}
1263
1284
  >
1264
- all-day
1285
+ {showAllDayLabel ? "all-day" : null}
1265
1286
  </div>
1266
1287
  {allDayByDay.map((list, i) => {
1267
1288
  const dayStart = startOfDay(days[i]);
@@ -1449,26 +1470,50 @@ export function TimeGrid<T = unknown>({
1449
1470
  {renderBusinessHours?.({ date: day, start: b.start, end: b.end })}
1450
1471
  </div>
1451
1472
  ))}
1452
- {/* Background events: shaded, non-interactive time ranges. */}
1453
- {backgroundByDay[dayIndex].map((b, bandIndex) => (
1454
- <div
1455
- key={`bg-${bandIndex}`}
1456
- aria-hidden
1457
- title={b.event.title}
1458
- {...slot("backgroundEvent", {
1459
- base: {
1460
- position: "absolute",
1461
- left: 0,
1462
- right: 0,
1463
- top: (b.startHours - windowStart) * hourHeight,
1464
- height: (b.endHours - b.startHours) * hourHeight,
1465
- pointerEvents: "none",
1466
- zIndex: 0,
1467
- },
1468
- themed: { background: theme.backgroundEvent },
1469
- })}
1470
- />
1471
- ))}
1473
+ {/* Background events: shaded time ranges, or the consumer's own band. */}
1474
+ {backgroundByDay[dayIndex].map((b) => {
1475
+ const { key } = b;
1476
+ const geometry = {
1477
+ position: "absolute" as const,
1478
+ left: 0,
1479
+ right: 0,
1480
+ top: (b.startHours - windowStart) * hourHeight,
1481
+ height: (b.endHours - b.startHours) * hourHeight,
1482
+ zIndex: 0,
1483
+ overflow: "hidden" as const,
1484
+ };
1485
+ if (!RenderBackground) {
1486
+ return (
1487
+ <div
1488
+ key={key}
1489
+ aria-hidden
1490
+ title={b.event.title}
1491
+ {...slot("backgroundEvent", {
1492
+ base: { ...geometry, pointerEvents: "none" },
1493
+ themed: { background: theme.backgroundEvent },
1494
+ })}
1495
+ />
1496
+ );
1497
+ }
1498
+ const dayStart = startOfDay(days[dayIndex]);
1499
+ return (
1500
+ <div
1501
+ key={key}
1502
+ {...slot("backgroundEvent", { base: { ...geometry, pointerEvents: "auto" } })}
1503
+ >
1504
+ <RenderBackground
1505
+ event={b.event}
1506
+ mode={mode}
1507
+ isAllDay={false}
1508
+ boxHeight={geometry.height}
1509
+ continuesBefore={b.event.start < dayStart}
1510
+ continuesAfter={b.event.end > addDays(dayStart, 1)}
1511
+ ampm={ampm}
1512
+ onPress={() => onPressEvent?.(b.event)}
1513
+ />
1514
+ </div>
1515
+ );
1516
+ })}
1472
1517
  {/* Grid lines, painted over the shade so they stay visible. */}
1473
1518
  <div
1474
1519
  aria-hidden
@@ -1591,11 +1636,21 @@ export function TimeGrid<T = unknown>({
1591
1636
  ) : (
1592
1637
  <DefaultDomEvent {...args} theme={theme} boxProps={slot("eventBox")} />
1593
1638
  )}
1639
+ {/* A release without movement on a handle presses the event, like
1640
+ the box itself. Only when the box can move: otherwise it carries
1641
+ its own `onClick`, which would press the event a second time. */}
1594
1642
  {canResize && !pe.continuesBefore ? (
1595
1643
  <div
1596
1644
  onPointerDown={(e) => {
1597
1645
  e.stopPropagation();
1598
- beginDrag(e, pe, key, "resize-start", dayIndex);
1646
+ beginDrag(
1647
+ e,
1648
+ pe,
1649
+ key,
1650
+ "resize-start",
1651
+ dayIndex,
1652
+ canMove ? onPress : undefined,
1653
+ );
1599
1654
  }}
1600
1655
  style={{
1601
1656
  position: "absolute",
@@ -1617,7 +1672,14 @@ export function TimeGrid<T = unknown>({
1617
1672
  <div
1618
1673
  onPointerDown={(e) => {
1619
1674
  e.stopPropagation();
1620
- beginDrag(e, pe, key, "resize", dayIndex);
1675
+ beginDrag(
1676
+ e,
1677
+ pe,
1678
+ key,
1679
+ "resize",
1680
+ dayIndex,
1681
+ canMove ? onPress : undefined,
1682
+ );
1621
1683
  }}
1622
1684
  style={{
1623
1685
  position: "absolute",