@super-calendar/dom 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +128 -16
- package/dist/index.d.ts +128 -16
- package/dist/index.js +763 -114
- package/dist/index.mjs +741 -117
- package/package.json +2 -2
- package/src/Agenda.tsx +5 -2
- package/src/Calendar.tsx +68 -8
- package/src/MonthList.tsx +3 -1
- package/src/MonthView.tsx +135 -3
- package/src/ResourceTimeline.tsx +269 -20
- package/src/TimeGrid.tsx +364 -80
- package/src/YearView.tsx +293 -0
- package/src/index.ts +6 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { CSSProperties, ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
-
import { BusinessHours, BusinessHours as BusinessHours$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, buildMonthGrid, daySelectionState, expandRecurringEvents, getViewDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, nextDateRange, parseICalendar, toICalendar, useDateRange, useMonthGrid, weekdayFormatToken } from "@super-calendar/core";
|
|
3
|
+
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, daySelectionState, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
4
4
|
//#region src/slots.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Per-slot styling overrides. Give a slot a Tailwind/CSS class and/or an inline
|
|
@@ -121,12 +121,55 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
121
121
|
*/
|
|
122
122
|
declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
123
123
|
//#endregion
|
|
124
|
+
//#region src/YearView.d.ts
|
|
125
|
+
/**
|
|
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` and
|
|
128
|
+
* `data-events` state attributes for variants.
|
|
129
|
+
*/
|
|
130
|
+
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "eventDot";
|
|
131
|
+
/** Props for {@link YearView}, the twelve mini-month year grid. */
|
|
132
|
+
interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
133
|
+
/** Any date inside the year to render. */
|
|
134
|
+
date: Date;
|
|
135
|
+
/** Days holding at least one event get a dot. Omit for a plain year. */
|
|
136
|
+
events?: CalendarEvent$1<T>[];
|
|
137
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
138
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
139
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
140
|
+
hiddenDays?: number[];
|
|
141
|
+
locale?: Locale;
|
|
142
|
+
/** Highlight this date instead of the real "today". */
|
|
143
|
+
activeDate?: Date;
|
|
144
|
+
/**
|
|
145
|
+
* Smallest width a mini month may take before the grid drops a column
|
|
146
|
+
* (default 150). The grid fits as many columns as the container allows.
|
|
147
|
+
*/
|
|
148
|
+
minMonthWidth?: number;
|
|
149
|
+
/** Tap a day cell (e.g. to drill into the day or month view). */
|
|
150
|
+
onPressDay?: (date: Date) => void;
|
|
151
|
+
/** Tap a month's title (e.g. to jump to that month's view). */
|
|
152
|
+
onPressMonth?: (month: Date) => void;
|
|
153
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
154
|
+
theme?: Partial<DomCalendarTheme>;
|
|
155
|
+
/** Class applied to the root element. */
|
|
156
|
+
className?: string;
|
|
157
|
+
/** Inline styles applied to the root element. */
|
|
158
|
+
style?: CSSProperties;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A year at a glance: the twelve months as compact mini grids, with today
|
|
162
|
+
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
163
|
+
* renders for `mode="year"`.
|
|
164
|
+
*/
|
|
165
|
+
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
166
|
+
//#endregion
|
|
124
167
|
//#region src/MonthView.d.ts
|
|
125
168
|
/**
|
|
126
169
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
127
170
|
* the `classNames` / `styles` props to restyle just that part.
|
|
128
171
|
*/
|
|
129
|
-
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "chipButton" | "chip" | "more";
|
|
172
|
+
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "chipButton" | "chip" | "more" | "morePopover";
|
|
130
173
|
/** Props passed to a custom month event chip renderer. */
|
|
131
174
|
interface DomMonthEventArgs<T = unknown> {
|
|
132
175
|
/** The event to render. */
|
|
@@ -142,6 +185,8 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
142
185
|
date: Date;
|
|
143
186
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
144
187
|
weekStartsOn?: WeekStartsOn$1;
|
|
188
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
189
|
+
hiddenDays?: number[];
|
|
145
190
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
146
191
|
weekdayFormat?: WeekdayFormat$1;
|
|
147
192
|
/**
|
|
@@ -218,14 +263,14 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
218
263
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
219
264
|
* ```
|
|
220
265
|
*/
|
|
221
|
-
declare function MonthView<T = unknown>({ date, weekStartsOn, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
266
|
+
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
222
267
|
//#endregion
|
|
223
268
|
//#region src/TimeGrid.d.ts
|
|
224
269
|
/**
|
|
225
270
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
226
271
|
* the `classNames` / `styles` props.
|
|
227
272
|
*/
|
|
228
|
-
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
273
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
229
274
|
/** Props passed to a custom time-grid event renderer. */
|
|
230
275
|
interface DomRenderEventArgs<T = unknown> {
|
|
231
276
|
/** The event to render. */
|
|
@@ -287,12 +332,28 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
287
332
|
showWeekNumber?: boolean;
|
|
288
333
|
/** Prefix for the week number, e.g. "W" → "W28". Default "W". */
|
|
289
334
|
weekNumberPrefix?: string;
|
|
335
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
336
|
+
hiddenDays?: number[];
|
|
290
337
|
/** Shade the hours outside business hours; `null` shades the whole day. */
|
|
291
338
|
businessHours?: BusinessHours$1;
|
|
339
|
+
/**
|
|
340
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
341
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
342
|
+
* and your output fills the band instead. Decorative only: the
|
|
343
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
344
|
+
*/
|
|
345
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
292
346
|
/** Show the current-time indicator on today's column (default true). */
|
|
293
347
|
showNowIndicator?: boolean;
|
|
348
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
349
|
+
now?: Date;
|
|
350
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
351
|
+
timeZone?: string;
|
|
294
352
|
/** Show the all-day lane above the grid (default true). */
|
|
295
353
|
showAllDayEventCell?: boolean;
|
|
354
|
+
/** Tint Saturday/Sunday columns with the weekend background (default true). Set
|
|
355
|
+
* false to treat weekends like any other day. */
|
|
356
|
+
highlightWeekends?: boolean;
|
|
296
357
|
/** date-fns locale for the column headers and time labels. */
|
|
297
358
|
locale?: Locale;
|
|
298
359
|
/** Theme overrides; falls back to the default light theme. */
|
|
@@ -333,6 +394,13 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
333
394
|
* Return `false` to reject the drop (the event snaps back).
|
|
334
395
|
*/
|
|
335
396
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
399
|
+
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
400
|
+
* dwelling briefly pages the view so the event can be dropped on a day in the
|
|
401
|
+
* previous/next period. Controlled, like the native renderer's `onChangeDate`.
|
|
402
|
+
*/
|
|
403
|
+
onChangeDate?: (date: Date) => void;
|
|
336
404
|
/** Class applied to the root element. */
|
|
337
405
|
className?: string;
|
|
338
406
|
/** Inline styles applied to the root element. */
|
|
@@ -349,7 +417,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
349
417
|
* <TimeGrid mode="week" date={new Date()} events={events} />
|
|
350
418
|
* ```
|
|
351
419
|
*/
|
|
352
|
-
declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, keyboardEventNavigation, businessHours, showNowIndicator, showAllDayEventCell, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
|
|
420
|
+
declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, hiddenDays, keyboardEventNavigation, businessHours, renderBusinessHours, showNowIndicator, highlightWeekends, now: nowProp, timeZone, showAllDayEventCell, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
|
|
353
421
|
//#endregion
|
|
354
422
|
//#region src/Calendar.d.ts
|
|
355
423
|
/**
|
|
@@ -357,14 +425,14 @@ declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekS
|
|
|
357
425
|
* for the active `mode` apply; the rest are ignored. See {@link MonthViewSlot},
|
|
358
426
|
* {@link TimeGridSlot}, and {@link AgendaSlot}.
|
|
359
427
|
*/
|
|
360
|
-
type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot;
|
|
428
|
+
type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
361
429
|
/** Props for {@link Calendar}. */
|
|
362
430
|
interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<CalendarSlot> {
|
|
363
431
|
/**
|
|
364
432
|
* The view to render (default "week"). `month` renders a month grid, `schedule`
|
|
365
433
|
* a day-grouped agenda list, and the others a time grid.
|
|
366
434
|
*/
|
|
367
|
-
mode?:
|
|
435
|
+
mode?: CalendarMode$1;
|
|
368
436
|
/** Controlled anchor date. Change it (e.g. from your own header) to navigate. */
|
|
369
437
|
date: Date;
|
|
370
438
|
/**
|
|
@@ -378,6 +446,14 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
378
446
|
events?: CalendarEvent$1<T>[];
|
|
379
447
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
380
448
|
weekStartsOn?: WeekStartsOn$1;
|
|
449
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
450
|
+
hiddenDays?: number[];
|
|
451
|
+
/**
|
|
452
|
+
* Fixed "now" instant for the current-time indicator (doesn't tick), e.g. a
|
|
453
|
+
* server-synced clock. Defaults to the device clock, shifted into `timeZone`
|
|
454
|
+
* when one is set so the line matches the displayed events.
|
|
455
|
+
*/
|
|
456
|
+
now?: Date;
|
|
381
457
|
/** Column count for `mode="custom"`. */
|
|
382
458
|
numberOfDays?: number;
|
|
383
459
|
/** date-fns locale for titles, headers, and time labels. */
|
|
@@ -424,10 +500,19 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
424
500
|
weekNumberPrefix?: string;
|
|
425
501
|
/** Shade the hours outside business hours. */
|
|
426
502
|
businessHours?: BusinessHours$1;
|
|
503
|
+
/**
|
|
504
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
505
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
506
|
+
* and your output fills the band instead. Decorative only: the
|
|
507
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
508
|
+
*/
|
|
509
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
427
510
|
/** Show the current-time indicator (default true). */
|
|
428
511
|
showNowIndicator?: boolean;
|
|
429
512
|
/** Show the all-day lane (default true). */
|
|
430
513
|
showAllDayEventCell?: boolean;
|
|
514
|
+
/** Tint weekend columns (default true). Set false to treat weekends normally. */
|
|
515
|
+
highlightWeekends?: boolean;
|
|
431
516
|
/** Snap dragged/created events to this many minutes. */
|
|
432
517
|
dragStepMinutes?: number;
|
|
433
518
|
/** Tap empty grid space. */
|
|
@@ -471,6 +556,8 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
471
556
|
keyboardDayNavigation?: boolean;
|
|
472
557
|
/** Tap a day cell. */
|
|
473
558
|
onPressDay?: (date: Date) => void;
|
|
559
|
+
/** Tap a month's title in the year view — e.g. jump to that month. */
|
|
560
|
+
onPressMonth?: (month: Date) => void;
|
|
474
561
|
/** Tap the "+N more" overflow row. */
|
|
475
562
|
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
476
563
|
/** Custom month chip renderer. */
|
|
@@ -489,7 +576,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
489
576
|
* <Calendar mode="week" date={new Date()} events={events} />
|
|
490
577
|
* ```
|
|
491
578
|
*/
|
|
492
|
-
declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, showNowIndicator, showAllDayEventCell, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
579
|
+
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, 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;
|
|
493
580
|
//#endregion
|
|
494
581
|
//#region src/MonthList.d.ts
|
|
495
582
|
/**
|
|
@@ -627,7 +714,7 @@ declare function DateRangePicker({ value, onChange, formatLabel, weekStartsOn, h
|
|
|
627
714
|
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
628
715
|
* slot via the `classNames` / `styles` props.
|
|
629
716
|
*/
|
|
630
|
-
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "event" | "eventBox" | "createGhost";
|
|
717
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
631
718
|
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
632
719
|
interface Resource {
|
|
633
720
|
/** Stable id events reference via their `resourceId`. */
|
|
@@ -660,6 +747,19 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
660
747
|
orientation?: "horizontal" | "vertical";
|
|
661
748
|
/** The resource lanes: rows when horizontal, columns when vertical. */
|
|
662
749
|
resources: Resource[];
|
|
750
|
+
/**
|
|
751
|
+
* Cap the number of lanes shown at once; the rest sit on further pages. Pair
|
|
752
|
+
* with `resourcePage` and your own prev/next controls to page through them
|
|
753
|
+
* (like `date` drives the time axis). Omit to show every lane, sharing the
|
|
754
|
+
* available space.
|
|
755
|
+
*/
|
|
756
|
+
resourcesPerPage?: number;
|
|
757
|
+
/**
|
|
758
|
+
* The 0-based page of lanes to show when `resourcesPerPage` is set (default
|
|
759
|
+
* 0, clamped to the last page). Controlled: update it from your own paging
|
|
760
|
+
* controls.
|
|
761
|
+
*/
|
|
762
|
+
resourcePage?: number;
|
|
663
763
|
/** Events; each is placed in the row named by `resourceId(event)`. */
|
|
664
764
|
events: CalendarEvent$1<T>[];
|
|
665
765
|
/** Read an event's resource id. Default: `event.resourceId`. */
|
|
@@ -688,7 +788,7 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
688
788
|
* Enables drag-to-move and edge-resize along the time axis; called with the
|
|
689
789
|
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
690
790
|
*/
|
|
691
|
-
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
791
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
692
792
|
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
693
793
|
onPressCell?: (at: Date, resource: Resource) => void;
|
|
694
794
|
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
@@ -698,12 +798,24 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
698
798
|
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
699
799
|
* (return `null` for a fully closed lane). A date-only function is accepted.
|
|
700
800
|
*/
|
|
701
|
-
businessHours?: (date: Date, resource: Resource) =>
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
801
|
+
businessHours?: (date: Date, resource: Resource) => BusinessHoursValue;
|
|
802
|
+
/**
|
|
803
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern). The
|
|
804
|
+
* board keeps positioning the band; when set, the themed tint is dropped and
|
|
805
|
+
* your output fills the band instead. Receives the lane's resource. Decorative only: the
|
|
806
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
807
|
+
*/
|
|
808
|
+
renderBusinessHours?: (band: BusinessHoursBand$1 & {
|
|
809
|
+
resource: Resource;
|
|
810
|
+
}) => ReactNode;
|
|
705
811
|
/** Snap dragged events to this many minutes (default 15). */
|
|
706
812
|
dragStepMinutes?: number;
|
|
813
|
+
/** Show the current-time line when `date` is today (default true). */
|
|
814
|
+
showNowIndicator?: boolean;
|
|
815
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
816
|
+
now?: Date;
|
|
817
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
818
|
+
timeZone?: string;
|
|
707
819
|
/** Class applied to the root element. */
|
|
708
820
|
className?: string;
|
|
709
821
|
/** Inline styles applied to the root element. */
|
|
@@ -725,6 +837,6 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
725
837
|
* />
|
|
726
838
|
* ```
|
|
727
839
|
*/
|
|
728
|
-
declare function ResourceTimeline<T = unknown>({ date, orientation, resources, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, onPressCell, onCreateEvent, businessHours, dragStepMinutes, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
840
|
+
declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, onPressCell, onCreateEvent, businessHours, renderBusinessHours, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
729
841
|
//#endregion
|
|
730
|
-
export { Agenda, type AgendaProps, type AgendaSlot, type BusinessHours, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, type CalendarSlot, DatePicker, type DatePickerProps, type DatePickerSlot, type DateRange, DateRangePicker, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthView, type MonthViewProps, type MonthViewSlot, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, type ResourceTimelineSlot, type SlotDefault, type SlotStyleProps, TimeGrid, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, buildMonthGrid, darkDomTheme, daySelectionState, defaultDomTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, mergeDomTheme, nextDateRange, parseICalendar, toICalendar, useDateRange, useMonthGrid, weekdayFormatToken };
|
|
842
|
+
export { Agenda, type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, type CalendarSlot, DatePicker, type DatePickerProps, type DatePickerSlot, type DateRange, DateRangePicker, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthView, type MonthViewProps, type MonthViewSlot, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, type ResourceTimelineSlot, type SlotDefault, type SlotStyleProps, TimeGrid, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, YearView, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, darkDomTheme, daySelectionState, defaultDomTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, mergeDomTheme, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { CSSProperties, ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
-
import { BusinessHours, BusinessHours as BusinessHours$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, buildMonthGrid, daySelectionState, expandRecurringEvents, getViewDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, nextDateRange, parseICalendar, toICalendar, useDateRange, useMonthGrid, weekdayFormatToken } from "@super-calendar/core";
|
|
3
|
+
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, daySelectionState, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
4
4
|
//#region src/slots.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Per-slot styling overrides. Give a slot a Tailwind/CSS class and/or an inline
|
|
@@ -121,12 +121,55 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
121
121
|
*/
|
|
122
122
|
declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
123
123
|
//#endregion
|
|
124
|
+
//#region src/YearView.d.ts
|
|
125
|
+
/**
|
|
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` and
|
|
128
|
+
* `data-events` state attributes for variants.
|
|
129
|
+
*/
|
|
130
|
+
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "eventDot";
|
|
131
|
+
/** Props for {@link YearView}, the twelve mini-month year grid. */
|
|
132
|
+
interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
133
|
+
/** Any date inside the year to render. */
|
|
134
|
+
date: Date;
|
|
135
|
+
/** Days holding at least one event get a dot. Omit for a plain year. */
|
|
136
|
+
events?: CalendarEvent$1<T>[];
|
|
137
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
138
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
139
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
140
|
+
hiddenDays?: number[];
|
|
141
|
+
locale?: Locale;
|
|
142
|
+
/** Highlight this date instead of the real "today". */
|
|
143
|
+
activeDate?: Date;
|
|
144
|
+
/**
|
|
145
|
+
* Smallest width a mini month may take before the grid drops a column
|
|
146
|
+
* (default 150). The grid fits as many columns as the container allows.
|
|
147
|
+
*/
|
|
148
|
+
minMonthWidth?: number;
|
|
149
|
+
/** Tap a day cell (e.g. to drill into the day or month view). */
|
|
150
|
+
onPressDay?: (date: Date) => void;
|
|
151
|
+
/** Tap a month's title (e.g. to jump to that month's view). */
|
|
152
|
+
onPressMonth?: (month: Date) => void;
|
|
153
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
154
|
+
theme?: Partial<DomCalendarTheme>;
|
|
155
|
+
/** Class applied to the root element. */
|
|
156
|
+
className?: string;
|
|
157
|
+
/** Inline styles applied to the root element. */
|
|
158
|
+
style?: CSSProperties;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A year at a glance: the twelve months as compact mini grids, with today
|
|
162
|
+
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
163
|
+
* renders for `mode="year"`.
|
|
164
|
+
*/
|
|
165
|
+
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
166
|
+
//#endregion
|
|
124
167
|
//#region src/MonthView.d.ts
|
|
125
168
|
/**
|
|
126
169
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
127
170
|
* the `classNames` / `styles` props to restyle just that part.
|
|
128
171
|
*/
|
|
129
|
-
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "chipButton" | "chip" | "more";
|
|
172
|
+
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "chipButton" | "chip" | "more" | "morePopover";
|
|
130
173
|
/** Props passed to a custom month event chip renderer. */
|
|
131
174
|
interface DomMonthEventArgs<T = unknown> {
|
|
132
175
|
/** The event to render. */
|
|
@@ -142,6 +185,8 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
142
185
|
date: Date;
|
|
143
186
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
144
187
|
weekStartsOn?: WeekStartsOn$1;
|
|
188
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
189
|
+
hiddenDays?: number[];
|
|
145
190
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
146
191
|
weekdayFormat?: WeekdayFormat$1;
|
|
147
192
|
/**
|
|
@@ -218,14 +263,14 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
218
263
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
219
264
|
* ```
|
|
220
265
|
*/
|
|
221
|
-
declare function MonthView<T = unknown>({ date, weekStartsOn, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
266
|
+
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
222
267
|
//#endregion
|
|
223
268
|
//#region src/TimeGrid.d.ts
|
|
224
269
|
/**
|
|
225
270
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
226
271
|
* the `classNames` / `styles` props.
|
|
227
272
|
*/
|
|
228
|
-
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
273
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
229
274
|
/** Props passed to a custom time-grid event renderer. */
|
|
230
275
|
interface DomRenderEventArgs<T = unknown> {
|
|
231
276
|
/** The event to render. */
|
|
@@ -287,12 +332,28 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
287
332
|
showWeekNumber?: boolean;
|
|
288
333
|
/** Prefix for the week number, e.g. "W" → "W28". Default "W". */
|
|
289
334
|
weekNumberPrefix?: string;
|
|
335
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
336
|
+
hiddenDays?: number[];
|
|
290
337
|
/** Shade the hours outside business hours; `null` shades the whole day. */
|
|
291
338
|
businessHours?: BusinessHours$1;
|
|
339
|
+
/**
|
|
340
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
341
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
342
|
+
* and your output fills the band instead. Decorative only: the
|
|
343
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
344
|
+
*/
|
|
345
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
292
346
|
/** Show the current-time indicator on today's column (default true). */
|
|
293
347
|
showNowIndicator?: boolean;
|
|
348
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
349
|
+
now?: Date;
|
|
350
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
351
|
+
timeZone?: string;
|
|
294
352
|
/** Show the all-day lane above the grid (default true). */
|
|
295
353
|
showAllDayEventCell?: boolean;
|
|
354
|
+
/** Tint Saturday/Sunday columns with the weekend background (default true). Set
|
|
355
|
+
* false to treat weekends like any other day. */
|
|
356
|
+
highlightWeekends?: boolean;
|
|
296
357
|
/** date-fns locale for the column headers and time labels. */
|
|
297
358
|
locale?: Locale;
|
|
298
359
|
/** Theme overrides; falls back to the default light theme. */
|
|
@@ -333,6 +394,13 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
333
394
|
* Return `false` to reject the drop (the event snaps back).
|
|
334
395
|
*/
|
|
335
396
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
399
|
+
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
400
|
+
* dwelling briefly pages the view so the event can be dropped on a day in the
|
|
401
|
+
* previous/next period. Controlled, like the native renderer's `onChangeDate`.
|
|
402
|
+
*/
|
|
403
|
+
onChangeDate?: (date: Date) => void;
|
|
336
404
|
/** Class applied to the root element. */
|
|
337
405
|
className?: string;
|
|
338
406
|
/** Inline styles applied to the root element. */
|
|
@@ -349,7 +417,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
349
417
|
* <TimeGrid mode="week" date={new Date()} events={events} />
|
|
350
418
|
* ```
|
|
351
419
|
*/
|
|
352
|
-
declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, keyboardEventNavigation, businessHours, showNowIndicator, showAllDayEventCell, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
|
|
420
|
+
declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekStartsOn, weekdayFormat, hourHeight: initialHourHeight, scrollOffsetMinutes, zoomable, minHourHeight, maxHourHeight, dragStepMinutes, ampm, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, hiddenDays, keyboardEventNavigation, businessHours, renderBusinessHours, showNowIndicator, highlightWeekends, now: nowProp, timeZone, showAllDayEventCell, locale, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, hourComponent, onPressEvent, onPressDateHeader, onPressCell, onCreateEvent, onDragStart, onDragEvent, onChangeDate, className, style, classNames, styles }: TimeGridProps<T>): ReactElement;
|
|
353
421
|
//#endregion
|
|
354
422
|
//#region src/Calendar.d.ts
|
|
355
423
|
/**
|
|
@@ -357,14 +425,14 @@ declare function TimeGrid<T = unknown>({ date, events, mode, numberOfDays, weekS
|
|
|
357
425
|
* for the active `mode` apply; the rest are ignored. See {@link MonthViewSlot},
|
|
358
426
|
* {@link TimeGridSlot}, and {@link AgendaSlot}.
|
|
359
427
|
*/
|
|
360
|
-
type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot;
|
|
428
|
+
type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
361
429
|
/** Props for {@link Calendar}. */
|
|
362
430
|
interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<CalendarSlot> {
|
|
363
431
|
/**
|
|
364
432
|
* The view to render (default "week"). `month` renders a month grid, `schedule`
|
|
365
433
|
* a day-grouped agenda list, and the others a time grid.
|
|
366
434
|
*/
|
|
367
|
-
mode?:
|
|
435
|
+
mode?: CalendarMode$1;
|
|
368
436
|
/** Controlled anchor date. Change it (e.g. from your own header) to navigate. */
|
|
369
437
|
date: Date;
|
|
370
438
|
/**
|
|
@@ -378,6 +446,14 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
378
446
|
events?: CalendarEvent$1<T>[];
|
|
379
447
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
380
448
|
weekStartsOn?: WeekStartsOn$1;
|
|
449
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
450
|
+
hiddenDays?: number[];
|
|
451
|
+
/**
|
|
452
|
+
* Fixed "now" instant for the current-time indicator (doesn't tick), e.g. a
|
|
453
|
+
* server-synced clock. Defaults to the device clock, shifted into `timeZone`
|
|
454
|
+
* when one is set so the line matches the displayed events.
|
|
455
|
+
*/
|
|
456
|
+
now?: Date;
|
|
381
457
|
/** Column count for `mode="custom"`. */
|
|
382
458
|
numberOfDays?: number;
|
|
383
459
|
/** date-fns locale for titles, headers, and time labels. */
|
|
@@ -424,10 +500,19 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
424
500
|
weekNumberPrefix?: string;
|
|
425
501
|
/** Shade the hours outside business hours. */
|
|
426
502
|
businessHours?: BusinessHours$1;
|
|
503
|
+
/**
|
|
504
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
505
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
506
|
+
* and your output fills the band instead. Decorative only: the
|
|
507
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
508
|
+
*/
|
|
509
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
427
510
|
/** Show the current-time indicator (default true). */
|
|
428
511
|
showNowIndicator?: boolean;
|
|
429
512
|
/** Show the all-day lane (default true). */
|
|
430
513
|
showAllDayEventCell?: boolean;
|
|
514
|
+
/** Tint weekend columns (default true). Set false to treat weekends normally. */
|
|
515
|
+
highlightWeekends?: boolean;
|
|
431
516
|
/** Snap dragged/created events to this many minutes. */
|
|
432
517
|
dragStepMinutes?: number;
|
|
433
518
|
/** Tap empty grid space. */
|
|
@@ -471,6 +556,8 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
471
556
|
keyboardDayNavigation?: boolean;
|
|
472
557
|
/** Tap a day cell. */
|
|
473
558
|
onPressDay?: (date: Date) => void;
|
|
559
|
+
/** Tap a month's title in the year view — e.g. jump to that month. */
|
|
560
|
+
onPressMonth?: (month: Date) => void;
|
|
474
561
|
/** Tap the "+N more" overflow row. */
|
|
475
562
|
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
476
563
|
/** Custom month chip renderer. */
|
|
@@ -489,7 +576,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
489
576
|
* <Calendar mode="week" date={new Date()} events={events} />
|
|
490
577
|
* ```
|
|
491
578
|
*/
|
|
492
|
-
declare function Calendar<T = unknown>({ mode, date, events, onChangeDate, weekStartsOn, numberOfDays, locale, timeZone, theme, height, className, style, onPressEvent, eventAccessibilityLabel, ampm, hourHeight, scrollOffsetMinutes, timeslots, minHour, maxHour, hideHours, showWeekNumber, weekNumberPrefix, businessHours, showNowIndicator, showAllDayEventCell, dragStepMinutes, onPressCell, onCreateEvent, onDragStart, onDragEvent, onPressDateHeader, renderTimeEvent, hourComponent, keyboardEventNavigation, maxVisibleEventCount, moreLabel, showAdjacentMonths, weekdayFormat, fillCellOnSelection, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
579
|
+
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, 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;
|
|
493
580
|
//#endregion
|
|
494
581
|
//#region src/MonthList.d.ts
|
|
495
582
|
/**
|
|
@@ -627,7 +714,7 @@ declare function DateRangePicker({ value, onChange, formatLabel, weekStartsOn, h
|
|
|
627
714
|
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
628
715
|
* slot via the `classNames` / `styles` props.
|
|
629
716
|
*/
|
|
630
|
-
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "event" | "eventBox" | "createGhost";
|
|
717
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
631
718
|
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
632
719
|
interface Resource {
|
|
633
720
|
/** Stable id events reference via their `resourceId`. */
|
|
@@ -660,6 +747,19 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
660
747
|
orientation?: "horizontal" | "vertical";
|
|
661
748
|
/** The resource lanes: rows when horizontal, columns when vertical. */
|
|
662
749
|
resources: Resource[];
|
|
750
|
+
/**
|
|
751
|
+
* Cap the number of lanes shown at once; the rest sit on further pages. Pair
|
|
752
|
+
* with `resourcePage` and your own prev/next controls to page through them
|
|
753
|
+
* (like `date` drives the time axis). Omit to show every lane, sharing the
|
|
754
|
+
* available space.
|
|
755
|
+
*/
|
|
756
|
+
resourcesPerPage?: number;
|
|
757
|
+
/**
|
|
758
|
+
* The 0-based page of lanes to show when `resourcesPerPage` is set (default
|
|
759
|
+
* 0, clamped to the last page). Controlled: update it from your own paging
|
|
760
|
+
* controls.
|
|
761
|
+
*/
|
|
762
|
+
resourcePage?: number;
|
|
663
763
|
/** Events; each is placed in the row named by `resourceId(event)`. */
|
|
664
764
|
events: CalendarEvent$1<T>[];
|
|
665
765
|
/** Read an event's resource id. Default: `event.resourceId`. */
|
|
@@ -688,7 +788,7 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
688
788
|
* Enables drag-to-move and edge-resize along the time axis; called with the
|
|
689
789
|
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
690
790
|
*/
|
|
691
|
-
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
791
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
692
792
|
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
693
793
|
onPressCell?: (at: Date, resource: Resource) => void;
|
|
694
794
|
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
@@ -698,12 +798,24 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
698
798
|
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
699
799
|
* (return `null` for a fully closed lane). A date-only function is accepted.
|
|
700
800
|
*/
|
|
701
|
-
businessHours?: (date: Date, resource: Resource) =>
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
801
|
+
businessHours?: (date: Date, resource: Resource) => BusinessHoursValue;
|
|
802
|
+
/**
|
|
803
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern). The
|
|
804
|
+
* board keeps positioning the band; when set, the themed tint is dropped and
|
|
805
|
+
* your output fills the band instead. Receives the lane's resource. Decorative only: the
|
|
806
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
807
|
+
*/
|
|
808
|
+
renderBusinessHours?: (band: BusinessHoursBand$1 & {
|
|
809
|
+
resource: Resource;
|
|
810
|
+
}) => ReactNode;
|
|
705
811
|
/** Snap dragged events to this many minutes (default 15). */
|
|
706
812
|
dragStepMinutes?: number;
|
|
813
|
+
/** Show the current-time line when `date` is today (default true). */
|
|
814
|
+
showNowIndicator?: boolean;
|
|
815
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
816
|
+
now?: Date;
|
|
817
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
818
|
+
timeZone?: string;
|
|
707
819
|
/** Class applied to the root element. */
|
|
708
820
|
className?: string;
|
|
709
821
|
/** Inline styles applied to the root element. */
|
|
@@ -725,6 +837,6 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
725
837
|
* />
|
|
726
838
|
* ```
|
|
727
839
|
*/
|
|
728
|
-
declare function ResourceTimeline<T = unknown>({ date, orientation, resources, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, onPressCell, onCreateEvent, businessHours, dragStepMinutes, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
840
|
+
declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, onPressCell, onCreateEvent, businessHours, renderBusinessHours, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
729
841
|
//#endregion
|
|
730
|
-
export { Agenda, type AgendaProps, type AgendaSlot, type BusinessHours, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, type CalendarSlot, DatePicker, type DatePickerProps, type DatePickerSlot, type DateRange, DateRangePicker, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthView, type MonthViewProps, type MonthViewSlot, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, type ResourceTimelineSlot, type SlotDefault, type SlotStyleProps, TimeGrid, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, buildMonthGrid, darkDomTheme, daySelectionState, defaultDomTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, mergeDomTheme, nextDateRange, parseICalendar, toICalendar, useDateRange, useMonthGrid, weekdayFormatToken };
|
|
842
|
+
export { Agenda, type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, type CalendarSlot, DatePicker, type DatePickerProps, type DatePickerSlot, type DateRange, DateRangePicker, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthView, type MonthViewProps, type MonthViewSlot, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, type ResourceTimelineSlot, type SlotDefault, type SlotStyleProps, TimeGrid, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, YearView, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, darkDomTheme, daySelectionState, defaultDomTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, mergeDomTheme, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|