@ilamy/calendar 1.6.3 → 1.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/README.md +103 -37
- package/dist/index.d.ts +74 -28
- package/dist/index.js +6 -6
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,50 +1,116 @@
|
|
|
1
1
|
# ilamy Calendar
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@ilamy/calendar)
|
|
4
|
+
[](https://github.com/kcsujeet/ilamy-calendar/blob/main/LICENSE)
|
|
5
|
+
[](https://github.com/kcsujeet/ilamy-calendar/actions)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A powerful, full-featured React calendar component library built with **TypeScript**, **Tailwind CSS 4**, and **Shadcn UI**. Designed for high-performance scheduling applications with full support for RFC 5545 recurring events, resource management, and drag-and-drop interactions.
|
|
6
8
|
|
|
7
|
-
<
|
|
9
|
+
<div align="center">
|
|
10
|
+
<img width="1643" height="873" alt="ilamy Calendar Month View" src="https://github.com/user-attachments/assets/d289f034-0d26-4a1c-a997-dfa1ad26aa7a" />
|
|
11
|
+
<p align="center"><i>Elegant month view with seamless event transitions</i></p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
8
15
|
|
|
9
16
|
## Features
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
### Core Views
|
|
19
|
+
- **Multiple Perspectives**: Month, Week, Day, and Year views.
|
|
20
|
+
- **Fluid Navigation**: Smooth transitions between dates and views.
|
|
21
|
+
- **Business Hours**: Customizable working hours with support for split shifts.
|
|
22
|
+
|
|
23
|
+
### Resource Management
|
|
24
|
+
- **Resource Timeline**: Visualize and manage events across multiple resources (rooms, people, equipment).
|
|
25
|
+
- **Vertical & Horizontal Layouts**: Flexible resource views to fit any application design.
|
|
26
|
+
- **Resource-Aware Validation**: Ensure events are correctly assigned and don't overlap where prohibited.
|
|
27
|
+
|
|
28
|
+
### Recurring Events (RFC 5545)
|
|
29
|
+
- **Full RRULE Support**: Daily, Weekly, Monthly, Yearly patterns with complex frequencies.
|
|
30
|
+
- **Smart CRUD**: Google Calendar-style operations—edit "this event", "this and following", or "all events".
|
|
31
|
+
- **Exclusion Dates**: Robust handling of EXDATE and modified instances within a series.
|
|
32
|
+
- **iCalendar Export**: Export events to `.ics` files with strict RFC 5545 compliance.
|
|
33
|
+
|
|
34
|
+
### Interactions & Globalization
|
|
35
|
+
- **Timezones**: Full timezone support via `dayjs.tz` with automatic DST handling.
|
|
36
|
+
- **Internationalization**: Support for 100+ locales with configurable week start days.
|
|
37
|
+
- **Drag & Drop**: Move and resize events with precision using `@dnd-kit`.
|
|
38
|
+
- **Responsive**: Adaptive layouts designed for desktop, tablet, and mobile.
|
|
39
|
+
|
|
40
|
+
### Developer Experience
|
|
41
|
+
- **Type Safety**: Written in TypeScript with comprehensive type definitions and IntelliSense support.
|
|
42
|
+
- **Reliability**: 100% test coverage for all mission-critical date and recurrence logic.
|
|
43
|
+
- **Theming**: Built on Tailwind CSS 4 variables for effortless branding and customization.
|
|
44
|
+
- **Modern Stack**: Zero-config integration with React 19 and modern build tools.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
Install the library and its peer dependencies using your preferred package manager:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# npm
|
|
54
|
+
npm install @ilamy/calendar
|
|
55
|
+
|
|
56
|
+
# bun
|
|
57
|
+
bun add @ilamy/calendar
|
|
58
|
+
|
|
59
|
+
# pnpm
|
|
60
|
+
pnpm add @ilamy/calendar
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> **Note**: This library requires **React 19+** and **Tailwind CSS 4+**.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { IlamyCalendar } from '@ilamy/calendar';
|
|
71
|
+
import '@ilamy/calendar/dist/index.css'; // Import base styles
|
|
72
|
+
|
|
73
|
+
const MyApp = () => {
|
|
74
|
+
const events = [
|
|
75
|
+
{
|
|
76
|
+
id: '1',
|
|
77
|
+
title: 'Project Kickoff',
|
|
78
|
+
start: '2026-05-01T10:00:00Z',
|
|
79
|
+
end: '2026-05-01T11:30:00Z',
|
|
80
|
+
color: 'blue'
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div style={{ height: '800px' }}>
|
|
86
|
+
<IlamyCalendar
|
|
87
|
+
events={events}
|
|
88
|
+
initialView="week"
|
|
89
|
+
onEventClick={(event) => console.log('Clicked:', event)}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
99
|
+
|
|
100
|
+
Explore the [examples directory](./examples) for complete implementation patterns:
|
|
101
|
+
|
|
102
|
+
- [Next.js](./examples/nextjs) - Integration with Next.js and Tailwind CSS.
|
|
103
|
+
- [Astro](./examples/astro) - Static site integration with Astro.
|
|
104
|
+
- [Vite](./examples/vite) - Fast, minimal setup using Vite.
|
|
105
|
+
|
|
106
|
+
---
|
|
40
107
|
|
|
41
108
|
## Documentation
|
|
42
109
|
|
|
43
|
-
For comprehensive
|
|
110
|
+
For comprehensive guides, API references, and interactive demos, visit [ilamy.dev](https://ilamy.dev).
|
|
44
111
|
|
|
45
|
-
|
|
112
|
+
---
|
|
46
113
|
|
|
47
|
-
|
|
114
|
+
## License
|
|
48
115
|
|
|
49
|
-
|
|
50
|
-
- [Astro Example](./examples/astro) - Static site integration with Astro
|
|
116
|
+
MIT © [Sujeet Kc](https://github.com/kcsujeet)
|
package/dist/index.d.ts
CHANGED
|
@@ -266,32 +266,6 @@ interface Translations {
|
|
|
266
266
|
date: string;
|
|
267
267
|
noResourcesVisible: string;
|
|
268
268
|
addResourcesOrShowExisting: string;
|
|
269
|
-
sunday: string;
|
|
270
|
-
monday: string;
|
|
271
|
-
tuesday: string;
|
|
272
|
-
wednesday: string;
|
|
273
|
-
thursday: string;
|
|
274
|
-
friday: string;
|
|
275
|
-
saturday: string;
|
|
276
|
-
sun: string;
|
|
277
|
-
mon: string;
|
|
278
|
-
tue: string;
|
|
279
|
-
wed: string;
|
|
280
|
-
thu: string;
|
|
281
|
-
fri: string;
|
|
282
|
-
sat: string;
|
|
283
|
-
january: string;
|
|
284
|
-
february: string;
|
|
285
|
-
march: string;
|
|
286
|
-
april: string;
|
|
287
|
-
may: string;
|
|
288
|
-
june: string;
|
|
289
|
-
july: string;
|
|
290
|
-
august: string;
|
|
291
|
-
september: string;
|
|
292
|
-
october: string;
|
|
293
|
-
november: string;
|
|
294
|
-
december: string;
|
|
295
269
|
}
|
|
296
270
|
type TranslationKey = keyof Translations;
|
|
297
271
|
type TranslatorFunction = (key: TranslationKey | string) => string;
|
|
@@ -304,6 +278,12 @@ type CalendarView = "month" | "week" | "day" | "year";
|
|
|
304
278
|
*/
|
|
305
279
|
type TimeFormat = "12-hour" | "24-hour";
|
|
306
280
|
/**
|
|
281
|
+
* Granularity of the time grid in minutes for day, week, and resource hour views.
|
|
282
|
+
* Quarter-hour increments only. `60` shows one row per hour with no sub-hour lines.
|
|
283
|
+
* `30` shows two rows per hour. `15` shows four rows per hour with dashed sub-hour separators.
|
|
284
|
+
*/
|
|
285
|
+
type SlotDuration = 15 | 30 | 60;
|
|
286
|
+
/**
|
|
307
287
|
* Custom class names for calendar styling.
|
|
308
288
|
* Allows users to override default styles for various calendar elements.
|
|
309
289
|
*/
|
|
@@ -360,6 +340,19 @@ interface RenderCurrentTimeIndicatorProps {
|
|
|
360
340
|
/** Progress percentage (0-100) representing position in the range */
|
|
361
341
|
progress: number;
|
|
362
342
|
/**
|
|
343
|
+
* Layout axis the indicator is rendered along.
|
|
344
|
+
* - `'vertical'`: `progress` maps to a `top` offset (day/week vertical grids).
|
|
345
|
+
* - `'horizontal'`: `progress` maps to a `left` offset (horizontal resource hour grids).
|
|
346
|
+
*
|
|
347
|
+
* The library always populates this field, so consumers can treat it as
|
|
348
|
+
* always defined inside their render function.
|
|
349
|
+
*
|
|
350
|
+
* Note: distinct from the `orientation` prop on `IlamyResourceCalendar`.
|
|
351
|
+
* `orientation` chooses which view component renders the calendar; `axis` tells
|
|
352
|
+
* your render function which dimension `progress` maps to inside that view.
|
|
353
|
+
*/
|
|
354
|
+
axis?: "vertical" | "horizontal";
|
|
355
|
+
/**
|
|
363
356
|
* The resource associated with this column (if in a resource-based view).
|
|
364
357
|
* Pass this to conditionally render custom indicators for specific resources.
|
|
365
358
|
*/
|
|
@@ -528,6 +521,12 @@ interface IlamyCalendarProps {
|
|
|
528
521
|
*/
|
|
529
522
|
hideNonBusinessHours?: boolean;
|
|
530
523
|
/**
|
|
524
|
+
* Whether to hide the iCalendar button in the calendar header.
|
|
525
|
+
* Applies to both desktop and mobile header layouts.
|
|
526
|
+
* @default false
|
|
527
|
+
*/
|
|
528
|
+
hideExportButton?: boolean;
|
|
529
|
+
/**
|
|
531
530
|
* Custom class names for overriding default calendar element styles.
|
|
532
531
|
* Allows fine-grained control over the appearance of different calendar elements.
|
|
533
532
|
* @example { disabledCell: "bg-gray-100 text-gray-400" }
|
|
@@ -538,13 +537,25 @@ interface IlamyCalendarProps {
|
|
|
538
537
|
* If provided, replaces the default red line indicator.
|
|
539
538
|
* Useful for adding custom time labels or styling.
|
|
540
539
|
*
|
|
540
|
+
* Branch on `axis` to position correctly across vertical day/week grids
|
|
541
|
+
* (`axis === 'vertical'` → use `top`) and horizontal resource hour grids
|
|
542
|
+
* (`axis === 'horizontal'` → use `left`).
|
|
543
|
+
*
|
|
541
544
|
* @example
|
|
542
545
|
* ```tsx
|
|
543
|
-
* renderCurrentTimeIndicator={({ currentTime, progress, resource, view }) => {
|
|
546
|
+
* renderCurrentTimeIndicator={({ currentTime, progress, resource, view, axis }) => {
|
|
544
547
|
* // Only show the time badge for the first resource in Day view (to avoid repetition)
|
|
545
548
|
* const isPrimary = !resource || resource.id === 'room-a'
|
|
546
549
|
* const showBadge = view === 'day' ? isPrimary : true
|
|
547
550
|
*
|
|
551
|
+
* if (axis === 'horizontal') {
|
|
552
|
+
* return (
|
|
553
|
+
* <div style={{ left: `${progress}%` }} className="absolute top-0 bottom-0">
|
|
554
|
+
* <div className="w-0.5 h-full bg-red-500" />
|
|
555
|
+
* </div>
|
|
556
|
+
* )
|
|
557
|
+
* }
|
|
558
|
+
*
|
|
548
559
|
* return (
|
|
549
560
|
* <div style={{ top: `${progress}%` }} className="absolute left-0 right-0">
|
|
550
561
|
* <div className="h-0.5 bg-red-500" />
|
|
@@ -583,6 +594,41 @@ interface IlamyCalendarProps {
|
|
|
583
594
|
* Receives a Dayjs object for the hour and should return a React node.
|
|
584
595
|
*/
|
|
585
596
|
renderHour?: (date: Dayjs) => React3.ReactNode;
|
|
597
|
+
/**
|
|
598
|
+
* Granularity of the time grid in minutes for day, week, and resource hour views.
|
|
599
|
+
* Quarter-hour increments only: `15`, `30`, or `60`.
|
|
600
|
+
*
|
|
601
|
+
* - `60` (default): one row per hour, no sub-hour lines.
|
|
602
|
+
* - `30`: two rows per hour (top of hour, half hour).
|
|
603
|
+
* - `15`: four rows per hour with dashed sub-hour separators.
|
|
604
|
+
*
|
|
605
|
+
* @default 60
|
|
606
|
+
*/
|
|
607
|
+
slotDuration?: SlotDuration;
|
|
608
|
+
/**
|
|
609
|
+
* Initial scroll position for hour-resolution views (day, week, resource
|
|
610
|
+
* day, resource week, in both orientations). Accepts `"HH:mm"` or
|
|
611
|
+
* `"HH:mm:ss"`. Minutes are floored to the hour. The scroll target is
|
|
612
|
+
* clamped to the nearest visible row when `hideNonBusinessHours` hides
|
|
613
|
+
* the requested hour.
|
|
614
|
+
*
|
|
615
|
+
* Independent of `businessHours`: you can show all 24 hours and still
|
|
616
|
+
* focus on 08:00 on load.
|
|
617
|
+
*
|
|
618
|
+
* **Requires a fixed calendar height** so the internal time grid has a
|
|
619
|
+
* scroll container to scroll within. If the calendar host element has
|
|
620
|
+
* `height: auto`, the time grid grows to fit all hours and there is
|
|
621
|
+
* nothing to scroll — this prop becomes a silent no-op.
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```tsx
|
|
625
|
+
* <IlamyCalendar
|
|
626
|
+
* businessHours={{ daysOfWeek: [1,2,3,4,5], startTime: 0, endTime: 24 }}
|
|
627
|
+
* scrollTime="08:00:00"
|
|
628
|
+
* />
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
scrollTime?: string;
|
|
586
632
|
}
|
|
587
633
|
declare const IlamyCalendar: React4.FC<IlamyCalendarProps>;
|
|
588
634
|
declare const isRecurringEvent: (event: CalendarEvent) => boolean;
|
|
@@ -627,4 +673,4 @@ interface UseIlamyCalendarContextReturn {
|
|
|
627
673
|
*/
|
|
628
674
|
declare function useIlamyCalendarContext(): UseIlamyCalendarContextReturn;
|
|
629
675
|
declare const defaultTranslations: Translations;
|
|
630
|
-
export { useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, TimeFormat, Resource, RenderCurrentTimeIndicatorProps, RRuleOptions, RRule, IlamyResourceCalendarProps, IlamyResourceCalendar, IlamyCalendarProps, IlamyCalendar, EventFormProps, CellClickInfo, CalendarView, CalendarEvent, BusinessHours };
|
|
676
|
+
export { useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, TimeFormat, SlotDuration, Resource, RenderCurrentTimeIndicatorProps, RRuleOptions, RRule, IlamyResourceCalendarProps, IlamyResourceCalendar, IlamyCalendarProps, IlamyCalendar, EventFormProps, CellClickInfo, CalendarView, CalendarEvent, BusinessHours };
|