kalendly 0.2.2 → 0.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/README.md +303 -45
- package/dist/core/index.d.mts +57 -10
- package/dist/core/index.d.ts +57 -10
- package/dist/core/index.js +159 -31
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +147 -30
- package/dist/core/index.mjs.map +1 -1
- package/dist/index.d.mts +86 -10
- package/dist/index.d.ts +86 -10
- package/dist/index.js +525 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +513 -177
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +499 -174
- package/dist/index.umd.js.map +1 -1
- package/dist/styles/calendar.css +457 -392
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
type Open<T extends string> = T | (string & {});
|
|
1
2
|
interface CalendarEvent {
|
|
2
3
|
id: string | number;
|
|
3
4
|
name: string;
|
|
4
5
|
date: string | Date;
|
|
6
|
+
endDate?: string | Date;
|
|
5
7
|
startTime?: string;
|
|
6
8
|
endTime?: string;
|
|
7
9
|
allDay?: boolean;
|
|
8
10
|
description?: string;
|
|
9
11
|
color?: string;
|
|
10
|
-
category?: 'work' | 'personal' | 'meeting' | 'deadline' | 'appointment' | 'other'
|
|
12
|
+
category?: Open<'work' | 'personal' | 'meeting' | 'deadline' | 'appointment' | 'other'>;
|
|
11
13
|
location?: string;
|
|
12
14
|
url?: string;
|
|
13
|
-
status?: 'scheduled' | 'completed' | 'cancelled' | 'tentative'
|
|
14
|
-
priority?: 'low' | 'medium' | 'high'
|
|
15
|
+
status?: Open<'scheduled' | 'completed' | 'cancelled' | 'tentative'>;
|
|
16
|
+
priority?: Open<'low' | 'medium' | 'high'>;
|
|
17
|
+
availabilityStatus?: Open<'open' | 'conditional' | 'blocked'>;
|
|
15
18
|
attendees?: string[];
|
|
16
19
|
organizer?: string;
|
|
17
20
|
reminders?: number[];
|
|
@@ -52,6 +55,13 @@ interface CalendarConfig {
|
|
|
52
55
|
maxYear?: number;
|
|
53
56
|
weekStartsOn?: 0 | 1;
|
|
54
57
|
categoryColors?: CategoryColorMap;
|
|
58
|
+
monthCount?: number;
|
|
59
|
+
}
|
|
60
|
+
interface CalendarPane {
|
|
61
|
+
year: number;
|
|
62
|
+
month: number;
|
|
63
|
+
monthAndYearText: string;
|
|
64
|
+
calendarDates: CalendarDate[][];
|
|
55
65
|
}
|
|
56
66
|
interface CalendarActions {
|
|
57
67
|
next: () => void;
|
|
@@ -62,18 +72,14 @@ interface CalendarActions {
|
|
|
62
72
|
selectDate: (date: Date) => void;
|
|
63
73
|
updateTasks: () => void;
|
|
64
74
|
}
|
|
65
|
-
interface PopupPosition {
|
|
66
|
-
class: 'popup-left' | 'popup-right' | 'popup-center-top' | 'popup-center-bottom';
|
|
67
|
-
style?: Record<string, string | number>;
|
|
68
|
-
}
|
|
69
75
|
interface CalendarViewModel extends CalendarState {
|
|
70
76
|
months: string[];
|
|
71
77
|
days: string[];
|
|
72
78
|
years: number[];
|
|
73
79
|
monthAndYearText: string;
|
|
74
80
|
scheduleDay: string;
|
|
81
|
+
panes: CalendarPane[];
|
|
75
82
|
calendarDates: CalendarDate[][];
|
|
76
|
-
popupPositionClass: string;
|
|
77
83
|
}
|
|
78
84
|
type CalendarEventHandler = (event: CalendarEvent) => void;
|
|
79
85
|
interface CalendarProps {
|
|
@@ -100,7 +106,37 @@ interface CalendarTheme {
|
|
|
100
106
|
selectedBg?: string;
|
|
101
107
|
headerBg?: string;
|
|
102
108
|
popupBg?: string;
|
|
109
|
+
pickerBg?: string;
|
|
110
|
+
pickerShadow?: string;
|
|
103
111
|
eventIndicator?: string;
|
|
112
|
+
onAccent?: string;
|
|
113
|
+
link?: string;
|
|
114
|
+
openBg?: string;
|
|
115
|
+
openFg?: string;
|
|
116
|
+
conditionalBg?: string;
|
|
117
|
+
conditionalFg?: string;
|
|
118
|
+
blockedBg?: string;
|
|
119
|
+
blockedFg?: string;
|
|
120
|
+
rangeBg?: string;
|
|
121
|
+
rangeOutline?: string;
|
|
122
|
+
inRangeBg?: string;
|
|
123
|
+
inRangeOutline?: string;
|
|
124
|
+
badgeBg?: string;
|
|
125
|
+
badgeText?: string;
|
|
126
|
+
badgeSuccessBg?: string;
|
|
127
|
+
badgeSuccessText?: string;
|
|
128
|
+
badgeInfoBg?: string;
|
|
129
|
+
badgeInfoText?: string;
|
|
130
|
+
badgeWarningBg?: string;
|
|
131
|
+
badgeWarningText?: string;
|
|
132
|
+
badgeDangerBg?: string;
|
|
133
|
+
badgeDangerText?: string;
|
|
134
|
+
badgeNeutralBg?: string;
|
|
135
|
+
badgeNeutralText?: string;
|
|
136
|
+
badgePositiveBg?: string;
|
|
137
|
+
badgePositiveText?: string;
|
|
138
|
+
badgeTentativeBg?: string;
|
|
139
|
+
badgeTentativeText?: string;
|
|
104
140
|
}
|
|
105
141
|
|
|
106
142
|
declare const MONTHS: string[];
|
|
@@ -110,10 +146,10 @@ declare function normalizeDate(date: Date): Date;
|
|
|
110
146
|
declare function isSameDay(date1: Date, date2: Date): boolean;
|
|
111
147
|
declare function isToday(date: Date): boolean;
|
|
112
148
|
declare function generateYears(minYear?: number, maxYear?: number): number[];
|
|
149
|
+
declare function eventCoversDate(event: CalendarEvent, date: Date): boolean;
|
|
113
150
|
declare function getEventsForDate(events: CalendarEvent[], date: Date): CalendarEvent[];
|
|
114
151
|
declare function hasEvents(events: CalendarEvent[], date: Date): boolean;
|
|
115
152
|
declare function generateCalendarDates(year: number, month: number, events?: CalendarEvent[], weekStartsOn?: 0 | 1): CalendarDate[][];
|
|
116
|
-
declare function getPopupPositionClass(selectedDayIndex: number | null): string;
|
|
117
153
|
declare function getCellClasses(calendarDate: CalendarDate): string[];
|
|
118
154
|
declare function formatDateForDisplay(date: Date): string;
|
|
119
155
|
declare function getMonthYearText(year: number, month: number): string;
|
|
@@ -125,6 +161,17 @@ declare function getDefaultEventColor(category?: string, customColors?: Category
|
|
|
125
161
|
declare function mergeCategoryColors(customColors?: CategoryColorMap): CategoryColorMap;
|
|
126
162
|
declare function isValidHexColor(color: string): boolean;
|
|
127
163
|
declare function getCategoryColor(category: string, customColors?: CategoryColorMap): string;
|
|
164
|
+
declare function escapeHtml(value: unknown): string;
|
|
165
|
+
declare function slugifyToken(value: string): string;
|
|
166
|
+
declare function safeUrl(value: string): string;
|
|
167
|
+
declare function safeColor(value: string): string;
|
|
168
|
+
declare const MINUTES_PER_DAY = 1440;
|
|
169
|
+
declare const DEFAULT_SLOT_DURATION = 60;
|
|
170
|
+
declare function parseTimeToMinutes(time: unknown): number | null;
|
|
171
|
+
declare function formatMinutes(total: number): string;
|
|
172
|
+
declare function eventInterval(event: CalendarEvent, slotDuration: number, onDay: Date): [number, number] | null;
|
|
173
|
+
declare function mergeIntervals(intervals: Array<[number, number]>): Array<[number, number]>;
|
|
174
|
+
declare function bookedSlots(events: CalendarEvent[], date: Date, slotDuration?: number): boolean[];
|
|
128
175
|
|
|
129
176
|
declare class CalendarEngine {
|
|
130
177
|
private state;
|
|
@@ -224,6 +271,7 @@ declare class CalendarEngine {
|
|
|
224
271
|
|
|
225
272
|
declare class CalendarElement extends HTMLElement {
|
|
226
273
|
static observedAttributes: string[];
|
|
274
|
+
private static readonly themeMap;
|
|
227
275
|
private engine;
|
|
228
276
|
private unsubscribe;
|
|
229
277
|
private actions;
|
|
@@ -241,6 +289,10 @@ declare class CalendarElement extends HTMLElement {
|
|
|
241
289
|
private _categoryColors;
|
|
242
290
|
private _renderEvent;
|
|
243
291
|
private _renderNoEvents;
|
|
292
|
+
private _availabilityColors;
|
|
293
|
+
private _selectableStatuses;
|
|
294
|
+
private _initError;
|
|
295
|
+
private pendingUpdate;
|
|
244
296
|
private _rangeStart;
|
|
245
297
|
private _rangeEnd;
|
|
246
298
|
private _timeRangeDate;
|
|
@@ -251,19 +303,39 @@ declare class CalendarElement extends HTMLElement {
|
|
|
251
303
|
set events(val: CalendarEvent[]);
|
|
252
304
|
set theme(val: CalendarTheme);
|
|
253
305
|
set categoryColors(val: CategoryColorMap);
|
|
306
|
+
get availabilityColors(): Record<string, string>;
|
|
307
|
+
set availabilityColors(val: Record<string, string>);
|
|
308
|
+
get selectableStatuses(): string[];
|
|
309
|
+
set selectableStatuses(val: string[]);
|
|
254
310
|
set renderEvent(val: (e: CalendarEvent) => string);
|
|
255
311
|
set renderNoEvents(val: () => string);
|
|
256
312
|
get loading(): boolean;
|
|
257
313
|
set loading(val: boolean);
|
|
314
|
+
private reaction;
|
|
258
315
|
connectedCallback(): void;
|
|
259
316
|
disconnectedCallback(): void;
|
|
260
317
|
attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
|
|
318
|
+
private get headingText();
|
|
319
|
+
private static warnedMissingEnd;
|
|
320
|
+
private get slotDuration();
|
|
321
|
+
private warnMissingEndTime;
|
|
322
|
+
private get monthCount();
|
|
261
323
|
private get minYear();
|
|
262
324
|
private get maxYear();
|
|
263
325
|
private initEngine;
|
|
264
326
|
private reinit;
|
|
265
327
|
private cleanup;
|
|
266
328
|
private applyTheme;
|
|
329
|
+
private static readonly BUILT_IN_BUCKETS;
|
|
330
|
+
private static titleDeprecationWarned;
|
|
331
|
+
private get knownBuckets();
|
|
332
|
+
get updateComplete(): Promise<void>;
|
|
333
|
+
private scheduleRender;
|
|
334
|
+
private rethrowInitError;
|
|
335
|
+
private assertStatusesDeclared;
|
|
336
|
+
private assertStatusesKnown;
|
|
337
|
+
private resolveBucket;
|
|
338
|
+
private isDateSelectable;
|
|
267
339
|
private render;
|
|
268
340
|
private attachEventListeners;
|
|
269
341
|
private updatePickerYear;
|
|
@@ -293,11 +365,15 @@ interface CalendarElementProps {
|
|
|
293
365
|
categoryColors?: CategoryColorMap;
|
|
294
366
|
renderEvent?: (event: CalendarEvent) => string;
|
|
295
367
|
renderNoEvents?: () => string;
|
|
368
|
+
availabilityColors?: Record<string, string>;
|
|
369
|
+
selectableStatuses?: string[];
|
|
296
370
|
}
|
|
297
371
|
interface CalendarElementInstance {
|
|
298
372
|
events: CalendarEvent[];
|
|
299
373
|
theme: CalendarTheme;
|
|
300
374
|
categoryColors: CategoryColorMap;
|
|
375
|
+
availabilityColors: Record<string, string>;
|
|
376
|
+
selectableStatuses: string[];
|
|
301
377
|
renderEvent: (event: CalendarEvent) => string;
|
|
302
378
|
renderNoEvents: () => string;
|
|
303
379
|
updateEvents: (events: CalendarEvent[]) => void;
|
|
@@ -307,4 +383,4 @@ interface CalendarElementInstance {
|
|
|
307
383
|
getEngine: () => CalendarEngine;
|
|
308
384
|
}
|
|
309
385
|
|
|
310
|
-
export { type CalendarActions, type CalendarConfig, type CalendarDate, CalendarElement, type CalendarElementInstance, type CalendarElementProps, CalendarEngine, type CalendarEvent, type CalendarEventHandler, type CalendarProps, type CalendarState, type CalendarTheme, type CalendarViewModel, type CategoryColorMap, DAYS, DEFAULT_CATEGORY_COLORS, MONTHS, MONTHS_FULL,
|
|
386
|
+
export { type CalendarActions, type CalendarConfig, type CalendarDate, CalendarElement, type CalendarElementInstance, type CalendarElementProps, CalendarEngine, type CalendarEvent, type CalendarEventHandler, type CalendarPane, type CalendarProps, type CalendarState, type CalendarTheme, type CalendarViewModel, type CategoryColorMap, DAYS, DEFAULT_CATEGORY_COLORS, DEFAULT_SLOT_DURATION, MINUTES_PER_DAY, MONTHS, MONTHS_FULL, bookedSlots, defineCalendarElement, escapeHtml, eventCoversDate, eventInterval, formatAttendees, formatDateForDisplay, formatMinutes, formatTimeRange, generateCalendarDates, generateYears, getCategoryColor, getCellClasses, getDefaultEventColor, getEventsForDate, getMonthYearText, hasEvents, isSameDay, isToday, isValidHexColor, mergeCategoryColors, mergeIntervals, normalizeDate, parseTimeToMinutes, safeColor, safeUrl, slugifyToken, sortEventsByTime };
|