kalendly 0.1.2 → 0.1.3

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
@@ -16,11 +16,11 @@ A universal calendar scheduler component that works seamlessly across React, Vue
16
16
 
17
17
  ## Live Examples
18
18
 
19
- Check out the interactive examples: [https://kalendly.netlify.app](https://kalendly.netlify.app)
19
+ Check out the interactive examples: [https://kalendly-example.netlify.app/](https://kalendly-example.netlify.app)
20
20
 
21
- - [Vanilla JavaScript](https://kalendly.netlify.app/vanilla)
22
- - [React](https://kalendly.netlify.app/react)
23
- - [Vue](https://kalendly.netlify.app/vue)
21
+ - [Vanilla JavaScript](https://kalendly-example.netlify.app/vanilla)
22
+ - [React](https://kalendly-example.netlify.app/react)
23
+ - [Vue](https://kalendly-example.netlify.app/vue)
24
24
 
25
25
  ## Installation
26
26
 
@@ -0,0 +1,299 @@
1
+ import { CSSProperties } from 'react';
2
+ import { default as React_3 } from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { TextStyle } from 'react-native';
5
+ import { ViewStyle } from 'react-native';
6
+
7
+ export declare interface CalendarActions {
8
+ next: () => void;
9
+ previous: () => void;
10
+ jump: (year: number, month: number) => void;
11
+ selectDate: (date: Date) => void;
12
+ updateTasks: () => void;
13
+ }
14
+
15
+ declare type CalendarComponentProps$1 = ReactCalendarProps;
16
+
17
+ declare type CalendarComponentProps = ReactNativeCalendarProps;
18
+
19
+ export declare interface CalendarConfig {
20
+ events: CalendarEvent[];
21
+ initialDate?: Date;
22
+ minYear?: number;
23
+ maxYear?: number;
24
+ weekStartsOn?: 0 | 1;
25
+ categoryColors?: CategoryColorMap;
26
+ }
27
+
28
+ export declare interface CalendarDate {
29
+ date: Date;
30
+ isCurrentMonth: boolean;
31
+ isToday: boolean;
32
+ hasEvents: boolean;
33
+ events: CalendarEvent[];
34
+ }
35
+
36
+ export declare class CalendarEngine {
37
+ private state;
38
+ private config;
39
+ private listeners;
40
+ private categoryColors;
41
+ constructor(config: CalendarConfig);
42
+ /**
43
+ * Subscribe to state changes
44
+ */
45
+ subscribe(listener: () => void): () => void;
46
+ /**
47
+ * Notify all listeners of state changes
48
+ */
49
+ private notify;
50
+ /**
51
+ * Get current state
52
+ */
53
+ getState(): CalendarState;
54
+ /**
55
+ * Get view model with computed properties
56
+ */
57
+ getViewModel(): CalendarViewModel;
58
+ /**
59
+ * Get actions object
60
+ */
61
+ getActions(): CalendarActions;
62
+ /**
63
+ * Navigate to next month
64
+ */
65
+ private next;
66
+ /**
67
+ * Navigate to previous month
68
+ */
69
+ private previous;
70
+ /**
71
+ * Jump to specific month and year
72
+ */
73
+ private jump;
74
+ /**
75
+ * Select a specific date
76
+ */
77
+ private selectDate;
78
+ /**
79
+ * Update tasks for the currently selected date
80
+ */
81
+ private updateTasks;
82
+ /**
83
+ * Update events configuration
84
+ */
85
+ updateEvents(events: CalendarEvent[]): void;
86
+ /**
87
+ * Handle date cell click
88
+ */
89
+ handleDateClick(date: Date, dayIndex?: number): void;
90
+ /**
91
+ * Check if date has events
92
+ */
93
+ hasEventsForDate(date: Date): boolean;
94
+ /**
95
+ * Get events for a specific date
96
+ */
97
+ getEventsForDate(date: Date): CalendarEvent[];
98
+ /**
99
+ * Clear selected date
100
+ */
101
+ clearSelection(): void;
102
+ /**
103
+ * Get category color (with custom colors support)
104
+ */
105
+ getCategoryColor(category?: string): string;
106
+ /**
107
+ * Update category colors dynamically
108
+ */
109
+ updateCategoryColors(colors: CategoryColorMap): void;
110
+ /**
111
+ * Get all category colors
112
+ */
113
+ getCategoryColors(): CategoryColorMap;
114
+ /**
115
+ * Register a new category with color
116
+ */
117
+ registerCategory(name: string, color: string): void;
118
+ /**
119
+ * Destroy the engine and cleanup listeners
120
+ */
121
+ destroy(): void;
122
+ }
123
+
124
+ export declare interface CalendarEvent {
125
+ id: string | number;
126
+ name: string;
127
+ date: string | Date;
128
+ startTime?: string;
129
+ endTime?: string;
130
+ allDay?: boolean;
131
+ description?: string;
132
+ color?: string;
133
+ category?: 'work' | 'personal' | 'meeting' | 'deadline' | 'appointment' | 'other';
134
+ location?: string;
135
+ url?: string;
136
+ status?: 'scheduled' | 'completed' | 'cancelled' | 'tentative';
137
+ priority?: 'low' | 'medium' | 'high';
138
+ attendees?: string[];
139
+ organizer?: string;
140
+ reminders?: number[];
141
+ recurring?: {
142
+ frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
143
+ interval?: number;
144
+ endDate?: string | Date;
145
+ daysOfWeek?: number[];
146
+ };
147
+ notes?: string;
148
+ tags?: string[];
149
+ createdAt?: string | Date;
150
+ updatedAt?: string | Date;
151
+ [key: string]: unknown;
152
+ }
153
+
154
+ export declare type CalendarEventHandler = (event: CalendarEvent) => void;
155
+
156
+ export declare interface CalendarProps {
157
+ events: CalendarEvent[];
158
+ initialDate?: Date;
159
+ minYear?: number;
160
+ maxYear?: number;
161
+ weekStartsOn?: 0 | 1;
162
+ onDateSelect?: (date: Date) => void;
163
+ onEventClick?: CalendarEventHandler;
164
+ onMonthChange?: (year: number, month: number) => void;
165
+ }
166
+
167
+ export declare interface CalendarState {
168
+ currentYear: number;
169
+ currentMonth: number;
170
+ currentDate: number;
171
+ selectedDate: Date | null;
172
+ selectedDayIndex: number | null;
173
+ tasks: CalendarEvent[];
174
+ }
175
+
176
+ export declare interface CalendarViewModel extends CalendarState {
177
+ months: string[];
178
+ days: string[];
179
+ years: number[];
180
+ monthAndYearText: string;
181
+ scheduleDay: string;
182
+ calendarDates: (CalendarDate | null)[][];
183
+ popupPositionClass: string;
184
+ }
185
+
186
+ export declare interface CategoryColorMap {
187
+ [category: string]: string;
188
+ }
189
+
190
+ export declare function createVanillaCalendar(props: VanillaCalendarProps): VanillaCalendarInstance;
191
+
192
+ export declare const DAYS: string[];
193
+
194
+ export declare const DEFAULT_CATEGORY_COLORS: CategoryColorMap;
195
+
196
+ export declare function formatAttendees(attendees?: string[]): string;
197
+
198
+ export declare function formatDateForDisplay(date: Date): string;
199
+
200
+ export declare function formatTimeRange(event: CalendarEvent): string;
201
+
202
+ export declare function generateCalendarDates(year: number, month: number, events?: CalendarEvent[], weekStartsOn?: 0 | 1): (CalendarDate | null)[][];
203
+
204
+ export declare function generateYears(minYear?: number, maxYear?: number): number[];
205
+
206
+ export declare function getCategoryColor(category: string, customColors?: CategoryColorMap): string;
207
+
208
+ export declare function getCellClasses(calendarDate: CalendarDate | null): string[];
209
+
210
+ export declare function getDefaultEventColor(category?: string, customColors?: CategoryColorMap): string;
211
+
212
+ export declare function getEventsForDate(events: CalendarEvent[], date: Date): CalendarEvent[];
213
+
214
+ export declare function getMonthYearText(year: number, month: number): string;
215
+
216
+ export declare function getPopupPositionClass(selectedDayIndex: number | null): string;
217
+
218
+ export declare function hasEvents(events: CalendarEvent[], date: Date): boolean;
219
+
220
+ export declare function isSameDay(date1: Date, date2: Date): boolean;
221
+
222
+ export declare function isToday(date: Date): boolean;
223
+
224
+ export declare function isValidHexColor(color: string): boolean;
225
+
226
+ export declare function mergeCategoryColors(customColors?: CategoryColorMap): CategoryColorMap;
227
+
228
+ export declare const MONTHS: string[];
229
+
230
+ declare const name_2 = "kalendly";
231
+ export { name_2 as name }
232
+
233
+ export declare function normalizeDate(date: Date): Date;
234
+
235
+ export declare interface PopupPosition {
236
+ class: 'popup-left' | 'popup-right' | 'popup-center-top' | 'popup-center-bottom';
237
+ style?: Record<string, string | number>;
238
+ }
239
+
240
+ declare namespace React_2 {
241
+ { Calendar$1 as Calendar, declare type index$2_CalendarActions as CalendarActions, declare type CalendarComponentProps$1 as CalendarComponentProps, declare type index$2_CalendarConfig as CalendarConfig, declare type index$2_CalendarDate as CalendarDate, index$2_CalendarEngine as CalendarEngine, declare type index$2_CalendarEvent as CalendarEvent, declare type index$2_CalendarEventHandler as CalendarEventHandler, declare type index$2_CalendarProps as CalendarProps, declare type index$2_CalendarState as CalendarState, declare type index$2_CalendarViewModel as CalendarViewModel, declare type index$2_CategoryColorMap as CategoryColorMap, index$2_DAYS as DAYS, index$2_DEFAULT_CATEGORY_COLORS as DEFAULT_CATEGORY_COLORS, DatePopup$1 as DatePopup, declare type DatePopupProps$1 as DatePopupProps, index$2_MONTHS as MONTHS, declare type index$2_PopupPosition as PopupPosition, declare type index$2_ReactCalendarProps as ReactCalendarProps, index$2_formatAttendees as formatAttendees, index$2_formatDateForDisplay as formatDateForDisplay, index$2_formatTimeRange as formatTimeRange, index$2_generateCalendarDates as generateCalendarDates, index$2_generateYears as generateYears, index$2_getCategoryColor as getCategoryColor, index$2_getCellClasses as getCellClasses, index$2_getDefaultEventColor as getDefaultEventColor, index$2_getEventsForDate as getEventsForDate, index$2_getMonthYearText as getMonthYearText, index$2_getPopupPositionClass as getPopupPositionClass, index$2_hasEvents as hasEvents, index$2_isSameDay as isSameDay, index$2_isToday as isToday, index$2_isValidHexColor as isValidHexColor, index$2_mergeCategoryColors as mergeCategoryColors, index$2_normalizeDate as normalizeDate, index$2_sortEventsByTime as sortEventsByTime };
242
+ }
243
+ export { React_2 as React }
244
+
245
+ export declare const ReactCalendar: React_3.FC<CalendarComponentProps$1>;
246
+
247
+ declare interface ReactCalendarProps extends CalendarProps {
248
+ className?: string;
249
+ style?: CSSProperties;
250
+ children?: ReactNode;
251
+ renderEvent?: (event: CalendarEvent) => ReactNode;
252
+ renderNoEvents?: () => ReactNode;
253
+ title?: string;
254
+ }
255
+
256
+ export declare namespace ReactNative {
257
+ { index$1_Calendar as Calendar, export declare type index$1_CalendarActions as CalendarActions, export declare type index$1_CalendarComponentProps as CalendarComponentProps, export declare type index$1_CalendarConfig as CalendarConfig, export declare type index$1_CalendarDate as CalendarDate, index$1_CalendarEngine as CalendarEngine, export declare type index$1_CalendarEvent as CalendarEvent, export declare type index$1_CalendarEventHandler as CalendarEventHandler, export declare type index$1_CalendarProps as CalendarProps, export declare type index$1_CalendarState as CalendarState, export declare type index$1_CalendarViewModel as CalendarViewModel, export declare type index$1_CategoryColorMap as CategoryColorMap, index$1_DAYS as DAYS, index$1_DEFAULT_CATEGORY_COLORS as DEFAULT_CATEGORY_COLORS, index$1_DatePopup as DatePopup, export declare type index$1_DatePopupProps as DatePopupProps, index$1_MONTHS as MONTHS, export declare type index$1_PopupPosition as PopupPosition, export declare type index$1_ReactNativeCalendarProps as ReactNativeCalendarProps, export declare type index$1_SelectProps as SelectProps, index$1_calendarStyles as calendarStyles, index$1_formatAttendees as formatAttendees, index$1_formatDateForDisplay as formatDateForDisplay, index$1_formatTimeRange as formatTimeRange, index$1_generateCalendarDates as generateCalendarDates, index$1_generateYears as generateYears, index$1_getCategoryColor as getCategoryColor, index$1_getCellClasses as getCellClasses, index$1_getDefaultEventColor as getDefaultEventColor, index$1_getEventsForDate as getEventsForDate, index$1_getMonthYearText as getMonthYearText, index$1_getPopupPositionClass as getPopupPositionClass, index$1_hasEvents as hasEvents, index$1_isSameDay as isSameDay, index$1_isToday as isToday, index$1_isValidHexColor as isValidHexColor, index$1_mergeCategoryColors as mergeCategoryColors, index$1_normalizeDate as normalizeDate, index$1_sortEventsByTime as sortEventsByTime };
258
+ }
259
+
260
+ export declare const ReactNativeCalendar: React_3.FC<CalendarComponentProps>;
261
+
262
+ declare interface ReactNativeCalendarProps extends CalendarProps {
263
+ style?: ViewStyle;
264
+ containerStyle?: ViewStyle;
265
+ headerStyle?: ViewStyle;
266
+ headerTextStyle?: TextStyle;
267
+ cellStyle?: ViewStyle;
268
+ cellTextStyle?: TextStyle;
269
+ renderEvent?: (event: CalendarEvent) => ReactNode;
270
+ renderNoEvents?: () => ReactNode;
271
+ title?: string;
272
+ showCloseButton?: boolean;
273
+ }
274
+
275
+ export declare function sortEventsByTime(events: CalendarEvent[]): CalendarEvent[];
276
+
277
+ export declare namespace Vanilla {
278
+ { export declare type index_CalendarActions as CalendarActions, export declare type index_CalendarConfig as CalendarConfig, export declare type index_CalendarDate as CalendarDate, index_CalendarEngine as CalendarEngine, export declare type index_CalendarEvent as CalendarEvent, export declare type index_CalendarEventHandler as CalendarEventHandler, export declare type index_CalendarProps as CalendarProps, export declare type index_CalendarState as CalendarState, export declare type index_CalendarViewModel as CalendarViewModel, export declare type index_CategoryColorMap as CategoryColorMap, index_DAYS as DAYS, index_DEFAULT_CATEGORY_COLORS as DEFAULT_CATEGORY_COLORS, index_MONTHS as MONTHS, export declare type index_PopupPosition as PopupPosition, index_VanillaCalendar as VanillaCalendar, export declare type index_VanillaCalendarInstance as VanillaCalendarInstance, export declare type index_VanillaCalendarProps as VanillaCalendarProps, index_createCalendar as createCalendar, index_formatAttendees as formatAttendees, index_formatDateForDisplay as formatDateForDisplay, index_formatTimeRange as formatTimeRange, index_generateCalendarDates as generateCalendarDates, index_generateYears as generateYears, index_getCategoryColor as getCategoryColor, index_getCellClasses as getCellClasses, index_getDefaultEventColor as getDefaultEventColor, index_getEventsForDate as getEventsForDate, index_getMonthYearText as getMonthYearText, index_getPopupPositionClass as getPopupPositionClass, index_hasEvents as hasEvents, index_isSameDay as isSameDay, index_isToday as isToday, index_isValidHexColor as isValidHexColor, index_mergeCategoryColors as mergeCategoryColors, index_normalizeDate as normalizeDate, index_sortEventsByTime as sortEventsByTime };
279
+ }
280
+
281
+ declare interface VanillaCalendarInstance {
282
+ destroy: () => void;
283
+ updateEvents: (events: CalendarEvent[]) => void;
284
+ getCurrentDate: () => Date | null;
285
+ goToDate: (date: Date) => void;
286
+ getEngine: () => CalendarEngine;
287
+ }
288
+
289
+ declare interface VanillaCalendarProps extends CalendarProps {
290
+ container: HTMLElement | string;
291
+ className?: string;
292
+ title?: string;
293
+ renderEvent?: (event: CalendarEvent) => string;
294
+ renderNoEvents?: () => string;
295
+ }
296
+
297
+ export declare const version = "1.0.0";
298
+
299
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kalendly",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A kalendly universal calendar scheduler component for React, Vue, and React Native",
5
5
  "keywords": [
6
6
  "calendar",