calendar-components 0.0.0 → 0.7.3

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.
@@ -0,0 +1,1475 @@
1
+ "use client";
2
+ import {
3
+ TIME_GRID_SLOTS,
4
+ __export,
5
+ disabled,
6
+ focusVisible,
7
+ hovered,
8
+ mergePartProps,
9
+ pressed,
10
+ renderElement,
11
+ resolve,
12
+ stateAttributes,
13
+ useChangeState,
14
+ useLatest,
15
+ useNow,
16
+ useToday
17
+ } from "./chunk-E6WBQCX3.js";
18
+
19
+ // src/time-grid/index.parts.ts
20
+ var index_parts_exports = {};
21
+ __export(index_parts_exports, {
22
+ AllDay: () => TimeGridAllDay,
23
+ AllDayEvent: () => TimeGridAllDayEvent,
24
+ Column: () => TimeGridColumn,
25
+ DayHeader: () => TimeGridDayHeader,
26
+ Event: () => TimeGridEvent,
27
+ EventResizeHandle: () => TimeGridEventResizeHandle,
28
+ Events: () => TimeGridEvents,
29
+ Hour: () => TimeGridHour,
30
+ Hours: () => TimeGridHours,
31
+ Line: () => TimeGridLine,
32
+ Lines: () => TimeGridLines,
33
+ Now: () => TimeGridNow,
34
+ Root: () => TimeGridRoot
35
+ });
36
+
37
+ // src/time-grid/root/TimeGridRoot.tsx
38
+ import { createChangeDetails as createChangeDetails2, createStore, compareEvents, getLocalTimeZone, labelsFor, localeInfo, nowOf } from "calendar-components-core";
39
+ import * as React5 from "react";
40
+ import { I18nProvider, useLocale } from "react-aria/I18nProvider";
41
+ import { mergeRefs } from "react-aria/mergeRefs";
42
+ import { useCollator } from "react-aria/useCollator";
43
+ import { useGridList } from "react-aria/useGridList";
44
+ import { useListState as useListState2 } from "react-stately/useListState";
45
+
46
+ // src/utils/useStore.ts
47
+ import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector";
48
+ var identity = (value3) => value3;
49
+ function useStore(store, select = identity, isEqual) {
50
+ return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getServerSnapshot ?? store.getSnapshot, select, isEqual);
51
+ }
52
+
53
+ // src/time-grid/root/collection.ts
54
+ var eventNode = (key, index = -1) => ({ type: "item", key, value: null, level: 0, hasChildNodes: false, childNodes: [], rendered: null, textValue: "", index, parentKey: null, props: {} });
55
+ var EventCollection = class {
56
+ #nodes;
57
+ #index = /* @__PURE__ */ new Map();
58
+ constructor(ids) {
59
+ this.#nodes = ids.map(eventNode);
60
+ for (const [i, id] of ids.entries()) this.#index.set(id, i);
61
+ }
62
+ get size() {
63
+ return this.#nodes.length;
64
+ }
65
+ *[Symbol.iterator]() {
66
+ yield* this.#nodes;
67
+ }
68
+ getKeys() {
69
+ return this.#index.keys();
70
+ }
71
+ getItem(key) {
72
+ const i = this.#index.get(key);
73
+ return i == null ? null : this.#nodes[i];
74
+ }
75
+ at(index) {
76
+ return this.#nodes[index] ?? null;
77
+ }
78
+ getKeyBefore(key) {
79
+ const i = this.#index.get(key);
80
+ return i ? this.#nodes[i - 1].key : null;
81
+ }
82
+ getKeyAfter(key) {
83
+ const i = this.#index.get(key);
84
+ return i == null ? null : this.#nodes[i + 1]?.key ?? null;
85
+ }
86
+ getFirstKey() {
87
+ return this.#nodes[0]?.key ?? null;
88
+ }
89
+ getLastKey() {
90
+ return this.#nodes.at(-1)?.key ?? null;
91
+ }
92
+ getChildren() {
93
+ return [];
94
+ }
95
+ getTextValue() {
96
+ return "";
97
+ }
98
+ };
99
+
100
+ // src/time-grid/root/keyboardDelegate.ts
101
+ import { moveFrom } from "calendar-components-core";
102
+ function timeGridKeyboardDelegate(source) {
103
+ const move = (key, to) => key == null ? null : moveFrom(source().days, String(key), to);
104
+ const sideways = (key, right) => move(key, right === (source().direction === "ltr") ? "next-day" : "previous-day");
105
+ return {
106
+ getKeyAbove: (key) => move(key, "previous"),
107
+ getKeyBelow: (key) => move(key, "next"),
108
+ getKeyLeftOf: (key) => sideways(key, false),
109
+ getKeyRightOf: (key) => sideways(key, true),
110
+ getFirstKey: (key) => move(key, "first") ?? source().collection.getFirstKey(),
111
+ getLastKey: (key) => move(key, "last") ?? source().collection.getLastKey(),
112
+ getKeyForSearch(search, from) {
113
+ const { collection, textOf, collator } = source();
114
+ for (let key = from ?? collection.getFirstKey(); key != null; key = collection.getKeyAfter(key)) {
115
+ if (collator.compare(textOf(key).trim().slice(0, search.length), search) === 0) return key;
116
+ }
117
+ return null;
118
+ }
119
+ };
120
+ }
121
+
122
+ // src/time-grid/drag/useEventDragAndDrop.ts
123
+ import { moved as moved2 } from "calendar-components-core";
124
+ import * as React2 from "react";
125
+ import { useDraggableCollection } from "react-aria/useDraggableCollection";
126
+ import { useDroppableCollection } from "react-aria/useDroppableCollection";
127
+ import { useDraggableCollectionState } from "react-stately/useDraggableCollectionState";
128
+ import { useDroppableCollectionState } from "react-stately/useDroppableCollectionState";
129
+ import { useListState } from "react-stately/useListState";
130
+
131
+ // src/time-grid/event/useEventChange.ts
132
+ import { announce } from "@react-aria/live-announcer";
133
+ import { createChangeDetails, dayAt, formatDay, formatTime, moved, resized, toLocalDate } from "calendar-components-core";
134
+
135
+ // src/time-grid/root/TimeGridRootContext.ts
136
+ import * as React from "react";
137
+ var TimeGridRootContext = React.createContext(null);
138
+ function useTimeGridRootContext(part = "useTimeGrid") {
139
+ const context = React.useContext(TimeGridRootContext);
140
+ if (!context) throw new Error(`${part.startsWith("use") ? part : `TimeGrid.${part}`} must be inside TimeGrid.Root.`);
141
+ return context;
142
+ }
143
+
144
+ // src/time-grid/event/useEventChange.ts
145
+ function useEventChange() {
146
+ return eventChange(useTimeGridRootContext("Event"));
147
+ }
148
+ function eventChange({ days: days2, store, step, changeEvent, locale, labels, range }) {
149
+ const drawn = { from: Math.max(0, range.from * 60), to: Math.min(24 * 60, range.to * 60) };
150
+ const at = ({ event, date: date4 }, kind, minutes, daysOn = 0) => {
151
+ const span = kind === "move" ? moved(event, minutes, step, drawn) : resized(event, minutes, step, drawn);
152
+ const index = Math.max(
153
+ 0,
154
+ days2.findIndex((day) => day.date === date4)
155
+ );
156
+ return { id: event.id, date: days2[dayAt(index, kind === "move" ? daysOn : 0, days2.length)]?.date ?? date4, ...span };
157
+ };
158
+ const commit = ({ event, date: date4, label, element }, to, reason) => {
159
+ store.set({ drag: null });
160
+ const time = (minutes) => formatTime(locale.locale, minutes);
161
+ const stayed = to.start === event.start && to.end === event.end && to.date === date4;
162
+ if (stayed) {
163
+ if (reason === "keyboard") announce(labels.event(label, time(event.start), time(event.end)), "polite");
164
+ return;
165
+ }
166
+ const details = createChangeDetails(reason, element ?? void 0);
167
+ changeEvent(to, details);
168
+ if (details.isCanceled) return;
169
+ announce(labels.changed(label, formatDay(locale.locale, toLocalDate(to.date)).full, time(to.start), time(to.end)), "assertive");
170
+ };
171
+ return { at, commit };
172
+ }
173
+
174
+ // src/time-grid/drag/slots.ts
175
+ import { addDays, formatDay as formatDay2, formatTime as formatTime2, toLocalDate as toLocalDate2 } from "calendar-components-core";
176
+ var slotKey = ({ date: date4, minutes }) => `${date4}/${minutes}`;
177
+ var slotOf = (key) => {
178
+ const [date4, minutes] = String(key).split("/");
179
+ return { date: date4, minutes: Number(minutes) };
180
+ };
181
+ var SlotCollection = class {
182
+ #keys = [];
183
+ #index = /* @__PURE__ */ new Map();
184
+ #locale;
185
+ constructor(dates, range, step, locale) {
186
+ this.#locale = locale;
187
+ const [from, to] = [Math.ceil(range.from * 60 / step) * step, Math.min(24, range.to) * 60];
188
+ for (const date4 of dates) for (let minutes = from; minutes < to; minutes += step) this.#index.set(slotKey({ date: date4, minutes }), this.#keys.push(slotKey({ date: date4, minutes })) - 1);
189
+ }
190
+ get size() {
191
+ return this.#keys.length;
192
+ }
193
+ *[Symbol.iterator]() {
194
+ for (const key of this.#keys) yield this.getItem(key);
195
+ }
196
+ getKeys() {
197
+ return this.#keys.values();
198
+ }
199
+ getItem(key) {
200
+ const index = this.#index.get(key);
201
+ if (index == null) return null;
202
+ return {
203
+ type: "item",
204
+ key,
205
+ value: slotOf(key),
206
+ level: 0,
207
+ hasChildNodes: false,
208
+ childNodes: [],
209
+ rendered: null,
210
+ textValue: this.getTextValue(key),
211
+ index,
212
+ parentKey: null,
213
+ prevKey: this.#keys[index - 1] ?? null,
214
+ nextKey: this.#keys[index + 1] ?? null,
215
+ props: {}
216
+ };
217
+ }
218
+ at(index) {
219
+ return this.#keys[index] == null ? null : this.getItem(this.#keys[index]);
220
+ }
221
+ getKeyBefore(key) {
222
+ const index = this.#index.get(key);
223
+ return index ? this.#keys[index - 1] : null;
224
+ }
225
+ getKeyAfter(key) {
226
+ const index = this.#index.get(key);
227
+ return index == null ? null : this.#keys[index + 1] ?? null;
228
+ }
229
+ getFirstKey() {
230
+ return this.#keys[0] ?? null;
231
+ }
232
+ getLastKey() {
233
+ return this.#keys.at(-1) ?? null;
234
+ }
235
+ getChildren() {
236
+ return [];
237
+ }
238
+ /** A time's name, for a screen reader: the day and the time, in the locale's words. */
239
+ getTextValue(key) {
240
+ const { date: date4, minutes } = slotOf(key);
241
+ return `${formatDay2(this.#locale, toLocalDate2(date4)).full}, ${formatTime2(this.#locale, minutes)}`;
242
+ }
243
+ };
244
+ function slotKeyboardDelegate(source) {
245
+ const to = (key, by) => {
246
+ const { slots } = source();
247
+ const { date: date4, minutes } = slotOf(key);
248
+ const next = slotKey({ date: by.days ? addDays(date4, by.days) : date4, minutes: minutes + (by.minutes ?? 0) });
249
+ return slots.getItem(next) ? next : null;
250
+ };
251
+ const sideways = (key, right) => to(key, { days: right === (source().direction === "ltr") ? 1 : -1 });
252
+ return {
253
+ getKeyBelow: (key) => to(key, { minutes: source().step }),
254
+ getKeyAbove: (key) => to(key, { minutes: -source().step }),
255
+ getKeyPageBelow: (key) => to(key, { minutes: 60 }),
256
+ getKeyPageAbove: (key) => to(key, { minutes: -60 }),
257
+ getKeyRightOf: (key) => sideways(key, true),
258
+ getKeyLeftOf: (key) => sideways(key, false),
259
+ getFirstKey: () => source().slots.getFirstKey(),
260
+ getLastKey: () => source().slots.getLastKey()
261
+ };
262
+ }
263
+
264
+ // src/time-grid/drag/useEventDragAndDrop.ts
265
+ var EVENT_DRAG_TYPE = "application/x-calendar-components-event";
266
+ var TimeGridDragContext = React2.createContext(null);
267
+ function useEventDragAndDrop(grid, root) {
268
+ const { days: days2, store, step, range, locale, direction, editable: editable2, list } = grid;
269
+ const latest = useLatest(grid);
270
+ const drawn = { from: Math.max(0, range.from * 60), to: Math.min(24 * 60, range.to * 60) };
271
+ const bounds = useLatest(drawn);
272
+ const [from, to] = [range.from, range.to];
273
+ const slots = React2.useMemo(
274
+ () => new SlotCollection(
275
+ days2.map((day) => day.date),
276
+ { from, to },
277
+ step,
278
+ locale.locale
279
+ ),
280
+ [days2, from, to, step, locale.locale]
281
+ );
282
+ const times = useListState({ collection: slots, selectionMode: "none" });
283
+ const column = (date4) => root.current?.querySelector(`[data-slot="${TIME_GRID_SLOTS.column}"][data-date="${date4}"]`);
284
+ const subjectOf = (id) => {
285
+ for (const day of latest.current.days) {
286
+ const event = day.events.find((each) => each.id === id);
287
+ if (event) return { event, date: day.date, label: latest.current.textOf(id), element: latest.current.find(id) };
288
+ }
289
+ return null;
290
+ };
291
+ const dropping = React2.useRef(null);
292
+ const drag = useDraggableCollectionState({
293
+ collection: list.collection,
294
+ selectionManager: list.selectionManager,
295
+ isDisabled: !editable2,
296
+ getItems: (keys2) => [...keys2].map((key) => ({ [EVENT_DRAG_TYPE]: String(key), "text/plain": latest.current.textOf(key) })),
297
+ getAllowedDropOperations: () => ["move"],
298
+ onDragStart(e) {
299
+ const [id] = [...e.keys].map(String);
300
+ const subject = id == null ? null : subjectOf(id);
301
+ if (!subject) return;
302
+ const top = subject.element?.getBoundingClientRect().top ?? e.y;
303
+ const grab = Math.max(0, (e.y - top) / latest.current.hourHeight * 60);
304
+ store.set({ session: { ...subject, grab }, drag: { id: subject.event.id, start: 0, end: 0, days: 0, offset: 0 } });
305
+ const at = slotKey({ date: subject.date, minutes: subject.event.start });
306
+ times.selectionManager.setFocusedKey(slots.getKeyBefore(at));
307
+ requestAnimationFrame(
308
+ () => requestAnimationFrame(() => {
309
+ if (store.getSnapshot().session && !dropping.current?.target) dropping.current?.setTarget({ type: "item", key: at, dropPosition: "on" });
310
+ })
311
+ );
312
+ },
313
+ onDragEnd(e) {
314
+ if (e.dropOperation === "cancel") store.set({ session: null, drag: null });
315
+ }
316
+ });
317
+ useDraggableCollection({}, drag, root);
318
+ const byPointer = React2.useRef(false);
319
+ const landing = (target2) => {
320
+ const { session } = store.getSnapshot();
321
+ if (!session || target2?.type !== "item") return null;
322
+ const { date: date4, minutes } = slotOf(target2.key);
323
+ const to2 = { id: session.event.id, date: date4, start: minutes, end: minutes + (session.event.end - session.event.start) };
324
+ return { session, to: to2 };
325
+ };
326
+ const pointer = React2.useMemo(
327
+ () => ({
328
+ getDropTargetFromPoint(x, y, isValid) {
329
+ byPointer.current = true;
330
+ const { session } = store.getSnapshot();
331
+ const box = root.current?.getBoundingClientRect();
332
+ if (!session || !box) return null;
333
+ const [across, down] = [box.left + x, box.top + y];
334
+ const over = [...root.current?.querySelectorAll(`[data-slot="${TIME_GRID_SLOTS.column}"]`) ?? []].find((each) => across >= each.getBoundingClientRect().left && across < each.getBoundingClientRect().right);
335
+ const date4 = over?.dataset.date;
336
+ if (!over || !date4) return null;
337
+ const { range: hours, hourHeight: hourHeight2, step: by } = latest.current;
338
+ const start = hours.from * 60 + (down - over.getBoundingClientRect().top) / hourHeight2 * 60 - session.grab;
339
+ const target2 = { type: "item", key: slotKey({ date: date4, minutes: moved2(session.event, start - session.event.start, by, bounds.current).start }), dropPosition: "on" };
340
+ return isValid(target2) ? target2 : null;
341
+ }
342
+ }),
343
+ [store, root, latest, bounds]
344
+ );
345
+ const onDrop = (e) => {
346
+ const land = landing((byPointer.current ? pointer.getDropTargetFromPoint(e.x, e.y, () => true) : null) ?? e.target);
347
+ store.set({ session: null });
348
+ if (land) eventChange(latest.current).commit(land.session, land.to, "drag");
349
+ else store.set({ drag: null });
350
+ if (land && !byPointer.current) {
351
+ latest.current.list.selectionManager.setFocusedKey(land.session.event.id);
352
+ latest.current.list.selectionManager.setFocused(true);
353
+ }
354
+ };
355
+ const drop = useDroppableCollectionState({
356
+ onDrop,
357
+ collection: slots,
358
+ selectionManager: times.selectionManager,
359
+ isDisabled: !editable2,
360
+ // Only an event of this grid, on a time it fits at before the day's end: nothing else is this grid's to take.
361
+ getDropOperation(target2, types) {
362
+ const land = types.has(EVENT_DRAG_TYPE) && target2.type === "item" && target2.dropPosition === "on" ? landing(target2) : null;
363
+ return land && land.to.end <= Math.max(bounds.current.to, land.session.event.end) ? "move" : "cancel";
364
+ }
365
+ });
366
+ const keys = useLatest({ slots, step, direction });
367
+ const keyboard = React2.useMemo(() => slotKeyboardDelegate(() => (byPointer.current = false, keys.current)), [keys]);
368
+ const { collectionProps } = useDroppableCollection(
369
+ {
370
+ keyboardDelegate: keyboard,
371
+ dropTargetDelegate: pointer,
372
+ onDrop
373
+ },
374
+ drop,
375
+ root
376
+ );
377
+ dropping.current = drop;
378
+ const target = drop.target;
379
+ React2.useEffect(() => {
380
+ const land = landing(target);
381
+ if (!land) return;
382
+ const { session, to: to2 } = land;
383
+ const [here, over] = [column(session.date), column(to2.date)];
384
+ const dates = latest.current.days.map((day) => day.date);
385
+ store.set({
386
+ drag: {
387
+ id: session.event.id,
388
+ start: to2.start - session.event.start,
389
+ end: to2.end - session.event.end,
390
+ days: dates.indexOf(to2.date) - dates.indexOf(session.date),
391
+ offset: here && over ? over.getBoundingClientRect().left - here.getBoundingClientRect().left : 0
392
+ }
393
+ });
394
+ }, [target]);
395
+ const { id: _id, "aria-describedby": _described, ...dropProps } = collectionProps;
396
+ const context = React2.useMemo(() => ({ drag, drop }), [drag, drop]);
397
+ return { dropProps, context };
398
+ }
399
+
400
+ // src/time-grid/root/useHeadHeight.ts
401
+ import * as React3 from "react";
402
+
403
+ // src/time-grid/root/TimeGridRootCssVars.ts
404
+ var TimeGridRootCssVars_exports = {};
405
+ __export(TimeGridRootCssVars_exports, {
406
+ dayHeaderHeight: () => dayHeaderHeight,
407
+ days: () => days,
408
+ headHeight: () => headHeight,
409
+ height: () => height,
410
+ hourHeight: () => hourHeight
411
+ });
412
+ var hourHeight = "--time-grid-hour-height";
413
+ var height = "--time-grid-height";
414
+ var days = "--time-grid-days";
415
+ var dayHeaderHeight = "--time-grid-day-header-height";
416
+ var headHeight = "--time-grid-head-height";
417
+
418
+ // src/time-grid/root/useHeadHeight.ts
419
+ function useHeadHeight(root, days2) {
420
+ React3.useLayoutEffect(() => {
421
+ const grid = root.current;
422
+ const name = grid?.querySelector(`[data-slot="${TIME_GRID_SLOTS.dayHeader}"]`);
423
+ if (!grid || !name) return;
424
+ const allDay = grid.querySelector(`[data-slot="${TIME_GRID_SLOTS.allDay}"]`);
425
+ const measure = () => {
426
+ grid.style.setProperty(dayHeaderHeight, `${name.offsetHeight}px`);
427
+ grid.style.setProperty(headHeight, `${name.offsetHeight + (allDay?.offsetHeight ?? 0)}px`);
428
+ };
429
+ measure();
430
+ if (typeof ResizeObserver === "undefined") return;
431
+ const observer = new ResizeObserver(measure);
432
+ observer.observe(name);
433
+ if (allDay) observer.observe(allDay);
434
+ return () => observer.disconnect();
435
+ }, [root, days2]);
436
+ }
437
+
438
+ // src/time-grid/root/useScrollLock.ts
439
+ import * as React4 from "react";
440
+ var FLICK = 0.3;
441
+ function useScrollLock(ref, enabled, busy) {
442
+ const isBusy = React4.useRef(busy);
443
+ isBusy.current = busy;
444
+ React4.useEffect(() => {
445
+ const grid = ref.current;
446
+ if (!grid || !enabled) return;
447
+ const stop2 = new AbortController();
448
+ const options = { signal: stop2.signal };
449
+ let pan = null;
450
+ let resting = 0;
451
+ const release = () => {
452
+ clearTimeout(resting);
453
+ delete grid.dataset.scrollAxis;
454
+ };
455
+ const touchOf = (event) => [...event.changedTouches].find((touch) => touch.identifier === pan?.id);
456
+ const starts = () => {
457
+ const style = getComputedStyle(grid);
458
+ const clear = Number.parseFloat(style.scrollPaddingInlineStart) || 0;
459
+ const box = grid.getBoundingClientRect();
460
+ return [...grid.querySelectorAll(`[data-slot="${TIME_GRID_SLOTS.column}"]`)].map((column) => {
461
+ const day = column.getBoundingClientRect();
462
+ return style.direction === "rtl" ? day.right - (box.right - clear) : day.left - (box.left + clear);
463
+ });
464
+ };
465
+ const rest = (flick) => {
466
+ const snaps = grid.dataset.scrollSnap === "days" || grid.dataset.scrollSnap === "both";
467
+ const offsets = snaps ? starts() : [];
468
+ const towards = offsets.filter((offset) => flick > 0 ? offset < 0 : flick < 0 ? offset > 0 : true);
469
+ const [to] = (towards.length ? towards : offsets).sort((one, other) => Math.abs(one) - Math.abs(other));
470
+ if (to) grid.scrollBy({ left: to, behavior: "smooth" });
471
+ else release();
472
+ };
473
+ grid.addEventListener(
474
+ "scroll",
475
+ () => {
476
+ if (pan?.following || !grid.dataset.scrollAxis) return;
477
+ clearTimeout(resting);
478
+ resting = window.setTimeout(release, 100);
479
+ },
480
+ { ...options, passive: true }
481
+ );
482
+ grid.addEventListener(
483
+ "touchstart",
484
+ (event) => {
485
+ const [touch] = event.touches;
486
+ pan = event.touches.length === 1 && touch ? { id: touch.identifier, x: touch.clientX, y: touch.clientY, speed: 0, at: event.timeStamp, following: null } : null;
487
+ },
488
+ { ...options, passive: true }
489
+ );
490
+ grid.addEventListener(
491
+ "touchmove",
492
+ (event) => {
493
+ const touch = touchOf(event);
494
+ if (!pan || !touch) return;
495
+ const by = touch.clientX - pan.x;
496
+ if (pan.following === null) {
497
+ pan.following = !isBusy.current() && event.cancelable && Math.abs(by) > Math.abs(touch.clientY - pan.y);
498
+ if (pan.following) {
499
+ release();
500
+ grid.dataset.scrollAxis = "x";
501
+ }
502
+ }
503
+ if (!pan.following) return;
504
+ event.preventDefault();
505
+ pan.speed = by / Math.max(1, event.timeStamp - pan.at);
506
+ pan.x = touch.clientX;
507
+ pan.at = event.timeStamp;
508
+ grid.scrollLeft -= by;
509
+ },
510
+ { ...options, passive: false }
511
+ );
512
+ const end = (event) => {
513
+ if (!pan || !touchOf(event)) return;
514
+ const { following, speed } = pan;
515
+ pan = null;
516
+ if (following) rest(Math.abs(speed) > FLICK ? speed : 0);
517
+ };
518
+ grid.addEventListener("touchend", end, options);
519
+ grid.addEventListener("touchcancel", end, options);
520
+ return () => {
521
+ stop2.abort();
522
+ release();
523
+ };
524
+ }, [ref, enabled]);
525
+ }
526
+
527
+ // src/time-grid/root/TimeGridRoot.tsx
528
+ import { jsx } from "react/jsx-runtime";
529
+ var WHOLE_DAY = { from: 0, to: 24 };
530
+ var EVENT_HEIGHTS = { short: 40, tall: 52 };
531
+ var TimeGridRoot = React5.forwardRef(function TimeGridRoot2(props, ref) {
532
+ const ambient = useLocale();
533
+ return /* @__PURE__ */ jsx(I18nProvider, { locale: props.locale ?? ambient.locale, children: /* @__PURE__ */ jsx(TimeGridRootInner, { ...props, ref }) });
534
+ });
535
+ var TimeGridRootInner = React5.forwardRef(function TimeGridRootInner2({
536
+ days: days2,
537
+ value: value3,
538
+ defaultValue = null,
539
+ onValueChange,
540
+ onEventChange,
541
+ readOnly = false,
542
+ step = 15,
543
+ hourHeight: hourHeight2 = 56,
544
+ range,
545
+ workHours,
546
+ minEventHeight = 24,
547
+ eventHeights = EVENT_HEIGHTS,
548
+ laneOverlap = 0,
549
+ scrollSnap: scrollSnap2,
550
+ scrollLock: scrollLock2 = false,
551
+ locale,
552
+ timeZone,
553
+ labels,
554
+ actionsRef,
555
+ className,
556
+ style,
557
+ render,
558
+ children,
559
+ ...props
560
+ }, ref) {
561
+ const { locale: tag, direction } = useLocale();
562
+ const collator = useCollator({ usage: "search", sensitivity: "base" });
563
+ const info = React5.useMemo(() => localeInfo(tag), [tag]);
564
+ const zone = React5.useMemo(() => timeZone ?? getLocalTimeZone(), [timeZone]);
565
+ const words = React5.useMemo(() => ({ ...labelsFor(tag), ...labels }), [tag, labels]);
566
+ const fitted = range ?? WHOLE_DAY;
567
+ const [selected3, setSelected] = useChangeState(value3, defaultValue, onValueChange);
568
+ const [store] = React5.useState(() => createStore({ session: null, drag: null, allDay: [], disabled: [] }));
569
+ const latest = useLatest({ onEventChange });
570
+ const setValue = React5.useCallback((next, details) => void setSelected(next, details), [setSelected]);
571
+ const changeEvent = React5.useCallback((change, details) => latest.current.onEventChange?.(change, details), [latest]);
572
+ const editable2 = onEventChange != null && !readOnly;
573
+ const registerAllDay = React5.useCallback(
574
+ (id, date4) => {
575
+ store.set({ allDay: [...store.getSnapshot().allDay, { id, date: date4 }] });
576
+ return () => store.set({ allDay: store.getSnapshot().allDay.filter((each) => each.id !== id) });
577
+ },
578
+ [store]
579
+ );
580
+ const registerDisabled = React5.useCallback(
581
+ (id) => {
582
+ store.set({ disabled: [...store.getSnapshot().disabled, id] });
583
+ return () => store.set({ disabled: store.getSnapshot().disabled.filter((each) => each !== id) });
584
+ },
585
+ [store]
586
+ );
587
+ const disabledKeys = useStore(store, (s) => s.disabled);
588
+ const allDay = useStore(store, (s) => s.allDay);
589
+ const drawn = React5.useMemo(
590
+ () => days2.map((day) => {
591
+ const here = allDay.filter((each) => each.date === day.date);
592
+ return { events: day.events, allDay: day.allDay ? day.allDay.filter((each) => here.some((one) => one.id === each.id)) : here };
593
+ }),
594
+ [days2, allDay]
595
+ );
596
+ const root = React5.useRef(null);
597
+ const refs = React5.useMemo(() => mergeRefs(root, ref), [ref]);
598
+ const find = React5.useCallback((id) => [...root.current?.querySelectorAll(`[data-slot="${TIME_GRID_SLOTS.event}"], [data-slot="${TIME_GRID_SLOTS.allDayEvent}"]`) ?? []].find((el) => el.dataset.value === id), []);
599
+ const collection = React5.useMemo(() => new EventCollection(drawn.flatMap((day) => [...day.allDay ?? [], ...[...day.events].sort(compareEvents)].map((event) => event.id))), [drawn]);
600
+ const selectedKeys = React5.useMemo(() => selected3 == null ? [] : [selected3], [selected3]);
601
+ const list = useListState2({
602
+ collection,
603
+ selectionMode: "single",
604
+ selectedKeys,
605
+ // A disabled event can be reached and read, and not picked.
606
+ disabledKeys,
607
+ disabledBehavior: "selection",
608
+ onSelectionChange(keys) {
609
+ const [next] = keys === "all" ? [] : keys;
610
+ const id = next == null ? null : String(next);
611
+ setValue(id, createChangeDetails2("event-press", find(id ?? selected3 ?? "")));
612
+ }
613
+ });
614
+ const source = useLatest({ days: drawn, direction, collection, collator, textOf: (key) => find(String(key))?.getAttribute("aria-label") ?? find(String(key))?.textContent ?? "" });
615
+ const navigation = React5.useMemo(() => timeGridKeyboardDelegate(() => source.current), [source]);
616
+ const { gridProps } = useGridList(
617
+ {
618
+ "aria-label": props["aria-label"],
619
+ "aria-labelledby": props["aria-labelledby"],
620
+ keyboardDelegate: navigation,
621
+ // As React Aria's own grid layout has it: every arrow is the list's (so left and right cross days), and Tab goes on.
622
+ keyboardNavigationBehavior: "tab",
623
+ shouldSelectOnPressUp: true,
624
+ escapeKeyBehavior: "none"
625
+ },
626
+ list,
627
+ root
628
+ );
629
+ const scroll = useLatest({ range: fitted, hourHeight: hourHeight2, zone });
630
+ React5.useImperativeHandle(
631
+ actionsRef,
632
+ () => ({
633
+ scrollToTime(target, { behavior, block = "start", offset = 0 } = {}) {
634
+ const { range: hours, hourHeight: tall2, zone: timeZone2 } = scroll.current;
635
+ const at = target === "now" ? nowOf(timeZone2) : target;
636
+ const columns = [...root.current?.querySelectorAll(`[data-slot="${TIME_GRID_SLOTS.column}"]`) ?? []];
637
+ const column = columns.find((el) => el.dataset.date === at.date) ?? columns[0];
638
+ if (!column) return false;
639
+ const mark = document.createElement("div");
640
+ const top = (Math.min(Math.max(at.minutes / 60, hours.from), hours.to) - hours.from) * tall2;
641
+ Object.assign(mark.style, { position: "absolute", top: `${top}px`, insetInline: "0", height: "1px", pointerEvents: "none", scrollMarginTop: `calc(var(--time-grid-scroll-inset, 0px) + ${offset}px)` });
642
+ column.append(mark);
643
+ mark.scrollIntoView({ behavior, block, inline: "nearest" });
644
+ mark.remove();
645
+ return true;
646
+ },
647
+ scrollToEvent(id, { behavior, block = "nearest" } = {}) {
648
+ const event = find(id);
649
+ if (!event) return false;
650
+ event.scrollIntoView({ behavior, block, inline: "nearest" });
651
+ event.focus({ preventScroll: true });
652
+ return true;
653
+ }
654
+ }),
655
+ [find, scroll]
656
+ );
657
+ const [workFrom, workTo] = [workHours?.from, workHours?.to];
658
+ const work = React5.useMemo(() => workFrom == null || workTo == null ? void 0 : { from: workFrom, to: workTo }, [workFrom, workTo]);
659
+ const context = React5.useMemo(
660
+ () => ({
661
+ days: days2,
662
+ range: fitted,
663
+ workHours: work,
664
+ hourHeight: hourHeight2,
665
+ laneOverlap,
666
+ minEventHeight,
667
+ eventHeights,
668
+ locale: info,
669
+ timeZone: zone,
670
+ labels: words,
671
+ store,
672
+ setValue,
673
+ step,
674
+ editable: editable2,
675
+ changeEvent,
676
+ list,
677
+ registerAllDay,
678
+ registerDisabled,
679
+ direction
680
+ }),
681
+ [days2, fitted, work, hourHeight2, laneOverlap, minEventHeight, eventHeights, info, zone, words, store, setValue, step, editable2, changeEvent, list, registerAllDay, registerDisabled, direction]
682
+ );
683
+ const textOf = React5.useCallback((key) => find(String(key))?.getAttribute("aria-label") ?? find(String(key))?.textContent ?? "", [find]);
684
+ const dnd = useEventDragAndDrop({ ...context, textOf, find }, root);
685
+ useHeadHeight(root, days2.length);
686
+ useScrollLock(root, scrollLock2, () => store.getSnapshot().drag != null || store.getSnapshot().session != null);
687
+ const dragging3 = useStore(store, (s) => s.drag != null);
688
+ const state = { editable: editable2, dragging: dragging3, direction };
689
+ return /* @__PURE__ */ jsx(TimeGridRootContext.Provider, { value: context, children: /* @__PURE__ */ jsx(TimeGridDragContext.Provider, { value: dnd.context, children: renderElement(
690
+ "div",
691
+ {
692
+ dir: direction,
693
+ // React Aria's grid: a day is a group of rows in it, and an event a row.
694
+ ...mergePartProps(props, gridProps, dnd.dropProps),
695
+ ref: refs,
696
+ "data-slot": TIME_GRID_SLOTS.root,
697
+ "data-scroll-snap": scrollSnap2,
698
+ "data-scroll-lock": scrollLock2 ? "" : void 0,
699
+ className,
700
+ style: (s) => ({ "--time-grid-hour-height": `${hourHeight2}px`, "--time-grid-height": `${(fitted.to - fitted.from) * hourHeight2}px`, "--time-grid-days": days2.length, ...resolve(style, s) }),
701
+ render,
702
+ children
703
+ },
704
+ state,
705
+ ["editable", "dragging"]
706
+ ) }) });
707
+ });
708
+
709
+ // src/time-grid/hours/TimeGridHours.tsx
710
+ import { formatHour, formatHourParts, formatTimeParts, offsetOf } from "calendar-components-core";
711
+ import * as React6 from "react";
712
+
713
+ // src/time-grid/offHours.ts
714
+ var isOffHours = (hour3, workHours) => workHours != null && (hour3 < workHours.from || hour3 > workHours.to);
715
+
716
+ // src/time-grid/hours/TimeGridHours.tsx
717
+ import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
718
+ var TimeGridHours = React6.forwardRef(function TimeGridHours2({ className, style, render, children, ...props }, ref) {
719
+ const { range, hourHeight: hourHeight2 } = useTimeGridRootContext("Hours");
720
+ const state = { from: range.from, to: range.to };
721
+ return renderElement(
722
+ "div",
723
+ {
724
+ "aria-hidden": true,
725
+ ...props,
726
+ ref,
727
+ "data-slot": TIME_GRID_SLOTS.hours,
728
+ className,
729
+ // Its hours are placed against it. A stylesheet that keeps it in view while the days scroll sets `--time-grid-hours-position: sticky`.
730
+ style: (s) => ({ position: "var(--time-grid-hours-position, relative)", height: (range.to - range.from) * hourHeight2, ...resolve(style, s) }),
731
+ render,
732
+ children: /* @__PURE__ */ jsxs(Fragment2, { children: [
733
+ Array.from({ length: range.to - range.from }, (_, i) => /* @__PURE__ */ jsx2(React6.Fragment, { children: children ? children(range.from + i) : /* @__PURE__ */ jsx2(TimeGridHour, { hour: range.from + i }) }, i)),
734
+ /* @__PURE__ */ jsx2(DragTime, {})
735
+ ] })
736
+ },
737
+ state
738
+ );
739
+ });
740
+ function DragTime() {
741
+ const { store, days: days2, range, hourHeight: hourHeight2, locale } = useTimeGridRootContext("Hours");
742
+ const minutes = useStore(store, ({ drag, session }) => {
743
+ if (!drag) return null;
744
+ const event = session?.event ?? days2.flatMap((day) => day.events).find((each) => each.id === drag.id);
745
+ if (!event) return null;
746
+ return drag.start !== 0 || session ? event.start + drag.start : event.end + drag.end;
747
+ });
748
+ if (minutes == null) return null;
749
+ const onHour = minutes % 60 === 0;
750
+ const time = onHour ? formatHourParts(locale.locale, minutes / 60).hour : formatTimeParts(locale.locale, minutes).time;
751
+ const { dayPeriod } = formatTimeParts(locale.locale, minutes);
752
+ return /* @__PURE__ */ jsxs("div", { "aria-hidden": true, "data-slot": TIME_GRID_SLOTS.dragTime, "data-on-hour": onHour ? "" : void 0, style: { position: "absolute", insetInline: 0, top: offsetOf(minutes, range, hourHeight2) }, children: [
753
+ /* @__PURE__ */ jsx2("span", { children: time }),
754
+ /* @__PURE__ */ jsx2("span", { children: dayPeriod })
755
+ ] });
756
+ }
757
+ var TimeGridHour = React6.forwardRef(function TimeGridHour2({ hour: hour3, className, style, render, children, ...props }, ref) {
758
+ const { range, hourHeight: hourHeight2, locale, labels, workHours } = useTimeGridRootContext("Hour");
759
+ const noon2 = hour3 === 12 && labels.noon != null;
760
+ const label = noon2 ? labels.noon : formatHour(locale.locale, hour3);
761
+ const parts = formatHourParts(locale.locale, hour3);
762
+ const state = { hour: hour3, label, hourLabel: parts.hour, dayPeriodLabel: parts.dayPeriod, noon: noon2, offHours: isOffHours(hour3, workHours) };
763
+ return renderElement(
764
+ "div",
765
+ {
766
+ ...props,
767
+ ref,
768
+ "data-slot": TIME_GRID_SLOTS.hour,
769
+ className,
770
+ style: (s) => ({ position: "absolute", insetInline: 0, top: (hour3 - range.from) * hourHeight2, ...resolve(style, s) }),
771
+ render,
772
+ children: children ?? label
773
+ },
774
+ state,
775
+ ["hour", "noon", "offHours"]
776
+ );
777
+ });
778
+
779
+ // src/time-grid/day-header/TimeGridDayHeader.tsx
780
+ import { formatDay as formatDay4, toLocalDate as toLocalDate4 } from "calendar-components-core";
781
+ import * as React7 from "react";
782
+
783
+ // src/time-grid/column/useDayState.ts
784
+ import { formatDay as formatDay3, toLocalDate as toLocalDate3, weekdayOf } from "calendar-components-core";
785
+ var DAY_ATTRIBUTES = ["date", "today", "weekend"];
786
+ function useDayState(day, part) {
787
+ const { locale, timeZone } = useTimeGridRootContext(part);
788
+ const today4 = useToday(timeZone);
789
+ return { date: day.date, today: day.date === today4, weekend: locale.weekend.includes(weekdayOf(day.date)) };
790
+ }
791
+ function useDayLabel(day, part) {
792
+ const { locale, timeZone, labels } = useTimeGridRootContext(part);
793
+ const today4 = useToday(timeZone);
794
+ const full = formatDay3(locale.locale, toLocalDate3(day.date)).full;
795
+ return day.date === today4 ? labels.dayToday(full) : full;
796
+ }
797
+
798
+ // src/time-grid/day-header/TimeGridDayHeader.tsx
799
+ var TimeGridDayHeader = React7.forwardRef(function TimeGridDayHeader2({ day, className, style, render, children, ...props }, ref) {
800
+ const { locale } = useTimeGridRootContext("DayHeader");
801
+ const words = formatDay4(locale.locale, toLocalDate4(day.date));
802
+ const state = { ...useDayState(day, "DayHeader"), weekdayLabel: words.weekday, dayLabel: words.day };
803
+ return renderElement("div", { "aria-hidden": true, ...props, ref, "data-slot": TIME_GRID_SLOTS.dayHeader, className, style, render, children: children ?? `${words.weekday} ${words.day}` }, state, DAY_ATTRIBUTES);
804
+ });
805
+
806
+ // src/time-grid/all-day/TimeGridAllDay.tsx
807
+ import * as React8 from "react";
808
+ import { formatDay as formatDay5, toLocalDate as toLocalDate5 } from "calendar-components-core";
809
+ import { jsx as jsx3 } from "react/jsx-runtime";
810
+ var TimeGridAllDayContext = React8.createContext(null);
811
+ var TimeGridAllDay = React8.forwardRef(function TimeGridAllDay2({ day, className, style, render, children, ...props }, ref) {
812
+ const { locale, labels } = useTimeGridRootContext("AllDay");
813
+ const label = labels.allDayOf(formatDay5(locale.locale, toLocalDate5(day.date)).full);
814
+ const state = useDayState(day, "AllDay");
815
+ return /* @__PURE__ */ jsx3(TimeGridAllDayContext.Provider, { value: day.date, children: renderElement("div", { role: "rowgroup", "aria-label": label, ...props, ref, "data-slot": TIME_GRID_SLOTS.allDay, className, style, render, children }, state, DAY_ATTRIBUTES) });
816
+ });
817
+
818
+ // src/time-grid/all-day-event/TimeGridAllDayEvent.tsx
819
+ import * as React10 from "react";
820
+ import { mergeRefs as mergeRefs2 } from "react-aria/mergeRefs";
821
+
822
+ // src/time-grid/event/useEventRow.ts
823
+ import * as React9 from "react";
824
+ import { mergeProps } from "react-aria/mergeProps";
825
+ import { useFocusRing } from "react-aria/useFocusRing";
826
+ import { useGridListItem } from "react-aria/useGridList";
827
+ import { useHover } from "react-aria/useHover";
828
+ var ATTRIBUTES = ["hovered", "pressed", "focusVisible", "disabled"];
829
+ function useEventRow(id, ref, { disabled: disabled4 = false, part = "Event" } = {}) {
830
+ const { list, registerDisabled } = useTimeGridRootContext(part);
831
+ React9.useLayoutEffect(() => disabled4 ? registerDisabled(id) : void 0, [disabled4, id, registerDisabled]);
832
+ const node = list.collection.getItem(id) ?? eventNode(id);
833
+ const item = useGridListItem({ node, shouldSelectOnPressUp: true }, list, ref);
834
+ const { hoverProps, isHovered } = useHover({ isDisabled: disabled4 });
835
+ const { focusProps, isFocusVisible } = useFocusRing();
836
+ const state = {
837
+ hovered: isHovered,
838
+ focused: item.isFocused,
839
+ focusVisible: isFocusVisible,
840
+ pressed: item.isPressed,
841
+ disabled: disabled4,
842
+ selected: item.isSelected
843
+ };
844
+ const rowProps = mergeProps(item.rowProps, hoverProps, focusProps, stateAttributes(state, ATTRIBUTES), { "aria-disabled": disabled4 || void 0 });
845
+ return { rowProps, gridCellProps: item.gridCellProps, state };
846
+ }
847
+
848
+ // src/time-grid/all-day-event/TimeGridAllDayEvent.tsx
849
+ import { jsx as jsx4 } from "react/jsx-runtime";
850
+ var TimeGridAllDayEvent = React10.forwardRef(function TimeGridAllDayEvent2({ event, label, disabled: disabled4 = false, className, style, render, children, ...props }, forwardedRef) {
851
+ const { registerAllDay } = useTimeGridRootContext("AllDayEvent");
852
+ const date4 = React10.useContext(TimeGridAllDayContext);
853
+ if (date4 == null) throw new Error("TimeGrid.AllDayEvent must be inside TimeGrid.AllDay.");
854
+ React10.useEffect(() => registerAllDay(event.id, date4), [registerAllDay, event.id, date4]);
855
+ const ref = React10.useRef(null);
856
+ const refs = React10.useMemo(() => mergeRefs2(ref, forwardedRef), [forwardedRef]);
857
+ const row = useEventRow(event.id, ref, { disabled: disabled4, part: "AllDayEvent" });
858
+ const state = { ...row.state, event };
859
+ return renderElement(
860
+ "div",
861
+ {
862
+ ...mergePartProps(props, row.rowProps),
863
+ ref: refs,
864
+ "data-slot": TIME_GRID_SLOTS.allDayEvent,
865
+ "data-value": event.id,
866
+ className,
867
+ style,
868
+ render,
869
+ children: (s) => /* @__PURE__ */ jsx4("div", { ...row.gridCellProps, "data-slot": TIME_GRID_SLOTS.eventContent, children: resolve(children, s) ?? label })
870
+ },
871
+ state,
872
+ ["selected"]
873
+ );
874
+ });
875
+
876
+ // src/time-grid/column/TimeGridColumn.tsx
877
+ import * as React13 from "react";
878
+ import { mergeRefs as mergeRefs3 } from "react-aria/mergeRefs";
879
+
880
+ // src/time-grid/drag/TimeGridDropIndicator.tsx
881
+ import { offsetOf as offsetOf2 } from "calendar-components-core";
882
+ import * as React11 from "react";
883
+ import { useDropIndicator } from "react-aria/useDroppableCollection";
884
+ import { jsx as jsx5 } from "react/jsx-runtime";
885
+ function TimeGridDropIndicator({ date: date4 }) {
886
+ const target = React11.useContext(TimeGridDragContext)?.drop.target;
887
+ return target?.type === "item" && slotOf(target.key).date === date4 ? /* @__PURE__ */ jsx5(Indicator, { target }) : null;
888
+ }
889
+ function Indicator({ target }) {
890
+ const { drop } = React11.useContext(TimeGridDragContext);
891
+ const { range, hourHeight: hourHeight2 } = useTimeGridRootContext("Column");
892
+ const ref = React11.useRef(null);
893
+ const { dropIndicatorProps, isHidden } = useDropIndicator({ target }, drop, ref);
894
+ if (isHidden) return null;
895
+ return /* @__PURE__ */ jsx5("div", { role: "row", style: { position: "absolute", insetInline: 0, top: offsetOf2(slotOf(target.key).minutes, range, hourHeight2), height: 1, pointerEvents: "none" }, children: /* @__PURE__ */ jsx5("div", { role: "gridcell", children: /* @__PURE__ */ jsx5("div", { ...dropIndicatorProps, role: "button", ref, style: { outline: "none" } }) }) });
896
+ }
897
+
898
+ // src/time-grid/column/TimeGridColumnContext.ts
899
+ import * as React12 from "react";
900
+ var TimeGridColumnContext = React12.createContext(null);
901
+ function useTimeGridColumnContext(part = "useTimeGridColumn") {
902
+ const day = React12.useContext(TimeGridColumnContext);
903
+ if (!day) throw new Error(`${part.startsWith("use") ? part : `TimeGrid.${part}`} must be inside TimeGrid.Column.`);
904
+ return day;
905
+ }
906
+
907
+ // src/time-grid/column/TimeGridColumn.tsx
908
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
909
+ var TimeGridColumn = React13.forwardRef(function TimeGridColumn2({ day, className, style, render, children, ...props }, forwardedRef) {
910
+ const { range, hourHeight: hourHeight2 } = useTimeGridRootContext("Column");
911
+ const state = useDayState(day, "Column");
912
+ const label = useDayLabel(day, "Column");
913
+ const ref = React13.useRef(null);
914
+ const refs = React13.useMemo(() => mergeRefs3(ref, forwardedRef), [forwardedRef]);
915
+ return /* @__PURE__ */ jsx6(TimeGridColumnContext.Provider, { value: day, children: renderElement(
916
+ "div",
917
+ {
918
+ role: "rowgroup",
919
+ "aria-label": label,
920
+ ...mergePartProps(props),
921
+ ref: refs,
922
+ "data-slot": TIME_GRID_SLOTS.column,
923
+ className,
924
+ style: (s) => ({ position: "relative", height: (range.to - range.from) * hourHeight2, ...resolve(style, s) }),
925
+ render,
926
+ // The time a dragged event would be dropped at is one of the day's rows while it is this day's.
927
+ children: (s) => /* @__PURE__ */ jsxs2(Fragment3, { children: [
928
+ resolve(children, s),
929
+ /* @__PURE__ */ jsx6(TimeGridDropIndicator, { date: day.date })
930
+ ] })
931
+ },
932
+ state,
933
+ DAY_ATTRIBUTES
934
+ ) });
935
+ });
936
+
937
+ // src/time-grid/lines/TimeGridLines.tsx
938
+ import * as React14 from "react";
939
+ import { Fragment as Fragment5, jsx as jsx7 } from "react/jsx-runtime";
940
+ function TimeGridLines({ children, className, style }) {
941
+ const { range } = useTimeGridRootContext("Lines");
942
+ return /* @__PURE__ */ jsx7(Fragment5, { children: Array.from({ length: range.to - range.from }, (_, i) => /* @__PURE__ */ jsx7(React14.Fragment, { children: children ? children(range.from + i) : /* @__PURE__ */ jsx7(TimeGridLine, { hour: range.from + i, className, style }) }, i)) });
943
+ }
944
+ var TimeGridLine = React14.forwardRef(function TimeGridLine2({ hour: hour3, className, style, render, children, ...props }, ref) {
945
+ const { range, hourHeight: hourHeight2, workHours } = useTimeGridRootContext("Line");
946
+ return renderElement(
947
+ "div",
948
+ {
949
+ "aria-hidden": true,
950
+ ...props,
951
+ ref,
952
+ "data-slot": TIME_GRID_SLOTS.line,
953
+ className,
954
+ style: (s) => ({ position: "absolute", insetInline: 0, top: (hour3 - range.from) * hourHeight2, ...resolve(style, s) }),
955
+ render,
956
+ children
957
+ },
958
+ { hour: hour3, offHours: isOffHours(hour3, workHours) },
959
+ ["hour", "offHours"]
960
+ );
961
+ });
962
+
963
+ // src/time-grid/events/TimeGridEvents.tsx
964
+ import { lanesOf } from "calendar-components-core";
965
+ import * as React15 from "react";
966
+ import { Fragment as Fragment7, jsx as jsx8 } from "react/jsx-runtime";
967
+ function TimeGridEvents({ children }) {
968
+ const day = useTimeGridColumnContext("Events");
969
+ const placed = React15.useMemo(() => lanesOf(day.events), [day.events]);
970
+ return /* @__PURE__ */ jsx8(Fragment7, { children: placed.map((item) => /* @__PURE__ */ jsx8(React15.Fragment, { children: children(item) }, item.event.id)) });
971
+ }
972
+
973
+ // src/time-grid/event/TimeGridEvent.tsx
974
+ import { formatTime as formatTime3, formatTimeParts as formatTimeParts2, offsetOf as offsetOf4 } from "calendar-components-core";
975
+ import * as React20 from "react";
976
+ import { mergeRefs as mergeRefs4 } from "react-aria/mergeRefs";
977
+ import { useDraggableItem } from "react-aria/useDraggableCollection";
978
+ import { useFocusVisible } from "react-aria/useFocusVisible";
979
+ import { useKeyboard } from "react-aria/useKeyboard";
980
+
981
+ // src/utils/useDescription.ts
982
+ import * as React16 from "react";
983
+ var nodes = /* @__PURE__ */ new Map();
984
+ var count = 0;
985
+ function useDescription(description) {
986
+ const [id, setId] = React16.useState();
987
+ React16.useLayoutEffect(() => {
988
+ if (!description) return void setId(void 0);
989
+ let node = nodes.get(description);
990
+ if (!node) {
991
+ const element = document.createElement("div");
992
+ element.id = `calendar-components-description-${count++}`;
993
+ element.style.display = "none";
994
+ element.textContent = description;
995
+ document.body.append(element);
996
+ node = { element, uses: 0 };
997
+ nodes.set(description, node);
998
+ }
999
+ const held = node;
1000
+ held.uses++;
1001
+ setId(held.element.id);
1002
+ return () => {
1003
+ if (--held.uses === 0) {
1004
+ held.element.remove();
1005
+ nodes.delete(description);
1006
+ }
1007
+ };
1008
+ }, [description]);
1009
+ return { "aria-describedby": description ? id : void 0 };
1010
+ }
1011
+
1012
+ // src/time-grid/event/TimeGridEventContext.ts
1013
+ import * as React17 from "react";
1014
+ var TimeGridEventContext = React17.createContext(null);
1015
+ function useTimeGridEvent() {
1016
+ const context = React17.useContext(TimeGridEventContext);
1017
+ if (!context) throw new Error("useTimeGridEvent must be inside TimeGrid.Event.");
1018
+ return context;
1019
+ }
1020
+
1021
+ // src/time-grid/event/useEventResize.ts
1022
+ import * as React19 from "react";
1023
+ import { useMove } from "react-aria/useMove";
1024
+
1025
+ // src/utils/useEdgeScroll.ts
1026
+ import * as React18 from "react";
1027
+ var ZONE = 48;
1028
+ var FASTEST = 16;
1029
+ function scrollerOf(element, axis) {
1030
+ for (let each = element; each; each = each.parentElement) {
1031
+ const style = getComputedStyle(each);
1032
+ const scrolls = /(auto|scroll)/.test(axis === "x" ? style.overflowX : style.overflowY);
1033
+ if (scrolls && (axis === "x" ? each.scrollWidth > each.clientWidth : each.scrollHeight > each.clientHeight)) return each;
1034
+ }
1035
+ return document.scrollingElement ?? document.documentElement;
1036
+ }
1037
+ function useEdgeScroll(ref, onScroll) {
1038
+ const heard = useLatest(onScroll);
1039
+ const state = React18.useRef({ x: null, y: null, from: { x: 0, y: 0 }, by: { x: 0, y: 0 }, frame: 0 }).current;
1040
+ return React18.useMemo(() => {
1041
+ const stop2 = () => {
1042
+ cancelAnimationFrame(state.frame);
1043
+ state.frame = 0;
1044
+ };
1045
+ const start = () => {
1046
+ if (!ref.current) return;
1047
+ state.x = scrollerOf(ref.current, "x");
1048
+ state.y = scrollerOf(ref.current, "y");
1049
+ state.from = { x: state.x.scrollLeft, y: state.y.scrollTop };
1050
+ };
1051
+ const step = () => {
1052
+ const [left, top] = [state.x?.scrollLeft, state.y?.scrollTop];
1053
+ if (state.by.x) state.x?.scrollBy({ left: state.by.x, behavior: "instant" });
1054
+ if (state.by.y) state.y?.scrollBy({ top: state.by.y, behavior: "instant" });
1055
+ if (left === state.x?.scrollLeft && top === state.y?.scrollTop) return stop2();
1056
+ heard.current?.();
1057
+ state.frame = requestAnimationFrame(step);
1058
+ };
1059
+ const pace = (scroller, axis, pointer) => {
1060
+ const box = scroller === document.scrollingElement ? { left: 0, top: 0, right: window.innerWidth, bottom: window.innerHeight } : scroller.getBoundingClientRect();
1061
+ const [from, to] = axis === "x" ? [box.left, box.right] : [box.top, box.bottom];
1062
+ const into = Math.max(from + ZONE - pointer, pointer - (to - ZONE));
1063
+ if (into <= 0) return 0;
1064
+ return Math.ceil(Math.min(1, into / ZONE) * FASTEST) * (pointer < (from + to) / 2 ? -1 : 1);
1065
+ };
1066
+ const near = (x, y) => {
1067
+ if (!state.x || !state.y) start();
1068
+ if (!state.x || !state.y) return;
1069
+ state.by = { x: pace(state.x, "x", x), y: pace(state.y, "y", y) };
1070
+ if (!state.by.x && !state.by.y) return stop2();
1071
+ state.frame ||= requestAnimationFrame(step);
1072
+ };
1073
+ const scrolled = () => ({ x: (state.x?.scrollLeft ?? 0) - state.from.x, y: (state.y?.scrollTop ?? 0) - state.from.y });
1074
+ return { start, near, scrolled, stop: stop2 };
1075
+ }, [ref, state, heard]);
1076
+ }
1077
+
1078
+ // src/time-grid/event/useEventResize.ts
1079
+ function useEventResize(subject, ref) {
1080
+ const { store, hourHeight: hourHeight2, step } = useTimeGridRootContext("Event");
1081
+ const { at, commit } = useEventChange();
1082
+ const pull = React19.useRef({ y: 0, given: false });
1083
+ const latest = useLatest({ subject, at, commit });
1084
+ const pulled = () => {
1085
+ const { subject: now, at: where } = latest.current;
1086
+ return where(now, "resize", (pull.current.y + edge.scrolled().y) / hourHeight2 * 60);
1087
+ };
1088
+ const draw = () => {
1089
+ if (pull.current.given) return;
1090
+ const { subject: now } = latest.current;
1091
+ store.set({ drag: { id: now.event.id, start: 0, end: pulled().end - now.event.end, days: 0, offset: 0 } });
1092
+ };
1093
+ const edge = useEdgeScroll(ref, draw);
1094
+ const { moveProps } = useMove({
1095
+ onMoveStart() {
1096
+ pull.current = { y: 0, given: false };
1097
+ edge.start();
1098
+ },
1099
+ onMove(e) {
1100
+ if (pull.current.given) return;
1101
+ pull.current.y += e.pointerType === "keyboard" ? e.deltaY * (step / 60) * hourHeight2 : e.deltaY;
1102
+ if (e.pointerType !== "keyboard") draw();
1103
+ },
1104
+ onMoveEnd(e) {
1105
+ edge.stop();
1106
+ if (pull.current.given) return;
1107
+ latest.current.commit(latest.current.subject, pulled(), e.pointerType === "keyboard" ? "keyboard" : "resize");
1108
+ }
1109
+ });
1110
+ const onPointerDown = (e) => {
1111
+ const press = new AbortController();
1112
+ const onKeyDown2 = (key) => {
1113
+ if (key.key !== "Escape") return;
1114
+ key.preventDefault();
1115
+ pull.current.given = true;
1116
+ edge.stop();
1117
+ store.set({ drag: null });
1118
+ };
1119
+ document.addEventListener("keydown", onKeyDown2, { capture: true, signal: press.signal });
1120
+ document.addEventListener("pointermove", (move) => pull.current.given || edge.near(move.clientX, move.clientY), { signal: press.signal });
1121
+ document.addEventListener("pointerup", () => press.abort(), { signal: press.signal });
1122
+ document.addEventListener("pointercancel", () => press.abort(), { signal: press.signal });
1123
+ moveProps.onPointerDown?.(e);
1124
+ };
1125
+ const onKeyDown = (e) => (e.key === "ArrowUp" || e.key === "ArrowDown") && moveProps.onKeyDown?.(e);
1126
+ const resizeProps = { onMouseDown: moveProps.onMouseDown, onTouchStart: moveProps.onTouchStart, onPointerDown, onKeyDown };
1127
+ return { resizeProps };
1128
+ }
1129
+
1130
+ // src/time-grid/event/useEventPlacement.ts
1131
+ import { laneBox, offsetOf as offsetOf3 } from "calendar-components-core";
1132
+ var acrossDay = (fraction) => fraction === 0 ? "0px" : `calc((100% - var(--time-grid-lane-inset, 0px)) * ${Math.round(fraction * 1e6) / 1e6})`;
1133
+ function laneStyle(lane2, lanes2, overlap) {
1134
+ const { start, width } = laneBox(lane2, lanes2, overlap);
1135
+ return { insetInlineStart: acrossDay(start), width: acrossDay(width), ...overlap > 0 && lanes2 > 1 ? { zIndex: lane2 + 1 } : {} };
1136
+ }
1137
+ function useEventPlacement(span, lane2 = 0, lanes2 = 1) {
1138
+ const { range, hourHeight: hourHeight2, minEventHeight, laneOverlap } = useTimeGridRootContext("useEventPlacement");
1139
+ const height2 = Math.max(minEventHeight, (span.end - span.start) / 60 * hourHeight2);
1140
+ return { height: height2, style: { position: "absolute", top: offsetOf3(span.start, range, hourHeight2), height: height2, ...laneStyle(lane2, lanes2, laneOverlap) } };
1141
+ }
1142
+
1143
+ // src/time-grid/event/TimeGridEvent.tsx
1144
+ import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
1145
+ var TimeGridEvent = React20.forwardRef(function TimeGridEvent2({ event, lane: lane2 = 0, lanes: lanes2 = 1, label, disabled: disabled4 = false, className, style, render, children, ...props }, forwardedRef) {
1146
+ const { store, locale, labels, range, hourHeight: hourHeight2, minEventHeight, step, laneOverlap, eventHeights, editable: canEdit } = useTimeGridRootContext("Event");
1147
+ const day = useTimeGridColumnContext("Event");
1148
+ const dragged = useStore(store, (s) => s.drag?.id === event.id ? s.drag : null);
1149
+ const ref = React20.useRef(null);
1150
+ const refs = React20.useMemo(() => mergeRefs4(ref, forwardedRef), [forwardedRef]);
1151
+ const editable2 = canEdit && !disabled4;
1152
+ const subject = { event, date: day.date, label, element: ref.current };
1153
+ const { dragProps: moveProps } = useDraggableItem({ key: event.id, hasAction: true }, React20.useContext(TimeGridDragContext).drag);
1154
+ const { resizeProps: pullProps } = useEventResize(subject, ref);
1155
+ const { isFocusVisible: byKeyboard } = useFocusVisible();
1156
+ const row = useEventRow(event.id, ref, { disabled: disabled4 });
1157
+ const { keyboardProps } = useKeyboard({
1158
+ onKeyDown(e) {
1159
+ if (e.key === "Home" || e.key === "End") e.preventDefault();
1160
+ e.continuePropagation();
1161
+ }
1162
+ });
1163
+ const start = event.start + (dragged?.start ?? 0);
1164
+ const end = event.end + (dragged?.end ?? 0);
1165
+ const height2 = Math.max(minEventHeight, (end - start) / 60 * hourHeight2);
1166
+ const placed = {
1167
+ position: "absolute",
1168
+ top: offsetOf4(start, range, hourHeight2),
1169
+ height: height2,
1170
+ ...laneStyle(dragged ? 0 : lane2, dragged ? 1 : lanes2, laneOverlap),
1171
+ ...dragged ? { transform: `translateX(${dragged.offset}px)`, zIndex: 3 } : {},
1172
+ // A finger on it can still scroll what it is in; rested on it, the event is picked up (React Aria's drag).
1173
+ ...editable2 ? { userSelect: "none" } : {}
1174
+ };
1175
+ const startLabel = formatTime3(locale.locale, start);
1176
+ const endLabel = formatTime3(locale.locale, end);
1177
+ const state = {
1178
+ ...row.state,
1179
+ event,
1180
+ start,
1181
+ end,
1182
+ startLabel,
1183
+ endLabel,
1184
+ startParts: formatTimeParts2(locale.locale, start),
1185
+ endParts: formatTimeParts2(locale.locale, end),
1186
+ dragging: dragged != null,
1187
+ short: height2 < eventHeights.short,
1188
+ tall: height2 >= eventHeights.tall,
1189
+ lane: lane2,
1190
+ lanes: lanes2
1191
+ };
1192
+ const description = useDescription(labels.timeRange(startLabel, endLabel));
1193
+ const slider = row.state.focused && byKeyboard;
1194
+ const resizeProps = editable2 ? {
1195
+ ...pullProps,
1196
+ ...slider ? {
1197
+ role: "slider",
1198
+ tabIndex: 0,
1199
+ "aria-orientation": "vertical",
1200
+ "aria-label": labels.resize || labels.timeRange(startLabel, endLabel),
1201
+ "aria-valuenow": end,
1202
+ "aria-valuemin": event.start + step,
1203
+ "aria-valuemax": Math.min(24, range.to) * 60,
1204
+ "aria-valuetext": endLabel
1205
+ } : { "aria-hidden": true }
1206
+ } : null;
1207
+ const context = React20.useMemo(() => ({ resizeProps }), [resizeProps]);
1208
+ const lifted = useStore(store, (s) => s.session?.event.id === event.id);
1209
+ const origin = { ...state, start: event.start, end: event.end, startLabel: formatTime3(locale.locale, event.start), endLabel: formatTime3(locale.locale, event.end), dragging: false, lane: lane2, lanes: lanes2 };
1210
+ const originHeight = Math.max(minEventHeight, (event.end - event.start) / 60 * hourHeight2);
1211
+ return /* @__PURE__ */ jsxs3(TimeGridEventContext.Provider, { value: context, children: [
1212
+ lifted && /* @__PURE__ */ jsx9(
1213
+ "div",
1214
+ {
1215
+ "aria-hidden": true,
1216
+ "data-slot": TIME_GRID_SLOTS.event,
1217
+ "data-origin": "",
1218
+ className: resolve(className, origin),
1219
+ style: { position: "absolute", top: offsetOf4(event.start, range, hourHeight2), height: originHeight, ...laneStyle(lane2, lanes2, laneOverlap), pointerEvents: "none", ...resolve(style, origin) },
1220
+ children: /* @__PURE__ */ jsx9("div", { "data-slot": TIME_GRID_SLOTS.eventContent, children: resolve(children, origin) ?? label })
1221
+ }
1222
+ ),
1223
+ renderElement(
1224
+ "div",
1225
+ {
1226
+ // Its name is what it shows (so what is seen is what is said); when it is follows, as its description.
1227
+ ...description,
1228
+ // Its own keys first: what it lets by is the list's.
1229
+ ...mergePartProps(props, keyboardProps, row.rowProps, editable2 ? moveProps : null),
1230
+ // When it is, and then how to pick it up (React Aria's words, for how it is being used: a mouse, a finger, the keyboard).
1231
+ "aria-describedby": [description["aria-describedby"], editable2 ? moveProps["aria-describedby"] : void 0].filter(Boolean).join(" ") || void 0,
1232
+ ref: refs,
1233
+ "data-slot": TIME_GRID_SLOTS.event,
1234
+ "data-value": event.id,
1235
+ className,
1236
+ style: (s) => ({ ...placed, "--time-grid-event-height": `${height2}px`, ...resolve(style, s) }),
1237
+ render,
1238
+ // A row holds cells: the event's content is its one cell.
1239
+ children: (s) => /* @__PURE__ */ jsx9("div", { ...row.gridCellProps, "data-slot": TIME_GRID_SLOTS.eventContent, children: resolve(children, s) ?? label })
1240
+ },
1241
+ state,
1242
+ ["selected", "dragging", "short", "tall", "lane", "lanes"]
1243
+ )
1244
+ ] });
1245
+ });
1246
+
1247
+ // src/time-grid/event-resize-handle/TimeGridEventResizeHandle.tsx
1248
+ import * as React21 from "react";
1249
+ var stop = (e) => e.stopPropagation();
1250
+ var CONTAINED = { onPointerDown: stop, onMouseDown: stop, onTouchStart: stop };
1251
+ var TimeGridEventResizeHandle = React21.forwardRef(function TimeGridEventResizeHandle2({ className, style, render, children, ...props }, ref) {
1252
+ const inside = React21.useContext(TimeGridEventContext);
1253
+ if (!inside) throw new Error("TimeGrid.EventResizeHandle must be inside TimeGrid.Event.");
1254
+ const { labels } = useTimeGridRootContext("EventResizeHandle");
1255
+ if (!inside.resizeProps) return null;
1256
+ return renderElement(
1257
+ "div",
1258
+ {
1259
+ title: labels.resize || void 0,
1260
+ ...mergePartProps(props, inside.resizeProps, CONTAINED),
1261
+ ref,
1262
+ "data-slot": TIME_GRID_SLOTS.eventResizeHandle,
1263
+ className,
1264
+ style: (s) => ({ position: "absolute", insetInline: 0, bottom: 0, cursor: "ns-resize", touchAction: "none", ...resolve(style, s) }),
1265
+ render,
1266
+ children
1267
+ },
1268
+ {}
1269
+ );
1270
+ });
1271
+
1272
+ // src/time-grid/now/TimeGridNow.tsx
1273
+ import { formatTime as formatTime4, offsetOf as offsetOf5 } from "calendar-components-core";
1274
+ import * as React22 from "react";
1275
+ var TimeGridNow = React22.forwardRef(function TimeGridNow2({ className, style, render, children, ...props }, ref) {
1276
+ const { range, hourHeight: hourHeight2, locale, timeZone } = useTimeGridRootContext("Now");
1277
+ const day = useTimeGridColumnContext("Now");
1278
+ const now = useNow(timeZone);
1279
+ if (!now || day.date !== now.date || now.minutes < range.from * 60 || now.minutes > range.to * 60) return null;
1280
+ const state = { minutes: now.minutes, label: formatTime4(locale.locale, now.minutes) };
1281
+ return renderElement(
1282
+ "div",
1283
+ {
1284
+ "aria-hidden": true,
1285
+ ...props,
1286
+ ref,
1287
+ "data-slot": TIME_GRID_SLOTS.now,
1288
+ className,
1289
+ style: (s) => ({ position: "absolute", insetInline: 0, top: offsetOf5(now.minutes, range, hourHeight2), ...resolve(style, s) }),
1290
+ render,
1291
+ children
1292
+ },
1293
+ state
1294
+ );
1295
+ });
1296
+
1297
+ // src/time-grid/useTimeGrid.ts
1298
+ import * as React23 from "react";
1299
+ function useTimeGrid() {
1300
+ const { days: days2, range, workHours, hourHeight: hourHeight2, laneOverlap, minEventHeight, eventHeights, locale, timeZone, labels, step, editable: editable2 } = useTimeGridRootContext("useTimeGrid");
1301
+ return React23.useMemo(
1302
+ () => ({ days: days2, range, workHours, hourHeight: hourHeight2, laneOverlap, minEventHeight, eventHeights, locale, timeZone, labels, step, editable: editable2 }),
1303
+ [days2, range, workHours, hourHeight2, laneOverlap, minEventHeight, eventHeights, locale, timeZone, labels, step, editable2]
1304
+ );
1305
+ }
1306
+
1307
+ // src/time-grid/root/TimeGridRootDataAttributes.ts
1308
+ var TimeGridRootDataAttributes_exports = {};
1309
+ __export(TimeGridRootDataAttributes_exports, {
1310
+ dragging: () => dragging,
1311
+ editable: () => editable,
1312
+ scrollAxis: () => scrollAxis,
1313
+ scrollLock: () => scrollLock,
1314
+ scrollSnap: () => scrollSnap,
1315
+ slot: () => slot
1316
+ });
1317
+ var slot = "data-slot";
1318
+ var editable = "data-editable";
1319
+ var dragging = "data-dragging";
1320
+ var scrollSnap = "data-scroll-snap";
1321
+ var scrollLock = "data-scroll-lock";
1322
+ var scrollAxis = "data-scroll-axis";
1323
+
1324
+ // src/time-grid/column/TimeGridColumnDataAttributes.ts
1325
+ var TimeGridColumnDataAttributes_exports = {};
1326
+ __export(TimeGridColumnDataAttributes_exports, {
1327
+ date: () => date,
1328
+ slot: () => slot2,
1329
+ today: () => today,
1330
+ weekend: () => weekend
1331
+ });
1332
+ var slot2 = "data-slot";
1333
+ var date = "data-date";
1334
+ var today = "data-today";
1335
+ var weekend = "data-weekend";
1336
+
1337
+ // src/time-grid/day-header/TimeGridDayHeaderDataAttributes.ts
1338
+ var TimeGridDayHeaderDataAttributes_exports = {};
1339
+ __export(TimeGridDayHeaderDataAttributes_exports, {
1340
+ date: () => date2,
1341
+ slot: () => slot3,
1342
+ today: () => today2,
1343
+ weekend: () => weekend2
1344
+ });
1345
+ var slot3 = "data-slot";
1346
+ var date2 = "data-date";
1347
+ var today2 = "data-today";
1348
+ var weekend2 = "data-weekend";
1349
+
1350
+ // src/time-grid/all-day/TimeGridAllDayDataAttributes.ts
1351
+ var TimeGridAllDayDataAttributes_exports = {};
1352
+ __export(TimeGridAllDayDataAttributes_exports, {
1353
+ date: () => date3,
1354
+ slot: () => slot4,
1355
+ today: () => today3,
1356
+ weekend: () => weekend3
1357
+ });
1358
+ var slot4 = "data-slot";
1359
+ var date3 = "data-date";
1360
+ var today3 = "data-today";
1361
+ var weekend3 = "data-weekend";
1362
+
1363
+ // src/time-grid/event/TimeGridEventDataAttributes.ts
1364
+ var TimeGridEventDataAttributes_exports = {};
1365
+ __export(TimeGridEventDataAttributes_exports, {
1366
+ disabled: () => disabled2,
1367
+ dragging: () => dragging2,
1368
+ focusVisible: () => focusVisible2,
1369
+ hovered: () => hovered2,
1370
+ lane: () => lane,
1371
+ lanes: () => lanes,
1372
+ pressed: () => pressed2,
1373
+ selected: () => selected,
1374
+ short: () => short,
1375
+ slot: () => slot5,
1376
+ tall: () => tall,
1377
+ value: () => value
1378
+ });
1379
+ var slot5 = "data-slot";
1380
+ var value = "data-value";
1381
+ var selected = "data-selected";
1382
+ var dragging2 = "data-dragging";
1383
+ var short = "data-short";
1384
+ var tall = "data-tall";
1385
+ var lane = "data-lane";
1386
+ var lanes = "data-lanes";
1387
+ var pressed2 = pressed;
1388
+ var hovered2 = hovered;
1389
+ var focusVisible2 = focusVisible;
1390
+ var disabled2 = disabled;
1391
+
1392
+ // src/time-grid/hours/TimeGridHoursDataAttributes.ts
1393
+ var TimeGridHoursDataAttributes_exports = {};
1394
+ __export(TimeGridHoursDataAttributes_exports, {
1395
+ slot: () => slot6
1396
+ });
1397
+ var slot6 = "data-slot";
1398
+
1399
+ // src/time-grid/hours/TimeGridHourDataAttributes.ts
1400
+ var TimeGridHourDataAttributes_exports = {};
1401
+ __export(TimeGridHourDataAttributes_exports, {
1402
+ hour: () => hour,
1403
+ noon: () => noon,
1404
+ offHours: () => offHours,
1405
+ slot: () => slot7
1406
+ });
1407
+ var slot7 = "data-slot";
1408
+ var hour = "data-hour";
1409
+ var noon = "data-noon";
1410
+ var offHours = "data-off-hours";
1411
+
1412
+ // src/time-grid/lines/TimeGridLineDataAttributes.ts
1413
+ var TimeGridLineDataAttributes_exports = {};
1414
+ __export(TimeGridLineDataAttributes_exports, {
1415
+ hour: () => hour2,
1416
+ offHours: () => offHours2,
1417
+ slot: () => slot8
1418
+ });
1419
+ var slot8 = "data-slot";
1420
+ var hour2 = "data-hour";
1421
+ var offHours2 = "data-off-hours";
1422
+
1423
+ // src/time-grid/all-day-event/TimeGridAllDayEventDataAttributes.ts
1424
+ var TimeGridAllDayEventDataAttributes_exports = {};
1425
+ __export(TimeGridAllDayEventDataAttributes_exports, {
1426
+ disabled: () => disabled3,
1427
+ focusVisible: () => focusVisible3,
1428
+ hovered: () => hovered3,
1429
+ pressed: () => pressed3,
1430
+ selected: () => selected2,
1431
+ slot: () => slot9,
1432
+ value: () => value2
1433
+ });
1434
+ var slot9 = "data-slot";
1435
+ var value2 = "data-value";
1436
+ var selected2 = "data-selected";
1437
+ var pressed3 = pressed;
1438
+ var hovered3 = hovered;
1439
+ var focusVisible3 = focusVisible;
1440
+ var disabled3 = disabled;
1441
+
1442
+ // src/time-grid/event-resize-handle/TimeGridEventResizeHandleDataAttributes.ts
1443
+ var TimeGridEventResizeHandleDataAttributes_exports = {};
1444
+ __export(TimeGridEventResizeHandleDataAttributes_exports, {
1445
+ slot: () => slot10
1446
+ });
1447
+ var slot10 = "data-slot";
1448
+
1449
+ // src/time-grid/now/TimeGridNowDataAttributes.ts
1450
+ var TimeGridNowDataAttributes_exports = {};
1451
+ __export(TimeGridNowDataAttributes_exports, {
1452
+ slot: () => slot11
1453
+ });
1454
+ var slot11 = "data-slot";
1455
+
1456
+ export {
1457
+ TimeGridRootCssVars_exports,
1458
+ useTimeGridColumnContext,
1459
+ useTimeGridEvent,
1460
+ useEventPlacement,
1461
+ index_parts_exports,
1462
+ useTimeGrid,
1463
+ TimeGridRootDataAttributes_exports,
1464
+ TimeGridColumnDataAttributes_exports,
1465
+ TimeGridDayHeaderDataAttributes_exports,
1466
+ TimeGridAllDayDataAttributes_exports,
1467
+ TimeGridEventDataAttributes_exports,
1468
+ TimeGridHoursDataAttributes_exports,
1469
+ TimeGridHourDataAttributes_exports,
1470
+ TimeGridLineDataAttributes_exports,
1471
+ TimeGridAllDayEventDataAttributes_exports,
1472
+ TimeGridEventResizeHandleDataAttributes_exports,
1473
+ TimeGridNowDataAttributes_exports
1474
+ };
1475
+ //# sourceMappingURL=chunk-X6ZOEKT4.js.map