@ilamy/calendar 1.2.3 → 1.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
@@ -129,6 +129,55 @@ interface EventFormProps {
129
129
  onDelete?: (event: CalendarEvent) => void;
130
130
  onClose: () => void;
131
131
  }
132
+ /**
133
+ * Public-facing resource calendar event interface with flexible date types.
134
+ * Similar to IlamyCalendarPropEvent but with resource assignment fields.
135
+ * Dates can be provided as dayjs.Dayjs, Date, or string and will be normalized internally.
136
+ *
137
+ * @interface IlamyResourceCalendarPropEvent
138
+ * @extends {IlamyCalendarPropEvent}
139
+ */
140
+ interface IlamyResourceCalendarPropEvent extends IlamyCalendarPropEvent {
141
+ /** Single resource assignment */
142
+ resourceId?: string | number;
143
+ /** Multiple resource assignment (cross-resource events) */
144
+ resourceIds?: (string | number)[];
145
+ }
146
+ interface IlamyResourceCalendarProps extends Omit<IlamyCalendarProps, "events"> {
147
+ /** Array of events to display */
148
+ events?: IlamyResourceCalendarPropEvent[];
149
+ /** Array of resources */
150
+ resources?: Resource[];
151
+ /** Custom render function for resources */
152
+ renderResource?: (resource: Resource) => React.ReactNode;
153
+ /**
154
+ * Orientation of the resource view.
155
+ * - "horizontal": Resources are rows, time is columns (default)
156
+ * - "vertical": Resources are columns, time is rows
157
+ */
158
+ orientation?: "horizontal" | "vertical";
159
+ }
160
+ /**
161
+ * Resource interface representing a calendar resource (person, room, equipment, etc.)
162
+ */
163
+ interface Resource {
164
+ /** Unique identifier for the resource */
165
+ id: string | number;
166
+ /** Display title of the resource */
167
+ title: string;
168
+ /**
169
+ * Color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
170
+ * @example "#3b82f6", "blue-500", "rgb(59, 130, 246)"
171
+ */
172
+ color?: string;
173
+ /**
174
+ * Background color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
175
+ * @example "#dbeafe", "blue-100", "rgba(59, 130, 246, 0.1)"
176
+ */
177
+ backgroundColor?: string;
178
+ /** Optional position for resource display */
179
+ position?: number;
180
+ }
132
181
  interface Translations {
133
182
  today: string;
134
183
  create: string;
@@ -275,6 +324,27 @@ interface CellClickInfo {
275
324
  /** Whether the clicked cell is an all-day cell (optional) */
276
325
  allDay?: boolean;
277
326
  }
327
+ /**
328
+ * Props passed to the custom render function for the current time indicator.
329
+ * Allows users to customize how the current time indicator is displayed.
330
+ */
331
+ interface RenderCurrentTimeIndicatorProps {
332
+ /** The current time as a dayjs object */
333
+ currentTime: dayjs2.Dayjs;
334
+ /** The start of the visible time range */
335
+ rangeStart: dayjs2.Dayjs;
336
+ /** The end of the visible time range */
337
+ rangeEnd: dayjs2.Dayjs;
338
+ /** Progress percentage (0-100) representing position in the range */
339
+ progress: number;
340
+ /**
341
+ * The resource associated with this column (if in a resource-based view).
342
+ * Pass this to conditionally render custom indicators for specific resources.
343
+ */
344
+ resource?: Resource;
345
+ /** The current calendar view (e.g. 'day', 'week') */
346
+ view: CalendarView;
347
+ }
278
348
  interface IlamyCalendarProps {
279
349
  /**
280
350
  * Array of events to display in the calendar.
@@ -423,11 +493,43 @@ interface IlamyCalendarProps {
423
493
  */
424
494
  timeFormat?: TimeFormat;
425
495
  /**
496
+ * Whether to hide non-business hours in Day and Week views.
497
+ * Requires businessHours to be configured.
498
+ * @default false
499
+ */
500
+ hideNonBusinessHours?: boolean;
501
+ /**
426
502
  * Custom class names for overriding default calendar element styles.
427
503
  * Allows fine-grained control over the appearance of different calendar elements.
428
504
  * @example { disabledCell: "bg-gray-100 text-gray-400" }
429
505
  */
430
506
  classesOverride?: CalendarClassesOverride;
507
+ /**
508
+ * Custom render function for the current time indicator.
509
+ * If provided, replaces the default red line indicator.
510
+ * Useful for adding custom time labels or styling.
511
+ *
512
+ * @example
513
+ * ```tsx
514
+ * renderCurrentTimeIndicator={({ currentTime, progress, resource, view }) => {
515
+ * // Only show the time badge for the first resource in Day view (to avoid repetition)
516
+ * const isPrimary = !resource || resource.id === 'room-a'
517
+ * const showBadge = view === 'day' ? isPrimary : true
518
+ *
519
+ * return (
520
+ * <div style={{ top: `${progress}%` }} className="absolute left-0 right-0">
521
+ * <div className="h-0.5 bg-red-500" />
522
+ * {showBadge && (
523
+ * <span className="absolute left-0 bg-red-500 text-white text-[10px] px-1 rounded-r-sm">
524
+ * {currentTime.format('h:mm A')}
525
+ * </span>
526
+ * )}
527
+ * </div>
528
+ * )
529
+ * }}
530
+ * ```
531
+ */
532
+ renderCurrentTimeIndicator?: (props: RenderCurrentTimeIndicatorProps) => React3.ReactNode;
431
533
  }
432
534
  declare const IlamyCalendar: React4.FC<IlamyCalendarProps>;
433
535
  declare const isRecurringEvent: (event: CalendarEvent) => boolean;
@@ -464,55 +566,6 @@ interface UseIlamyCalendarContextReturn {
464
566
  readonly businessHours?: BusinessHours | BusinessHours[];
465
567
  }
466
568
  declare const useIlamyCalendarContext: () => UseIlamyCalendarContextReturn;
467
- /**
468
- * Public-facing resource calendar event interface with flexible date types.
469
- * Similar to IlamyCalendarPropEvent but with resource assignment fields.
470
- * Dates can be provided as dayjs.Dayjs, Date, or string and will be normalized internally.
471
- *
472
- * @interface IlamyResourceCalendarPropEvent
473
- * @extends {IlamyCalendarPropEvent}
474
- */
475
- interface IlamyResourceCalendarPropEvent extends IlamyCalendarPropEvent {
476
- /** Single resource assignment */
477
- resourceId?: string | number;
478
- /** Multiple resource assignment (cross-resource events) */
479
- resourceIds?: (string | number)[];
480
- }
481
- interface IlamyResourceCalendarProps extends Omit<IlamyCalendarProps, "events"> {
482
- /** Array of events to display */
483
- events?: IlamyResourceCalendarPropEvent[];
484
- /** Array of resources */
485
- resources?: Resource[];
486
- /** Custom render function for resources */
487
- renderResource?: (resource: Resource) => React.ReactNode;
488
- /**
489
- * Orientation of the resource view.
490
- * - "horizontal": Resources are rows, time is columns (default)
491
- * - "vertical": Resources are columns, time is rows
492
- */
493
- orientation?: "horizontal" | "vertical";
494
- }
495
- /**
496
- * Resource interface representing a calendar resource (person, room, equipment, etc.)
497
- */
498
- interface Resource {
499
- /** Unique identifier for the resource */
500
- id: string | number;
501
- /** Display title of the resource */
502
- title: string;
503
- /**
504
- * Color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
505
- * @example "#3b82f6", "blue-500", "rgb(59, 130, 246)"
506
- */
507
- color?: string;
508
- /**
509
- * Background color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
510
- * @example "#dbeafe", "blue-100", "rgba(59, 130, 246, 0.1)"
511
- */
512
- backgroundColor?: string;
513
- /** Optional position for resource display */
514
- position?: number;
515
- }
516
569
  import React5 from "react";
517
570
  declare const IlamyResourceCalendar: React5.FC<IlamyResourceCalendarProps>;
518
571
  /**
@@ -525,4 +578,4 @@ interface UseIlamyResourceCalendarContextReturn extends UseIlamyCalendarContextR
525
578
  }
526
579
  declare const useIlamyResourceCalendarContext: () => UseIlamyResourceCalendarContextReturn;
527
580
  declare const defaultTranslations: Translations;
528
- export { useIlamyResourceCalendarContext, useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyResourceCalendarContextReturn, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, TimeFormat, Resource, RRuleOptions, RRule, IlamyResourceCalendarProps, IlamyResourceCalendar, IlamyCalendarProps, IlamyCalendar, Frequency, EventFormProps, CellClickInfo, CalendarView, CalendarEvent };
581
+ export { useIlamyResourceCalendarContext, useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyResourceCalendarContextReturn, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, TimeFormat, Resource, RenderCurrentTimeIndicatorProps, RRuleOptions, RRule, IlamyResourceCalendarProps, IlamyResourceCalendar, IlamyCalendarProps, IlamyCalendar, Frequency, EventFormProps, CellClickInfo, CalendarView, CalendarEvent, BusinessHours };