@ilamy/calendar 3.2.1 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -47,6 +47,27 @@ interface CalendarEvent {
47
47
  * @example { meetingType: 'standup', attendees: ['john', 'jane'] }
48
48
  */
49
49
  data?: Record<string, unknown>;
50
+ /**
51
+ * Whether this event can be moved. Beats the calendar's
52
+ * `editable`; `startEditable` beats this one (FullCalendar
53
+ * `event.editable`).
54
+ */
55
+ editable?: boolean;
56
+ /** Whether this event can be moved. Defaults to `editable`. */
57
+ startEditable?: boolean;
58
+ /** Whether this event can be resized by its edges. Defaults to `editable`. */
59
+ durationEditable?: boolean;
60
+ }
61
+ /**
62
+ * A candidate placement for a dragged event, handed to `eventAllow` (the
63
+ * counterpart of FullCalendar's `DateSpanApi` plus the resource).
64
+ */
65
+ interface EventDropInfo {
66
+ start: Dayjs2;
67
+ end: Dayjs2;
68
+ allDay: boolean;
69
+ /** The resource the event would land on, in resource views. */
70
+ resourceId?: string | number;
50
71
  }
51
72
  /**
52
73
  * Supported days of the week for calendar configuration.
@@ -134,6 +155,23 @@ interface PluginMutationResult {
134
155
  added: CalendarEvent[];
135
156
  /** Existing rows to persist via `onEventDelete`. */
136
157
  deleted: CalendarEvent[];
158
+ /**
159
+ * The update as it was stored, when that is less than what was asked: a
160
+ * scope that keeps its own day applies only the time of day of a drop on
161
+ * another day. `delta` and `endDelta` describe these, not the request.
162
+ * Omit it when the update was stored as asked.
163
+ */
164
+ appliedUpdates?: Partial<CalendarEvent>;
165
+ }
166
+ /**
167
+ * How far an update moved an event's start: whole calendar days plus the change
168
+ * in wall-clock time of day.
169
+ */
170
+ interface EventDelta {
171
+ /** Whole calendar days, in the calendar's zone. */
172
+ days: number;
173
+ /** Change in the time of day on the wall clock, in milliseconds. */
174
+ milliseconds: number;
137
175
  }
138
176
  /**
139
177
  * One user action and every stored row it touched, reported once through
@@ -146,7 +184,10 @@ interface PluginMutationResult {
146
184
  interface EventsChange {
147
185
  /** What the user did. */
148
186
  action: "add" | "update" | "delete";
149
- /** The event the user acted on, as it was shown (an occurrence, for a series). */
187
+ /**
188
+ * The event the user acted on, as it was shown before the change (an
189
+ * occurrence, for a series). The changed rows are in `updated`.
190
+ */
150
191
  event: CalendarEvent;
151
192
  /**
152
193
  * The scope chosen in the plugin's scope dialog, when a plugin manages the
@@ -160,6 +201,34 @@ interface EventsChange {
160
201
  updated: CalendarEvent[];
161
202
  /** Removed rows, the same ones passed to `onEventDelete`. */
162
203
  deleted: CalendarEvent[];
204
+ /**
205
+ * For `'update'`: how far the event's start moved (zero when it did not).
206
+ * Undefined for `'add'` and `'delete'`. A timed event that became all-day is
207
+ * measured from the start of its own day.
208
+ */
209
+ delta?: EventDelta;
210
+ /**
211
+ * For `'update'`: how far the event's end moved (zero when it did not),
212
+ * measured the same way as `delta`, from the two ends as they are. A resize
213
+ * from the end edge sets only this one and a resize from the start edge only
214
+ * `delta`. A move sets both to the same amount, except that a timed event
215
+ * moved onto the all-day row has `delta` measured from the start of its day,
216
+ * so the two can differ. Undefined for `'add'` and `'delete'`.
217
+ *
218
+ * FullCalendar reports a resize through its own `eventResize` callback with
219
+ * `startDelta` and `endDelta`; ilamy reports every action once, through
220
+ * `onEventsChange` (#309), so `delta` is the `startDelta`.
221
+ */
222
+ endDelta?: EventDelta;
223
+ /**
224
+ * Undoes the whole action in the calendar's own store: removes `added`,
225
+ * restores the previous version of every row in `updated`, and puts back
226
+ * `deleted`. A later edit of one of those rows is overwritten; rows other
227
+ * actions added or changed since are kept. It fires no callbacks, and
228
+ * calling it again does nothing. A consumer that controls `events` reverts
229
+ * its own state instead.
230
+ */
231
+ revert: () => void;
163
232
  }
164
233
  /**
165
234
  * Calendar configuration handed to a view's `columns()`/`renderHeader()`.
@@ -169,12 +238,23 @@ interface EventsChange {
169
238
  */
170
239
  interface ViewConfig {
171
240
  firstDayOfWeek: number;
241
+ /** Weekdays (0 = Sunday) the view does not draw. Absent when none are hidden. */
172
242
  hiddenDays?: Set<number>;
173
243
  businessHours?: BusinessHours | BusinessHours[];
174
244
  hideNonBusinessHours?: boolean;
245
+ /** First visible time in hour grids, `'HH:mm'`. Unset shows from midnight. */
246
+ slotMinTime?: string;
247
+ /** End of the visible time in hour grids, exclusive, `'HH:mm'` up to `'24:00'`. */
248
+ slotMaxTime?: string;
175
249
  /** The resource axis. Set only when the calendar renders resources. */
176
250
  resources?: Resource[];
177
251
  /**
252
+ * Whether the calendar is a resource calendar: it has resources, or is still
253
+ * loading them (then `resources` is empty or absent). When absent, it is
254
+ * derived from `resources` being non-empty.
255
+ */
256
+ hasResourceAxis?: boolean;
257
+ /**
178
258
  * The calendar-level resource arrangement (the user's choice): where the
179
259
  * resource axis goes. Only meaningful when `resources` is set.
180
260
  */
@@ -226,6 +306,11 @@ interface HorizontalRowSpec {
226
306
  columns?: HorizontalCellSpec[];
227
307
  className?: string;
228
308
  showDayNumber?: boolean;
309
+ /**
310
+ * Marks the row as one calendar week, so it shows its week number at its
311
+ * start when the calendar's `weekNumbers` is `true`.
312
+ */
313
+ showWeekNumber?: boolean;
229
314
  /** Resource-axis identity when the row belongs to one resource. */
230
315
  resource?: Resource;
231
316
  }
@@ -396,7 +481,8 @@ type DayjsStatics = { [K in keyof typeof dayjs] : (typeof dayjs)[K] };
396
481
  * keeps it a compile error either way. Format parsing would additionally need the
397
482
  * CustomParseFormat plugin, which this module deliberately does not extend
398
483
  * (https://day.js.org/docs/en/parse/string-format). To read a bare wall-clock
399
- * string as a time in a given zone, call `dayjs.tz(input, timezone)`.
484
+ * string as a time in a given zone, call `readInZone(input, timezone)`:
485
+ * `dayjs.tz(input, timezone)` reads a repeated autumn time by today's offset.
400
486
  */
401
487
  type ConfiguredDayjs = ((date?: ConfigType) => DayjsInstance) & DayjsStatics;
402
488
  declare const _default: ConfiguredDayjs;
@@ -421,6 +507,15 @@ declare const defaultTranslations: {
421
507
  endDate: string;
422
508
  startTime: string;
423
509
  searchTime: string;
510
+ selectTime: string;
511
+ noTimeFound: string;
512
+ pickDate: string;
513
+ previousMonth: string;
514
+ nextMonth: string;
515
+ previousYear: string;
516
+ nextYear: string;
517
+ previousYears: string;
518
+ nextYears: string;
424
519
  endTime: string;
425
520
  color: string;
426
521
  createEvent: string;
@@ -508,8 +603,9 @@ interface EventFormProps {
508
603
  onDelete?: (event: CalendarEvent) => void;
509
604
  onClose: () => void;
510
605
  }
606
+ import React4 from "react";
607
+ import { ReactNode as ReactNode6, Ref } from "react";
511
608
  import React3 from "react";
512
- import { ReactNode as ReactNode4 } from "react";
513
609
  /**
514
610
  * Available calendar view types. The built-in views (day, week, month, year)
515
611
  * are `PluginView` specs in `features/calendar/components/views`; plugins may
@@ -521,11 +617,109 @@ type CalendarView = string;
521
617
  */
522
618
  type TimeFormat = "12-hour" | "24-hour";
523
619
  /**
620
+ * The public calendar API surface exposed by useIlamyCalendarContext() — for consumers and plugin
621
+ * components. The full internal context is intentionally not exported.
622
+ */
623
+ interface IlamyCalendarApi {
624
+ readonly currentDate: Dayjs3;
625
+ /** The active view's current visible date range (what is on screen). */
626
+ readonly currentRange: DateRange;
627
+ readonly view: CalendarView;
628
+ readonly events: CalendarEvent[];
629
+ readonly rawEvents: CalendarEvent[];
630
+ /**
631
+ * Fetches the visible range again through the `events` function, whatever
632
+ * `lazyFetching` says. The events shown stay until the new ones arrive. Does
633
+ * nothing when `events` is an array.
634
+ */
635
+ readonly refetchEvents: () => void;
636
+ /**
637
+ * Scrolls the hour grids to a time of day, `'HH:mm'` or `'HH:mm:ss'`, the way
638
+ * the `scrollTime` prop does at the start (the minute lands that far into
639
+ * the hour). Does nothing in a view without an hour axis, such as month.
640
+ */
641
+ readonly scrollToTime: (time: string) => void;
642
+ /**
643
+ * Calls the `resources` function again. The resources shown stay until the
644
+ * new ones arrive. Does nothing when `resources` is an array.
645
+ */
646
+ readonly refetchResources: () => void;
647
+ readonly isEventFormOpen: boolean;
648
+ readonly selectedEvent: CalendarEvent | null;
649
+ readonly selectedDate: Dayjs3 | null;
650
+ readonly firstDayOfWeek: number;
651
+ readonly resources: Resource[];
652
+ /** Whether the calendar lays out a resource axis: it has resources, or is still loading them. */
653
+ readonly hasResourceAxis: boolean;
654
+ /** Axis the views lay out along: 'horizontal' (columns) or 'vertical' (rows). */
655
+ readonly orientation: "horizontal" | "vertical";
656
+ readonly setCurrentDate: (date: Dayjs3) => void;
657
+ readonly selectDate: (date: Dayjs3) => void;
658
+ /** Switch view; pass `date` to move there atomically in the same update. */
659
+ readonly setView: (view: CalendarView, date?: Dayjs3) => void;
660
+ readonly nextPeriod: () => void;
661
+ readonly prevPeriod: () => void;
662
+ readonly today: () => void;
663
+ readonly addEvent: (event: CalendarEvent) => void;
664
+ readonly updateEvent: (eventId: string | number, event: Partial<CalendarEvent>) => void;
665
+ readonly deleteEvent: (eventId: string | number) => void;
666
+ readonly openEventForm: (eventData?: OpenEventFormInput) => void;
667
+ readonly closeEventForm: () => void;
668
+ /**
669
+ * Handle a click on an existing event: runs the consumer's `onEventClick`
670
+ * callback if provided, otherwise opens the event for editing. Lets plugin
671
+ * views (e.g. agenda) handle event clicks identically to the built-in views.
672
+ */
673
+ readonly onEventClick: (event: CalendarEvent) => void;
674
+ /**
675
+ * The consumer's custom event renderer, if provided. Lets plugin views
676
+ * (e.g. agenda) draw events with the same `renderEvent` the built-in views
677
+ * use, passing the slice of the event each call draws.
678
+ */
679
+ readonly renderEvent?: (event: CalendarEvent, segment: EventSegment) => React3.ReactNode;
680
+ /**
681
+ * The consumer's custom current-time-indicator renderer, if provided. Lets
682
+ * plugin views (e.g. agenda) render the indicator consistently with the
683
+ * built-in views via the shared `@ilamy/ui` CurrentTimeIndicator.
684
+ */
685
+ readonly renderCurrentTimeIndicator?: (props: RenderCurrentTimeIndicatorProps) => React3.ReactNode;
686
+ /**
687
+ * Events whose resource membership (`resourceIds`, falling back to
688
+ * `resourceId`) contains the given resource. On a calendar without
689
+ * resources this simply filters by the events' own resource fields.
690
+ */
691
+ readonly getEventsForResource: (resourceId: string | number) => CalendarEvent[];
692
+ readonly businessHours?: BusinessHours | BusinessHours[];
693
+ readonly t: TranslatorFunction;
694
+ readonly timeFormat: TimeFormat;
695
+ readonly timezone?: string;
696
+ readonly currentLocale: string;
697
+ readonly getEventsForDateRange: (start: Dayjs3, end: Dayjs3) => CalendarEvent[];
698
+ readonly applyScopedEdit: (event: CalendarEvent, updates: Partial<CalendarEvent>, scope: unknown) => void;
699
+ readonly applyScopedDelete: (event: CalendarEvent, scope: unknown) => void;
700
+ readonly getEventManager: (event: CalendarEvent) => IlamyPlugin | undefined;
701
+ readonly renderSlot: (slotName: string, context: unknown) => React3.ReactNode[];
702
+ readonly collect: (point: string, context: unknown) => unknown[];
703
+ readonly getViews: () => PluginView[];
704
+ }
705
+ /**
706
+ * Public hook exported for library users.
707
+ * Returns a limited set of commonly used properties and methods.
708
+ */
709
+ declare function useIlamyCalendarContext(): IlamyCalendarApi;
710
+ /**
524
711
  * Granularity of the time grid in minutes for day, week, and resource hour views.
525
- * Quarter-hour increments only. `60` shows one row per hour with no sub-hour lines.
526
- * `30` shows two rows per hour. `15` shows four rows per hour with dashed sub-hour separators.
712
+ * `60` shows one row per hour with no sub-hour lines. `30` shows two rows per
713
+ * hour. `15` shows four rows per hour with dashed sub-hour separators.
527
714
  */
528
715
  type SlotDuration = 15 | 30 | 60;
716
+ /** The finest sizes a drag, a resize or a drag-to-create selection can snap to. */
717
+ type SnapDuration = 15 | 30;
718
+ /**
719
+ * How a week number is counted: the locale's own count (`'local'`) or ISO 8601
720
+ * (`'ISO'`).
721
+ */
722
+ type WeekNumberCalculation = "local" | "ISO";
529
723
  /**
530
724
  * Which slice of an event a `renderEvent` call is drawing.
531
725
  *
@@ -631,11 +825,80 @@ interface RenderCurrentTimeIndicatorProps {
631
825
  /** The current calendar view (e.g. 'day', 'week') */
632
826
  view: CalendarView;
633
827
  }
828
+ /**
829
+ * What the calendar asks an `events` function for: the visible range, in the
830
+ * calendar's time zone. `end` is exclusive (the next midnight after the last
831
+ * visible day), like an event's own `end`. In month view the range is the whole
832
+ * grid, including the leading and trailing days of the neighbouring months.
833
+ */
834
+ interface EventsFetchInfo {
835
+ /** Start of the visible range, inclusive. */
836
+ start: Dayjs3;
837
+ /** End of the visible range, exclusive. */
838
+ end: Dayjs3;
839
+ /** `start` as an ISO string. */
840
+ startStr: string;
841
+ /** `end` as an ISO string. */
842
+ endStr: string;
843
+ /** The `timezone` prop, when one is set. */
844
+ timezone?: string;
845
+ }
846
+ /**
847
+ * Loads the events for a visible range. `options.signal` aborts when a newer
848
+ * request supersedes this one, so a `fetch` can be cancelled by passing it on.
849
+ * A result that arrives after being superseded is ignored either way.
850
+ */
851
+ type EventsFetcher = (info: EventsFetchInfo, options: {
852
+ signal: AbortSignal;
853
+ }) => Promise<IlamyCalendarPropEvent[]>;
854
+ /**
855
+ * Loads the resources. Called with the visible range at mount (and, with
856
+ * `refetchResourcesOnNavigate`, whenever the view leaves the fetched range).
857
+ * `options.signal` aborts when a newer request supersedes this one; a late
858
+ * result is ignored either way.
859
+ */
860
+ type ResourcesFetcher = (info: EventsFetchInfo, options: {
861
+ signal: AbortSignal;
862
+ }) => Promise<Resource[]>;
634
863
  interface IlamyCalendarProps {
635
864
  /**
636
- * Array of events to display in the calendar.
865
+ * Drives the calendar from outside it: `ref.current` is the object
866
+ * `useIlamyCalendarContext()` returns, so a toolbar or sidebar of your own
867
+ * calls `ref.current.nextPeriod()`, `setView('week')`, `scrollToTime('13:30')`
868
+ * and the rest. Read it in event handlers and effects, not while rendering:
869
+ * it is set after the calendar mounts and refreshed after every render.
637
870
  */
638
- events?: IlamyCalendarPropEvent[];
871
+ ref?: Ref<IlamyCalendarApi>;
872
+ /**
873
+ * The events to display: an array, or a function the calendar calls with the
874
+ * visible range to load them on demand (see `EventsFetcher`).
875
+ *
876
+ * With a function, the calendar refetches when the visible range leaves the
877
+ * last fetched one (unless `lazyFetching` is off), when `timezone` changes,
878
+ * and when `refetchEvents()` is called. A new function identity does NOT
879
+ * refetch: an inline function would refetch on every render. Call
880
+ * `refetchEvents()` when your query changes. Edits made in the calendar are
881
+ * applied immediately and reported through the `onEvent*` callbacks; the next
882
+ * fetch replaces them with exactly what your function returns.
883
+ */
884
+ events?: IlamyCalendarPropEvent[] | EventsFetcher;
885
+ /**
886
+ * With an `events` function: fetch only when the visible range is not inside
887
+ * the range last fetched. When `false`, every navigation fetches.
888
+ * @default true
889
+ */
890
+ lazyFetching?: boolean;
891
+ /**
892
+ * With an `events` or `resources` function: called with `true` when a fetch
893
+ * starts and `false` when none is in flight any more, for both together. Fires on those transitions only.
894
+ */
895
+ loading?: (isLoading: boolean) => void;
896
+ /**
897
+ * With an `events` function: called when a fetch fails. The events already
898
+ * shown stay, and the next navigation retries. Without it, the error goes to
899
+ * `console.error`.
900
+ */
901
+ onEventsError?: (error: unknown) => void;
639
902
  /**
640
903
  * The first day of the week to display in the calendar.
641
904
  * Can be 'sunday', 'monday', etc. Defaults to 'sunday'.
@@ -661,7 +924,7 @@ interface IlamyCalendarProps {
661
924
  * and `top: var(--ilamy-sticky-top)`, which each grid publishes to clear
662
925
  * its own sticky column and header.
663
926
  */
664
- renderEvent?: (event: CalendarEvent, segment: EventSegment) => ReactNode4;
927
+ renderEvent?: (event: CalendarEvent, segment: EventSegment) => ReactNode6;
665
928
  /**
666
929
  * Callback when an event is clicked.
667
930
  * Provides the clicked event object.
@@ -750,10 +1013,48 @@ interface IlamyCalendarProps {
750
1013
  disableEventClick?: boolean;
751
1014
  /**
752
1015
  * Whether to disable drag-and-drop functionality for calendar events.
753
- * Useful for read-only views or when drag-and-drop is not needed.
1016
+ * Only sets the `editable` default, so an explicit `eventStartEditable`
1017
+ * still enables moving.
1018
+ * @deprecated Use `editable={false}`. Kept until 4.0.
754
1019
  */
755
1020
  disableDragAndDrop?: boolean;
756
1021
  /**
1022
+ * Whether events can be moved. A per-event `editable` beats it, and
1023
+ * `eventStartEditable` beats it for moving.
1024
+ *
1025
+ * Deliberate deviation: FullCalendar defaults `editable` to `false`
1026
+ * (`options.ts:495`, v7.1.1). Drag is on by default here, so this defaults
1027
+ * to `true` until 4.0, when flipping it can be a breaking change.
1028
+ * @default true
1029
+ */
1030
+ editable?: boolean;
1031
+ /**
1032
+ * Whether events can be moved.
1033
+ * @default editable
1034
+ */
1035
+ eventStartEditable?: boolean;
1036
+ /**
1037
+ * Whether events can be resized by dragging an edge. Resize needs a mouse
1038
+ * or a pen: on touch-only devices events can be moved but not resized until
1039
+ * event selection lands. A per-event `durationEditable` beats it. The end edge always shows a handle when
1040
+ * allowed; the start edge needs `eventResizableFromStart`.
1041
+ * @default editable
1042
+ */
1043
+ eventDurationEditable?: boolean;
1044
+ /**
1045
+ * Also show a resize handle on the start edge of an event.
1046
+ * @default false
1047
+ */
1048
+ eventResizableFromStart?: boolean;
1049
+ /**
1050
+ * Vetoes a candidate placement while an event is dragged or resized. Called when the
1051
+ * hovered placement changes, not on every pointer move; returning `false`
1052
+ * shows the not-allowed cursor and a release there changes nothing.
1053
+ * `draggedEvent` is the event as it was before the drag. It does not apply
1054
+ * to the event form or to drag-to-create (FullCalendar's `selectAllow`).
1055
+ */
1056
+ eventAllow?: (dropInfo: EventDropInfo, draggedEvent: CalendarEvent) => boolean;
1057
+ /**
757
1058
  * Maximum number of events to display in one grid cell: a day in month
758
1059
  * view, an hour in the resource day view.
759
1060
  * Additional events will be hidden and can be viewed via a "more" link.
@@ -788,7 +1089,7 @@ interface IlamyCalendarProps {
788
1089
  * Custom header component to replace the default calendar header.
789
1090
  * Useful for adding custom branding or additional controls.
790
1091
  */
791
- headerComponent?: ReactNode4;
1092
+ headerComponent?: ReactNode6;
792
1093
  /**
793
1094
  * Custom class name for the calendar header.
794
1095
  * Useful for applying custom styles to the header.
@@ -806,7 +1107,7 @@ interface IlamyCalendarProps {
806
1107
  * If provided, it will override the default event form component.
807
1108
  * The function receives EventFormProps and should return a React node.
808
1109
  */
809
- renderEventForm?: (props: EventFormProps) => ReactNode4;
1110
+ renderEventForm?: (props: EventFormProps) => ReactNode6;
810
1111
  /**
811
1112
  * Called when the "+N more" overflow indicator in a month/grid cell is
812
1113
  * clicked, receiving the cell's day and its full list of events.
@@ -821,12 +1122,88 @@ interface IlamyCalendarProps {
821
1122
  */
822
1123
  timeFormat?: TimeFormat;
823
1124
  /**
1125
+ * How the labels in the time gutter are written, as `Intl.DateTimeFormat`
1126
+ * options, formatted with the calendar's `locale` and `timezone`. When the
1127
+ * options carry neither `hour12` nor `hourCycle`, a `timeFormat` you passed
1128
+ * decides; without one, the locale does.
1129
+ * Unset keeps the built-in label. `renderHour` takes precedence.
1130
+ *
1131
+ * Only the `Intl.DateTimeFormatOptions` form is supported: no format
1132
+ * strings, no functions, and none of FullCalendar's extras (`meridiem`,
1133
+ * `omitZeroMinute`). Use `renderHour` for anything else.
1134
+ * (FullCalendar v7 calls this `slotHeaderFormat` too.)
1135
+ */
1136
+ slotHeaderFormat?: Intl.DateTimeFormatOptions;
1137
+ /**
1138
+ * How the time on an event bar is written, as `Intl.DateTimeFormat`
1139
+ * options. Same rules as `slotHeaderFormat`. Setting it shows the time
1140
+ * unless `displayEventTime` is `false`. `renderEvent` takes precedence.
1141
+ */
1142
+ eventTimeFormat?: Intl.DateTimeFormatOptions;
1143
+ /**
1144
+ * Whether the built-in event bar shows the event's time. All-day events
1145
+ * never do. Unset: shown only when `eventTimeFormat` is set, so existing
1146
+ * calendars look as they did. Shown with no `eventTimeFormat`, it reads
1147
+ * like "9:30 AM".
1148
+ *
1149
+ * FullCalendar defaults this to on; flipping it here is a 4.0 candidate.
1150
+ */
1151
+ displayEventTime?: boolean;
1152
+ /**
1153
+ * Whether the time on an event bar runs to the end ("9:30 – 10:30").
1154
+ * Needs the time to be shown. FullCalendar defaults the end on when the
1155
+ * event has one; flipping it here is a 4.0 candidate.
1156
+ * @default false
1157
+ */
1158
+ displayEventEnd?: boolean;
1159
+ /**
1160
+ * How a day header is written, as `Intl.DateTimeFormat` options. When set,
1161
+ * the formatted text is the whole header: `{ weekday: 'long' }` gives
1162
+ * "Wednesday" with no day number, and `{ weekday: 'short', day: 'numeric' }`
1163
+ * gives "Wed 12". Applies to the week, day, month and resource headers
1164
+ * (not the agenda plugin). Unset keeps the weekday over the day number.
1165
+ */
1166
+ dayHeaderFormat?: Intl.DateTimeFormatOptions;
1167
+ /**
1168
+ * How the toolbar title is written, as `Intl.DateTimeFormat` options.
1169
+ * A range (week, custom window) is written with `formatRange`. Unset keeps
1170
+ * the built-in title for each view.
1171
+ */
1172
+ titleFormat?: Intl.DateTimeFormatOptions;
1173
+ /**
824
1174
  * Whether to hide non-business hours in Day and Week views.
825
1175
  * Requires businessHours to be configured.
826
1176
  * @default false
827
1177
  */
828
1178
  hideNonBusinessHours?: boolean;
829
1179
  /**
1180
+ * First visible time in the hour grids (day, week, and the resource hour
1181
+ * views in both orientations), `'HH:mm'` or `'HH:mm:ss'`. A bound that falls
1182
+ * inside an hour shows that whole hour. Month, year, agenda and
1183
+ * `weekViewGranularity: 'daily'` ignore it.
1184
+ *
1185
+ * An event outside the range is not drawn; one that crosses its edge is
1186
+ * clipped to it and keeps its real start and end times. Combined with
1187
+ * `hideNonBusinessHours`, the grid shows the overlap of the two ranges.
1188
+ *
1189
+ * Between `'00:00'` and `'24:00'` only. An invalid value, or a range whose
1190
+ * end is not after its start, shows the whole day and logs one
1191
+ * `console.warn` naming the prop.
1192
+ *
1193
+ * @default '00:00'
1194
+ * @example slotMinTime="08:00"
1195
+ */
1196
+ slotMinTime?: string;
1197
+ /**
1198
+ * End of the visible time in the hour grids, exclusive: `'18:00'` shows the
1199
+ * 5 PM row and stops there. `'HH:mm'` or `'HH:mm:ss'` up to `'24:00'`. See
1200
+ * `slotMinTime`.
1201
+ *
1202
+ * @default '24:00'
1203
+ * @example slotMaxTime="18:00"
1204
+ */
1205
+ slotMaxTime?: string;
1206
+ /**
830
1207
  * Whether to hide the iCalendar button in the calendar header.
831
1208
  * Applies to both desktop and mobile header layouts.
832
1209
  * @default false
@@ -875,35 +1252,44 @@ interface IlamyCalendarProps {
875
1252
  * }}
876
1253
  * ```
877
1254
  */
878
- renderCurrentTimeIndicator?: (props: RenderCurrentTimeIndicatorProps) => ReactNode4;
1255
+ renderCurrentTimeIndicator?: (props: RenderCurrentTimeIndicatorProps) => ReactNode6;
879
1256
  /**
880
- * Days of the week to hide from the week view.
881
- * Hidden days won't render as columns, giving remaining days more space.
1257
+ * Days of the week to hide. A hidden day gets no column or row, so the
1258
+ * remaining days share the space.
1259
+ *
1260
+ * Applies to the month, week and day views, with or without `resources`, in
1261
+ * every orientation and granularity. The day view skips hidden days when you
1262
+ * step to the previous or next day, and opens on the next visible day if it
1263
+ * is given a hidden one.
882
1264
  *
883
- * Applies to:
884
- * - Regular vertical week view (always)
885
- * - Resource vertical week view in hourly granularity
1265
+ * An event that runs across a hidden day is drawn as one bar over the visible
1266
+ * days it covers; one that starts or ends on a hidden day is clamped to the
1267
+ * nearest visible day (`EventSegment.isStart` / `isEnd` are false there), and
1268
+ * one that lies wholly on hidden days is not drawn.
886
1269
  *
887
- * Does NOT apply to:
888
- * - Resource horizontal week view (layout is days-as-rows)
889
- * - Resource vertical week view in daily granularity
890
- * (`weekViewGranularity: 'daily'`) — non-contiguous visible days would
891
- * break multi-day event positioning
892
- * - Month, day, and year views
1270
+ * Does NOT apply to the year view, which shows every day of each month, or to
1271
+ * the agenda plugin, which lists events rather than days.
1272
+ *
1273
+ * Hiding all seven days is ignored, with a warning in development.
893
1274
  *
894
1275
  * @default []
895
1276
  * @example ['saturday', 'sunday'] // Hide weekends
896
1277
  */
897
1278
  hiddenDays?: WeekDays[];
898
1279
  /**
1280
+ * Whether to show Saturday and Sunday. `false` is the same as adding both
1281
+ * to `hiddenDays`, and is added to it when both are set.
1282
+ *
1283
+ * @default true
1284
+ */
1285
+ weekends?: boolean;
1286
+ /**
899
1287
  * Custom render function for the hour labels in the gutter/header.
900
1288
  * Receives a Dayjs object for the hour and should return a React node.
901
1289
  */
902
- renderHour?: (date: Dayjs3) => ReactNode4;
1290
+ renderHour?: (date: Dayjs3) => ReactNode6;
903
1291
  /**
904
1292
  * Granularity of the time grid in minutes for day, week, and resource hour views.
905
- * Quarter-hour increments only: `15`, `30`, or `60`.
906
- *
907
1293
  * - `60` (default): one row per hour, no sub-hour lines.
908
1294
  * - `30`: two rows per hour (top of hour, half hour).
909
1295
  * - `15`: four rows per hour with dashed sub-hour separators.
@@ -912,11 +1298,21 @@ interface IlamyCalendarProps {
912
1298
  */
913
1299
  slotDuration?: SlotDuration;
914
1300
  /**
1301
+ * The size, in minutes, a dragged or resized event (and a drag-to-create
1302
+ * selection) snaps to: `15` or `30`. Takes effect only where it is finer than
1303
+ * the cell under the pointer (`slotDuration` in the vertical time grid, one
1304
+ * hour in the horizontal resource timeline) and divides it: with
1305
+ * `slotDuration={60}` and `snapDuration={15}` an event dropped halfway down an
1306
+ * hour row lands on `:30`. Otherwise the cell's own size is used.
1307
+ */
1308
+ snapDuration?: SnapDuration;
1309
+ /**
915
1310
  * Initial scroll position for hour-resolution views (day, week, resource
916
1311
  * day, resource week, in both orientations). Accepts `"HH:mm"` or
917
- * `"HH:mm:ss"`. Minutes are floored to the hour. The scroll target is
918
- * clamped to the nearest visible row when `hideNonBusinessHours` hides
919
- * the requested hour.
1312
+ * `"HH:mm:ss"`. The grid scrolls to the exact minute: `"08:30"` lands
1313
+ * halfway into the 08:00 row. The scroll target is clamped to the nearest
1314
+ * visible row (landing on its edge) when `hideNonBusinessHours` hides the
1315
+ * requested hour.
920
1316
  *
921
1317
  * Reapplied whenever the visible date range changes (navigation, view
922
1318
  * switch), the rendered hours change, or `scrollTime` itself changes, as
@@ -943,8 +1339,8 @@ interface IlamyCalendarProps {
943
1339
  scrollTime?: string;
944
1340
  /**
945
1341
  * Open every scrolling grid on the current moment rather than its start:
946
- * the current hour in time grids (day, week, resource day, hourly resource
947
- * week), and today's column or row in day grids (resource month, daily
1342
+ * the current moment in time grids (day, week, resource day, hourly
1343
+ * resource week), down to the minute, and today's column or row in day grids (resource month, daily
948
1344
  * resource week, #285). Month and year grids do not scroll, so it does
949
1345
  * nothing there.
950
1346
  *
@@ -968,20 +1364,81 @@ interface IlamyCalendarProps {
968
1364
  */
969
1365
  scrollToNow?: boolean;
970
1366
  /**
1367
+ * Whether day, week and resource time grids draw the all-day row above the
1368
+ * hours. When `false` the row is removed and all-day events are not shown in
1369
+ * those views. Month, year and agenda views are unaffected.
1370
+ *
1371
+ * @default true
1372
+ */
1373
+ allDaySlot?: boolean;
1374
+ /**
1375
+ * Whether time grids draw a line at the current time.
1376
+ *
1377
+ * @default true
1378
+ */
1379
+ nowIndicator?: boolean;
1380
+ /**
1381
+ * Whether week numbers are shown.
1382
+ *
1383
+ * - unset (default): the week number appears in the corner of the week and
1384
+ * resource week headers, and month view shows none.
1385
+ * - `true`: additionally shows a number in each row of the month view,
1386
+ * counted from the row's first day.
1387
+ * - `false`: shows week numbers nowhere.
1388
+ */
1389
+ weekNumbers?: boolean;
1390
+ /**
1391
+ * How week numbers are counted.
1392
+ *
1393
+ * - `'local'` (default): the locale's own count.
1394
+ * - `'ISO'`: ISO 8601, week 1 being the week holding the year's first
1395
+ * Thursday. It only changes the number: it does not make weeks start on
1396
+ * Monday. Use `firstDayOfWeek` for that.
1397
+ *
1398
+ * @default 'local'
1399
+ */
1400
+ weekNumberCalculation?: WeekNumberCalculation;
1401
+ /**
971
1402
  * Optional plugins that add behavior/UI (e.g. recurrence). The core ships
972
1403
  * with no plugins by default — pass `recurrencePlugin()` to enable recurring
973
1404
  * events.
974
1405
  */
975
1406
  plugins?: IlamyPlugin[];
976
1407
  /**
977
- * Resources (people, rooms, equipment) to display as a resource axis.
1408
+ * Resources (people, rooms, equipment) to display as a resource axis: an
1409
+ * array, or a function that loads them (see `ResourcesFetcher`).
1410
+ *
1411
+ * A function is called once on mount and again on `refetchResources()`, or
1412
+ * on navigation with `refetchResourcesOnNavigate`. A new function identity
1413
+ * does NOT refetch. Until it resolves the calendar is a resource calendar with no lanes yet;
1414
+ * a failure keeps the resources shown and goes to `onResourcesError`.
978
1415
  * When set: events are shown per matching resource (`resourceIds`, falling
979
1416
  * back to `resourceId`); events with no resource assignment are hidden; the
980
1417
  * year view is hidden from the view switcher.
981
1418
  */
982
- resources?: Resource[];
1419
+ resources?: Resource[] | ResourcesFetcher;
1420
+ /**
1421
+ * With a `resources` function: also fetch when the visible range leaves the
1422
+ * range last fetched, so the function can return resources for the dates in view.
1423
+ * @default false
1424
+ */
1425
+ refetchResourcesOnNavigate?: boolean;
1426
+ /**
1427
+ * Called with the resource list once it is set and after every change: an
1428
+ * array prop whose resources changed, or a fetch result. Compared by
1429
+ * content, so an inline array does not re-fire on every render (`data` is
1430
+ * compared one level deep: same keys, each value `===`; keep objects nested
1431
+ * deeper inside `data` stable). Not called
1432
+ * while there is no list yet.
1433
+ */
1434
+ resourcesSet?: (resources: Resource[]) => void;
1435
+ /**
1436
+ * With a `resources` function: called when a fetch fails. The resources
1437
+ * already shown stay. Without it, the error goes to `console.error`.
1438
+ */
1439
+ onResourcesError?: (error: unknown) => void;
983
1440
  /** Custom render function for resource header cells. */
984
- renderResource?: (resource: Resource) => ReactNode4;
1441
+ renderResource?: (resource: Resource) => ReactNode6;
985
1442
  /**
986
1443
  * How resources are arranged. Only applies when `resources` is set.
987
1444
  * - "horizontal": resources are rows, time is columns (default)
@@ -991,13 +1448,12 @@ interface IlamyCalendarProps {
991
1448
  /**
992
1449
  * Granularity of week-view time slots when `resources` is set.
993
1450
  * - "hourly": one column per hour (default)
994
- * - "daily": one column per day. Note: `hiddenDays` is ignored in daily
995
- * mode (non-contiguous days would break multi-day event positioning).
1451
+ * - "daily": one column per day
996
1452
  */
997
1453
  weekViewGranularity?: "hourly" | "daily";
998
1454
  }
999
- declare const IlamyCalendar: React3.FC<IlamyCalendarProps>;
1000
- import React4 from "react";
1455
+ declare const IlamyCalendar: React4.FC<IlamyCalendarProps>;
1456
+ import React5 from "react";
1001
1457
  /**
1002
1458
  * @deprecated Since v2.0 `IlamyCalendar` accepts `resources`, `renderResource`,
1003
1459
  * `orientation`, and `weekViewGranularity` directly — use it instead. This
@@ -1005,72 +1461,5 @@ import React4 from "react";
1005
1461
  */
1006
1462
  type IlamyResourceCalendarProps = IlamyCalendarProps;
1007
1463
  /** @deprecated Since v2.0 — use `IlamyCalendar` with the `resources` prop. */
1008
- declare const IlamyResourceCalendar: React4.FC<IlamyResourceCalendarProps>;
1009
- import React5 from "react";
1010
- /**
1011
- * The public calendar API surface exposed by useIlamyCalendarContext() — for consumers and plugin
1012
- * components. The full internal context is intentionally not exported.
1013
- */
1014
- interface IlamyCalendarApi {
1015
- readonly currentDate: Dayjs3;
1016
- /** The active view's current visible date range (what is on screen). */
1017
- readonly currentRange: DateRange;
1018
- readonly view: CalendarView;
1019
- readonly events: CalendarEvent[];
1020
- readonly rawEvents: CalendarEvent[];
1021
- readonly isEventFormOpen: boolean;
1022
- readonly selectedEvent: CalendarEvent | null;
1023
- readonly selectedDate: Dayjs3 | null;
1024
- readonly firstDayOfWeek: number;
1025
- readonly resources: Resource[];
1026
- /** Axis the views lay out along: 'horizontal' (columns) or 'vertical' (rows). */
1027
- readonly orientation: "horizontal" | "vertical";
1028
- readonly setCurrentDate: (date: Dayjs3) => void;
1029
- readonly selectDate: (date: Dayjs3) => void;
1030
- /** Switch view; pass `date` to move there atomically in the same update. */
1031
- readonly setView: (view: CalendarView, date?: Dayjs3) => void;
1032
- readonly nextPeriod: () => void;
1033
- readonly prevPeriod: () => void;
1034
- readonly today: () => void;
1035
- readonly addEvent: (event: CalendarEvent) => void;
1036
- readonly updateEvent: (eventId: string | number, event: Partial<CalendarEvent>) => void;
1037
- readonly deleteEvent: (eventId: string | number) => void;
1038
- readonly openEventForm: (eventData?: OpenEventFormInput) => void;
1039
- readonly closeEventForm: () => void;
1040
- /**
1041
- * Handle a click on an existing event: runs the consumer's `onEventClick`
1042
- * callback if provided, otherwise opens the event for editing. Lets plugin
1043
- * views (e.g. agenda) handle event clicks identically to the built-in views.
1044
- */
1045
- readonly onEventClick: (event: CalendarEvent) => void;
1046
- /**
1047
- * The consumer's custom current-time-indicator renderer, if provided. Lets
1048
- * plugin views (e.g. agenda) render the indicator consistently with the
1049
- * built-in views via the shared `@ilamy/ui` CurrentTimeIndicator.
1050
- */
1051
- readonly renderCurrentTimeIndicator?: (props: RenderCurrentTimeIndicatorProps) => React5.ReactNode;
1052
- /**
1053
- * Events whose resource membership (`resourceIds`, falling back to
1054
- * `resourceId`) contains the given resource. On a calendar without
1055
- * resources this simply filters by the events' own resource fields.
1056
- */
1057
- readonly getEventsForResource: (resourceId: string | number) => CalendarEvent[];
1058
- readonly businessHours?: BusinessHours | BusinessHours[];
1059
- readonly t: TranslatorFunction;
1060
- readonly timeFormat: TimeFormat;
1061
- readonly timezone?: string;
1062
- readonly currentLocale: string;
1063
- readonly getEventsForDateRange: (start: Dayjs3, end: Dayjs3) => CalendarEvent[];
1064
- readonly applyScopedEdit: (event: CalendarEvent, updates: Partial<CalendarEvent>, scope: unknown) => void;
1065
- readonly applyScopedDelete: (event: CalendarEvent, scope: unknown) => void;
1066
- readonly getEventManager: (event: CalendarEvent) => IlamyPlugin | undefined;
1067
- readonly renderSlot: (slotName: string, context: unknown) => React5.ReactNode[];
1068
- readonly collect: (point: string, context: unknown) => unknown[];
1069
- readonly getViews: () => PluginView[];
1070
- }
1071
- /**
1072
- * Public hook exported for library users.
1073
- * Returns a limited set of commonly used properties and methods.
1074
- */
1075
- declare function useIlamyCalendarContext(): IlamyCalendarApi;
1076
- export { BusinessHours, CalendarClassesOverride, CalendarEvent, CalendarView, CellInfo, ColumnSpec, Dayjs3 as Dayjs, EventFormProps, EventFormSlotContext, EventMutationScopeSlotContext, EventSegment, EventsChange, HorizontalCellSpec, HorizontalRowSpec, IlamyCalendar, IlamyCalendarApi, IlamyCalendarProps, IlamyPlugin, IlamyResourceCalendar, IlamyResourceCalendarProps, ManipulateType3 as ManipulateType, OpenEventFormInput, PluginDateRange, PluginMutationArgs, PluginMutationResult, PluginView, RenderCurrentTimeIndicatorProps, Resource, SLOT_EVENT_FORM, SLOT_EVENT_MUTATION_SCOPE, SlotDuration, TimeFormat, TranslationKey, Translations, TranslatorFunction, VerticalColumnSpec, ViewConfig, ViewHeaderContext, WeekDays, _default as dayjs, defaultTranslations, useIlamyCalendarContext };
1464
+ declare const IlamyResourceCalendar: React5.FC<IlamyResourceCalendarProps>;
1465
+ export { BusinessHours, CalendarClassesOverride, CalendarEvent, CalendarView, CellInfo, ColumnSpec, Dayjs3 as Dayjs, EventDelta, EventDropInfo, EventFormProps, EventFormSlotContext, EventMutationScopeSlotContext, EventSegment, EventsChange, EventsFetchInfo, EventsFetcher, HorizontalCellSpec, HorizontalRowSpec, IlamyCalendar, IlamyCalendarApi, IlamyCalendarProps, IlamyPlugin, IlamyResourceCalendar, IlamyResourceCalendarProps, ManipulateType3 as ManipulateType, OpenEventFormInput, PluginDateRange, PluginMutationArgs, PluginMutationResult, PluginView, RenderCurrentTimeIndicatorProps, Resource, ResourcesFetcher, SLOT_EVENT_FORM, SLOT_EVENT_MUTATION_SCOPE, SlotDuration, SnapDuration, TimeFormat, TranslationKey, Translations, TranslatorFunction, VerticalColumnSpec, ViewConfig, ViewHeaderContext, WeekDays, WeekNumberCalculation, _default as dayjs, defaultTranslations, useIlamyCalendarContext };