calendar-simple 1.2.0 → 2.0.0-beta.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.
Files changed (101) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +371 -62
  3. package/dist/calendar-simple.css +1 -1
  4. package/dist/index.cjs.js +1 -1
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +7588 -978
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/index.iife.js +1 -1
  9. package/dist/index.iife.js.map +1 -1
  10. package/dist/src/Calendar.d.ts +19 -0
  11. package/dist/src/Calendar.test.d.ts +1 -0
  12. package/dist/src/assets/LeftArrow.d.ts +3 -0
  13. package/dist/src/assets/RightArrow.d.ts +3 -0
  14. package/dist/src/components/core/all_day_banner/AllDayBanner.d.ts +9 -0
  15. package/dist/src/components/core/all_day_banner/AllDayBanner.test.d.ts +1 -0
  16. package/dist/src/components/core/current_time_line/CurrentTimeLine.d.ts +7 -0
  17. package/dist/src/components/core/current_time_line/CurrentTimeLine.test.d.ts +1 -0
  18. package/dist/src/components/core/day_column/DayColumn.d.ts +11 -0
  19. package/dist/src/components/core/day_column/DayColumn.test.d.ts +1 -0
  20. package/dist/src/components/core/day_event_item/DayWeekEventItem.d.ts +8 -0
  21. package/dist/src/components/core/day_event_item/DayWeekEventItem.test.d.ts +1 -0
  22. package/dist/src/components/core/month_event_item/MonthEventItem.d.ts +21 -0
  23. package/dist/src/components/core/month_event_item/MonthEventItem.test.d.ts +1 -0
  24. package/dist/src/components/core/time_column/TimeColumn.d.ts +6 -0
  25. package/dist/src/components/core/time_column/TimeColumn.test.d.ts +1 -0
  26. package/dist/src/components/layout/Header.d.ts +7 -0
  27. package/dist/src/components/layout/Header.test.d.ts +1 -0
  28. package/dist/src/components/ui/CalendarErrorBoundary.d.ts +14 -0
  29. package/dist/src/components/ui/popover/Popover.d.ts +11 -0
  30. package/dist/src/components/ui/popover/Popover.test.d.ts +1 -0
  31. package/dist/src/components/ui/skeleton/MonthSkeleton.d.ts +2 -0
  32. package/dist/src/components/ui/skeleton/MonthSkeleton.test.d.ts +1 -0
  33. package/dist/src/components/ui/skeleton/ScheduleSkeleton.d.ts +2 -0
  34. package/dist/src/components/ui/skeleton/ScheduleSkeleton.test.d.ts +1 -0
  35. package/dist/src/components/ui/skeleton/TimeGridSkeleton.d.ts +2 -0
  36. package/dist/src/components/ui/skeleton/TimeGridSkeleton.test.d.ts +1 -0
  37. package/dist/src/components/views/View.d.ts +4 -0
  38. package/dist/src/components/views/View.test.d.ts +1 -0
  39. package/dist/src/components/views/custom_days_view/CustomDaysView.d.ts +5 -0
  40. package/dist/src/components/views/custom_days_view/CustomDaysView.test.d.ts +1 -0
  41. package/dist/src/components/views/day_view/DayView.d.ts +5 -0
  42. package/dist/src/components/views/day_view/DayView.test.d.ts +1 -0
  43. package/dist/src/components/views/month_view/MonthView.d.ts +5 -0
  44. package/dist/src/components/views/month_view/MonthView.test.d.ts +1 -0
  45. package/dist/src/components/views/schedule_view/ScheduleView.d.ts +4 -0
  46. package/dist/src/components/views/schedule_view/ScheduleView.test.d.ts +1 -0
  47. package/dist/src/components/views/week_view/WeekView.d.ts +5 -0
  48. package/dist/src/components/views/week_view/WeekView.test.d.ts +1 -0
  49. package/dist/src/constants/calendar.d.ts +96 -0
  50. package/dist/src/constants/index.d.ts +2 -0
  51. package/dist/src/constants/theme.d.ts +38 -0
  52. package/dist/src/context/CalendarContext.d.ts +83 -0
  53. package/dist/src/context/CalendarContext.test.d.ts +1 -0
  54. package/dist/src/hooks/useAllDayBanner.d.ts +48 -0
  55. package/dist/src/hooks/useAllDayBanner.test.d.ts +1 -0
  56. package/dist/src/hooks/useCalendarProps.d.ts +10 -0
  57. package/dist/src/hooks/useColorScheme.d.ts +2 -0
  58. package/dist/src/hooks/useColorScheme.test.d.ts +1 -0
  59. package/dist/src/hooks/useDayEventLayout.d.ts +27 -0
  60. package/dist/src/hooks/useDayEventLayout.test.d.ts +1 -0
  61. package/dist/src/hooks/useEvents.d.ts +16 -0
  62. package/dist/src/hooks/useEvents.test.d.ts +1 -0
  63. package/dist/src/hooks/useMonthGrid.d.ts +44 -0
  64. package/dist/src/hooks/useMonthGrid.test.d.ts +1 -0
  65. package/dist/src/hooks/useResizeObserver.d.ts +13 -0
  66. package/dist/src/hooks/useResizeObserver.test.d.ts +1 -0
  67. package/dist/src/hooks/useScheduleView.d.ts +24 -0
  68. package/dist/src/hooks/useScheduleView.test.d.ts +1 -0
  69. package/dist/src/index.d.ts +13 -0
  70. package/dist/src/setupTests.d.ts +0 -0
  71. package/dist/src/stories/Accessibility.stories.d.ts +10 -0
  72. package/dist/src/stories/CustomDayView.stories.d.ts +10 -0
  73. package/dist/src/stories/Customization.stories.d.ts +29 -0
  74. package/dist/src/stories/DayView.stories.d.ts +11 -0
  75. package/dist/src/stories/Features.stories.d.ts +25 -0
  76. package/dist/src/stories/Localization.stories.d.ts +22 -0
  77. package/dist/src/stories/MonthView.stories.d.ts +13 -0
  78. package/dist/src/stories/QA/EdgeCases.stories.d.ts +12 -0
  79. package/dist/src/stories/QA/Interactions.stories.d.ts +8 -0
  80. package/dist/src/stories/QA/LayoutLimits.stories.d.ts +11 -0
  81. package/dist/src/stories/QA/Performance.stories.d.ts +9 -0
  82. package/dist/src/stories/QA/TimeFormatting.stories.d.ts +11 -0
  83. package/dist/src/stories/QA/Views.stories.d.ts +10 -0
  84. package/dist/src/stories/ScheduleView.stories.d.ts +10 -0
  85. package/dist/src/stories/WeekView.stories.d.ts +14 -0
  86. package/dist/src/types/calendar.d.ts +213 -0
  87. package/dist/src/types/events.d.ts +34 -0
  88. package/dist/src/types/index.d.ts +3 -0
  89. package/dist/src/types/theme.d.ts +81 -0
  90. package/dist/src/utils/common.d.ts +48 -0
  91. package/dist/src/utils/common.test.d.ts +1 -0
  92. package/dist/src/utils/contrast.d.ts +18 -0
  93. package/dist/src/utils/contrast.test.d.ts +1 -0
  94. package/dist/src/utils/date.d.ts +55 -0
  95. package/dist/src/utils/date.test.d.ts +1 -0
  96. package/dist/src/utils/formatting.d.ts +21 -0
  97. package/dist/src/utils/formatting.test.d.ts +1 -0
  98. package/dist/src/utils/index.d.ts +9 -0
  99. package/dist/stats.html +4950 -0
  100. package/package.json +56 -16
  101. package/dist/index.d.ts +0 -60
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarProps } from './types';
3
+ import { default as Header } from './components/layout/Header';
4
+ import { default as DayView } from './components/views/day_view/DayView';
5
+ import { default as WeekView } from './components/views/week_view/WeekView';
6
+ import { default as MonthView } from './components/views/month_view/MonthView';
7
+ import { default as ScheduleView } from './components/views/schedule_view/ScheduleView';
8
+ import { default as CustomDaysView } from './components/views/custom_days_view/CustomDaysView';
9
+ import { default as View } from './components/views/View';
10
+ declare const MemoizedCalendar: React.NamedExoticComponent<CalendarProps> & {
11
+ Header: typeof Header;
12
+ View: typeof View;
13
+ DayView: typeof DayView;
14
+ WeekView: typeof WeekView;
15
+ MonthView: typeof MonthView;
16
+ ScheduleView: typeof ScheduleView;
17
+ CustomDaysView: typeof CustomDaysView;
18
+ };
19
+ export default MemoizedCalendar;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare function LeftArrow(): React.JSX.Element;
3
+ export default LeftArrow;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare function RightArrow(): React.JSX.Element;
3
+ export default RightArrow;
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { DateType } from '../../../utils';
3
+ import { CalendarEvent, CalendarContentProps } from '../../../types';
4
+ interface AllDayBannerProps extends Pick<CalendarContentProps, "maxEvents" | "onEventClick" | "classNames" | "is12Hour" | "renderEvent" | "locale"> {
5
+ days: DateType[];
6
+ events: CalendarEvent[];
7
+ }
8
+ export default function AllDayBanner({ days, events, maxEvents, onEventClick, classNames, is12Hour, renderEvent, locale, }: AllDayBannerProps): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ interface CurrentTimeLineProps extends Pick<CalendarContentProps, "minHour" | "maxHour"> {
4
+ className?: string;
5
+ }
6
+ declare const CurrentTimeLine: ({ className, minHour, maxHour, }: CurrentTimeLineProps) => React.JSX.Element | null;
7
+ export default CurrentTimeLine;
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { DateTime } from 'luxon';
3
+ import { CalendarContentProps } from '../../../types';
4
+ import { DayEventLayout } from '../../../hooks/useDayEventLayout';
5
+ interface DayColumnProps extends Pick<CalendarContentProps, "onEventClick" | "is12Hour" | "classNames" | "showCurrentTime" | "minHour" | "maxHour" | "renderEvent" | "renderHourCell" | "creatable" | "onSlotClick"> {
6
+ dayEvents: DayEventLayout[];
7
+ date: DateTime;
8
+ isToday?: boolean;
9
+ }
10
+ declare function DayColumn({ dayEvents, date, onEventClick, is12Hour, classNames, isToday, showCurrentTime, minHour, maxHour, renderEvent, renderHourCell, creatable, onSlotClick, }: DayColumnProps): React.JSX.Element;
11
+ export default DayColumn;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ import { DayEventLayout } from '../../../hooks/useDayEventLayout';
4
+ interface DayWeekEventItemProps extends Pick<CalendarContentProps, "onEventClick" | "is12Hour" | "classNames" | "renderEvent"> {
5
+ item: DayEventLayout;
6
+ }
7
+ export declare function DayWeekEventItem({ item, onEventClick, is12Hour, classNames, renderEvent, }: DayWeekEventItemProps): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps, EventListType } from '../../../types';
3
+ import { DateType } from '../../../utils';
4
+ interface MonthEventItemProps extends Pick<CalendarContentProps, "onEventClick" | "theme" | "maxEvents" | "is12Hour" | "showAdjacentMonths" | "classNames" | "renderEvent" | "renderDateCell"> {
5
+ dataClassName?: string;
6
+ selectedClassName?: string;
7
+ todayClassName?: string;
8
+ date: number;
9
+ dateObj: DateType;
10
+ data: (EventListType | null)[];
11
+ cellWidth: number;
12
+ className?: string;
13
+ isSelected: boolean;
14
+ isToday: boolean;
15
+ isCurrentMonth: boolean;
16
+ onClick?: (date: DateType) => void;
17
+ onMoreClick?: (date: DateType, hiddenEvents: EventListType[]) => void;
18
+ totalEvents?: number;
19
+ }
20
+ declare function MonthEventItem({ date, dateObj, data, cellWidth, className, dataClassName, isSelected, isToday, onClick, selectedClassName, todayClassName, isCurrentMonth, theme, maxEvents, onMoreClick, onEventClick, totalEvents, is12Hour, showAdjacentMonths, classNames, renderEvent, renderDateCell, }: MonthEventItemProps): React.JSX.Element;
21
+ export default MonthEventItem;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ interface TimeColumnProps extends Pick<CalendarContentProps, "is12Hour" | "classNames" | "minHour" | "maxHour" | "locale"> {
4
+ }
5
+ declare function TimeColumn({ is12Hour, classNames, minHour, maxHour, locale, }: TimeColumnProps): React.JSX.Element;
6
+ export default TimeColumn;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../types';
3
+ export type HeaderProps = Partial<Pick<CalendarContentProps, "pastYearLength" | "futureYearLength" | "onNavigate" | "onViewChange" | "customDays" | "resetDateOnViewChange" | "localeMessages" | "showWeekNumbers">> & {
4
+ headerClassName?: string;
5
+ };
6
+ declare function Header(props: HeaderProps): React.JSX.Element;
7
+ export default Header;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { default as React, Component, ReactNode, ErrorInfo } from 'react';
2
+ interface Props {
3
+ children: ReactNode;
4
+ }
5
+ interface State {
6
+ hasError: boolean;
7
+ }
8
+ export default class CalendarErrorBoundary extends Component<Props, State> {
9
+ state: State;
10
+ static getDerivedStateFromError(): State;
11
+ componentDidCatch(_error: Error, _info: ErrorInfo): void;
12
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
13
+ }
14
+ export {};
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { DateType } from '../../../utils';
3
+ import { CalendarContentProps, EventListType } from '../../../types';
4
+ interface PopoverProps extends Pick<CalendarContentProps, "onEventClick" | "is12Hour" | "renderEvent"> {
5
+ dateObj: DateType;
6
+ events: EventListType[];
7
+ onClose: () => void;
8
+ anchorEl: HTMLElement | null;
9
+ }
10
+ declare function Popover({ dateObj, events, onEventClick, onClose, anchorEl, is12Hour, renderEvent, }: PopoverProps): React.ReactPortal;
11
+ export default Popover;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export default function MonthSkeleton(): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export default function ScheduleSkeleton(): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export default function TimeGridSkeleton(): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../types';
3
+ export type ViewProps = Partial<Omit<CalendarContentProps, "events" | "locale" | "pastYearLength" | "futureYearLength" | "onNavigate" | "onViewChange" | "resetDateOnViewChange" | "localeMessages">>;
4
+ export default function View(props: ViewProps): React.JSX.Element | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ export type CustomViewProps = Partial<Pick<CalendarContentProps, "is12Hour" | "dayType" | "onEventClick" | "theme" | "classNames" | "showCurrentTime" | "maxEvents" | "autoScrollToCurrentTime" | "minHour" | "maxHour" | "customDays" | "renderEvent" | "renderHourCell" | "renderDateCell" | "showAllDayRow" | "eventOverlapOffset" | "enableEnrichedEvents" | "enrichedEventsByDate" | "eventsAreSorted" | "isEventOrderingEnabled" | "creatable" | "onSlotClick">>;
4
+ declare function CustomView(props: CustomViewProps): React.JSX.Element;
5
+ export default CustomView;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ export type DayViewProps = Partial<Pick<CalendarContentProps, "is12Hour" | "dayType" | "onEventClick" | "theme" | "classNames" | "showCurrentTime" | "maxEvents" | "autoScrollToCurrentTime" | "minHour" | "maxHour" | "renderEvent" | "renderHourCell" | "renderDateCell" | "showAllDayRow" | "eventOverlapOffset" | "enableEnrichedEvents" | "enrichedEventsByDate" | "eventsAreSorted" | "isEventOrderingEnabled" | "creatable" | "onSlotClick">>;
4
+ declare function DayView(props: DayViewProps): React.JSX.Element;
5
+ export default DayView;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ export type MonthViewProps = Partial<Pick<CalendarContentProps, "is12Hour" | "selectable" | "maxEvents" | "dayType" | "onDateClick" | "onEventClick" | "onMoreClick" | "theme" | "classNames" | "weekStartsOn" | "weekEndsOn" | "showAdjacentMonths" | "renderEvent" | "renderDateCell" | "enableEnrichedEvents" | "enrichedEventsByDate" | "eventsAreSorted" | "isEventOrderingEnabled" | "sortedMonthView" | "showWeekNumbers" | "creatable" | "onSlotClick">>;
4
+ declare function MonthView(props: MonthViewProps): React.JSX.Element;
5
+ export default MonthView;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ export type ScheduleViewProps = Partial<Pick<CalendarContentProps, "is12Hour" | "dayType" | "onEventClick" | "theme" | "classNames" | "autoScrollToCurrentTime" | "renderEvent" | "renderScheduleSeparator">>;
4
+ export default function ScheduleView(props: ScheduleViewProps): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarContentProps } from '../../../types';
3
+ export type WeekViewProps = Partial<Pick<CalendarContentProps, "is12Hour" | "dayType" | "onEventClick" | "theme" | "classNames" | "showCurrentTime" | "maxEvents" | "autoScrollToCurrentTime" | "weekStartsOn" | "weekEndsOn" | "minHour" | "maxHour" | "renderEvent" | "renderHourCell" | "renderDateCell" | "showAllDayRow" | "eventOverlapOffset" | "enableEnrichedEvents" | "enrichedEventsByDate" | "eventsAreSorted" | "isEventOrderingEnabled" | "creatable" | "onSlotClick">>;
4
+ declare function WeekView(props: WeekViewProps): React.JSX.Element;
5
+ export default WeekView;
@@ -0,0 +1,96 @@
1
+ /** Test ID strings used to locate header dropdown elements in tests and automation. */
2
+ export declare const CALENDAR_STRINGS: {
3
+ MONTH: string;
4
+ YEAR: string;
5
+ };
6
+ /** View options shown in the header view switcher dropdown (excludes CustomDays, which is dynamic). */
7
+ export declare const VIEW_OPTIONS: ({
8
+ label: string;
9
+ value: "day";
10
+ } | {
11
+ label: string;
12
+ value: "week";
13
+ } | {
14
+ label: string;
15
+ value: "month";
16
+ } | {
17
+ label: string;
18
+ value: "schedule";
19
+ })[];
20
+ /** Default values merged into `CalendarProps` by `useCalendarProps` when the consumer omits a prop. */
21
+ export declare const defaultCalendarProps: {
22
+ events: never[];
23
+ view: "month";
24
+ locale: string;
25
+ localeMessages: {
26
+ today: string;
27
+ day: string;
28
+ week: string;
29
+ month: string;
30
+ schedule: string;
31
+ days: string;
32
+ };
33
+ is12Hour: boolean;
34
+ selectable: boolean;
35
+ creatable: boolean;
36
+ dayType: "half";
37
+ pastYearLength: number;
38
+ futureYearLength: number;
39
+ showCurrentTime: boolean;
40
+ autoScrollToCurrentTime: boolean;
41
+ minHour: number;
42
+ maxHour: number;
43
+ weekStartsOn: number;
44
+ weekEndsOn: number;
45
+ theme: {};
46
+ classNames: {};
47
+ showAdjacentMonths: boolean;
48
+ showWeekNumbers: boolean;
49
+ resetDateOnViewChange: boolean;
50
+ showAllDayRow: boolean;
51
+ eventOverlapOffset: number;
52
+ enableEnrichedEvents: boolean;
53
+ eventsAreSorted: boolean;
54
+ isEventOrderingEnabled: boolean;
55
+ sortedMonthView: boolean;
56
+ testId: string;
57
+ isLoading: boolean;
58
+ };
59
+ /**
60
+ * Locale primary subtags that default to RTL layout when no explicit `direction` prop is given.
61
+ * Match is case-insensitive and handles BCP-47 region/script tags (e.g. ar-SA → ar).
62
+ */
63
+ export declare const RTL_LOCALES: readonly ["ar", "he", "fa", "ur", "ps", "sd", "ckb", "yi"];
64
+ /** Action type strings dispatched to the calendar reducer. */
65
+ export declare const CALENDAR_ACTIONS: {
66
+ readonly SET_DATE: "SET_DATE";
67
+ readonly SET_VIEW: "SET_VIEW";
68
+ readonly SET_CUSTOM_DAYS: "SET_CUSTOM_DAYS";
69
+ readonly NEXT: "NEXT";
70
+ readonly PREV: "PREV";
71
+ readonly TODAY: "TODAY";
72
+ };
73
+ /** Common time unit values used in duration and overlap calculations. */
74
+ export declare const TIME_CONSTANTS: {
75
+ readonly MINUTES_IN_HOUR: 60;
76
+ readonly HOURS_IN_DAY: 24;
77
+ readonly DAYS_IN_WEEK: 7;
78
+ readonly MS_PER_MINUTE: 60000;
79
+ readonly MS_PER_HOUR: 3600000;
80
+ };
81
+ /** Luxon format strings used throughout the calendar for date and time display. */
82
+ export declare const DATE_FORMATS: {
83
+ readonly DATE: "yyyy-MM-dd";
84
+ readonly TIME: "HH:mm";
85
+ readonly TIME_12H: "hh:mm a";
86
+ readonly HOUR_12H: "hh a";
87
+ readonly MONTH_YEAR: "MMMM yyyy";
88
+ readonly DAY_INDEX: "c";
89
+ readonly DAY_NUMBER: "d";
90
+ readonly FULL_DATE: "EEEE, MMMM d, yyyy";
91
+ readonly MONTH_DAY_YEAR: "MMMM d, yyyy";
92
+ readonly SHORT_MONTH_YEAR: "MMM yyyy";
93
+ readonly SHORT_MONTH: "MMM";
94
+ readonly SHORT_DAY: "EEE";
95
+ readonly DAY_DATE_SHORT_MONTH: "EEE, d MMM";
96
+ };
@@ -0,0 +1,2 @@
1
+ export * from './theme';
2
+ export * from './calendar';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @file Default theme values and layout/keyboard constants.
3
+ */
4
+ /** Fallback color theme applied when no `theme` prop is provided. */
5
+ export declare const defaultTheme: {
6
+ default: {
7
+ color: string;
8
+ bgColor: string;
9
+ };
10
+ selected: {
11
+ color: string;
12
+ bgColor: string;
13
+ };
14
+ today: {
15
+ color: string;
16
+ bgColor: string;
17
+ };
18
+ };
19
+ /** Pixel dimensions used by layout algorithms to calculate cell sizes and event positioning. */
20
+ export declare const LAYOUT_CONSTANTS: {
21
+ readonly HEADER_HEIGHT: 122;
22
+ readonly DATE_LABEL_HEIGHT: 28;
23
+ readonly CELL_PADDING: 8;
24
+ readonly EVENT_HEIGHT: 26;
25
+ readonly DEFAULT_ROWS: 6;
26
+ readonly MIN_ROWS: 4;
27
+ readonly ALL_DAY_ROW_HEIGHT: 24;
28
+ readonly EVENT_ITEM_PADDING: 16;
29
+ readonly SMALL_EVENT_HEIGHT: 40;
30
+ readonly TINY_EVENT_HEIGHT: 20;
31
+ readonly DEFAULT_EVENT_COLOR: "#3b82f6";
32
+ };
33
+ /** Keyboard key values that trigger interactive calendar actions. */
34
+ export declare const KEYBOARD_SHORTCUTS: {
35
+ readonly OPEN: "Enter";
36
+ readonly ACTIVATE: " ";
37
+ readonly CLOSE: "Escape";
38
+ };
@@ -0,0 +1,83 @@
1
+ import { default as React, ReactNode, Dispatch } from 'react';
2
+ import { DateType } from '../utils';
3
+ import { ECalendarViewType, CalendarProps } from '../types';
4
+ import { CALENDAR_ACTIONS } from '../constants';
5
+ /**
6
+ * Mutable runtime state managed by the calendar reducer.
7
+ */
8
+ export interface CalendarState {
9
+ /** The currently selected (navigated-to) date. */
10
+ selectedDate: DateType;
11
+ /** The active view mode. */
12
+ view: ECalendarViewType;
13
+ /** Number of days shown when view is `customDays`. */
14
+ customDays?: number;
15
+ }
16
+ /**
17
+ * Union of all dispatchable actions for the calendar reducer.
18
+ * - `SET_DATE` — jump to a specific date
19
+ * - `SET_VIEW` — switch the active view
20
+ * - `NEXT` / `PREV` — advance or retreat by one view-unit (month, week, day, or N custom days)
21
+ * - `TODAY` — reset navigation to today
22
+ */
23
+ export type CalendarAction = {
24
+ type: typeof CALENDAR_ACTIONS.SET_DATE;
25
+ payload: DateType;
26
+ } | {
27
+ type: typeof CALENDAR_ACTIONS.SET_VIEW;
28
+ payload: ECalendarViewType;
29
+ } | {
30
+ type: typeof CALENDAR_ACTIONS.SET_CUSTOM_DAYS;
31
+ payload: number;
32
+ } | {
33
+ type: typeof CALENDAR_ACTIONS.NEXT;
34
+ } | {
35
+ type: typeof CALENDAR_ACTIONS.PREV;
36
+ } | {
37
+ type: typeof CALENDAR_ACTIONS.TODAY;
38
+ };
39
+ /**
40
+ * Shape of the value exposed by `CalendarContext`.
41
+ */
42
+ export interface CalendarContextValue {
43
+ /** Current reducer state (selected date, view, customDays). */
44
+ state: CalendarState;
45
+ /** Dispatch function for sending actions to the reducer. */
46
+ dispatch: Dispatch<CalendarAction>;
47
+ /** `data-testid` forwarded from the root `<Calendar>` prop. */
48
+ testId?: string;
49
+ /** Static calendar configuration props (everything except `children`, `selectedDate`, and `view`). */
50
+ config: Omit<CalendarProps, "children" | "selectedDate" | "view">;
51
+ /** Resolved color scheme ("light" or "dark") for portaled UI such as Popover. */
52
+ colorScheme: "light" | "dark";
53
+ }
54
+ export declare const CalendarContext: React.Context<CalendarContextValue | undefined>;
55
+ /**
56
+ * Props accepted by `CalendarProvider`.
57
+ */
58
+ export interface CalendarProviderProps {
59
+ /** Content rendered inside the calendar layout. */
60
+ children: ReactNode;
61
+ /** Starting selected date for the reducer. */
62
+ initialDate: DateType;
63
+ /** Starting view mode for the reducer. */
64
+ initialView: ECalendarViewType;
65
+ /** Starting value for `customDays` when the initial view is `customDays`. */
66
+ initialCustomDays?: number;
67
+ /** Forwarded `data-testid` from the root `<Calendar>` prop. */
68
+ testId?: string;
69
+ /** Static configuration props passed through to all child components via context. */
70
+ config?: Omit<CalendarProps, "children" | "selectedDate" | "view">;
71
+ }
72
+ /**
73
+ * Provides calendar state and dispatch to the component tree via `CalendarContext`.
74
+ * Wrap view components with this provider; consume state via `useCalendar()`.
75
+ */
76
+ export declare function CalendarProvider({ children, initialDate, initialView, initialCustomDays, testId, config, }: CalendarProviderProps): React.JSX.Element;
77
+ /**
78
+ * Consumes `CalendarContext` and returns the current state, dispatch, and config.
79
+ * Must be called inside a `CalendarProvider` — throws if the context is missing.
80
+ *
81
+ * @returns The current `CalendarContextValue`.
82
+ */
83
+ export declare function useCalendar(): CalendarContextValue;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,48 @@
1
+ import { DateType } from '../utils/date';
2
+ import { CalendarEvent } from '../types';
3
+ /**
4
+ * Represents the layout information for an event displayed in the all-day banner.
5
+ */
6
+ export interface BannerLayoutEvent {
7
+ /** The original calendar event data */
8
+ event: CalendarEvent;
9
+ /** The index of the day where the event starts within the current view */
10
+ startIndex: number;
11
+ /** The index of the day where the event ends within the current view */
12
+ endIndex: number;
13
+ /** Indicates if the event starts before the current view's start date */
14
+ isClippedLeft: boolean;
15
+ /** Indicates if the event ends after the current view's end date */
16
+ isClippedRight: boolean;
17
+ /** The vertical row index where the event should be positioned to avoid overlap */
18
+ row: number;
19
+ }
20
+ /**
21
+ * Hook to calculate layout and positioning for multi-day and all-day events in a banner view.
22
+ * It determines which events are visible, how they stack vertically to avoid overlapping,
23
+ * and handles an expanded/collapsed state when there are too many concurrent events.
24
+ *
25
+ * @param days - The array of days currently visible in the calendar view.
26
+ * @param events - The complete array of calendar events to filter and layout.
27
+ * @param isExpanded - Whether the banner is currently expanded to show all stacked events.
28
+ * @param maxVisibleRows - The maximum number of event rows to show before collapsing (default: 3).
29
+ * @returns An object containing layout details:
30
+ * - `layoutEvents`: All calculated events that intersect with the current view.
31
+ * - `rowCount`: The total number of rows required to display all events without overlap.
32
+ * - `effectiveMaxRows`: The effective limit on visible rows.
33
+ * - `hiddenCounts`: An array representing the number of hidden events for each day index.
34
+ * - `hasHiddenEvents`: A boolean flag indicating if any events exceed the `maxVisibleRows`.
35
+ * - `visibleLayoutEvents`: The events that should currently be rendered based on the `isExpanded` state.
36
+ * - `containerHeight`: The computed height of the banner container.
37
+ * - `showExpandCollapse`: A boolean flag indicating if the expand/collapse button should be rendered.
38
+ */
39
+ export default function useAllDayBanner(days: DateType[], events: CalendarEvent[], isExpanded: boolean, maxVisibleRows?: number): {
40
+ layoutEvents: BannerLayoutEvent[];
41
+ rowCount: number;
42
+ effectiveMaxRows: number;
43
+ hiddenCounts: any[];
44
+ hasHiddenEvents: boolean;
45
+ visibleLayoutEvents: BannerLayoutEvent[];
46
+ containerHeight: number;
47
+ showExpandCollapse: boolean;
48
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { CalendarProps, CalendarContentProps } from '../types';
2
+ /**
3
+ * Merges the global calendar config from context with view-local props.
4
+ * Local props take precedence — undefined values are ignored so they don't
5
+ * accidentally overwrite context defaults.
6
+ *
7
+ * @param localProps - Props specific to the calling view component.
8
+ * @returns Merged `CalendarContentProps` with all required defaults guaranteed.
9
+ */
10
+ export default function useCalendarProps<T extends Partial<CalendarProps>>(localProps: T): CalendarContentProps;
@@ -0,0 +1,2 @@
1
+ import { ColorScheme } from '../types';
2
+ export default function useColorScheme(colorScheme: ColorScheme | undefined): "light" | "dark";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { CalendarEvent } from '../types';
2
+ import { DateType } from '../utils/date';
3
+ export interface UseDayEventLayoutOptions {
4
+ enableEnrichedEvents?: boolean;
5
+ enrichedEventsByDate?: Record<string, CalendarEvent[]>;
6
+ eventsAreSorted?: boolean;
7
+ isEventOrderingEnabled?: boolean;
8
+ }
9
+ /**
10
+ * Represents the final calculated CSS positioning for an event in the day view.
11
+ */
12
+ export interface DayEventLayout {
13
+ event: CalendarEvent;
14
+ top: number;
15
+ height: number;
16
+ left: number;
17
+ width: number;
18
+ zIndex: number;
19
+ }
20
+ /**
21
+ * Hook to calculate layout and positioning for timed events in a day or week view.
22
+ *
23
+ * @param events - The complete array of calendar events.
24
+ * @param currentDateOrDates - A single date (for Day view) or array of dates (for Week view) to render.
25
+ * @returns A layout array (for a single day) or a nested array of layouts (for multiple days).
26
+ */
27
+ export default function useDayEventLayout(events: CalendarEvent[], currentDateOrDates: DateType | DateType[], minHour: number, maxHour: number, showAllDayRow: boolean, eventOverlapOffset: number, options?: UseDayEventLayoutOptions): DayEventLayout[] | DayEventLayout[][];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { CalendarEvent } from '../types/events';
2
+ /**
3
+ * Hook to filter and return only valid calendar events.
4
+ *
5
+ * Events where `endDate` is chronologically before `startDate` are silently removed.
6
+ * This is intentional — such events have no renderable duration (C-TC3).
7
+ *
8
+ * @param events - The raw array of calendar events to process. Events with
9
+ * `endDate < startDate` are filtered out (negative-duration guard).
10
+ * @param eventsAreSorted - When `true`, skips validation and returns events as-is (caller guarantees
11
+ * events are pre-sorted by `startDate` ascending). **Caveat:** unsorted input will render in the
12
+ * provided order — the library never re-sorts the array.
13
+ * @param enableEnrichedEvents - When `true`, skips validation (caller supplies pre-enriched events via `enrichedEventsByDate`).
14
+ * @returns A memoized array containing only logically valid events.
15
+ */
16
+ export default function useEvents(events: CalendarEvent[], eventsAreSorted?: boolean, enableEnrichedEvents?: boolean): CalendarEvent[];
@@ -0,0 +1 @@
1
+ export {};