@ilamy/calendar 0.3.2 → 1.0.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 +3 -0
- package/dist/index.d.ts +83 -22
- package/dist/index.js +8 -4805
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -4,9 +4,12 @@ A powerful, full-featured React calendar component library built with TypeScript
|
|
|
4
4
|
|
|
5
5
|
<img width="1643" height="873" alt="Screenshot 2025-08-05 at 9 46 41 AM" src="https://github.com/user-attachments/assets/d289f034-0d26-4a1c-a997-dfa1ad26aa7a" />
|
|
6
6
|
|
|
7
|
+
<img width="1663" height="872" alt="Screenshot 2025-10-13 at 4 24 29 PM" src="https://github.com/user-attachments/assets/ba0aa27e-373c-40ba-98c6-2d6fd767cb66" />
|
|
8
|
+
|
|
7
9
|
## Features
|
|
8
10
|
|
|
9
11
|
- 🗓️ **Multiple Views**: Month, Week, Day, and Year views with smooth transitions
|
|
12
|
+
- 📊 **Resource Calendar**: Visualize and manage events across multiple resources with timeline layout
|
|
10
13
|
- 🎯 **Drag & Drop**: Move events between dates and time slots with collision detection
|
|
11
14
|
- 🔄 **RFC 5545 Recurring Events**: Full RRULE support with Google Calendar-style operations
|
|
12
15
|
- **RRULE Patterns**: Daily, Weekly, Monthly, Yearly with complex frequencies
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
import React3 from "react";
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
* Re-rrule.js Options with practical TypeScript interface.
|
|
5
|
-
* Makes all properties optional except freq and dtstart (which are required by RFC 5545).
|
|
6
|
-
* This allows clean object creation without needing explicit null values.
|
|
7
|
-
*
|
|
8
|
-
* @see https://tools.ietf.org/html/rfc5545 - RFC 5545 iCalendar specification
|
|
9
|
-
* @see https://github.com/jakubroztocil/rrule - rrule.js library documentation
|
|
10
|
-
*/
|
|
11
|
-
type RRuleOptions = {
|
|
12
|
-
/**
|
|
13
|
-
* The frequency of the event. Must be one of the following: DAILY, WEEKLY, MONTHLY, etc.
|
|
14
|
-
*/
|
|
15
|
-
freq: Options["freq"]
|
|
16
|
-
/**
|
|
17
|
-
* The start date of the recurrence rule. This defines when the recurrence pattern begins.
|
|
18
|
-
* Required for proper RRULE functionality according to RFC 5545.
|
|
19
|
-
* @important Same as the event start date.
|
|
20
|
-
*/
|
|
21
|
-
dtstart: Date
|
|
22
|
-
} & Partial<Omit<Options, "freq" | "dtstart">>;
|
|
2
|
+
import { RRuleOptions } from "@/lib/recurrence-handler/types";
|
|
23
3
|
/**
|
|
24
4
|
* Core calendar event interface representing a single calendar event.
|
|
25
5
|
* This is the primary data structure for calendar events.
|
|
@@ -157,6 +137,12 @@ interface Translations {
|
|
|
157
137
|
day: string;
|
|
158
138
|
year: string;
|
|
159
139
|
more: string;
|
|
140
|
+
resources: string;
|
|
141
|
+
resource: string;
|
|
142
|
+
time: string;
|
|
143
|
+
date: string;
|
|
144
|
+
noResourcesVisible: string;
|
|
145
|
+
addResourcesOrShowExisting: string;
|
|
160
146
|
sunday: string;
|
|
161
147
|
monday: string;
|
|
162
148
|
tuesday: string;
|
|
@@ -288,6 +274,11 @@ interface IlamyCalendarProps {
|
|
|
288
274
|
* Useful for read-only views or when drag-and-drop is not needed.
|
|
289
275
|
*/
|
|
290
276
|
disableDragAndDrop?: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Maximum number of events to display per day in month view.
|
|
279
|
+
* Additional events will be hidden and can be viewed via a "more" link.
|
|
280
|
+
* Defaults to 3 if not specified.
|
|
281
|
+
*/
|
|
291
282
|
dayMaxEvents?: number;
|
|
292
283
|
/**
|
|
293
284
|
* Whether to stick the view header to the top of the calendar.
|
|
@@ -311,6 +302,67 @@ interface IlamyCalendarProps {
|
|
|
311
302
|
headerClassName?: string;
|
|
312
303
|
}
|
|
313
304
|
declare const IlamyCalendar: React3.FC<IlamyCalendarProps>;
|
|
305
|
+
import React4 from "react";
|
|
306
|
+
interface IlamyResourceCalendarProps extends IlamyCalendarProps {
|
|
307
|
+
/** Array of events to display */
|
|
308
|
+
events?: ResourceCalendarEvent[];
|
|
309
|
+
/** Array of resources */
|
|
310
|
+
resources?: Resource[];
|
|
311
|
+
/** Custom render function for resources */
|
|
312
|
+
renderResource?: (resource: Resource) => React.ReactNode;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Resource interface representing a calendar resource (person, room, equipment, etc.)
|
|
316
|
+
*/
|
|
317
|
+
interface Resource {
|
|
318
|
+
/** Unique identifier for the resource */
|
|
319
|
+
id: string | number;
|
|
320
|
+
/** Display title of the resource */
|
|
321
|
+
title: string;
|
|
322
|
+
/**
|
|
323
|
+
* Color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
|
|
324
|
+
* @example "#3b82f6", "blue-500", "rgb(59, 130, 246)"
|
|
325
|
+
*/
|
|
326
|
+
color?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Background color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
|
|
329
|
+
* @example "#dbeafe", "blue-100", "rgba(59, 130, 246, 0.1)"
|
|
330
|
+
*/
|
|
331
|
+
backgroundColor?: string;
|
|
332
|
+
/** Optional position for resource display */
|
|
333
|
+
position?: number;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Resource calendar event interface extending CalendarEvent with resource assignment
|
|
337
|
+
*/
|
|
338
|
+
interface ResourceCalendarEvent extends CalendarEvent {
|
|
339
|
+
/** Single resource assignment */
|
|
340
|
+
resourceId?: string | number;
|
|
341
|
+
/** Multiple resource assignment (cross-resource events) */
|
|
342
|
+
resourceIds?: (string | number)[];
|
|
343
|
+
}
|
|
344
|
+
declare const IlamyResourceCalendar: React4.FC<IlamyResourceCalendarProps>;
|
|
345
|
+
import { Options } from "rrule";
|
|
346
|
+
/**
|
|
347
|
+
* Re-rrule.js Options with practical TypeScript interface.
|
|
348
|
+
* Makes all properties optional except freq and dtstart (which are required by RFC 5545).
|
|
349
|
+
* This allows clean object creation without needing explicit null values.
|
|
350
|
+
*
|
|
351
|
+
* @see https://tools.ietf.org/html/rfc5545 - RFC 5545 iCalendar specification
|
|
352
|
+
* @see https://github.com/jakubroztocil/rrule - rrule.js library documentation
|
|
353
|
+
*/
|
|
354
|
+
type RRuleOptions2 = {
|
|
355
|
+
/**
|
|
356
|
+
* The frequency of the event. Must be one of the following: DAILY, WEEKLY, MONTHLY, etc.
|
|
357
|
+
*/
|
|
358
|
+
freq: Options["freq"]
|
|
359
|
+
/**
|
|
360
|
+
* The start date of the recurrence rule. This defines when the recurrence pattern begins.
|
|
361
|
+
* Required for proper RRULE functionality according to RFC 5545.
|
|
362
|
+
* @important Same as the event start date.
|
|
363
|
+
*/
|
|
364
|
+
dtstart: Date
|
|
365
|
+
} & Partial<Omit<Options, "freq" | "dtstart">>;
|
|
314
366
|
/**
|
|
315
367
|
* Simplified calendar context type for external use
|
|
316
368
|
* Contains only the most commonly used calendar operations
|
|
@@ -336,6 +388,15 @@ interface UseIlamyCalendarContextReturn {
|
|
|
336
388
|
readonly closeEventForm: () => void;
|
|
337
389
|
}
|
|
338
390
|
declare const useIlamyCalendarContext: () => UseIlamyCalendarContextReturn;
|
|
391
|
+
/**
|
|
392
|
+
* Simplified resource calendar context type for external use
|
|
393
|
+
*/
|
|
394
|
+
interface UseIlamyResourceCalendarContextReturn extends UseIlamyCalendarContextReturn {
|
|
395
|
+
readonly events: ResourceCalendarEvent[];
|
|
396
|
+
readonly resources: Resource[];
|
|
397
|
+
readonly getEventsForResource: (resourceId: string | number) => ResourceCalendarEvent[];
|
|
398
|
+
}
|
|
399
|
+
declare const useIlamyResourceCalendarContext: () => UseIlamyResourceCalendarContextReturn;
|
|
339
400
|
declare const isRecurringEvent: (event: CalendarEvent) => boolean;
|
|
340
401
|
interface GenerateRecurringEventsProps {
|
|
341
402
|
event: CalendarEvent;
|
|
@@ -347,4 +408,4 @@ declare const generateRecurringEvents: ({ event, currentEvents, startDate, endDa
|
|
|
347
408
|
import { Frequency, Weekday } from "rrule";
|
|
348
409
|
import { RRule } from "rrule";
|
|
349
410
|
declare const defaultTranslations: Translations;
|
|
350
|
-
export { useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, RRuleOptions, RRule, IlamyCalendarProps, IlamyCalendar, Frequency, CalendarEvent };
|
|
411
|
+
export { useIlamyResourceCalendarContext, useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyResourceCalendarContextReturn, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, ResourceCalendarEvent, Resource, RRuleOptions2 as RRuleOptions, RRule, IlamyResourceCalendarProps, IlamyResourceCalendar, IlamyCalendarProps, IlamyCalendar, Frequency, CalendarEvent };
|