calendarkit-pro 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,6 @@ A professional, feature-rich React calendar component with drag-and-drop, recurr
15
15
  - **i18n Ready** - Built-in English/French, fully customizable
16
16
  - **Resource Scheduling** - Schedule across rooms, people, or equipment
17
17
  - **Dark Mode** - Built-in theme toggle
18
- - **ICS Import/Export** - RFC 5545 compliant
19
18
  - **Mobile Friendly** - Touch gestures and responsive layout
20
19
  - **TypeScript** - Full type definitions included
21
20
  - **High Performance** - Handles 10,000+ events
@@ -85,7 +84,9 @@ function MyCalendar() {
85
84
  | `onEventCreate` | `(event: Partial<CalendarEvent>) => void` | Event creation callback |
86
85
  | `onEventUpdate` | `(event: CalendarEvent) => void` | Event update callback |
87
86
  | `onEventDelete` | `(eventId: string) => void` | Event deletion callback |
88
- | `onEventResize` | `(event, start, end) => void` | Event resize callback |
87
+ | `onEventDrop` | `(event, start, end) => void` | Called when an event is dropped (with the event before the move and its new dates), alongside `onEventUpdate` |
88
+ | `onEventResize` | `(event, start, end) => void` | Called when an event is resized, alongside `onEventUpdate` (both fire, so update your state in only one of them) |
89
+ | `onOccurrenceDelete` | `(occurrence, updatedSeries) => void` | Delete a single occurrence of a recurring event: persist `updatedSeries` (it has the date in `recurrence.exdates`). Without it, deleting an occurrence deletes the series |
89
90
  | `calendars` | `Calendar[]` | Multiple calendar support |
90
91
  | `resources` | `Resource[]` | Resources for resource view |
91
92
  | `eventTypes` | `EventType[]` | Pre-defined event types |
@@ -126,7 +127,8 @@ interface CalendarEvent {
126
127
  interval?: number;
127
128
  count?: number;
128
129
  until?: Date;
129
- byweekday?: number[];
130
+ byweekday?: number[]; // 0 = Monday … 6 = Sunday
131
+ exdates?: Date[]; // occurrence starts excluded from the series
130
132
  };
131
133
  }
132
134
  ```
@@ -193,6 +195,25 @@ const recurringEvent: CalendarEvent = {
193
195
  };
194
196
  ```
195
197
 
198
+ Occurrences keep their wall-clock time across daylight-saving changes, in the `timezone` prop's zone (or the browser's).
199
+
200
+ Moving, resizing or editing one occurrence updates the whole series by the same amount (`onEventUpdate` receives the recurring event). To delete a single occurrence, handle `onOccurrenceDelete`:
201
+
202
+ ```tsx
203
+ <Scheduler
204
+ events={events}
205
+ onOccurrenceDelete={(occurrence, updatedSeries) => {
206
+ setEvents(events.map(e => (e.id === updatedSeries.id ? updatedSeries : e)));
207
+ }}
208
+ />
209
+ ```
210
+
211
+ ### Invalid data
212
+
213
+ Dates may be `Date` objects, ISO strings or timestamps. Events with an invalid date or an end before their start are skipped, with a warning in development. Event ids must be unique (duplicates are rendered but warned about, and break drag & drop).
214
+
215
+ Treat events as immutable: to change an event, pass a new object (`events.map(e => e.id === id ? { ...e, title } : e)`). Computations are cached per event object, so mutating an event in place may not be reflected.
216
+
196
217
  ## Timezone Support
197
218
 
198
219
  ```tsx
package/dist/index.d.mts CHANGED
@@ -111,7 +111,13 @@ interface CalendarEvent {
111
111
  count?: number;
112
112
  until?: Date;
113
113
  byweekday?: number[];
114
+ /** Occurrence start dates excluded from the series. */
115
+ exdates?: Date[];
114
116
  };
117
+ /** Set on expanded occurrences: id of the recurring (master) event. */
118
+ originalEventId?: string;
119
+ /** Set on expanded occurrences: start of this occurrence. */
120
+ occurrenceStart?: Date;
115
121
  [key: string]: any;
116
122
  }
117
123
  interface EventType {
@@ -154,6 +160,12 @@ interface CalendarProps {
154
160
  onEventCreate?: (event: Partial<CalendarEvent>) => void;
155
161
  onEventUpdate?: (event: CalendarEvent) => void;
156
162
  onEventDelete?: (eventId: string) => void;
163
+ /**
164
+ * Called when a single occurrence of a recurring event is deleted. `updatedSeries` is the master
165
+ * event with that occurrence added to `recurrence.exdates`: persist it to delete only this
166
+ * occurrence. Without this prop, deleting an occurrence deletes the whole series (`onEventDelete`).
167
+ */
168
+ onOccurrenceDelete?: (occurrence: CalendarEvent, updatedSeries: CalendarEvent) => void;
157
169
  theme?: CalendarTheme;
158
170
  locale?: Locale;
159
171
  timezone?: string;
package/dist/index.d.ts CHANGED
@@ -111,7 +111,13 @@ interface CalendarEvent {
111
111
  count?: number;
112
112
  until?: Date;
113
113
  byweekday?: number[];
114
+ /** Occurrence start dates excluded from the series. */
115
+ exdates?: Date[];
114
116
  };
117
+ /** Set on expanded occurrences: id of the recurring (master) event. */
118
+ originalEventId?: string;
119
+ /** Set on expanded occurrences: start of this occurrence. */
120
+ occurrenceStart?: Date;
115
121
  [key: string]: any;
116
122
  }
117
123
  interface EventType {
@@ -154,6 +160,12 @@ interface CalendarProps {
154
160
  onEventCreate?: (event: Partial<CalendarEvent>) => void;
155
161
  onEventUpdate?: (event: CalendarEvent) => void;
156
162
  onEventDelete?: (eventId: string) => void;
163
+ /**
164
+ * Called when a single occurrence of a recurring event is deleted. `updatedSeries` is the master
165
+ * event with that occurrence added to `recurrence.exdates`: persist it to delete only this
166
+ * occurrence. Without this prop, deleting an occurrence deletes the whole series (`onEventDelete`).
167
+ */
168
+ onOccurrenceDelete?: (occurrence: CalendarEvent, updatedSeries: CalendarEvent) => void;
157
169
  theme?: CalendarTheme;
158
170
  locale?: Locale;
159
171
  timezone?: string;