@super-calendar/dom 2.8.2 → 2.9.1
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 +7 -0
- package/dist/index.d.mts +88 -11
- package/dist/index.d.ts +88 -11
- package/dist/index.js +394 -85
- package/dist/index.mjs +396 -87
- package/package.json +2 -2
- package/src/Calendar.tsx +49 -4
- package/src/MonthView.tsx +200 -50
- package/src/TimeGrid.tsx +257 -54
- package/src/YearView.tsx +218 -19
package/README.md
CHANGED
|
@@ -52,6 +52,13 @@ export function MyCalendar() {
|
|
|
52
52
|
|
|
53
53
|
For a custom picker, pair the headless hooks (`useDateRange`, `useMonthGrid`) with `MonthList` and `TimeGrid`, all re-exported from this package.
|
|
54
54
|
|
|
55
|
+
## Moving events
|
|
56
|
+
|
|
57
|
+
Pass `onDragEvent` and update your event state with the returned `start` and `end`.
|
|
58
|
+
On the time grid, dragging any segment of a multi-day event previews the whole
|
|
59
|
+
range moving together and preserves its duration. Drag a resize grip to change
|
|
60
|
+
only the start or end. See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
61
|
+
|
|
55
62
|
## Styling
|
|
56
63
|
|
|
57
64
|
Out of the box the calendar is fully styled from the theme, no stylesheet required. To restyle a specific part with **Tailwind** or your own CSS, every element is a named slot: pass `classNames` (or `styles`) per slot, and use `data-*` state variants like `data-[today]:`.
|
package/dist/index.d.mts
CHANGED
|
@@ -124,12 +124,13 @@ declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme:
|
|
|
124
124
|
//#region src/YearView.d.ts
|
|
125
125
|
/**
|
|
126
126
|
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
127
|
-
* via the `classNames` / `styles` props; day cells carry `data-today
|
|
128
|
-
* `data-events`
|
|
127
|
+
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
128
|
+
* `data-events`, `data-selected`, `data-range`, `data-disabled` and
|
|
129
|
+
* `data-creating` state attributes for variants.
|
|
129
130
|
*/
|
|
130
|
-
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "eventDot";
|
|
131
|
+
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "dayBadge" | "rangeBand" | "eventDot";
|
|
131
132
|
/** Props for {@link YearView}, the twelve mini-month year grid. */
|
|
132
|
-
interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
133
|
+
interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<YearViewSlot> {
|
|
133
134
|
/** Any date inside the year to render. */
|
|
134
135
|
date: Date;
|
|
135
136
|
/** Days holding at least one event get a dot. Omit for a plain year. */
|
|
@@ -141,6 +142,10 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
141
142
|
locale?: Locale;
|
|
142
143
|
/** Highlight this date instead of the real "today". */
|
|
143
144
|
activeDate?: Date;
|
|
145
|
+
/** A selected span: endpoints get a filled badge, the days between get the range band. */
|
|
146
|
+
selectedRange?: DateRange$1;
|
|
147
|
+
/** Discrete selected days, drawn with a filled badge. */
|
|
148
|
+
selectedDates?: Date[];
|
|
144
149
|
/**
|
|
145
150
|
* Smallest width a mini month may take before the grid drops a column
|
|
146
151
|
* (default 150). The grid fits as many columns as the container allows.
|
|
@@ -150,6 +155,22 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
150
155
|
onPressDay?: (date: Date) => void;
|
|
151
156
|
/** Tap a month's title (e.g. to jump to that month's view). */
|
|
152
157
|
onPressMonth?: (month: Date) => void;
|
|
158
|
+
/**
|
|
159
|
+
* Enables drag-to-select and reports the swept span live, as the ordered
|
|
160
|
+
* inclusive `[start, end]` days (both at midnight). Pair it with
|
|
161
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Fires on every day the
|
|
162
|
+
* pointer crosses, so the highlight follows the drag; `onCreateEvent` (when also
|
|
163
|
+
* set) fires once on release. Either handler enables the same sweep gesture, and
|
|
164
|
+
* a sweep can run across mini months.
|
|
165
|
+
*/
|
|
166
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
167
|
+
/**
|
|
168
|
+
* Enables drag-to-create: press a day and drag across others, then release to
|
|
169
|
+
* fire this with the all-day range (`start` at midnight of the first day, `end`
|
|
170
|
+
* at midnight after the last, exclusive). A plain click without dragging still
|
|
171
|
+
* fires `onPressDay`, not this. Days being sketched carry `data-creating`.
|
|
172
|
+
*/
|
|
173
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
153
174
|
/** Theme overrides; falls back to the default light theme. */
|
|
154
175
|
theme?: Partial<DomCalendarTheme>;
|
|
155
176
|
/** Class applied to the root element. */
|
|
@@ -162,7 +183,7 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
162
183
|
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
163
184
|
* renders for `mode="year"`.
|
|
164
185
|
*/
|
|
165
|
-
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
186
|
+
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
166
187
|
//#endregion
|
|
167
188
|
//#region src/MonthView.d.ts
|
|
168
189
|
/**
|
|
@@ -239,6 +260,11 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
239
260
|
theme?: Partial<DomCalendarTheme>;
|
|
240
261
|
/** Fired when a selectable day is clicked. */
|
|
241
262
|
onPressDay?: (date: Date) => void;
|
|
263
|
+
/**
|
|
264
|
+
* Fired alongside `onPressDay` when a day cell is clicked, with the same day at
|
|
265
|
+
* midnight, so one handler can create events across month and week/day modes.
|
|
266
|
+
*/
|
|
267
|
+
onPressCell?: (date: Date) => void;
|
|
242
268
|
/**
|
|
243
269
|
* In events mode, enables drag-to-create: press on a day and drag across others
|
|
244
270
|
* to sketch a span, then release to fire this with the all-day range (`start` at
|
|
@@ -247,6 +273,28 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
247
273
|
* carry `data-creating` for styling.
|
|
248
274
|
*/
|
|
249
275
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
276
|
+
/**
|
|
277
|
+
* Reports the day span of a create sweep **as it happens**, as the ordered
|
|
278
|
+
* inclusive `[start, end]` days (both at midnight), so a selection highlight can
|
|
279
|
+
* follow the drag instead of appearing only on release. Pair it with
|
|
280
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Enables the sweep on
|
|
281
|
+
* its own, so it works without `onCreateEvent`.
|
|
282
|
+
*/
|
|
283
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
284
|
+
/**
|
|
285
|
+
* In events mode, enables drag-to-reschedule: press an event chip and drop it on
|
|
286
|
+
* another day. Called with the event and its new `start`/`end`, both shifted by
|
|
287
|
+
* the whole days dragged, so the time of day and duration are preserved. Return
|
|
288
|
+
* `false` to reject the drop. The day under the pointer carries `data-drop` for
|
|
289
|
+
* styling.
|
|
290
|
+
*/
|
|
291
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
292
|
+
/** Fired the instant an event is picked up for a drag, before anything is committed. */
|
|
293
|
+
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
294
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
295
|
+
eventStartEditable?: boolean;
|
|
296
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
297
|
+
eventOverlap?: boolean;
|
|
250
298
|
/**
|
|
251
299
|
* When events are shown, also make the day cells keyboard-navigable: a single
|
|
252
300
|
* roving tab stop, arrow keys move the focus, Enter opens the day (`onPressDay`).
|
|
@@ -270,7 +318,7 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
270
318
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
271
319
|
* ```
|
|
272
320
|
*/
|
|
273
|
-
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
321
|
+
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
274
322
|
//#endregion
|
|
275
323
|
//#region src/TimeGrid.d.ts
|
|
276
324
|
/**
|
|
@@ -447,7 +495,13 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
447
495
|
* a day-grouped agenda list, and the others a time grid.
|
|
448
496
|
*/
|
|
449
497
|
mode?: CalendarMode$1;
|
|
450
|
-
/**
|
|
498
|
+
/**
|
|
499
|
+
* Controlled anchor date, read in the device's local time zone; change it
|
|
500
|
+
* (e.g. from your own header) to navigate. Construct it as a local date
|
|
501
|
+
* (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
502
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
503
|
+
* and anchors the previous week.
|
|
504
|
+
*/
|
|
451
505
|
date: Date;
|
|
452
506
|
/**
|
|
453
507
|
* Fires with the next/previous period's date when the user pages the focused
|
|
@@ -535,13 +589,24 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
535
589
|
eventOverlap?: boolean;
|
|
536
590
|
/** Snap dragged/created events to this many minutes. */
|
|
537
591
|
dragStepMinutes?: number;
|
|
538
|
-
/**
|
|
592
|
+
/**
|
|
593
|
+
* Tap empty space: the date+time pressed on the week/day grid, or the tapped
|
|
594
|
+
* day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
595
|
+
*/
|
|
539
596
|
onPressCell?: (date: Date) => void;
|
|
540
|
-
/**
|
|
597
|
+
/**
|
|
598
|
+
* Drag empty space to create. On the week/day grid that sweeps out a time
|
|
599
|
+
* range; in `month` mode it sweeps out an **all-day** span across the days
|
|
600
|
+
* dragged (`start` at midnight of the first, `end` at midnight after the last).
|
|
601
|
+
*/
|
|
541
602
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
542
603
|
/** Fires when an event drag begins. */
|
|
543
604
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
544
|
-
/**
|
|
605
|
+
/**
|
|
606
|
+
* Enables drag-to-move/resize; return `false` to reject the drop. In `month`
|
|
607
|
+
* mode an event chip can be dragged onto another day, shifting both ends by the
|
|
608
|
+
* days dragged so the time of day and duration are kept.
|
|
609
|
+
*/
|
|
545
610
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
546
611
|
/** Tap a day's column header. */
|
|
547
612
|
onPressDateHeader?: (day: Date) => void;
|
|
@@ -560,6 +625,11 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
560
625
|
moreLabel?: string;
|
|
561
626
|
/** Render neighbouring months' days in the leading/trailing cells (default true). */
|
|
562
627
|
showAdjacentMonths?: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Render the built-in "Month yyyy" title above the month grid. Default true. Set
|
|
630
|
+
* false when your own header already shows the month and year. Month mode only.
|
|
631
|
+
*/
|
|
632
|
+
showTitle?: boolean;
|
|
563
633
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
564
634
|
weekdayFormat?: WeekdayFormat$1;
|
|
565
635
|
/** Fill the cell with the range background instead of the pill band. */
|
|
@@ -576,6 +646,13 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
576
646
|
keyboardDayNavigation?: boolean;
|
|
577
647
|
/** Tap a day cell. */
|
|
578
648
|
onPressDay?: (date: Date) => void;
|
|
649
|
+
/**
|
|
650
|
+
* Month and year modes: reports a create sweep's day span as it happens, as the
|
|
651
|
+
* ordered inclusive `[start, end]` days, so a selection highlight can follow the
|
|
652
|
+
* drag. Pair it with `useDateRange`'s `selectRange`. Enables the sweep on its
|
|
653
|
+
* own, so it works without `onCreateEvent`.
|
|
654
|
+
*/
|
|
655
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
579
656
|
/** Tap a month's title in the year view — e.g. jump to that month. */
|
|
580
657
|
onPressMonth?: (month: Date) => void;
|
|
581
658
|
/** Tap the "+N more" overflow row. */
|
|
@@ -596,7 +673,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
596
673
|
* <Calendar mode="week" date={new Date()} events={events} />
|
|
597
674
|
* ```
|
|
598
675
|
*/
|
|
599
|
-
declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
676
|
+
declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
600
677
|
//#endregion
|
|
601
678
|
//#region src/MonthList.d.ts
|
|
602
679
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -124,12 +124,13 @@ declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme:
|
|
|
124
124
|
//#region src/YearView.d.ts
|
|
125
125
|
/**
|
|
126
126
|
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
127
|
-
* via the `classNames` / `styles` props; day cells carry `data-today
|
|
128
|
-
* `data-events`
|
|
127
|
+
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
128
|
+
* `data-events`, `data-selected`, `data-range`, `data-disabled` and
|
|
129
|
+
* `data-creating` state attributes for variants.
|
|
129
130
|
*/
|
|
130
|
-
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "eventDot";
|
|
131
|
+
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "dayBadge" | "rangeBand" | "eventDot";
|
|
131
132
|
/** Props for {@link YearView}, the twelve mini-month year grid. */
|
|
132
|
-
interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
133
|
+
interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<YearViewSlot> {
|
|
133
134
|
/** Any date inside the year to render. */
|
|
134
135
|
date: Date;
|
|
135
136
|
/** Days holding at least one event get a dot. Omit for a plain year. */
|
|
@@ -141,6 +142,10 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
141
142
|
locale?: Locale;
|
|
142
143
|
/** Highlight this date instead of the real "today". */
|
|
143
144
|
activeDate?: Date;
|
|
145
|
+
/** A selected span: endpoints get a filled badge, the days between get the range band. */
|
|
146
|
+
selectedRange?: DateRange$1;
|
|
147
|
+
/** Discrete selected days, drawn with a filled badge. */
|
|
148
|
+
selectedDates?: Date[];
|
|
144
149
|
/**
|
|
145
150
|
* Smallest width a mini month may take before the grid drops a column
|
|
146
151
|
* (default 150). The grid fits as many columns as the container allows.
|
|
@@ -150,6 +155,22 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
150
155
|
onPressDay?: (date: Date) => void;
|
|
151
156
|
/** Tap a month's title (e.g. to jump to that month's view). */
|
|
152
157
|
onPressMonth?: (month: Date) => void;
|
|
158
|
+
/**
|
|
159
|
+
* Enables drag-to-select and reports the swept span live, as the ordered
|
|
160
|
+
* inclusive `[start, end]` days (both at midnight). Pair it with
|
|
161
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Fires on every day the
|
|
162
|
+
* pointer crosses, so the highlight follows the drag; `onCreateEvent` (when also
|
|
163
|
+
* set) fires once on release. Either handler enables the same sweep gesture, and
|
|
164
|
+
* a sweep can run across mini months.
|
|
165
|
+
*/
|
|
166
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
167
|
+
/**
|
|
168
|
+
* Enables drag-to-create: press a day and drag across others, then release to
|
|
169
|
+
* fire this with the all-day range (`start` at midnight of the first day, `end`
|
|
170
|
+
* at midnight after the last, exclusive). A plain click without dragging still
|
|
171
|
+
* fires `onPressDay`, not this. Days being sketched carry `data-creating`.
|
|
172
|
+
*/
|
|
173
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
153
174
|
/** Theme overrides; falls back to the default light theme. */
|
|
154
175
|
theme?: Partial<DomCalendarTheme>;
|
|
155
176
|
/** Class applied to the root element. */
|
|
@@ -162,7 +183,7 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
162
183
|
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
163
184
|
* renders for `mode="year"`.
|
|
164
185
|
*/
|
|
165
|
-
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
186
|
+
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
166
187
|
//#endregion
|
|
167
188
|
//#region src/MonthView.d.ts
|
|
168
189
|
/**
|
|
@@ -239,6 +260,11 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
239
260
|
theme?: Partial<DomCalendarTheme>;
|
|
240
261
|
/** Fired when a selectable day is clicked. */
|
|
241
262
|
onPressDay?: (date: Date) => void;
|
|
263
|
+
/**
|
|
264
|
+
* Fired alongside `onPressDay` when a day cell is clicked, with the same day at
|
|
265
|
+
* midnight, so one handler can create events across month and week/day modes.
|
|
266
|
+
*/
|
|
267
|
+
onPressCell?: (date: Date) => void;
|
|
242
268
|
/**
|
|
243
269
|
* In events mode, enables drag-to-create: press on a day and drag across others
|
|
244
270
|
* to sketch a span, then release to fire this with the all-day range (`start` at
|
|
@@ -247,6 +273,28 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
247
273
|
* carry `data-creating` for styling.
|
|
248
274
|
*/
|
|
249
275
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
276
|
+
/**
|
|
277
|
+
* Reports the day span of a create sweep **as it happens**, as the ordered
|
|
278
|
+
* inclusive `[start, end]` days (both at midnight), so a selection highlight can
|
|
279
|
+
* follow the drag instead of appearing only on release. Pair it with
|
|
280
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Enables the sweep on
|
|
281
|
+
* its own, so it works without `onCreateEvent`.
|
|
282
|
+
*/
|
|
283
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
284
|
+
/**
|
|
285
|
+
* In events mode, enables drag-to-reschedule: press an event chip and drop it on
|
|
286
|
+
* another day. Called with the event and its new `start`/`end`, both shifted by
|
|
287
|
+
* the whole days dragged, so the time of day and duration are preserved. Return
|
|
288
|
+
* `false` to reject the drop. The day under the pointer carries `data-drop` for
|
|
289
|
+
* styling.
|
|
290
|
+
*/
|
|
291
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
292
|
+
/** Fired the instant an event is picked up for a drag, before anything is committed. */
|
|
293
|
+
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
294
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
295
|
+
eventStartEditable?: boolean;
|
|
296
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
297
|
+
eventOverlap?: boolean;
|
|
250
298
|
/**
|
|
251
299
|
* When events are shown, also make the day cells keyboard-navigable: a single
|
|
252
300
|
* roving tab stop, arrow keys move the focus, Enter opens the day (`onPressDay`).
|
|
@@ -270,7 +318,7 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
270
318
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
271
319
|
* ```
|
|
272
320
|
*/
|
|
273
|
-
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
321
|
+
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
274
322
|
//#endregion
|
|
275
323
|
//#region src/TimeGrid.d.ts
|
|
276
324
|
/**
|
|
@@ -447,7 +495,13 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
447
495
|
* a day-grouped agenda list, and the others a time grid.
|
|
448
496
|
*/
|
|
449
497
|
mode?: CalendarMode$1;
|
|
450
|
-
/**
|
|
498
|
+
/**
|
|
499
|
+
* Controlled anchor date, read in the device's local time zone; change it
|
|
500
|
+
* (e.g. from your own header) to navigate. Construct it as a local date
|
|
501
|
+
* (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
502
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
503
|
+
* and anchors the previous week.
|
|
504
|
+
*/
|
|
451
505
|
date: Date;
|
|
452
506
|
/**
|
|
453
507
|
* Fires with the next/previous period's date when the user pages the focused
|
|
@@ -535,13 +589,24 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
535
589
|
eventOverlap?: boolean;
|
|
536
590
|
/** Snap dragged/created events to this many minutes. */
|
|
537
591
|
dragStepMinutes?: number;
|
|
538
|
-
/**
|
|
592
|
+
/**
|
|
593
|
+
* Tap empty space: the date+time pressed on the week/day grid, or the tapped
|
|
594
|
+
* day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
595
|
+
*/
|
|
539
596
|
onPressCell?: (date: Date) => void;
|
|
540
|
-
/**
|
|
597
|
+
/**
|
|
598
|
+
* Drag empty space to create. On the week/day grid that sweeps out a time
|
|
599
|
+
* range; in `month` mode it sweeps out an **all-day** span across the days
|
|
600
|
+
* dragged (`start` at midnight of the first, `end` at midnight after the last).
|
|
601
|
+
*/
|
|
541
602
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
542
603
|
/** Fires when an event drag begins. */
|
|
543
604
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
544
|
-
/**
|
|
605
|
+
/**
|
|
606
|
+
* Enables drag-to-move/resize; return `false` to reject the drop. In `month`
|
|
607
|
+
* mode an event chip can be dragged onto another day, shifting both ends by the
|
|
608
|
+
* days dragged so the time of day and duration are kept.
|
|
609
|
+
*/
|
|
545
610
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
546
611
|
/** Tap a day's column header. */
|
|
547
612
|
onPressDateHeader?: (day: Date) => void;
|
|
@@ -560,6 +625,11 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
560
625
|
moreLabel?: string;
|
|
561
626
|
/** Render neighbouring months' days in the leading/trailing cells (default true). */
|
|
562
627
|
showAdjacentMonths?: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Render the built-in "Month yyyy" title above the month grid. Default true. Set
|
|
630
|
+
* false when your own header already shows the month and year. Month mode only.
|
|
631
|
+
*/
|
|
632
|
+
showTitle?: boolean;
|
|
563
633
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
564
634
|
weekdayFormat?: WeekdayFormat$1;
|
|
565
635
|
/** Fill the cell with the range background instead of the pill band. */
|
|
@@ -576,6 +646,13 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
576
646
|
keyboardDayNavigation?: boolean;
|
|
577
647
|
/** Tap a day cell. */
|
|
578
648
|
onPressDay?: (date: Date) => void;
|
|
649
|
+
/**
|
|
650
|
+
* Month and year modes: reports a create sweep's day span as it happens, as the
|
|
651
|
+
* ordered inclusive `[start, end]` days, so a selection highlight can follow the
|
|
652
|
+
* drag. Pair it with `useDateRange`'s `selectRange`. Enables the sweep on its
|
|
653
|
+
* own, so it works without `onCreateEvent`.
|
|
654
|
+
*/
|
|
655
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
579
656
|
/** Tap a month's title in the year view — e.g. jump to that month. */
|
|
580
657
|
onPressMonth?: (month: Date) => void;
|
|
581
658
|
/** Tap the "+N more" overflow row. */
|
|
@@ -596,7 +673,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
596
673
|
* <Calendar mode="week" date={new Date()} events={events} />
|
|
597
674
|
* ```
|
|
598
675
|
*/
|
|
599
|
-
declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
676
|
+
declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, hiddenDays, now, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, renderBusinessHours, showNowIndicator, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, showTitle, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onSelectDrag, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
600
677
|
//#endregion
|
|
601
678
|
//#region src/MonthList.d.ts
|
|
602
679
|
/**
|