@super-calendar/dom 2.6.0 → 2.8.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 +111 -16
- package/dist/index.d.ts +111 -16
- package/dist/index.js +811 -250
- package/dist/index.mjs +783 -252
- package/package.json +2 -2
- package/src/Agenda.tsx +5 -2
- package/src/Calendar.tsx +42 -0
- package/src/MonthList.tsx +3 -1
- package/src/MonthView.tsx +441 -174
- package/src/ResourceTimeline.tsx +286 -24
- package/src/TimeGrid.tsx +427 -87
- package/src/YearView.tsx +14 -4
- package/src/index.ts +8 -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, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, 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, layoutMonthWeek, 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
|
|
@@ -136,6 +136,8 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
136
136
|
events?: CalendarEvent$1<T>[];
|
|
137
137
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
138
138
|
weekStartsOn?: WeekStartsOn$1;
|
|
139
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
140
|
+
hiddenDays?: number[];
|
|
139
141
|
locale?: Locale;
|
|
140
142
|
/** Highlight this date instead of the real "today". */
|
|
141
143
|
activeDate?: Date;
|
|
@@ -160,14 +162,14 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
160
162
|
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
161
163
|
* renders for `mode="year"`.
|
|
162
164
|
*/
|
|
163
|
-
declare function YearView<T = unknown>({ date, events, weekStartsOn, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
165
|
+
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
164
166
|
//#endregion
|
|
165
167
|
//#region src/MonthView.d.ts
|
|
166
168
|
/**
|
|
167
169
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
168
170
|
* the `classNames` / `styles` props to restyle just that part.
|
|
169
171
|
*/
|
|
170
|
-
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";
|
|
171
173
|
/** Props passed to a custom month event chip renderer. */
|
|
172
174
|
interface DomMonthEventArgs<T = unknown> {
|
|
173
175
|
/** The event to render. */
|
|
@@ -183,6 +185,8 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
183
185
|
date: Date;
|
|
184
186
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
185
187
|
weekStartsOn?: WeekStartsOn$1;
|
|
188
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
189
|
+
hiddenDays?: number[];
|
|
186
190
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
187
191
|
weekdayFormat?: WeekdayFormat$1;
|
|
188
192
|
/**
|
|
@@ -199,7 +203,12 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
199
203
|
* announce. Defaults to the event title and day (e.g. "Standup, 15 July").
|
|
200
204
|
*/
|
|
201
205
|
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
202
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Max event lanes (stacked rows) shown per week before the rest of a day's
|
|
208
|
+
* events collapse into a "+N more" row (default 3). Because multi-day events draw
|
|
209
|
+
* as one bar spanning a lane across the week, this caps lanes per row, not chips
|
|
210
|
+
* per day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
211
|
+
*/
|
|
203
212
|
maxVisibleEventCount?: number;
|
|
204
213
|
/** Template for the overflow row; `{moreCount}` is replaced (default "{moreCount} More"). */
|
|
205
214
|
moreLabel?: string;
|
|
@@ -259,14 +268,14 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
259
268
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
260
269
|
* ```
|
|
261
270
|
*/
|
|
262
|
-
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;
|
|
271
|
+
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;
|
|
263
272
|
//#endregion
|
|
264
273
|
//#region src/TimeGrid.d.ts
|
|
265
274
|
/**
|
|
266
275
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
267
276
|
* the `classNames` / `styles` props.
|
|
268
277
|
*/
|
|
269
|
-
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
278
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
270
279
|
/** Props passed to a custom time-grid event renderer. */
|
|
271
280
|
interface DomRenderEventArgs<T = unknown> {
|
|
272
281
|
/** The event to render. */
|
|
@@ -328,12 +337,35 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
328
337
|
showWeekNumber?: boolean;
|
|
329
338
|
/** Prefix for the week number, e.g. "W" → "W28". Default "W". */
|
|
330
339
|
weekNumberPrefix?: string;
|
|
340
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
341
|
+
hiddenDays?: number[];
|
|
331
342
|
/** Shade the hours outside business hours; `null` shades the whole day. */
|
|
332
343
|
businessHours?: BusinessHours$1;
|
|
344
|
+
/**
|
|
345
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
346
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
347
|
+
* and your output fills the band instead. Decorative only: the
|
|
348
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
349
|
+
*/
|
|
350
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
333
351
|
/** Show the current-time indicator on today's column (default true). */
|
|
334
352
|
showNowIndicator?: boolean;
|
|
353
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
354
|
+
now?: Date;
|
|
355
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
356
|
+
timeZone?: string;
|
|
335
357
|
/** Show the all-day lane above the grid (default true). */
|
|
336
358
|
showAllDayEventCell?: boolean;
|
|
359
|
+
/** Tint Saturday/Sunday columns with the weekend background (default true). Set
|
|
360
|
+
* false to treat weekends like any other day. */
|
|
361
|
+
highlightWeekends?: boolean;
|
|
362
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
363
|
+
eventStartEditable?: boolean;
|
|
364
|
+
/** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
|
|
365
|
+
eventDurationEditable?: boolean;
|
|
366
|
+
/** Allow a dragged/resized event to overlap another (default true). Set false to
|
|
367
|
+
* reject a drop that would collide, snapping the event back. */
|
|
368
|
+
eventOverlap?: boolean;
|
|
337
369
|
/** date-fns locale for the column headers and time labels. */
|
|
338
370
|
locale?: Locale;
|
|
339
371
|
/** Theme overrides; falls back to the default light theme. */
|
|
@@ -374,6 +406,13 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
374
406
|
* Return `false` to reject the drop (the event snaps back).
|
|
375
407
|
*/
|
|
376
408
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
411
|
+
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
412
|
+
* dwelling briefly pages the view so the event can be dropped on a day in the
|
|
413
|
+
* previous/next period. Controlled, like the native renderer's `onChangeDate`.
|
|
414
|
+
*/
|
|
415
|
+
onChangeDate?: (date: Date) => void;
|
|
377
416
|
/** Class applied to the root element. */
|
|
378
417
|
className?: string;
|
|
379
418
|
/** Inline styles applied to the root element. */
|
|
@@ -390,7 +429,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
390
429
|
* <TimeGrid mode="week" date={new Date()} events={events} />
|
|
391
430
|
* ```
|
|
392
431
|
*/
|
|
393
|
-
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;
|
|
432
|
+
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, eventStartEditable, eventDurationEditable, eventOverlap, 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;
|
|
394
433
|
//#endregion
|
|
395
434
|
//#region src/Calendar.d.ts
|
|
396
435
|
/**
|
|
@@ -419,6 +458,14 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
419
458
|
events?: CalendarEvent$1<T>[];
|
|
420
459
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
421
460
|
weekStartsOn?: WeekStartsOn$1;
|
|
461
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
462
|
+
hiddenDays?: number[];
|
|
463
|
+
/**
|
|
464
|
+
* Fixed "now" instant for the current-time indicator (doesn't tick), e.g. a
|
|
465
|
+
* server-synced clock. Defaults to the device clock, shifted into `timeZone`
|
|
466
|
+
* when one is set so the line matches the displayed events.
|
|
467
|
+
*/
|
|
468
|
+
now?: Date;
|
|
422
469
|
/** Column count for `mode="custom"`. */
|
|
423
470
|
numberOfDays?: number;
|
|
424
471
|
/** date-fns locale for titles, headers, and time labels. */
|
|
@@ -465,10 +512,25 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
465
512
|
weekNumberPrefix?: string;
|
|
466
513
|
/** Shade the hours outside business hours. */
|
|
467
514
|
businessHours?: BusinessHours$1;
|
|
515
|
+
/**
|
|
516
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
517
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
518
|
+
* and your output fills the band instead. Decorative only: the
|
|
519
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
520
|
+
*/
|
|
521
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
468
522
|
/** Show the current-time indicator (default true). */
|
|
469
523
|
showNowIndicator?: boolean;
|
|
470
524
|
/** Show the all-day lane (default true). */
|
|
471
525
|
showAllDayEventCell?: boolean;
|
|
526
|
+
/** Tint weekend columns (default true). Set false to treat weekends normally. */
|
|
527
|
+
highlightWeekends?: boolean;
|
|
528
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
529
|
+
eventStartEditable?: boolean;
|
|
530
|
+
/** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
|
|
531
|
+
eventDurationEditable?: boolean;
|
|
532
|
+
/** Reject drags/resizes that would overlap another event (default true = allowed). */
|
|
533
|
+
eventOverlap?: boolean;
|
|
472
534
|
/** Snap dragged/created events to this many minutes. */
|
|
473
535
|
dragStepMinutes?: number;
|
|
474
536
|
/** Tap empty grid space. */
|
|
@@ -532,7 +594,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
532
594
|
* <Calendar mode="week" date={new Date()} events={events} />
|
|
533
595
|
* ```
|
|
534
596
|
*/
|
|
535
|
-
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, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
597
|
+
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;
|
|
536
598
|
//#endregion
|
|
537
599
|
//#region src/MonthList.d.ts
|
|
538
600
|
/**
|
|
@@ -670,7 +732,7 @@ declare function DateRangePicker({ value, onChange, formatLabel, weekStartsOn, h
|
|
|
670
732
|
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
671
733
|
* slot via the `classNames` / `styles` props.
|
|
672
734
|
*/
|
|
673
|
-
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "event" | "eventBox" | "createGhost";
|
|
735
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
674
736
|
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
675
737
|
interface Resource {
|
|
676
738
|
/** Stable id events reference via their `resourceId`. */
|
|
@@ -703,6 +765,19 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
703
765
|
orientation?: "horizontal" | "vertical";
|
|
704
766
|
/** The resource lanes: rows when horizontal, columns when vertical. */
|
|
705
767
|
resources: Resource[];
|
|
768
|
+
/**
|
|
769
|
+
* Cap the number of lanes shown at once; the rest sit on further pages. Pair
|
|
770
|
+
* with `resourcePage` and your own prev/next controls to page through them
|
|
771
|
+
* (like `date` drives the time axis). Omit to show every lane, sharing the
|
|
772
|
+
* available space.
|
|
773
|
+
*/
|
|
774
|
+
resourcesPerPage?: number;
|
|
775
|
+
/**
|
|
776
|
+
* The 0-based page of lanes to show when `resourcesPerPage` is set (default
|
|
777
|
+
* 0, clamped to the last page). Controlled: update it from your own paging
|
|
778
|
+
* controls.
|
|
779
|
+
*/
|
|
780
|
+
resourcePage?: number;
|
|
706
781
|
/** Events; each is placed in the row named by `resourceId(event)`. */
|
|
707
782
|
events: CalendarEvent$1<T>[];
|
|
708
783
|
/** Read an event's resource id. Default: `event.resourceId`. */
|
|
@@ -731,7 +806,7 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
731
806
|
* Enables drag-to-move and edge-resize along the time axis; called with the
|
|
732
807
|
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
733
808
|
*/
|
|
734
|
-
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
809
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
735
810
|
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
736
811
|
onPressCell?: (at: Date, resource: Resource) => void;
|
|
737
812
|
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
@@ -741,12 +816,32 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
741
816
|
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
742
817
|
* (return `null` for a fully closed lane). A date-only function is accepted.
|
|
743
818
|
*/
|
|
744
|
-
businessHours?: (date: Date, resource: Resource) =>
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
819
|
+
businessHours?: (date: Date, resource: Resource) => BusinessHoursValue;
|
|
820
|
+
/**
|
|
821
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern). The
|
|
822
|
+
* board keeps positioning the band; when set, the themed tint is dropped and
|
|
823
|
+
* your output fills the band instead. Receives the lane's resource. Decorative only: the
|
|
824
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
825
|
+
*/
|
|
826
|
+
renderBusinessHours?: (band: BusinessHoursBand$1 & {
|
|
827
|
+
resource: Resource;
|
|
828
|
+
}) => ReactNode;
|
|
829
|
+
/**
|
|
830
|
+
* Render each resource's header cell yourself (an avatar, a subtitle, a status
|
|
831
|
+
* dot). Receives the resource and its index; return the cell's content. The board
|
|
832
|
+
* keeps the header cell's sizing so columns stay aligned, so this replaces only
|
|
833
|
+
* the label content. Falls back to the resource title (or id). Applies to both
|
|
834
|
+
* orientations: the top header cells when vertical, the row labels when horizontal.
|
|
835
|
+
*/
|
|
836
|
+
renderResourceHeader?: (resource: Resource, index: number) => ReactNode;
|
|
748
837
|
/** Snap dragged events to this many minutes (default 15). */
|
|
749
838
|
dragStepMinutes?: number;
|
|
839
|
+
/** Show the current-time line when `date` is today (default true). */
|
|
840
|
+
showNowIndicator?: boolean;
|
|
841
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
842
|
+
now?: Date;
|
|
843
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
844
|
+
timeZone?: string;
|
|
750
845
|
/** Class applied to the root element. */
|
|
751
846
|
className?: string;
|
|
752
847
|
/** Inline styles applied to the root element. */
|
|
@@ -768,6 +863,6 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
768
863
|
* />
|
|
769
864
|
* ```
|
|
770
865
|
*/
|
|
771
|
-
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;
|
|
866
|
+
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, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
772
867
|
//#endregion
|
|
773
|
-
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, YearView, type YearViewProps, type YearViewSlot, buildMonthGrid, darkDomTheme, daySelectionState, defaultDomTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, mergeDomTheme, nextDateRange, parseICalendar, toICalendar, useDateRange, useMonthGrid, weekdayFormatToken };
|
|
868
|
+
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 MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, 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, layoutMonthWeek, 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, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, 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, layoutMonthWeek, 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
|
|
@@ -136,6 +136,8 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
136
136
|
events?: CalendarEvent$1<T>[];
|
|
137
137
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
138
138
|
weekStartsOn?: WeekStartsOn$1;
|
|
139
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
140
|
+
hiddenDays?: number[];
|
|
139
141
|
locale?: Locale;
|
|
140
142
|
/** Highlight this date instead of the real "today". */
|
|
141
143
|
activeDate?: Date;
|
|
@@ -160,14 +162,14 @@ interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot> {
|
|
|
160
162
|
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
161
163
|
* renders for `mode="year"`.
|
|
162
164
|
*/
|
|
163
|
-
declare function YearView<T = unknown>({ date, events, weekStartsOn, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
165
|
+
declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
164
166
|
//#endregion
|
|
165
167
|
//#region src/MonthView.d.ts
|
|
166
168
|
/**
|
|
167
169
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
168
170
|
* the `classNames` / `styles` props to restyle just that part.
|
|
169
171
|
*/
|
|
170
|
-
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";
|
|
171
173
|
/** Props passed to a custom month event chip renderer. */
|
|
172
174
|
interface DomMonthEventArgs<T = unknown> {
|
|
173
175
|
/** The event to render. */
|
|
@@ -183,6 +185,8 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
183
185
|
date: Date;
|
|
184
186
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
185
187
|
weekStartsOn?: WeekStartsOn$1;
|
|
188
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
189
|
+
hiddenDays?: number[];
|
|
186
190
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
187
191
|
weekdayFormat?: WeekdayFormat$1;
|
|
188
192
|
/**
|
|
@@ -199,7 +203,12 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
199
203
|
* announce. Defaults to the event title and day (e.g. "Standup, 15 July").
|
|
200
204
|
*/
|
|
201
205
|
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
202
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Max event lanes (stacked rows) shown per week before the rest of a day's
|
|
208
|
+
* events collapse into a "+N more" row (default 3). Because multi-day events draw
|
|
209
|
+
* as one bar spanning a lane across the week, this caps lanes per row, not chips
|
|
210
|
+
* per day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
211
|
+
*/
|
|
203
212
|
maxVisibleEventCount?: number;
|
|
204
213
|
/** Template for the overflow row; `{moreCount}` is replaced (default "{moreCount} More"). */
|
|
205
214
|
moreLabel?: string;
|
|
@@ -259,14 +268,14 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
259
268
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
260
269
|
* ```
|
|
261
270
|
*/
|
|
262
|
-
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;
|
|
271
|
+
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;
|
|
263
272
|
//#endregion
|
|
264
273
|
//#region src/TimeGrid.d.ts
|
|
265
274
|
/**
|
|
266
275
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
267
276
|
* the `classNames` / `styles` props.
|
|
268
277
|
*/
|
|
269
|
-
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
278
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
270
279
|
/** Props passed to a custom time-grid event renderer. */
|
|
271
280
|
interface DomRenderEventArgs<T = unknown> {
|
|
272
281
|
/** The event to render. */
|
|
@@ -328,12 +337,35 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
328
337
|
showWeekNumber?: boolean;
|
|
329
338
|
/** Prefix for the week number, e.g. "W" → "W28". Default "W". */
|
|
330
339
|
weekNumberPrefix?: string;
|
|
340
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
341
|
+
hiddenDays?: number[];
|
|
331
342
|
/** Shade the hours outside business hours; `null` shades the whole day. */
|
|
332
343
|
businessHours?: BusinessHours$1;
|
|
344
|
+
/**
|
|
345
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
346
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
347
|
+
* and your output fills the band instead. Decorative only: the
|
|
348
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
349
|
+
*/
|
|
350
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
333
351
|
/** Show the current-time indicator on today's column (default true). */
|
|
334
352
|
showNowIndicator?: boolean;
|
|
353
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
354
|
+
now?: Date;
|
|
355
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
356
|
+
timeZone?: string;
|
|
335
357
|
/** Show the all-day lane above the grid (default true). */
|
|
336
358
|
showAllDayEventCell?: boolean;
|
|
359
|
+
/** Tint Saturday/Sunday columns with the weekend background (default true). Set
|
|
360
|
+
* false to treat weekends like any other day. */
|
|
361
|
+
highlightWeekends?: boolean;
|
|
362
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
363
|
+
eventStartEditable?: boolean;
|
|
364
|
+
/** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
|
|
365
|
+
eventDurationEditable?: boolean;
|
|
366
|
+
/** Allow a dragged/resized event to overlap another (default true). Set false to
|
|
367
|
+
* reject a drop that would collide, snapping the event back. */
|
|
368
|
+
eventOverlap?: boolean;
|
|
337
369
|
/** date-fns locale for the column headers and time labels. */
|
|
338
370
|
locale?: Locale;
|
|
339
371
|
/** Theme overrides; falls back to the default light theme. */
|
|
@@ -374,6 +406,13 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
374
406
|
* Return `false` to reject the drop (the event snaps back).
|
|
375
407
|
*/
|
|
376
408
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
411
|
+
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
412
|
+
* dwelling briefly pages the view so the event can be dropped on a day in the
|
|
413
|
+
* previous/next period. Controlled, like the native renderer's `onChangeDate`.
|
|
414
|
+
*/
|
|
415
|
+
onChangeDate?: (date: Date) => void;
|
|
377
416
|
/** Class applied to the root element. */
|
|
378
417
|
className?: string;
|
|
379
418
|
/** Inline styles applied to the root element. */
|
|
@@ -390,7 +429,7 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
390
429
|
* <TimeGrid mode="week" date={new Date()} events={events} />
|
|
391
430
|
* ```
|
|
392
431
|
*/
|
|
393
|
-
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;
|
|
432
|
+
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, eventStartEditable, eventDurationEditable, eventOverlap, 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;
|
|
394
433
|
//#endregion
|
|
395
434
|
//#region src/Calendar.d.ts
|
|
396
435
|
/**
|
|
@@ -419,6 +458,14 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
419
458
|
events?: CalendarEvent$1<T>[];
|
|
420
459
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
421
460
|
weekStartsOn?: WeekStartsOn$1;
|
|
461
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
462
|
+
hiddenDays?: number[];
|
|
463
|
+
/**
|
|
464
|
+
* Fixed "now" instant for the current-time indicator (doesn't tick), e.g. a
|
|
465
|
+
* server-synced clock. Defaults to the device clock, shifted into `timeZone`
|
|
466
|
+
* when one is set so the line matches the displayed events.
|
|
467
|
+
*/
|
|
468
|
+
now?: Date;
|
|
422
469
|
/** Column count for `mode="custom"`. */
|
|
423
470
|
numberOfDays?: number;
|
|
424
471
|
/** date-fns locale for titles, headers, and time labels. */
|
|
@@ -465,10 +512,25 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
465
512
|
weekNumberPrefix?: string;
|
|
466
513
|
/** Shade the hours outside business hours. */
|
|
467
514
|
businessHours?: BusinessHours$1;
|
|
515
|
+
/**
|
|
516
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
517
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
518
|
+
* and your output fills the band instead. Decorative only: the
|
|
519
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
520
|
+
*/
|
|
521
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => ReactNode;
|
|
468
522
|
/** Show the current-time indicator (default true). */
|
|
469
523
|
showNowIndicator?: boolean;
|
|
470
524
|
/** Show the all-day lane (default true). */
|
|
471
525
|
showAllDayEventCell?: boolean;
|
|
526
|
+
/** Tint weekend columns (default true). Set false to treat weekends normally. */
|
|
527
|
+
highlightWeekends?: boolean;
|
|
528
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
529
|
+
eventStartEditable?: boolean;
|
|
530
|
+
/** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
|
|
531
|
+
eventDurationEditable?: boolean;
|
|
532
|
+
/** Reject drags/resizes that would overlap another event (default true = allowed). */
|
|
533
|
+
eventOverlap?: boolean;
|
|
472
534
|
/** Snap dragged/created events to this many minutes. */
|
|
473
535
|
dragStepMinutes?: number;
|
|
474
536
|
/** Tap empty grid space. */
|
|
@@ -532,7 +594,7 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
532
594
|
* <Calendar mode="week" date={new Date()} events={events} />
|
|
533
595
|
* ```
|
|
534
596
|
*/
|
|
535
|
-
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, onPressMonth, onPressMore, renderMonthEvent, renderScheduleEvent, classNames, styles }: CalendarProps<T>): ReactElement;
|
|
597
|
+
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;
|
|
536
598
|
//#endregion
|
|
537
599
|
//#region src/MonthList.d.ts
|
|
538
600
|
/**
|
|
@@ -670,7 +732,7 @@ declare function DateRangePicker({ value, onChange, formatLabel, weekStartsOn, h
|
|
|
670
732
|
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
671
733
|
* slot via the `classNames` / `styles` props.
|
|
672
734
|
*/
|
|
673
|
-
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "event" | "eventBox" | "createGhost";
|
|
735
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
674
736
|
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
675
737
|
interface Resource {
|
|
676
738
|
/** Stable id events reference via their `resourceId`. */
|
|
@@ -703,6 +765,19 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
703
765
|
orientation?: "horizontal" | "vertical";
|
|
704
766
|
/** The resource lanes: rows when horizontal, columns when vertical. */
|
|
705
767
|
resources: Resource[];
|
|
768
|
+
/**
|
|
769
|
+
* Cap the number of lanes shown at once; the rest sit on further pages. Pair
|
|
770
|
+
* with `resourcePage` and your own prev/next controls to page through them
|
|
771
|
+
* (like `date` drives the time axis). Omit to show every lane, sharing the
|
|
772
|
+
* available space.
|
|
773
|
+
*/
|
|
774
|
+
resourcesPerPage?: number;
|
|
775
|
+
/**
|
|
776
|
+
* The 0-based page of lanes to show when `resourcesPerPage` is set (default
|
|
777
|
+
* 0, clamped to the last page). Controlled: update it from your own paging
|
|
778
|
+
* controls.
|
|
779
|
+
*/
|
|
780
|
+
resourcePage?: number;
|
|
706
781
|
/** Events; each is placed in the row named by `resourceId(event)`. */
|
|
707
782
|
events: CalendarEvent$1<T>[];
|
|
708
783
|
/** Read an event's resource id. Default: `event.resourceId`. */
|
|
@@ -731,7 +806,7 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
731
806
|
* Enables drag-to-move and edge-resize along the time axis; called with the
|
|
732
807
|
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
733
808
|
*/
|
|
734
|
-
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
809
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
735
810
|
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
736
811
|
onPressCell?: (at: Date, resource: Resource) => void;
|
|
737
812
|
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
@@ -741,12 +816,32 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
741
816
|
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
742
817
|
* (return `null` for a fully closed lane). A date-only function is accepted.
|
|
743
818
|
*/
|
|
744
|
-
businessHours?: (date: Date, resource: Resource) =>
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
819
|
+
businessHours?: (date: Date, resource: Resource) => BusinessHoursValue;
|
|
820
|
+
/**
|
|
821
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern). The
|
|
822
|
+
* board keeps positioning the band; when set, the themed tint is dropped and
|
|
823
|
+
* your output fills the band instead. Receives the lane's resource. Decorative only: the
|
|
824
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
825
|
+
*/
|
|
826
|
+
renderBusinessHours?: (band: BusinessHoursBand$1 & {
|
|
827
|
+
resource: Resource;
|
|
828
|
+
}) => ReactNode;
|
|
829
|
+
/**
|
|
830
|
+
* Render each resource's header cell yourself (an avatar, a subtitle, a status
|
|
831
|
+
* dot). Receives the resource and its index; return the cell's content. The board
|
|
832
|
+
* keeps the header cell's sizing so columns stay aligned, so this replaces only
|
|
833
|
+
* the label content. Falls back to the resource title (or id). Applies to both
|
|
834
|
+
* orientations: the top header cells when vertical, the row labels when horizontal.
|
|
835
|
+
*/
|
|
836
|
+
renderResourceHeader?: (resource: Resource, index: number) => ReactNode;
|
|
748
837
|
/** Snap dragged events to this many minutes (default 15). */
|
|
749
838
|
dragStepMinutes?: number;
|
|
839
|
+
/** Show the current-time line when `date` is today (default true). */
|
|
840
|
+
showNowIndicator?: boolean;
|
|
841
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
842
|
+
now?: Date;
|
|
843
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
844
|
+
timeZone?: string;
|
|
750
845
|
/** Class applied to the root element. */
|
|
751
846
|
className?: string;
|
|
752
847
|
/** Inline styles applied to the root element. */
|
|
@@ -768,6 +863,6 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
768
863
|
* />
|
|
769
864
|
* ```
|
|
770
865
|
*/
|
|
771
|
-
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;
|
|
866
|
+
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, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
772
867
|
//#endregion
|
|
773
|
-
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, YearView, type YearViewProps, type YearViewSlot, buildMonthGrid, darkDomTheme, daySelectionState, defaultDomTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, mergeDomTheme, nextDateRange, parseICalendar, toICalendar, useDateRange, useMonthGrid, weekdayFormatToken };
|
|
868
|
+
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 MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, 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, layoutMonthWeek, mergeDomTheme, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|