@super-calendar/dom 2.17.0 → 2.18.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/README.md +42 -2
- package/dist/index.d.mts +58 -16
- package/dist/index.d.ts +58 -16
- package/dist/index.js +398 -144
- package/dist/index.mjs +400 -146
- package/package.json +2 -2
- package/src/Agenda.tsx +18 -2
- package/src/Calendar.tsx +104 -29
- package/src/MonthView.tsx +182 -33
- package/src/TimeGrid.tsx +363 -153
- package/src/YearView.tsx +12 -1
package/src/TimeGrid.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
useCallback,
|
|
21
21
|
useEffect,
|
|
22
22
|
useImperativeHandle,
|
|
23
|
+
useLayoutEffect,
|
|
23
24
|
useMemo,
|
|
24
25
|
useRef,
|
|
25
26
|
useState,
|
|
@@ -48,11 +49,13 @@ import {
|
|
|
48
49
|
eventTimeLabel,
|
|
49
50
|
formatHour,
|
|
50
51
|
getIsToday,
|
|
52
|
+
nowInTimeZone,
|
|
51
53
|
getViewDays,
|
|
52
54
|
isAllDayEvent,
|
|
53
55
|
isSameCalendarDay,
|
|
54
56
|
isWeekend,
|
|
55
57
|
layoutDayEvents,
|
|
58
|
+
layoutMonthWeek,
|
|
56
59
|
overlapsOtherEvents,
|
|
57
60
|
type PositionedEvent,
|
|
58
61
|
useNow,
|
|
@@ -110,7 +113,8 @@ const DEFAULT_MIN_EVENT_HEIGHT = 14;
|
|
|
110
113
|
// via `eventGap`.
|
|
111
114
|
const DEFAULT_EVENT_GAP = 1;
|
|
112
115
|
const clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));
|
|
113
|
-
|
|
116
|
+
const useClientLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
117
|
+
// Keep an empty or fully clipped preview visible at the column edge.
|
|
114
118
|
const CREATE_PREVIEW_MIN_HEIGHT = 2;
|
|
115
119
|
// Vertical placement of the create preview inside a day column `gridHeight` px
|
|
116
120
|
// tall. Both ends are clamped to the visible hours. The preview is anchored to
|
|
@@ -126,6 +130,26 @@ function createPreviewPlacement(topPx: number, heightPx: number, gridHeight: num
|
|
|
126
130
|
: { top, height };
|
|
127
131
|
}
|
|
128
132
|
|
|
133
|
+
function createRangePlacement(
|
|
134
|
+
range: CreateGhostArgs,
|
|
135
|
+
day: Date,
|
|
136
|
+
hourHeight: number,
|
|
137
|
+
minHour: number,
|
|
138
|
+
gridHeight: number,
|
|
139
|
+
minEventHeight: number,
|
|
140
|
+
) {
|
|
141
|
+
// Use wall-clock positions, including midnight on the following day. Elapsed
|
|
142
|
+
// milliseconds would shift the preview on daylight-saving transitions.
|
|
143
|
+
const at = (time: Date) =>
|
|
144
|
+
(differenceInCalendarDays(time, day) * 24 +
|
|
145
|
+
time.getHours() +
|
|
146
|
+
time.getMinutes() / 60 -
|
|
147
|
+
minHour) *
|
|
148
|
+
hourHeight;
|
|
149
|
+
const top = at(range.start);
|
|
150
|
+
return createPreviewPlacement(top, Math.max(minEventHeight, at(range.end) - top), gridHeight);
|
|
151
|
+
}
|
|
152
|
+
|
|
129
153
|
// Edge auto-advance: how close to the day-columns edge (px) counts as "at the
|
|
130
154
|
// edge", how long to dwell there before paging, and the repeat interval while
|
|
131
155
|
// the pointer stays in the zone.
|
|
@@ -151,7 +175,12 @@ const VISUALLY_HIDDEN: CSSProperties = {
|
|
|
151
175
|
|
|
152
176
|
/** Props passed to a custom time-grid event renderer. */
|
|
153
177
|
export interface DomRenderEventArgs<T = unknown> {
|
|
154
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* The event to render. While it is being moved or resized, a copy whose
|
|
180
|
+
* `start` and `end` are the times `onDragEvent` would report on release.
|
|
181
|
+
* After a drag pages the view, the floating preview keeps the stored times
|
|
182
|
+
* until release.
|
|
183
|
+
*/
|
|
155
184
|
event: CalendarEvent<T>;
|
|
156
185
|
/** The current view mode. */
|
|
157
186
|
mode: CalendarMode;
|
|
@@ -159,9 +188,9 @@ export interface DomRenderEventArgs<T = unknown> {
|
|
|
159
188
|
isAllDay: boolean;
|
|
160
189
|
/** Pixel height of the event box (timed events only). */
|
|
161
190
|
boxHeight?: number;
|
|
162
|
-
/**
|
|
191
|
+
/** Starts before the visible day (timed) or visible date range (all-day). */
|
|
163
192
|
continuesBefore?: boolean;
|
|
164
|
-
/**
|
|
193
|
+
/** Ends after the visible day (timed) or visible date range (all-day). */
|
|
165
194
|
continuesAfter?: boolean;
|
|
166
195
|
/** Show the time range in 12-hour AM/PM. */
|
|
167
196
|
ampm?: boolean;
|
|
@@ -249,9 +278,15 @@ export interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot>
|
|
|
249
278
|
renderBackgroundEvent?: DomRenderEvent<T>;
|
|
250
279
|
/** Show the current-time indicator on today's column (default true). */
|
|
251
280
|
showNowIndicator?: boolean;
|
|
252
|
-
/**
|
|
281
|
+
/**
|
|
282
|
+
* Fixed "now" instant for the indicator (doesn't tick) and for the day
|
|
283
|
+
* highlighted as today. Defaults to the device clock.
|
|
284
|
+
*/
|
|
253
285
|
now?: Date;
|
|
254
|
-
/**
|
|
286
|
+
/**
|
|
287
|
+
* Shift the now indicator and the day highlighted as today into this IANA zone
|
|
288
|
+
* (pair with `eventsInTimeZone`).
|
|
289
|
+
*/
|
|
255
290
|
timeZone?: string;
|
|
256
291
|
/** Show the all-day lane above the grid (default true). */
|
|
257
292
|
showAllDayEventCell?: boolean;
|
|
@@ -319,7 +354,7 @@ export interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot>
|
|
|
319
354
|
* Return `false` to reject the drop (the event snaps back).
|
|
320
355
|
*/
|
|
321
356
|
onDragEvent?: (event: CalendarEvent<T>, start: Date, end: Date) => void | boolean;
|
|
322
|
-
/** Stable, unique
|
|
357
|
+
/** Stable, unique identity for the editing dialog and all-day bars across data refreshes. */
|
|
323
358
|
getEventId?: (event: CalendarEvent<T>) => string | number;
|
|
324
359
|
/**
|
|
325
360
|
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
@@ -384,6 +419,40 @@ function movedSegmentStart(
|
|
|
384
419
|
);
|
|
385
420
|
}
|
|
386
421
|
|
|
422
|
+
// The start and end a drag reports. A bottom resize re-resolves the end from the
|
|
423
|
+
// edge the layout drew, like the native renderer, so it lands on the row the edge
|
|
424
|
+
// reached on either side of a DST change. A move or a top resize shifts the real
|
|
425
|
+
// instants by how far the segment moved on `base`, the day it lands on, so a
|
|
426
|
+
// move that now spans midnight keeps the parts outside the dragged day. The drop
|
|
427
|
+
// and the live preview share it, so the renderer shows what the drop reports.
|
|
428
|
+
function draggedEventBounds(
|
|
429
|
+
d: DragState,
|
|
430
|
+
origin: { startHours: number; durationHours: number; segmentStart: Date; base: Date },
|
|
431
|
+
event: { start: Date; end: Date },
|
|
432
|
+
base: Date,
|
|
433
|
+
snapMinutes: number,
|
|
434
|
+
): { start: Date; end: Date } | null {
|
|
435
|
+
if (d.kind === "resize") {
|
|
436
|
+
const endDelta = Math.round(
|
|
437
|
+
(d.startHours + d.durationHours - origin.startHours - origin.durationHours) * 60,
|
|
438
|
+
);
|
|
439
|
+
return resolveDraggedBounds(event.start, event.end, 0, endDelta, snapMinutes);
|
|
440
|
+
}
|
|
441
|
+
const segmentStart = movedSegmentStart(
|
|
442
|
+
origin,
|
|
443
|
+
base,
|
|
444
|
+
d.kind === "move" ? d.requestedStartHours : d.startHours,
|
|
445
|
+
);
|
|
446
|
+
const startShift = segmentStart.getTime() - origin.segmentStart.getTime();
|
|
447
|
+
const endShift = d.kind === "move" ? startShift : 0;
|
|
448
|
+
const start = new Date(event.start.getTime() + startShift);
|
|
449
|
+
const end = new Date(event.end.getTime() + endShift);
|
|
450
|
+
// A move keeps the event's duration, so it commits even when that is zero.
|
|
451
|
+
return end > start || (d.kind === "move" && end.getTime() === start.getTime())
|
|
452
|
+
? { start, end }
|
|
453
|
+
: null;
|
|
454
|
+
}
|
|
455
|
+
|
|
387
456
|
function DefaultDomEvent<T>({
|
|
388
457
|
event,
|
|
389
458
|
mode,
|
|
@@ -578,6 +647,9 @@ function TimeGridInner<T = unknown>(
|
|
|
578
647
|
// Ticks every minute so the red now-line follows the wall clock; a `now`
|
|
579
648
|
// override pins it, and `timeZone` shifts it to match zone-shifted events.
|
|
580
649
|
const now = useNow(showNowIndicator, { now: nowProp, timeZone });
|
|
650
|
+
// The day the headers and columns mark as today: the indicator's clock while
|
|
651
|
+
// it runs, so the two can't disagree.
|
|
652
|
+
const todayDate = showNowIndicator ? now : nowInTimeZone(nowProp, timeZone);
|
|
581
653
|
|
|
582
654
|
const [hourHeight, setHourHeight] = useState(initialHourHeight);
|
|
583
655
|
useEffect(() => setHourHeight(initialHourHeight), [initialHourHeight]);
|
|
@@ -622,6 +694,7 @@ function TimeGridInner<T = unknown>(
|
|
|
622
694
|
} | null>(null);
|
|
623
695
|
const createOrigin = useRef<{
|
|
624
696
|
pointerId: number;
|
|
697
|
+
captureLoss?: ReturnType<typeof setTimeout>;
|
|
625
698
|
clientY: number;
|
|
626
699
|
el: HTMLElement;
|
|
627
700
|
dayIndex: number;
|
|
@@ -630,6 +703,8 @@ function TimeGridInner<T = unknown>(
|
|
|
630
703
|
startPx: number;
|
|
631
704
|
} | null>(null);
|
|
632
705
|
const createActive = createBox !== null;
|
|
706
|
+
const detachCreateListeners = useRef<(() => void) | null>(null);
|
|
707
|
+
const createRelease = useRef<((event: PointerEvent) => void) | null>(null);
|
|
633
708
|
useEffect(() => {
|
|
634
709
|
if (!createActive) return;
|
|
635
710
|
// Scrolling a column or an ancestor moves it beneath the held pointer.
|
|
@@ -686,6 +761,7 @@ function TimeGridInner<T = unknown>(
|
|
|
686
761
|
move: (e: PointerEvent) => void;
|
|
687
762
|
up: (e: PointerEvent) => void;
|
|
688
763
|
cancel: (e: PointerEvent) => void;
|
|
764
|
+
preventNative: (e: Event) => void;
|
|
689
765
|
} | null>(null);
|
|
690
766
|
const daysRef = useRef(days);
|
|
691
767
|
daysRef.current = days;
|
|
@@ -712,6 +788,11 @@ function TimeGridInner<T = unknown>(
|
|
|
712
788
|
canResize: editable && (event.durationEditable ?? eventDurationEditable),
|
|
713
789
|
};
|
|
714
790
|
};
|
|
791
|
+
const hasEditActions = (event: CalendarEvent<T>) => {
|
|
792
|
+
if (isAllDayEvent(event) || isBackgroundEvent(event)) return false;
|
|
793
|
+
const { canMove, canResize } = editability(event);
|
|
794
|
+
return canMove || canResize;
|
|
795
|
+
};
|
|
715
796
|
const eventLabel = (event: CalendarEvent<T>) =>
|
|
716
797
|
eventAccessibilityLabel
|
|
717
798
|
? eventAccessibilityLabel(event, { mode, isAllDay: false, ampm })
|
|
@@ -748,7 +829,7 @@ function TimeGridInner<T = unknown>(
|
|
|
748
829
|
}
|
|
749
830
|
};
|
|
750
831
|
const editActions = (event: CalendarEvent<T>): EventEditAction[] => {
|
|
751
|
-
if (
|
|
832
|
+
if (!hasEditActions(event)) return [];
|
|
752
833
|
const { canMove, canResize } = editability(event);
|
|
753
834
|
const action = (id: string, label: string): EventEditAction => {
|
|
754
835
|
const [startDelta, endDelta] = actionDelta(id) ?? [0, 0];
|
|
@@ -793,20 +874,50 @@ function TimeGridInner<T = unknown>(
|
|
|
793
874
|
getEventId,
|
|
794
875
|
);
|
|
795
876
|
|
|
796
|
-
const
|
|
797
|
-
// A multi-day all-day event shows in every column it overlaps (matching the
|
|
798
|
-
// native AllDayLane), not just its start day.
|
|
877
|
+
const allDayLayout = useMemo(
|
|
799
878
|
() =>
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
879
|
+
layoutMonthWeek(
|
|
880
|
+
days,
|
|
881
|
+
events.filter(
|
|
882
|
+
(event) =>
|
|
883
|
+
isAllDayEvent(event) &&
|
|
884
|
+
!isBackgroundEvent(event) &&
|
|
885
|
+
days.some(
|
|
886
|
+
(day) => event.start < addDays(startOfDay(day), 1) && event.end > startOfDay(day),
|
|
887
|
+
),
|
|
888
|
+
),
|
|
889
|
+
),
|
|
807
890
|
[days, events],
|
|
808
891
|
);
|
|
809
|
-
const hasAllDay =
|
|
892
|
+
const hasAllDay = allDayLayout.segments.length > 0;
|
|
893
|
+
const allDayIds = useMemo(() => {
|
|
894
|
+
const keys = new Map<CalendarEvent<T>, string>();
|
|
895
|
+
const seen = new Map<string, CalendarEvent<T>>();
|
|
896
|
+
for (const { event } of allDayLayout.segments) {
|
|
897
|
+
const id = getEventId?.(event);
|
|
898
|
+
if (typeof id !== "string" && typeof id !== "number") continue;
|
|
899
|
+
const key = `${typeof id}:${id}`;
|
|
900
|
+
const previous = seen.get(key);
|
|
901
|
+
if (previous) keys.delete(previous);
|
|
902
|
+
else {
|
|
903
|
+
seen.set(key, event);
|
|
904
|
+
keys.set(event, key);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
return keys;
|
|
908
|
+
}, [allDayLayout, getEventId]);
|
|
909
|
+
const allDayKeys = useRef(new WeakMap<CalendarEvent<T>, number>());
|
|
910
|
+
const nextAllDayKey = useRef(0);
|
|
911
|
+
const allDayKey = (event: CalendarEvent<T>) => {
|
|
912
|
+
const id = allDayIds.get(event);
|
|
913
|
+
if (id !== undefined) return id;
|
|
914
|
+
let key = allDayKeys.current.get(event);
|
|
915
|
+
if (key === undefined) {
|
|
916
|
+
key = nextAllDayKey.current++;
|
|
917
|
+
allDayKeys.current.set(event, key);
|
|
918
|
+
}
|
|
919
|
+
return `object:${key}`;
|
|
920
|
+
};
|
|
810
921
|
|
|
811
922
|
useEffect(() => {
|
|
812
923
|
// On mount / when the offset prop changes, not on every zoom (hence the ref).
|
|
@@ -936,6 +1047,8 @@ function TimeGridInner<T = unknown>(
|
|
|
936
1047
|
document.removeEventListener("pointermove", h.move);
|
|
937
1048
|
document.removeEventListener("pointerup", h.up);
|
|
938
1049
|
document.removeEventListener("pointercancel", h.cancel);
|
|
1050
|
+
document.removeEventListener("selectstart", h.preventNative, true);
|
|
1051
|
+
document.removeEventListener("dragstart", h.preventNative, true);
|
|
939
1052
|
docHandlersRef.current = null;
|
|
940
1053
|
};
|
|
941
1054
|
|
|
@@ -1110,31 +1223,16 @@ function TimeGridInner<T = unknown>(
|
|
|
1110
1223
|
} else {
|
|
1111
1224
|
base = startOfDay(daysRef.current[originIndex] ?? daysRef.current[0]);
|
|
1112
1225
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
} else if (base && held && origin) {
|
|
1123
|
-
// Shift the real event by how far its segment moved, so a move that now
|
|
1124
|
-
// spans midnight (and every later drag of the resulting multi-day event)
|
|
1125
|
-
// keeps the parts outside the dragged day instead of clipping to it.
|
|
1126
|
-
const segmentStart = movedSegmentStart(
|
|
1127
|
-
origin,
|
|
1128
|
-
base,
|
|
1129
|
-
d.kind === "move" ? d.requestedStartHours : d.startHours,
|
|
1130
|
-
);
|
|
1131
|
-
const startShift = segmentStart.getTime() - origin.segmentStart.getTime();
|
|
1132
|
-
const endShift = d.kind === "move" ? startShift : 0;
|
|
1133
|
-
const start = new Date(held.event.start.getTime() + startShift);
|
|
1134
|
-
const end = new Date(held.event.end.getTime() + endShift);
|
|
1135
|
-
if (end > start) onDragEventRef.current?.(held.event, start, end);
|
|
1226
|
+
try {
|
|
1227
|
+
if (base && held && origin) {
|
|
1228
|
+
const next = draggedEventBounds(d, origin, held.event, base, snapMinutes);
|
|
1229
|
+
if (next) onDragEventRef.current?.(held.event, next.start, next.end);
|
|
1230
|
+
}
|
|
1231
|
+
} finally {
|
|
1232
|
+
// A handler that throws must not leave the drag and its document listeners,
|
|
1233
|
+
// which block native selection, in place.
|
|
1234
|
+
finishDrag();
|
|
1136
1235
|
}
|
|
1137
|
-
finishDrag();
|
|
1138
1236
|
};
|
|
1139
1237
|
|
|
1140
1238
|
const cancelDrag = () => {
|
|
@@ -1165,7 +1263,8 @@ function TimeGridInner<T = unknown>(
|
|
|
1165
1263
|
// across days, so 0 is fine there.
|
|
1166
1264
|
const boxEl = e.box;
|
|
1167
1265
|
const column = kind === "move" ? boxEl.parentElement : null;
|
|
1168
|
-
const
|
|
1266
|
+
const columnRect = column ? column.getBoundingClientRect() : null;
|
|
1267
|
+
const dayWidth = columnRect ? columnRect.width : 0;
|
|
1169
1268
|
const boxRect = kind === "move" ? boxEl.getBoundingClientRect() : null;
|
|
1170
1269
|
const originBase = startOfDay(days[dayIndex] ?? days[0]);
|
|
1171
1270
|
const originNextDay = addDays(originBase, 1);
|
|
@@ -1187,9 +1286,12 @@ function TimeGridInner<T = unknown>(
|
|
|
1187
1286
|
draggedRef.current = {
|
|
1188
1287
|
event,
|
|
1189
1288
|
onPress: onPress ?? (() => {}),
|
|
1190
|
-
|
|
1289
|
+
// A moved box spans its whole day column, so the ghost that replaces it
|
|
1290
|
+
// after a page change keeps that width and the pointer's place in it. The
|
|
1291
|
+
// box sits in the column's padding box, inside any border.
|
|
1292
|
+
grabX: column && columnRect ? e.clientX - columnRect.left - column.clientLeft - eventGap : 0,
|
|
1191
1293
|
grabY: boxRect ? e.clientY - boxRect.top : 0,
|
|
1192
|
-
w:
|
|
1294
|
+
w: column ? Math.max(column.clientWidth - eventGap * 2, 0) : 0,
|
|
1193
1295
|
h: boxRect ? boxRect.height : 0,
|
|
1194
1296
|
};
|
|
1195
1297
|
ptr.current = { x: e.clientX, y: e.clientY };
|
|
@@ -1232,11 +1334,16 @@ function TimeGridInner<T = unknown>(
|
|
|
1232
1334
|
cancelDrag();
|
|
1233
1335
|
}
|
|
1234
1336
|
},
|
|
1337
|
+
// Text selected by an earlier drag can turn this one into a native text
|
|
1338
|
+
// drag, after which the browser stops sending pointer events (WebKit).
|
|
1339
|
+
preventNative: (event: Event) => event.preventDefault(),
|
|
1235
1340
|
};
|
|
1236
1341
|
docHandlersRef.current = handlers;
|
|
1237
1342
|
document.addEventListener("pointermove", handlers.move);
|
|
1238
1343
|
document.addEventListener("pointerup", handlers.up);
|
|
1239
1344
|
document.addEventListener("pointercancel", handlers.cancel);
|
|
1345
|
+
document.addEventListener("selectstart", handlers.preventNative, true);
|
|
1346
|
+
document.addEventListener("dragstart", handlers.preventNative, true);
|
|
1240
1347
|
};
|
|
1241
1348
|
|
|
1242
1349
|
const pressEvent = (
|
|
@@ -1292,6 +1399,11 @@ function TimeGridInner<T = unknown>(
|
|
|
1292
1399
|
cancelHoldRef.current?.();
|
|
1293
1400
|
detachDocListeners();
|
|
1294
1401
|
clearEdgeTimer();
|
|
1402
|
+
if (createOrigin.current?.captureLoss !== undefined)
|
|
1403
|
+
clearTimeout(createOrigin.current.captureLoss);
|
|
1404
|
+
createOrigin.current = null;
|
|
1405
|
+
detachCreateListeners.current?.();
|
|
1406
|
+
detachCreateListeners.current = null;
|
|
1295
1407
|
},
|
|
1296
1408
|
[],
|
|
1297
1409
|
);
|
|
@@ -1302,6 +1414,7 @@ function TimeGridInner<T = unknown>(
|
|
|
1302
1414
|
|
|
1303
1415
|
const pxFromTop = (el: HTMLElement, clientY: number) => clientY - el.getBoundingClientRect().top;
|
|
1304
1416
|
const beginCreate = (e: ReactPointerEvent, dayIndex: number) => {
|
|
1417
|
+
if (createOrigin.current || activeGrabRef.current || e.isPrimary === false) return;
|
|
1305
1418
|
// Mouse / pen only: on touch the column must stay free to scroll the grid.
|
|
1306
1419
|
// Only from the column background, primary button, never on an event.
|
|
1307
1420
|
cellTouchRef.current =
|
|
@@ -1328,6 +1441,37 @@ function TimeGridInner<T = unknown>(
|
|
|
1328
1441
|
startPx,
|
|
1329
1442
|
};
|
|
1330
1443
|
setCreateBox({ dayIndex, dayTime, startPx, curPx: startPx });
|
|
1444
|
+
// Capture can be lost before pointerup. Observe release outside the column
|
|
1445
|
+
// too, without depending on React having rendered the preview yet.
|
|
1446
|
+
const document = el.ownerDocument;
|
|
1447
|
+
const release = (event: PointerEvent) => createRelease.current?.(event);
|
|
1448
|
+
const cancel = (event: PointerEvent) => {
|
|
1449
|
+
if (createOrigin.current?.pointerId === event.pointerId) clearCreate();
|
|
1450
|
+
};
|
|
1451
|
+
const restart = (event: PointerEvent) => {
|
|
1452
|
+
if (
|
|
1453
|
+
(event.isPrimary && event.pointerType !== "touch") ||
|
|
1454
|
+
createOrigin.current?.pointerId === event.pointerId
|
|
1455
|
+
)
|
|
1456
|
+
clearCreate();
|
|
1457
|
+
};
|
|
1458
|
+
// Text selected during a sweep can turn the next sweep into a native drag,
|
|
1459
|
+
// which cancels pointer input before the calendar receives its release.
|
|
1460
|
+
const preventSelection = (event: Event) => event.preventDefault();
|
|
1461
|
+
// If capture failed and release happened outside the window, the next press
|
|
1462
|
+
// belongs to a new gesture and must not complete the old one.
|
|
1463
|
+
document.addEventListener("pointerup", release, true);
|
|
1464
|
+
document.addEventListener("pointercancel", cancel, true);
|
|
1465
|
+
document.addEventListener("pointerdown", restart, true);
|
|
1466
|
+
document.addEventListener("selectstart", preventSelection, true);
|
|
1467
|
+
document.addEventListener("dragstart", preventSelection, true);
|
|
1468
|
+
detachCreateListeners.current = () => {
|
|
1469
|
+
document.removeEventListener("pointerup", release, true);
|
|
1470
|
+
document.removeEventListener("pointercancel", cancel, true);
|
|
1471
|
+
document.removeEventListener("pointerdown", restart, true);
|
|
1472
|
+
document.removeEventListener("selectstart", preventSelection, true);
|
|
1473
|
+
document.removeEventListener("dragstart", preventSelection, true);
|
|
1474
|
+
};
|
|
1331
1475
|
};
|
|
1332
1476
|
const moveCreate = (e: ReactPointerEvent) => {
|
|
1333
1477
|
const touch = cellTouchRef.current;
|
|
@@ -1339,7 +1483,7 @@ function TimeGridInner<T = unknown>(
|
|
|
1339
1483
|
cellTouchRef.current = null;
|
|
1340
1484
|
}
|
|
1341
1485
|
const o = createOrigin.current;
|
|
1342
|
-
if (!o) return;
|
|
1486
|
+
if (!o || o.pointerId !== e.pointerId) return;
|
|
1343
1487
|
o.clientY = e.clientY;
|
|
1344
1488
|
setCreateBox({
|
|
1345
1489
|
dayIndex: o.dayIndex,
|
|
@@ -1348,14 +1492,17 @@ function TimeGridInner<T = unknown>(
|
|
|
1348
1492
|
curPx: pxFromTop(o.el, e.clientY),
|
|
1349
1493
|
});
|
|
1350
1494
|
};
|
|
1351
|
-
const endCreate = (e:
|
|
1495
|
+
const endCreate = (e: Pick<PointerEvent, "pointerId" | "clientY">) => {
|
|
1352
1496
|
const o = createOrigin.current;
|
|
1353
|
-
if (!o) return;
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1497
|
+
if (!o || o.pointerId !== e.pointerId) return;
|
|
1498
|
+
clearCreate();
|
|
1499
|
+
if (
|
|
1500
|
+
!o.el.isConnected ||
|
|
1501
|
+
!cellEnabled ||
|
|
1502
|
+
(o.creating && !onCreateEvent) ||
|
|
1503
|
+
days[o.dayIndex]?.getTime() !== o.dayTime
|
|
1504
|
+
)
|
|
1505
|
+
return;
|
|
1359
1506
|
const endPx = pxFromTop(o.el, e.clientY);
|
|
1360
1507
|
const day = days[o.dayIndex];
|
|
1361
1508
|
const moved = Math.abs(endPx - o.startPx) > 4;
|
|
@@ -1367,9 +1514,10 @@ function TimeGridInner<T = unknown>(
|
|
|
1367
1514
|
const at = cellRangeFromDrag(day, o.startPx, o.startPx, h, windowStart, snapMinutes);
|
|
1368
1515
|
if (at) onPressCell(at.start);
|
|
1369
1516
|
}
|
|
1370
|
-
createOrigin.current = null;
|
|
1371
|
-
setCreateBox(null);
|
|
1372
1517
|
};
|
|
1518
|
+
useClientLayoutEffect(() => {
|
|
1519
|
+
createRelease.current = endCreate;
|
|
1520
|
+
});
|
|
1373
1521
|
const tapCell = (e: ReactMouseEvent<HTMLDivElement>, dayIndex: number) => {
|
|
1374
1522
|
const touch = cellTouchRef.current;
|
|
1375
1523
|
cellTouchRef.current = null;
|
|
@@ -1388,6 +1536,9 @@ function TimeGridInner<T = unknown>(
|
|
|
1388
1536
|
const clearCreate = useCallback(() => {
|
|
1389
1537
|
const previous = createOrigin.current;
|
|
1390
1538
|
createOrigin.current = null;
|
|
1539
|
+
if (previous?.captureLoss !== undefined) clearTimeout(previous.captureLoss);
|
|
1540
|
+
detachCreateListeners.current?.();
|
|
1541
|
+
detachCreateListeners.current = null;
|
|
1391
1542
|
setCreateBox(null);
|
|
1392
1543
|
try {
|
|
1393
1544
|
previous?.el.releasePointerCapture?.(previous.pointerId);
|
|
@@ -1395,15 +1546,20 @@ function TimeGridInner<T = unknown>(
|
|
|
1395
1546
|
// The browser may have already released capture.
|
|
1396
1547
|
}
|
|
1397
1548
|
}, []);
|
|
1398
|
-
const cancelCreate = () => {
|
|
1399
|
-
cellTouchRef.current = null;
|
|
1549
|
+
const cancelCreate = (e: ReactPointerEvent) => {
|
|
1550
|
+
if (cellTouchRef.current?.pointerId === e.pointerId) cellTouchRef.current = null;
|
|
1551
|
+
if (createOrigin.current?.pointerId !== e.pointerId) return;
|
|
1400
1552
|
clearCreate();
|
|
1401
1553
|
};
|
|
1402
|
-
//
|
|
1403
|
-
//
|
|
1554
|
+
// Capture loss can precede pointerup with either button state. Give release
|
|
1555
|
+
// the rest of this event task to complete, then cancel any remaining sweep.
|
|
1404
1556
|
const loseCreateCapture = (e: ReactPointerEvent) => {
|
|
1405
|
-
|
|
1406
|
-
|
|
1557
|
+
const origin = createOrigin.current;
|
|
1558
|
+
if (!origin || origin.pointerId !== e.pointerId) return;
|
|
1559
|
+
if (origin.captureLoss !== undefined) clearTimeout(origin.captureLoss);
|
|
1560
|
+
origin.captureLoss = setTimeout(() => {
|
|
1561
|
+
if (createOrigin.current === origin) clearCreate();
|
|
1562
|
+
}, 0);
|
|
1407
1563
|
};
|
|
1408
1564
|
// Pointer capture does not move keyboard focus to the grid.
|
|
1409
1565
|
useEffect(() => {
|
|
@@ -1420,10 +1576,7 @@ function TimeGridInner<T = unknown>(
|
|
|
1420
1576
|
// the same `Date`s while that range holds, so content effects keyed on them
|
|
1421
1577
|
// re-run only when it changes.
|
|
1422
1578
|
const liveRange =
|
|
1423
|
-
createBox &&
|
|
1424
|
-
RenderCreateGhost &&
|
|
1425
|
-
onCreateEvent &&
|
|
1426
|
-
days[createBox.dayIndex]?.getTime() === createBox.dayTime
|
|
1579
|
+
createBox && onCreateEvent && days[createBox.dayIndex]?.getTime() === createBox.dayTime
|
|
1427
1580
|
? cellRangeFromDrag(
|
|
1428
1581
|
days[createBox.dayIndex],
|
|
1429
1582
|
createBox.startPx,
|
|
@@ -1477,9 +1630,20 @@ function TimeGridInner<T = unknown>(
|
|
|
1477
1630
|
event.end.getTime() === heldEvent.end.getTime() &&
|
|
1478
1631
|
event.title === heldEvent.title,
|
|
1479
1632
|
) ?? heldEvent));
|
|
1633
|
+
// A held multi-day event, moved or not. The active box must also be the held
|
|
1634
|
+
// event, because an events refresh can give its `day:index` key to another
|
|
1635
|
+
// event, even before the pointer moves.
|
|
1636
|
+
const multiDayHeld =
|
|
1637
|
+
!paged &&
|
|
1638
|
+
drag?.kind === "move" &&
|
|
1639
|
+
(drag.continuesBefore || drag.continuesAfter) &&
|
|
1640
|
+
!!movingEvent;
|
|
1641
|
+
// Only once the pointer has moved: a press that may still be a click keeps
|
|
1642
|
+
// the segments in their shared columns instead of swapping in the preview.
|
|
1480
1643
|
const multiDayMove =
|
|
1481
1644
|
!paged &&
|
|
1482
1645
|
drag?.kind === "move" &&
|
|
1646
|
+
drag.moved &&
|
|
1483
1647
|
(drag.continuesBefore || drag.continuesAfter) &&
|
|
1484
1648
|
moveOrigin &&
|
|
1485
1649
|
movingEvent
|
|
@@ -1500,6 +1664,25 @@ function TimeGridInner<T = unknown>(
|
|
|
1500
1664
|
})()
|
|
1501
1665
|
: null;
|
|
1502
1666
|
|
|
1667
|
+
// Where a single-day drag would land if released now, for the renderer of the
|
|
1668
|
+
// dragged box and its spill. The multi-day preview carries its own shifted
|
|
1669
|
+
// event, and a paged drag resolves its day only on release.
|
|
1670
|
+
const liveBounds =
|
|
1671
|
+
!paged && drag?.moved && !multiDayMove && moveOrigin && draggedRef.current
|
|
1672
|
+
? draggedEventBounds(
|
|
1673
|
+
drag,
|
|
1674
|
+
moveOrigin,
|
|
1675
|
+
draggedRef.current.event,
|
|
1676
|
+
startOfDay(
|
|
1677
|
+
days[moveOrigin.dayIndex + (drag.kind === "move" ? drag.dayDelta : 0)] ??
|
|
1678
|
+
days[moveOrigin.dayIndex],
|
|
1679
|
+
),
|
|
1680
|
+
snapMinutes,
|
|
1681
|
+
)
|
|
1682
|
+
: null;
|
|
1683
|
+
const withLiveBounds = (event: CalendarEvent<T>): CalendarEvent<T> =>
|
|
1684
|
+
liveBounds ? { ...event, start: liveBounds.start, end: liveBounds.end } : event;
|
|
1685
|
+
|
|
1503
1686
|
// The tail of an in-progress move that runs past midnight, shown on `dayIndex`
|
|
1504
1687
|
// so the drop is visible on both days at once. `drag` and `draggedRef` are set
|
|
1505
1688
|
// together in `beginDrag` and cleared together in `finishDrag`, so the guard on
|
|
@@ -1509,7 +1692,7 @@ function TimeGridInner<T = unknown>(
|
|
|
1509
1692
|
const dragged = draggedRef.current?.event;
|
|
1510
1693
|
if (!dragged) return null;
|
|
1511
1694
|
return {
|
|
1512
|
-
event: dragged,
|
|
1695
|
+
event: withLiveBounds(dragged),
|
|
1513
1696
|
mode,
|
|
1514
1697
|
isAllDay: false,
|
|
1515
1698
|
boxHeight: Math.max(drag.spillHours * hourHeight, minEventHeight),
|
|
@@ -1653,7 +1836,7 @@ function TimeGridInner<T = unknown>(
|
|
|
1653
1836
|
)
|
|
1654
1837
|
.map((pe) => pe.event),
|
|
1655
1838
|
),
|
|
1656
|
-
].filter(
|
|
1839
|
+
].filter(hasEditActions)}
|
|
1657
1840
|
label={labels.editEvents}
|
|
1658
1841
|
labelFor={(event) => labels.eventActions(event.title ?? "")}
|
|
1659
1842
|
descriptionFor={eventDescription}
|
|
@@ -1690,7 +1873,7 @@ function TimeGridInner<T = unknown>(
|
|
|
1690
1873
|
: null}
|
|
1691
1874
|
</div>
|
|
1692
1875
|
{days.map((day) => {
|
|
1693
|
-
const today = getIsToday(day);
|
|
1876
|
+
const today = getIsToday(day, todayDate);
|
|
1694
1877
|
// Full, unambiguous date for assistive tech; the visible weekday + day
|
|
1695
1878
|
// number below are decorative (aria-hidden) so it isn't read twice.
|
|
1696
1879
|
const dateLabel = format(day, "EEEE, d MMMM yyyy", dfns);
|
|
@@ -1779,87 +1962,93 @@ function TimeGridInner<T = unknown>(
|
|
|
1779
1962
|
base: {
|
|
1780
1963
|
width: gutterWidth,
|
|
1781
1964
|
flex: "none",
|
|
1965
|
+
boxSizing: "border-box",
|
|
1782
1966
|
minWidth: 0,
|
|
1783
1967
|
overflow: "hidden",
|
|
1784
1968
|
textAlign: "right",
|
|
1785
1969
|
},
|
|
1786
|
-
themed: {
|
|
1970
|
+
themed: {
|
|
1971
|
+
fontSize: 10,
|
|
1972
|
+
color: theme.textMuted,
|
|
1973
|
+
padding: hideHours ? 0 : "4px 6px 0 0",
|
|
1974
|
+
},
|
|
1787
1975
|
})}
|
|
1788
1976
|
>
|
|
1789
1977
|
{showAllDayLabel ? labels.allDay : null}
|
|
1790
1978
|
</div>
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1979
|
+
<div
|
|
1980
|
+
style={{
|
|
1981
|
+
flex: 1,
|
|
1982
|
+
minWidth: 0,
|
|
1983
|
+
display: "grid",
|
|
1984
|
+
gridTemplateColumns: `repeat(${days.length}, minmax(0, 1fr))`,
|
|
1985
|
+
gap: "2px 0",
|
|
1986
|
+
padding: "2px 0",
|
|
1987
|
+
}}
|
|
1988
|
+
>
|
|
1989
|
+
{allDayLayout.segments.map((segment) => {
|
|
1990
|
+
const { event, startCol, endCol, lane, continuesBefore, continuesAfter } = segment;
|
|
1991
|
+
const args: DomRenderEventArgs<T> = {
|
|
1992
|
+
event,
|
|
1993
|
+
mode,
|
|
1994
|
+
isAllDay: true,
|
|
1995
|
+
continuesBefore,
|
|
1996
|
+
continuesAfter,
|
|
1997
|
+
ampm,
|
|
1998
|
+
onPress: () => onPressEvent?.(event),
|
|
1999
|
+
};
|
|
2000
|
+
return (
|
|
2001
|
+
<div
|
|
2002
|
+
key={allDayKey(event)}
|
|
2003
|
+
{...slot("allDayColumn", {
|
|
2004
|
+
base: {
|
|
2005
|
+
gridColumn: `${startCol + 1} / span ${endCol - startCol + 1}`,
|
|
2006
|
+
gridRow: lane + 1,
|
|
2007
|
+
minWidth: 0,
|
|
2008
|
+
// Match the timed columns' grid line and horizontal inset.
|
|
2009
|
+
borderLeft: "1px solid transparent",
|
|
2010
|
+
padding: "0 1px",
|
|
2011
|
+
display: "flex",
|
|
2012
|
+
flexDirection: "column",
|
|
2013
|
+
},
|
|
2014
|
+
})}
|
|
2015
|
+
>
|
|
2016
|
+
<button
|
|
2017
|
+
type="button"
|
|
2018
|
+
onClick={() => onPressEvent?.(event)}
|
|
2019
|
+
aria-label={
|
|
2020
|
+
eventAccessibilityLabel
|
|
2021
|
+
? eventAccessibilityLabel(event, { mode, isAllDay: true, ampm })
|
|
2022
|
+
: defaultEventAccessibilityLabel({
|
|
2023
|
+
title: event.title,
|
|
2024
|
+
isAllDay: true,
|
|
2025
|
+
start: event.start,
|
|
2026
|
+
end: event.end,
|
|
2027
|
+
ampm,
|
|
2028
|
+
labels,
|
|
2029
|
+
})
|
|
2030
|
+
}
|
|
2031
|
+
{...slot("allDayEvent", {
|
|
2032
|
+
base: {
|
|
2033
|
+
border: "none",
|
|
2034
|
+
padding: 0,
|
|
2035
|
+
background: "transparent",
|
|
2036
|
+
cursor: "pointer",
|
|
2037
|
+
textAlign: "left",
|
|
2038
|
+
height: 22,
|
|
2039
|
+
},
|
|
2040
|
+
})}
|
|
2041
|
+
>
|
|
2042
|
+
{Renderer ? (
|
|
2043
|
+
<Renderer {...args} />
|
|
2044
|
+
) : (
|
|
2045
|
+
<DefaultDomEvent {...args} theme={theme} boxProps={slot("eventBox")} />
|
|
2046
|
+
)}
|
|
2047
|
+
</button>
|
|
2048
|
+
</div>
|
|
2049
|
+
);
|
|
2050
|
+
})}
|
|
2051
|
+
</div>
|
|
1863
2052
|
</div>
|
|
1864
2053
|
) : null}
|
|
1865
2054
|
|
|
@@ -1923,7 +2112,7 @@ function TimeGridInner<T = unknown>(
|
|
|
1923
2112
|
createBox?.dayIndex === dayIndex && createBox.dayTime === day.getTime()
|
|
1924
2113
|
? createBox
|
|
1925
2114
|
: null;
|
|
1926
|
-
const ghostRange = ghost ? createRange : null;
|
|
2115
|
+
const ghostRange = ghost && RenderCreateGhost ? createRange : null;
|
|
1927
2116
|
// The tail of a move that runs past midnight, previewed at the top of
|
|
1928
2117
|
// this column. The dragged event is looked up from its `drag.key`
|
|
1929
2118
|
// ("<originColumn>:<index>"), so no extra state has to track it.
|
|
@@ -1945,7 +2134,10 @@ function TimeGridInner<T = unknown>(
|
|
|
1945
2134
|
onPointerCancel={cellEnabled ? cancelCreate : undefined}
|
|
1946
2135
|
onLostPointerCapture={cellEnabled ? loseCreateCapture : undefined}
|
|
1947
2136
|
onClick={cellEnabled ? (e) => tapCell(e, dayIndex) : undefined}
|
|
1948
|
-
{...dataState({
|
|
2137
|
+
{...dataState({
|
|
2138
|
+
"data-today": getIsToday(day, todayDate),
|
|
2139
|
+
"data-weekend": isWeekend(day),
|
|
2140
|
+
})}
|
|
1949
2141
|
{...slot("dayColumn", {
|
|
1950
2142
|
base: { flex: 1, position: "relative" },
|
|
1951
2143
|
// Weekend columns are tinted (matching the native renderer); the
|
|
@@ -2039,7 +2231,7 @@ function TimeGridInner<T = unknown>(
|
|
|
2039
2231
|
// the ghost stands in, so a same-slot event on the new page (e.g. a
|
|
2040
2232
|
// recurring one) must not also render lifted.
|
|
2041
2233
|
const active =
|
|
2042
|
-
!paged && drag?.key === key && (!
|
|
2234
|
+
!paged && drag?.key === key && (!multiDayHeld || pe.event === movingEvent)
|
|
2043
2235
|
? drag
|
|
2044
2236
|
: null;
|
|
2045
2237
|
const hiddenForMove = !!multiDayMove && pe.event === movingEvent;
|
|
@@ -2062,9 +2254,14 @@ function TimeGridInner<T = unknown>(
|
|
|
2062
2254
|
minEventHeight,
|
|
2063
2255
|
);
|
|
2064
2256
|
const widthPct = 100 / pe.columns;
|
|
2257
|
+
// A moved event floats across its whole day column, like the
|
|
2258
|
+
// multi-day preview, so a narrow overlapping event shows its
|
|
2259
|
+
// full content while carried. A press or a resize keeps the
|
|
2260
|
+
// shared column.
|
|
2261
|
+
const floating = active?.kind === "move" && active.moved;
|
|
2065
2262
|
const onPress = () => onPressEvent?.(pe.event);
|
|
2066
2263
|
const args: DomRenderEventArgs<T> = {
|
|
2067
|
-
event: pe.event,
|
|
2264
|
+
event: active ? withLiveBounds(pe.event) : pe.event,
|
|
2068
2265
|
mode,
|
|
2069
2266
|
isAllDay: false,
|
|
2070
2267
|
boxHeight,
|
|
@@ -2124,8 +2321,12 @@ function TimeGridInner<T = unknown>(
|
|
|
2124
2321
|
// is the renderer's concern: the built-in one clamps, and a
|
|
2125
2322
|
// custom renderer should adapt to the `boxHeight` it's given.
|
|
2126
2323
|
height: boxHeight,
|
|
2127
|
-
left:
|
|
2128
|
-
|
|
2324
|
+
left: floating
|
|
2325
|
+
? eventGap
|
|
2326
|
+
: `calc(${pe.column * widthPct}% + ${eventGap}px)`,
|
|
2327
|
+
width: floating
|
|
2328
|
+
? `calc(100% - ${eventGap * 2}px)`
|
|
2329
|
+
: `calc(${widthPct}% - ${eventGap * 2}px)`,
|
|
2129
2330
|
cursor: canMove ? "grab" : "pointer",
|
|
2130
2331
|
touchAction: canMove ? "pan-y" : "auto",
|
|
2131
2332
|
userSelect: canMove ? "none" : undefined,
|
|
@@ -2305,11 +2506,20 @@ function TimeGridInner<T = unknown>(
|
|
|
2305
2506
|
position: "absolute",
|
|
2306
2507
|
left: eventGap,
|
|
2307
2508
|
right: eventGap,
|
|
2308
|
-
...
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2509
|
+
...(createRange
|
|
2510
|
+
? createRangePlacement(
|
|
2511
|
+
createRange,
|
|
2512
|
+
day,
|
|
2513
|
+
hourHeight,
|
|
2514
|
+
windowStart,
|
|
2515
|
+
totalHeight,
|
|
2516
|
+
minEventHeight,
|
|
2517
|
+
)
|
|
2518
|
+
: createPreviewPlacement(
|
|
2519
|
+
Math.min(ghost.startPx, ghost.curPx),
|
|
2520
|
+
Math.abs(ghost.curPx - ghost.startPx),
|
|
2521
|
+
totalHeight,
|
|
2522
|
+
)),
|
|
2313
2523
|
// Borders, including custom ones, stay inside the placed box.
|
|
2314
2524
|
boxSizing: "border-box",
|
|
2315
2525
|
...(ghostRange ? { overflow: "hidden" } : null),
|