@ilamy/calendar 1.6.3 → 1.7.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
@@ -1,50 +1,116 @@
1
1
  # ilamy Calendar
2
2
 
3
- A powerful, full-featured React calendar component library built with TypeScript, Tailwind CSS, and modern React patterns. Features multiple calendar views, drag-and-drop support, recurring events, and comprehensive internationalization.
3
+ [![NPM Version](https://img.shields.io/npm/v/@ilamy/calendar?style=flat-square&color=black)](https://www.npmjs.com/package/@ilamy/calendar)
4
+ [![License](https://img.shields.io/npm/l/@ilamy/calendar?style=flat-square&color=black)](https://github.com/kcsujeet/ilamy-calendar/blob/main/LICENSE)
5
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/kcsujeet/ilamy-calendar/ci.yml?branch=main&style=flat-square)](https://github.com/kcsujeet/ilamy-calendar/actions)
4
6
 
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" />
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
- <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" />
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
- - 🗓️ **Multiple Views**: Month, Week, Day, and Year views with smooth transitions
12
- - 📊 **Resource Calendar**: Visualize and manage events across multiple resources with timeline layout
13
- - 🎯 **Drag & Drop**: Move events between dates and time slots with collision detection
14
- - 🔄 **RFC 5545 Recurring Events**: Full RRULE support with Google Calendar-style operations
15
- - **RRULE Patterns**: Daily, Weekly, Monthly, Yearly with complex frequencies
16
- - **Smart Operations**: Edit "this event", "this and following", or "all events"
17
- - **Exception Handling**: EXDATE exclusions and modified instance support
18
- - **rrule.js Integration**: Battle-tested library for robust recurrence generation
19
- - 📤 **iCalendar Export**: RFC 5545 compliant .ics file export with proper recurring event handling
20
- - 🌍 **Internationalization**: 100+ locales with dayjs and configurable week start days
21
- - 🎨 **Customizable Styling**:
22
- - Flexible theming with Tailwind CSS and CSS variables
23
- - Custom event rendering with render props
24
- - Configurable colors, fonts, and spacing
25
- - **Performance Optimized**:
26
- - On-demand recurring event generation
27
- - Efficient date range calculations
28
- - Minimal re-renders with optimized React patterns
29
- - 📱 **Responsive Design**: Adaptive layouts for desktop, tablet, and mobile
30
- - 🔧 **Developer Experience**:
31
- - Full TypeScript support with comprehensive type definitions
32
- - IntelliSense and autocompletion
33
- - Extensive JSDoc documentation
34
- - Test-driven development with 100% test coverage
35
- - 🎛️ **Advanced Event Management**:
36
- - All-day events with proper timezone handling
37
- - Multi-day events with smart positioning
38
- - Event validation and error handling
39
- - Bulk operations and batch updates
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 documentation, examples, and interactive demos, visit [ilamy.dev](https://ilamy.dev)
110
+ For comprehensive guides, API references, and interactive demos, visit [ilamy.dev](https://ilamy.dev).
44
111
 
45
- ## Code Example
112
+ ---
46
113
 
47
- Check out the [examples directory](./examples) for complete project setups:
114
+ ## License
48
115
 
49
- - [Next.js Example](./examples/nextjs) - Full-featured Next.js integration
50
- - [Astro Example](./examples/astro) - Static site integration with Astro
116
+ MIT © [Sujeet Kc](https://github.com/kcsujeet)
package/dist/index.d.ts CHANGED
@@ -304,6 +304,12 @@ type CalendarView = "month" | "week" | "day" | "year";
304
304
  */
305
305
  type TimeFormat = "12-hour" | "24-hour";
306
306
  /**
307
+ * Granularity of the time grid in minutes for day, week, and resource hour views.
308
+ * Quarter-hour increments only. `60` shows one row per hour with no sub-hour lines.
309
+ * `30` shows two rows per hour. `15` shows four rows per hour with dashed sub-hour separators.
310
+ */
311
+ type SlotDuration = 15 | 30 | 60;
312
+ /**
307
313
  * Custom class names for calendar styling.
308
314
  * Allows users to override default styles for various calendar elements.
309
315
  */
@@ -360,6 +366,19 @@ interface RenderCurrentTimeIndicatorProps {
360
366
  /** Progress percentage (0-100) representing position in the range */
361
367
  progress: number;
362
368
  /**
369
+ * Layout axis the indicator is rendered along.
370
+ * - `'vertical'`: `progress` maps to a `top` offset (day/week vertical grids).
371
+ * - `'horizontal'`: `progress` maps to a `left` offset (horizontal resource hour grids).
372
+ *
373
+ * The library always populates this field, so consumers can treat it as
374
+ * always defined inside their render function.
375
+ *
376
+ * Note: distinct from the `orientation` prop on `IlamyResourceCalendar`.
377
+ * `orientation` chooses which view component renders the calendar; `axis` tells
378
+ * your render function which dimension `progress` maps to inside that view.
379
+ */
380
+ axis?: "vertical" | "horizontal";
381
+ /**
363
382
  * The resource associated with this column (if in a resource-based view).
364
383
  * Pass this to conditionally render custom indicators for specific resources.
365
384
  */
@@ -538,13 +557,25 @@ interface IlamyCalendarProps {
538
557
  * If provided, replaces the default red line indicator.
539
558
  * Useful for adding custom time labels or styling.
540
559
  *
560
+ * Branch on `axis` to position correctly across vertical day/week grids
561
+ * (`axis === 'vertical'` → use `top`) and horizontal resource hour grids
562
+ * (`axis === 'horizontal'` → use `left`).
563
+ *
541
564
  * @example
542
565
  * ```tsx
543
- * renderCurrentTimeIndicator={({ currentTime, progress, resource, view }) => {
566
+ * renderCurrentTimeIndicator={({ currentTime, progress, resource, view, axis }) => {
544
567
  * // Only show the time badge for the first resource in Day view (to avoid repetition)
545
568
  * const isPrimary = !resource || resource.id === 'room-a'
546
569
  * const showBadge = view === 'day' ? isPrimary : true
547
570
  *
571
+ * if (axis === 'horizontal') {
572
+ * return (
573
+ * <div style={{ left: `${progress}%` }} className="absolute top-0 bottom-0">
574
+ * <div className="w-0.5 h-full bg-red-500" />
575
+ * </div>
576
+ * )
577
+ * }
578
+ *
548
579
  * return (
549
580
  * <div style={{ top: `${progress}%` }} className="absolute left-0 right-0">
550
581
  * <div className="h-0.5 bg-red-500" />
@@ -583,6 +614,41 @@ interface IlamyCalendarProps {
583
614
  * Receives a Dayjs object for the hour and should return a React node.
584
615
  */
585
616
  renderHour?: (date: Dayjs) => React3.ReactNode;
617
+ /**
618
+ * Granularity of the time grid in minutes for day, week, and resource hour views.
619
+ * Quarter-hour increments only: `15`, `30`, or `60`.
620
+ *
621
+ * - `60` (default): one row per hour, no sub-hour lines.
622
+ * - `30`: two rows per hour (top of hour, half hour).
623
+ * - `15`: four rows per hour with dashed sub-hour separators.
624
+ *
625
+ * @default 60
626
+ */
627
+ slotDuration?: SlotDuration;
628
+ /**
629
+ * Initial scroll position for hour-resolution views (day, week, resource
630
+ * day, resource week, in both orientations). Accepts `"HH:mm"` or
631
+ * `"HH:mm:ss"`. Minutes are floored to the hour. The scroll target is
632
+ * clamped to the nearest visible row when `hideNonBusinessHours` hides
633
+ * the requested hour.
634
+ *
635
+ * Independent of `businessHours`: you can show all 24 hours and still
636
+ * focus on 08:00 on load.
637
+ *
638
+ * **Requires a fixed calendar height** so the internal time grid has a
639
+ * scroll container to scroll within. If the calendar host element has
640
+ * `height: auto`, the time grid grows to fit all hours and there is
641
+ * nothing to scroll — this prop becomes a silent no-op.
642
+ *
643
+ * @example
644
+ * ```tsx
645
+ * <IlamyCalendar
646
+ * businessHours={{ daysOfWeek: [1,2,3,4,5], startTime: 0, endTime: 24 }}
647
+ * scrollTime="08:00:00"
648
+ * />
649
+ * ```
650
+ */
651
+ scrollTime?: string;
586
652
  }
587
653
  declare const IlamyCalendar: React4.FC<IlamyCalendarProps>;
588
654
  declare const isRecurringEvent: (event: CalendarEvent) => boolean;
@@ -627,4 +693,4 @@ interface UseIlamyCalendarContextReturn {
627
693
  */
628
694
  declare function useIlamyCalendarContext(): UseIlamyCalendarContextReturn;
629
695
  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 };
696
+ 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 };