@super-calendar/dom 2.17.0 → 2.19.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 +435 -150
- package/dist/index.mjs +437 -152
- package/package.json +2 -2
- package/src/Agenda.tsx +20 -3
- package/src/Calendar.tsx +106 -30
- package/src/MonthList.tsx +1 -1
- package/src/MonthView.tsx +243 -46
- package/src/ResourceTimeline.tsx +11 -7
- package/src/TimeGrid.tsx +363 -153
- package/src/YearView.tsx +21 -5
package/README.md
CHANGED
|
@@ -6,6 +6,15 @@ The react-dom renderer for [super-calendar](https://github.com/afonsojramos/supe
|
|
|
6
6
|
|
|
7
7
|
It is built on the headless [`@super-calendar/core`](https://www.npmjs.com/package/@super-calendar/core) and Legend List's DOM renderer.
|
|
8
8
|
|
|
9
|
+
## All-day spans
|
|
10
|
+
|
|
11
|
+
In the time grid, an all-day event renders once as a bar across the visible
|
|
12
|
+
dates it covers. Overlapping events stack on separate rows. The end is
|
|
13
|
+
exclusive, and hidden days take no width. `renderEvent` and press callbacks
|
|
14
|
+
receive the original event; `continuesBefore` and `continuesAfter` indicate
|
|
15
|
+
clipping at the visible range edges. The `allDayColumn` slot styles one
|
|
16
|
+
spanning cell. Timed events that cross midnight keep their per-day segments.
|
|
17
|
+
|
|
9
18
|
## Install
|
|
10
19
|
|
|
11
20
|
```sh
|
|
@@ -105,6 +114,9 @@ Counts must be positive safe integers whose date span is representable; invalid
|
|
|
105
114
|
counts or dates throw `RangeError`. Rows are materialized, so larger counts need
|
|
106
115
|
more space. `MonthView` retains its month-only behavior.
|
|
107
116
|
|
|
117
|
+
In month and multi-week grids, Escape or cancellation of the active pointer
|
|
118
|
+
ends a create or move gesture without committing. Release and cancellation events from other pointers do not end that gesture.
|
|
119
|
+
|
|
108
120
|
In the multi-week web grid, a quick touch swipe scrolls. Hold a day or event for
|
|
109
121
|
400 ms, then drag to create or move. Mouse input starts immediately. Cancelling
|
|
110
122
|
the pointer or changing the displayed window cancels the hold or drag.
|
|
@@ -121,6 +133,12 @@ Time-grid edge paging requires a mouse drag. Touch and pen remain within the
|
|
|
121
133
|
visible period, so resting near an edge cannot repeatedly change the date.
|
|
122
134
|
See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
123
135
|
|
|
136
|
+
While you move or resize a time-grid event, `renderTimeEvent` (or a
|
|
137
|
+
`TimeGrid` `renderEvent`) receives a copy of the event whose `start` and `end`
|
|
138
|
+
are the times the drop would report, so the label updates as you drag. Compare
|
|
139
|
+
events by a stable ID inside a renderer. After a drag pages the view, the floating
|
|
140
|
+
preview keeps the stored times until release.
|
|
141
|
+
|
|
124
142
|
On the time grid, dragging any segment of a multi-day event previews the whole
|
|
125
143
|
range moving together and preserves its duration. Drag a resize grip to change
|
|
126
144
|
only the start or end. See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
@@ -143,6 +161,10 @@ refreshes close it. See
|
|
|
143
161
|
Active gestures retain the original event through live insertions and reordering;
|
|
144
162
|
removing the event or lane, losing capture, or unmounting cancels the gesture.
|
|
145
163
|
|
|
164
|
+
In time grids, `getEventId` also preserves all-day focus and renderer state when
|
|
165
|
+
a refresh replaces event objects. Bars without a valid, unique ID use object
|
|
166
|
+
identity and remount when that object changes.
|
|
167
|
+
|
|
146
168
|
## Month chip dimensions
|
|
147
169
|
|
|
148
170
|
`chipHeight` and `chipGap` configure month lanes and overflow rows on `Calendar`,
|
|
@@ -172,8 +194,26 @@ On the time grid, an empty-slot touch tap calls `onPressCell` from the column's
|
|
|
172
194
|
click. Swipes and cancelled contacts do not press the slot. Mouse and pen retain
|
|
173
195
|
drag-to-create behavior. See the [DOM guide](https://super-calendar.afonsojramos.me/guides/dom).
|
|
174
196
|
|
|
175
|
-
The drag-to-create preview
|
|
176
|
-
with
|
|
197
|
+
The drag-to-create preview snaps to the same range as `onCreateEvent`, starting
|
|
198
|
+
with one slot on press. It stays within the visible hours of the pressed column,
|
|
199
|
+
with its border inside the column. `dragStepMinutes` sets the snap interval.
|
|
200
|
+
Short previews use `minEventHeight`, like committed events. Clipping to the
|
|
201
|
+
visible hours takes priority at the column edges.
|
|
202
|
+
|
|
203
|
+
`TimeGrid` completes creation on pointer release even if capture is lost just
|
|
204
|
+
before it. Capture loss without a matching release and pointer cancellation
|
|
205
|
+
cancel the sweep. If a release outside the window is missed, a new press cancels
|
|
206
|
+
the stale sweep before starting another interaction. Text selection and native
|
|
207
|
+
browser dragging are disabled only while a mouse or pen sweep is active.
|
|
208
|
+
|
|
209
|
+
`MonthView`, `MultiWeekView`, and `Calendar` in month and multi-week modes also
|
|
210
|
+
accept `renderCreateGhost`. It receives the full all-day range with an exclusive
|
|
211
|
+
end, once per covered row. Use date labels for this content. The preview follows
|
|
212
|
+
`chipHeight` and `chipGap`, uses the `createGhost` slot, and requires
|
|
213
|
+
`onCreateEvent`. It is clipped, noninteractive, and hidden from assistive
|
|
214
|
+
technology. Empty months use the event-grid layout when both props are set.
|
|
215
|
+
Set `keyboardDayNavigation` to keep arrow-key day navigation in that layout,
|
|
216
|
+
including before the first event exists.
|
|
177
217
|
|
|
178
218
|
Pass `renderCreateGhost` to `TimeGrid`, `Calendar`, or `ResourceTimeline` to draw
|
|
179
219
|
a draft inside that preview. Define the component once, outside render:
|
package/dist/index.d.mts
CHANGED
|
@@ -78,6 +78,13 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
78
78
|
events: CalendarEvent$1<T>[];
|
|
79
79
|
/** date-fns locale for the day headers and time labels. */
|
|
80
80
|
locale?: Locale;
|
|
81
|
+
/**
|
|
82
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
83
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
84
|
+
*/
|
|
85
|
+
now?: Date;
|
|
86
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
87
|
+
timeZone?: string;
|
|
81
88
|
/** Render times in 12-hour AM/PM (default false, 24h). */
|
|
82
89
|
ampm?: boolean;
|
|
83
90
|
/** Highlight this date's header instead of the real "today". */
|
|
@@ -114,7 +121,7 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
114
121
|
* <Agenda events={events} onPressEvent={(e) => console.log(e.title)} />
|
|
115
122
|
* ```
|
|
116
123
|
*/
|
|
117
|
-
export declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
124
|
+
export declare function Agenda<T = unknown>({ events, locale, now, timeZone, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
118
125
|
/**
|
|
119
126
|
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
120
127
|
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
@@ -133,6 +140,13 @@ interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
133
140
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
134
141
|
hiddenDays?: number[];
|
|
135
142
|
locale?: Locale;
|
|
143
|
+
/**
|
|
144
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
145
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
146
|
+
*/
|
|
147
|
+
now?: Date;
|
|
148
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
149
|
+
timeZone?: string;
|
|
136
150
|
/** Translations for the screen-reader words; omitted keys use English. */
|
|
137
151
|
labels?: Partial<CalendarLabels$1>;
|
|
138
152
|
/** Highlight this date instead of the real "today". */
|
|
@@ -178,12 +192,12 @@ interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
178
192
|
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
179
193
|
* renders for `mode="year"`.
|
|
180
194
|
*/
|
|
181
|
-
export declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
195
|
+
export declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, now, timeZone, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
182
196
|
/**
|
|
183
197
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
184
198
|
* the `classNames` / `styles` props to restyle just that part.
|
|
185
199
|
*/
|
|
186
|
-
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "chipButton" | "chip" | "more" | "morePopover";
|
|
200
|
+
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "createGhost" | "chipButton" | "chip" | "more" | "morePopover";
|
|
187
201
|
/** Props passed to a custom month event chip renderer. */
|
|
188
202
|
interface DomMonthEventArgs<T = unknown> {
|
|
189
203
|
/** The event to render. */
|
|
@@ -257,6 +271,13 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
257
271
|
showWeekdays?: boolean;
|
|
258
272
|
/** date-fns locale for the title and weekday labels. */
|
|
259
273
|
locale?: Locale;
|
|
274
|
+
/**
|
|
275
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
276
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
277
|
+
*/
|
|
278
|
+
now?: Date;
|
|
279
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
280
|
+
timeZone?: string;
|
|
260
281
|
/** Theme overrides; falls back to the default light theme. */
|
|
261
282
|
theme?: Partial<DomCalendarTheme>;
|
|
262
283
|
/** Fired when a selectable day is clicked. */
|
|
@@ -274,6 +295,12 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
274
295
|
* carry `data-creating` for styling.
|
|
275
296
|
*/
|
|
276
297
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
298
|
+
/**
|
|
299
|
+
* Custom content for a drag-to-create preview, once per covered week row.
|
|
300
|
+
* Receives the full all-day range with an exclusive end. Requires onCreateEvent.
|
|
301
|
+
* Content is clipped, noninteractive, and hidden from assistive technology.
|
|
302
|
+
*/
|
|
303
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
277
304
|
/**
|
|
278
305
|
* Reports the day span of a create sweep **as it happens**, as the ordered
|
|
279
306
|
* inclusive `[start, end]` days (both at midnight), so a selection highlight can
|
|
@@ -329,7 +356,12 @@ type EventActionsSlot = "eventActionsTrigger" | "eventActionsList" | "eventActio
|
|
|
329
356
|
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
330
357
|
/** Props passed to a custom time-grid event renderer. */
|
|
331
358
|
interface DomRenderEventArgs<T = unknown> {
|
|
332
|
-
/**
|
|
359
|
+
/**
|
|
360
|
+
* The event to render. While it is being moved or resized, a copy whose
|
|
361
|
+
* `start` and `end` are the times `onDragEvent` would report on release.
|
|
362
|
+
* After a drag pages the view, the floating preview keeps the stored times
|
|
363
|
+
* until release.
|
|
364
|
+
*/
|
|
333
365
|
event: CalendarEvent$1<T>;
|
|
334
366
|
/** The current view mode. */
|
|
335
367
|
mode: CalendarMode$1;
|
|
@@ -337,9 +369,9 @@ interface DomRenderEventArgs<T = unknown> {
|
|
|
337
369
|
isAllDay: boolean;
|
|
338
370
|
/** Pixel height of the event box (timed events only). */
|
|
339
371
|
boxHeight?: number;
|
|
340
|
-
/**
|
|
372
|
+
/** Starts before the visible day (timed) or visible date range (all-day). */
|
|
341
373
|
continuesBefore?: boolean;
|
|
342
|
-
/**
|
|
374
|
+
/** Ends after the visible day (timed) or visible date range (all-day). */
|
|
343
375
|
continuesAfter?: boolean;
|
|
344
376
|
/** Show the time range in 12-hour AM/PM. */
|
|
345
377
|
ampm?: boolean;
|
|
@@ -425,9 +457,15 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
425
457
|
renderBackgroundEvent?: DomRenderEvent<T>;
|
|
426
458
|
/** Show the current-time indicator on today's column (default true). */
|
|
427
459
|
showNowIndicator?: boolean;
|
|
428
|
-
/**
|
|
460
|
+
/**
|
|
461
|
+
* Fixed "now" instant for the indicator (doesn't tick) and for the day
|
|
462
|
+
* highlighted as today. Defaults to the device clock.
|
|
463
|
+
*/
|
|
429
464
|
now?: Date;
|
|
430
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* Shift the now indicator and the day highlighted as today into this IANA zone
|
|
467
|
+
* (pair with `eventsInTimeZone`).
|
|
468
|
+
*/
|
|
431
469
|
timeZone?: string;
|
|
432
470
|
/** Show the all-day lane above the grid (default true). */
|
|
433
471
|
showAllDayEventCell?: boolean;
|
|
@@ -495,7 +533,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
495
533
|
* Return `false` to reject the drop (the event snaps back).
|
|
496
534
|
*/
|
|
497
535
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
498
|
-
/** Stable, unique
|
|
536
|
+
/** Stable, unique identity for the editing dialog and all-day bars across data refreshes. */
|
|
499
537
|
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
500
538
|
/**
|
|
501
539
|
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
@@ -558,9 +596,10 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
558
596
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
559
597
|
hiddenDays?: number[];
|
|
560
598
|
/**
|
|
561
|
-
* Fixed "now" instant for the current-time indicator (doesn't tick)
|
|
562
|
-
*
|
|
563
|
-
*
|
|
599
|
+
* Fixed "now" instant for the current-time indicator (doesn't tick) and for
|
|
600
|
+
* the day highlighted as today in every mode, e.g. a server-synced clock.
|
|
601
|
+
* Defaults to the device clock, shifted into `timeZone` when one is set so
|
|
602
|
+
* both match the displayed events.
|
|
564
603
|
*/
|
|
565
604
|
now?: Date;
|
|
566
605
|
/** Column count for `mode="custom"`. */
|
|
@@ -575,7 +614,9 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
575
614
|
/**
|
|
576
615
|
* Display events in this IANA time zone (e.g. `"America/New_York"`), DST-correct
|
|
577
616
|
* and independent of the device zone. Display-only: it shifts the wall-clock the
|
|
578
|
-
* grid lays out from, it doesn't change your `Date`s
|
|
617
|
+
* grid lays out from, it doesn't change your `Date`s, and callbacks report your
|
|
618
|
+
* own events and real instants. All-day events stay on their days. Uses
|
|
619
|
+
* `eventsInTimeZone`.
|
|
579
620
|
*/
|
|
580
621
|
timeZone?: string;
|
|
581
622
|
/** Theme overrides; falls back to the default light theme. */
|
|
@@ -669,8 +710,9 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
669
710
|
*/
|
|
670
711
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
671
712
|
/**
|
|
672
|
-
* A component that draws content inside
|
|
673
|
-
*
|
|
713
|
+
* A component that draws content inside a creation preview in time-grid, month
|
|
714
|
+
* and multi-week modes. Month rows receive the full all-day range with an
|
|
715
|
+
* exclusive end, once per covered row. Requires onCreateEvent.
|
|
674
716
|
*/
|
|
675
717
|
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
676
718
|
/** Fires when an event drag begins. */
|
|
@@ -681,7 +723,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
681
723
|
* days dragged so the time of day and duration are kept.
|
|
682
724
|
*/
|
|
683
725
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
684
|
-
/** Stable, unique
|
|
726
|
+
/** Stable, unique identity for the editing dialog and time-grid all-day bars across data refreshes. */
|
|
685
727
|
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
686
728
|
/** Tap a day's column header. */
|
|
687
729
|
onPressDateHeader?: (day: Date) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,13 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
78
78
|
events: CalendarEvent$1<T>[];
|
|
79
79
|
/** date-fns locale for the day headers and time labels. */
|
|
80
80
|
locale?: Locale;
|
|
81
|
+
/**
|
|
82
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
83
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
84
|
+
*/
|
|
85
|
+
now?: Date;
|
|
86
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
87
|
+
timeZone?: string;
|
|
81
88
|
/** Render times in 12-hour AM/PM (default false, 24h). */
|
|
82
89
|
ampm?: boolean;
|
|
83
90
|
/** Highlight this date's header instead of the real "today". */
|
|
@@ -114,7 +121,7 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
114
121
|
* <Agenda events={events} onPressEvent={(e) => console.log(e.title)} />
|
|
115
122
|
* ```
|
|
116
123
|
*/
|
|
117
|
-
export declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
124
|
+
export declare function Agenda<T = unknown>({ events, locale, now, timeZone, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
118
125
|
/**
|
|
119
126
|
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
120
127
|
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
@@ -133,6 +140,13 @@ interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
133
140
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
134
141
|
hiddenDays?: number[];
|
|
135
142
|
locale?: Locale;
|
|
143
|
+
/**
|
|
144
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
145
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
146
|
+
*/
|
|
147
|
+
now?: Date;
|
|
148
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
149
|
+
timeZone?: string;
|
|
136
150
|
/** Translations for the screen-reader words; omitted keys use English. */
|
|
137
151
|
labels?: Partial<CalendarLabels$1>;
|
|
138
152
|
/** Highlight this date instead of the real "today". */
|
|
@@ -178,12 +192,12 @@ interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
178
192
|
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
179
193
|
* renders for `mode="year"`.
|
|
180
194
|
*/
|
|
181
|
-
export declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
195
|
+
export declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, now, timeZone, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
182
196
|
/**
|
|
183
197
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
184
198
|
* the `classNames` / `styles` props to restyle just that part.
|
|
185
199
|
*/
|
|
186
|
-
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "chipButton" | "chip" | "more" | "morePopover";
|
|
200
|
+
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "createGhost" | "chipButton" | "chip" | "more" | "morePopover";
|
|
187
201
|
/** Props passed to a custom month event chip renderer. */
|
|
188
202
|
interface DomMonthEventArgs<T = unknown> {
|
|
189
203
|
/** The event to render. */
|
|
@@ -257,6 +271,13 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
257
271
|
showWeekdays?: boolean;
|
|
258
272
|
/** date-fns locale for the title and weekday labels. */
|
|
259
273
|
locale?: Locale;
|
|
274
|
+
/**
|
|
275
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
276
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
277
|
+
*/
|
|
278
|
+
now?: Date;
|
|
279
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
280
|
+
timeZone?: string;
|
|
260
281
|
/** Theme overrides; falls back to the default light theme. */
|
|
261
282
|
theme?: Partial<DomCalendarTheme>;
|
|
262
283
|
/** Fired when a selectable day is clicked. */
|
|
@@ -274,6 +295,12 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
274
295
|
* carry `data-creating` for styling.
|
|
275
296
|
*/
|
|
276
297
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
298
|
+
/**
|
|
299
|
+
* Custom content for a drag-to-create preview, once per covered week row.
|
|
300
|
+
* Receives the full all-day range with an exclusive end. Requires onCreateEvent.
|
|
301
|
+
* Content is clipped, noninteractive, and hidden from assistive technology.
|
|
302
|
+
*/
|
|
303
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
277
304
|
/**
|
|
278
305
|
* Reports the day span of a create sweep **as it happens**, as the ordered
|
|
279
306
|
* inclusive `[start, end]` days (both at midnight), so a selection highlight can
|
|
@@ -329,7 +356,12 @@ type EventActionsSlot = "eventActionsTrigger" | "eventActionsList" | "eventActio
|
|
|
329
356
|
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
330
357
|
/** Props passed to a custom time-grid event renderer. */
|
|
331
358
|
interface DomRenderEventArgs<T = unknown> {
|
|
332
|
-
/**
|
|
359
|
+
/**
|
|
360
|
+
* The event to render. While it is being moved or resized, a copy whose
|
|
361
|
+
* `start` and `end` are the times `onDragEvent` would report on release.
|
|
362
|
+
* After a drag pages the view, the floating preview keeps the stored times
|
|
363
|
+
* until release.
|
|
364
|
+
*/
|
|
333
365
|
event: CalendarEvent$1<T>;
|
|
334
366
|
/** The current view mode. */
|
|
335
367
|
mode: CalendarMode$1;
|
|
@@ -337,9 +369,9 @@ interface DomRenderEventArgs<T = unknown> {
|
|
|
337
369
|
isAllDay: boolean;
|
|
338
370
|
/** Pixel height of the event box (timed events only). */
|
|
339
371
|
boxHeight?: number;
|
|
340
|
-
/**
|
|
372
|
+
/** Starts before the visible day (timed) or visible date range (all-day). */
|
|
341
373
|
continuesBefore?: boolean;
|
|
342
|
-
/**
|
|
374
|
+
/** Ends after the visible day (timed) or visible date range (all-day). */
|
|
343
375
|
continuesAfter?: boolean;
|
|
344
376
|
/** Show the time range in 12-hour AM/PM. */
|
|
345
377
|
ampm?: boolean;
|
|
@@ -425,9 +457,15 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
425
457
|
renderBackgroundEvent?: DomRenderEvent<T>;
|
|
426
458
|
/** Show the current-time indicator on today's column (default true). */
|
|
427
459
|
showNowIndicator?: boolean;
|
|
428
|
-
/**
|
|
460
|
+
/**
|
|
461
|
+
* Fixed "now" instant for the indicator (doesn't tick) and for the day
|
|
462
|
+
* highlighted as today. Defaults to the device clock.
|
|
463
|
+
*/
|
|
429
464
|
now?: Date;
|
|
430
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* Shift the now indicator and the day highlighted as today into this IANA zone
|
|
467
|
+
* (pair with `eventsInTimeZone`).
|
|
468
|
+
*/
|
|
431
469
|
timeZone?: string;
|
|
432
470
|
/** Show the all-day lane above the grid (default true). */
|
|
433
471
|
showAllDayEventCell?: boolean;
|
|
@@ -495,7 +533,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
495
533
|
* Return `false` to reject the drop (the event snaps back).
|
|
496
534
|
*/
|
|
497
535
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
498
|
-
/** Stable, unique
|
|
536
|
+
/** Stable, unique identity for the editing dialog and all-day bars across data refreshes. */
|
|
499
537
|
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
500
538
|
/**
|
|
501
539
|
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
@@ -558,9 +596,10 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
558
596
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
559
597
|
hiddenDays?: number[];
|
|
560
598
|
/**
|
|
561
|
-
* Fixed "now" instant for the current-time indicator (doesn't tick)
|
|
562
|
-
*
|
|
563
|
-
*
|
|
599
|
+
* Fixed "now" instant for the current-time indicator (doesn't tick) and for
|
|
600
|
+
* the day highlighted as today in every mode, e.g. a server-synced clock.
|
|
601
|
+
* Defaults to the device clock, shifted into `timeZone` when one is set so
|
|
602
|
+
* both match the displayed events.
|
|
564
603
|
*/
|
|
565
604
|
now?: Date;
|
|
566
605
|
/** Column count for `mode="custom"`. */
|
|
@@ -575,7 +614,9 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
575
614
|
/**
|
|
576
615
|
* Display events in this IANA time zone (e.g. `"America/New_York"`), DST-correct
|
|
577
616
|
* and independent of the device zone. Display-only: it shifts the wall-clock the
|
|
578
|
-
* grid lays out from, it doesn't change your `Date`s
|
|
617
|
+
* grid lays out from, it doesn't change your `Date`s, and callbacks report your
|
|
618
|
+
* own events and real instants. All-day events stay on their days. Uses
|
|
619
|
+
* `eventsInTimeZone`.
|
|
579
620
|
*/
|
|
580
621
|
timeZone?: string;
|
|
581
622
|
/** Theme overrides; falls back to the default light theme. */
|
|
@@ -669,8 +710,9 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
669
710
|
*/
|
|
670
711
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
671
712
|
/**
|
|
672
|
-
* A component that draws content inside
|
|
673
|
-
*
|
|
713
|
+
* A component that draws content inside a creation preview in time-grid, month
|
|
714
|
+
* and multi-week modes. Month rows receive the full all-day range with an
|
|
715
|
+
* exclusive end, once per covered row. Requires onCreateEvent.
|
|
674
716
|
*/
|
|
675
717
|
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
676
718
|
/** Fires when an event drag begins. */
|
|
@@ -681,7 +723,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
681
723
|
* days dragged so the time of day and duration are kept.
|
|
682
724
|
*/
|
|
683
725
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
684
|
-
/** Stable, unique
|
|
726
|
+
/** Stable, unique identity for the editing dialog and time-grid all-day bars across data refreshes. */
|
|
685
727
|
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
686
728
|
/** Tap a day's column header. */
|
|
687
729
|
onPressDateHeader?: (day: Date) => void;
|