calkit 0.1.0 → 0.2.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 +1 -1
- package/dist/booking.es.js +421 -318
- package/dist/booking.es.js.map +1 -1
- package/dist/booking.umd.js +12 -12
- package/dist/booking.umd.js.map +1 -1
- package/dist/calkit.d.ts +453 -0
- package/dist/calkit.es.js +1101 -898
- package/dist/calkit.es.js.map +1 -1
- package/dist/calkit.umd.js +34 -34
- package/dist/calkit.umd.js.map +1 -1
- package/dist/datepicker.es.js +333 -241
- package/dist/datepicker.es.js.map +1 -1
- package/dist/datepicker.umd.js +12 -12
- package/dist/datepicker.umd.js.map +1 -1
- package/dist/scheduler.es.js +705 -638
- package/dist/scheduler.es.js.map +1 -1
- package/dist/scheduler.umd.js +20 -20
- package/dist/scheduler.umd.js.map +1 -1
- package/dist/timepicker.es.js +146 -116
- package/dist/timepicker.es.js.map +1 -1
- package/dist/timepicker.umd.js +6 -6
- package/dist/timepicker.umd.js.map +1 -1
- package/llms.txt +1 -1
- package/package.json +4 -2
package/dist/calkit.d.ts
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
// Type definitions for CalKit 0.2.0
|
|
2
|
+
// Project: https://github.com/SimonKefas/calkit
|
|
3
|
+
|
|
4
|
+
// --- Shared Types ---
|
|
5
|
+
|
|
6
|
+
export interface CalStatusEvent {
|
|
7
|
+
type: 'error' | 'warning' | 'info' | 'success' | null;
|
|
8
|
+
message: string | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CustomColor {
|
|
12
|
+
name: string;
|
|
13
|
+
bg: string;
|
|
14
|
+
fg: string;
|
|
15
|
+
hover?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// --- CalDatepicker ---
|
|
19
|
+
|
|
20
|
+
export interface CalDatepickerRangeValue {
|
|
21
|
+
start: string;
|
|
22
|
+
end: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CalDatepickerChangeDetail {
|
|
26
|
+
value: string | string[] | CalDatepickerRangeValue | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CalDatepickerMonthChangeDetail {
|
|
30
|
+
year: number;
|
|
31
|
+
month: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class CalDatepicker extends HTMLElement {
|
|
35
|
+
// Attributes
|
|
36
|
+
mode: 'single' | 'range' | 'multi';
|
|
37
|
+
display: 'inline' | 'popover';
|
|
38
|
+
theme: string;
|
|
39
|
+
placeholder: string;
|
|
40
|
+
firstDay: number;
|
|
41
|
+
minDate: string | null;
|
|
42
|
+
maxDate: string | null;
|
|
43
|
+
locale: string | undefined;
|
|
44
|
+
loading: boolean;
|
|
45
|
+
disabledDates: string[];
|
|
46
|
+
presetKeys: string[];
|
|
47
|
+
|
|
48
|
+
// Properties
|
|
49
|
+
value: string | string[] | CalDatepickerRangeValue | null;
|
|
50
|
+
|
|
51
|
+
// Methods
|
|
52
|
+
open(): void;
|
|
53
|
+
close(): void;
|
|
54
|
+
clear(): void;
|
|
55
|
+
goToMonth(month: number, year: number): void;
|
|
56
|
+
showStatus(type: string, message: string, opts?: { autoDismiss?: number; dismissible?: boolean }): void;
|
|
57
|
+
clearStatus(): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// --- CalTimepicker ---
|
|
61
|
+
|
|
62
|
+
export interface CalTimepickerRangeValue {
|
|
63
|
+
start: string;
|
|
64
|
+
end: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface CalTimepickerChangeDetail {
|
|
68
|
+
value: string | string[] | CalTimepickerRangeValue | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface CalTimepickerSlot {
|
|
72
|
+
time: string;
|
|
73
|
+
displayText?: string;
|
|
74
|
+
available?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export class CalTimepicker extends HTMLElement {
|
|
78
|
+
// Attributes
|
|
79
|
+
mode: 'single' | 'range' | 'multi';
|
|
80
|
+
display: 'inline' | 'popover';
|
|
81
|
+
theme: string;
|
|
82
|
+
placeholder: string;
|
|
83
|
+
startTime: string;
|
|
84
|
+
endTime: string;
|
|
85
|
+
interval: number;
|
|
86
|
+
format: '12h' | '24h';
|
|
87
|
+
durationLabels: boolean;
|
|
88
|
+
loading: boolean;
|
|
89
|
+
locale: string | undefined;
|
|
90
|
+
minTime: string | null;
|
|
91
|
+
|
|
92
|
+
// Properties
|
|
93
|
+
value: string | string[] | CalTimepickerRangeValue | null;
|
|
94
|
+
slots: CalTimepickerSlot[] | null;
|
|
95
|
+
unavailableTimes: string[];
|
|
96
|
+
|
|
97
|
+
// Methods
|
|
98
|
+
open(): void;
|
|
99
|
+
close(): void;
|
|
100
|
+
clear(): void;
|
|
101
|
+
showStatus(type: string, message: string, opts?: { autoDismiss?: number; dismissible?: boolean }): void;
|
|
102
|
+
clearStatus(): void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// --- CalBooking ---
|
|
106
|
+
|
|
107
|
+
export interface Booking {
|
|
108
|
+
id: string | number;
|
|
109
|
+
start: string;
|
|
110
|
+
end: string;
|
|
111
|
+
label?: string;
|
|
112
|
+
color?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface BookingDayData {
|
|
116
|
+
[dateStr: string]: {
|
|
117
|
+
label?: string;
|
|
118
|
+
status?: string;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface CalBookingValue {
|
|
123
|
+
start: string;
|
|
124
|
+
end: string;
|
|
125
|
+
startTime?: string;
|
|
126
|
+
endTime?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface CalBookingChangeDetail {
|
|
130
|
+
value: CalBookingValue | null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface CalBookingSelectionInvalidDetail {
|
|
134
|
+
start: string;
|
|
135
|
+
end: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export class CalBooking extends HTMLElement {
|
|
139
|
+
// Attributes
|
|
140
|
+
display: 'inline' | 'popover';
|
|
141
|
+
theme: string;
|
|
142
|
+
placeholder: string;
|
|
143
|
+
firstDay: number;
|
|
144
|
+
minDate: string | null;
|
|
145
|
+
maxDate: string | null;
|
|
146
|
+
locale: string | undefined;
|
|
147
|
+
showLabelsOnHover: boolean;
|
|
148
|
+
timeSlotsEnabled: boolean;
|
|
149
|
+
timeStartTime: string;
|
|
150
|
+
timeEndTime: string;
|
|
151
|
+
timeInterval: number;
|
|
152
|
+
timeFormat: '12h' | '24h';
|
|
153
|
+
durationLabels: boolean;
|
|
154
|
+
loading: boolean;
|
|
155
|
+
|
|
156
|
+
// Properties
|
|
157
|
+
value: CalBookingValue | null;
|
|
158
|
+
bookings: Booking[];
|
|
159
|
+
dayData: BookingDayData;
|
|
160
|
+
labelFormula: ((dateStr: string) => { label?: string; status?: string } | null) | null;
|
|
161
|
+
timeSlots: CalTimepickerSlot[] | null;
|
|
162
|
+
colors: CustomColor[] | null;
|
|
163
|
+
|
|
164
|
+
// Methods
|
|
165
|
+
open(): void;
|
|
166
|
+
close(): void;
|
|
167
|
+
clear(): void;
|
|
168
|
+
goToMonth(month: number, year: number): void;
|
|
169
|
+
showStatus(type: string, message: string, opts?: { autoDismiss?: number; dismissible?: boolean }): void;
|
|
170
|
+
clearStatus(): void;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// --- CalScheduler ---
|
|
174
|
+
|
|
175
|
+
export interface SchedulerResource {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
capacity?: number;
|
|
179
|
+
color?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface SchedulerEvent {
|
|
183
|
+
id: string | number;
|
|
184
|
+
title: string;
|
|
185
|
+
start: string;
|
|
186
|
+
end?: string;
|
|
187
|
+
startTime?: string;
|
|
188
|
+
endTime?: string;
|
|
189
|
+
resourceId?: string;
|
|
190
|
+
color?: string;
|
|
191
|
+
locked?: boolean;
|
|
192
|
+
metadata?: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface SchedulerEventAction {
|
|
196
|
+
label: string;
|
|
197
|
+
type?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface CalSlotSelectDetail {
|
|
201
|
+
date: string;
|
|
202
|
+
startTime: string | null;
|
|
203
|
+
endTime: string | null;
|
|
204
|
+
resourceId: string | null;
|
|
205
|
+
resource: SchedulerResource | null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface CalSlotCreateDetail {
|
|
209
|
+
date: string;
|
|
210
|
+
startTime: string | null;
|
|
211
|
+
endTime: string | null;
|
|
212
|
+
resourceId: string | null;
|
|
213
|
+
resource: SchedulerResource | null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface CalEventClickDetail {
|
|
217
|
+
event: SchedulerEvent;
|
|
218
|
+
resourceId: string | null;
|
|
219
|
+
resource: SchedulerResource | null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface CalEventActionDetail {
|
|
223
|
+
action: string;
|
|
224
|
+
event: SchedulerEvent;
|
|
225
|
+
resourceId: string | null;
|
|
226
|
+
resource: SchedulerResource | null;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface CalEventMoveDetail {
|
|
230
|
+
event: SchedulerEvent;
|
|
231
|
+
date: string;
|
|
232
|
+
startTime: string;
|
|
233
|
+
endTime: string;
|
|
234
|
+
resourceId: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface CalEventResizeDetail {
|
|
238
|
+
event: SchedulerEvent;
|
|
239
|
+
endTime: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface CalDateChangeDetail {
|
|
243
|
+
date: string;
|
|
244
|
+
view: 'day' | 'week' | 'month';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface CalViewChangeDetail {
|
|
248
|
+
view: 'day' | 'week' | 'month';
|
|
249
|
+
date: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface CalFabCreateDetail {
|
|
253
|
+
date: string;
|
|
254
|
+
view: 'day' | 'week' | 'month';
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface AvailableSlotResult {
|
|
258
|
+
resourceId: string;
|
|
259
|
+
date: string;
|
|
260
|
+
startTime: string;
|
|
261
|
+
endTime: string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export class CalScheduler extends HTMLElement {
|
|
265
|
+
// Attributes
|
|
266
|
+
view: 'day' | 'week' | 'month';
|
|
267
|
+
layout: 'vertical' | 'horizontal';
|
|
268
|
+
theme: string;
|
|
269
|
+
startTime: string;
|
|
270
|
+
endTime: string;
|
|
271
|
+
interval: number;
|
|
272
|
+
format: '12h' | '24h';
|
|
273
|
+
firstDay: number;
|
|
274
|
+
slotHeight: number;
|
|
275
|
+
resourceMode: 'tabs' | 'columns';
|
|
276
|
+
loading: boolean;
|
|
277
|
+
locale: string | undefined;
|
|
278
|
+
showEventTime: boolean;
|
|
279
|
+
showFab: boolean;
|
|
280
|
+
draggableEvents: boolean;
|
|
281
|
+
snapInterval: number | null;
|
|
282
|
+
minDuration: number | null;
|
|
283
|
+
maxDuration: number | null;
|
|
284
|
+
|
|
285
|
+
// Properties
|
|
286
|
+
value: CalSlotSelectDetail | null;
|
|
287
|
+
resources: SchedulerResource[];
|
|
288
|
+
events: SchedulerEvent[];
|
|
289
|
+
eventActions: SchedulerEventAction[];
|
|
290
|
+
eventContent: ((event: SchedulerEvent) => HTMLElement | string | null) | null;
|
|
291
|
+
colors: CustomColor[] | null;
|
|
292
|
+
|
|
293
|
+
// Methods
|
|
294
|
+
goToDate(dateStr: string): void;
|
|
295
|
+
setView(view: 'day' | 'week' | 'month'): void;
|
|
296
|
+
today(): void;
|
|
297
|
+
next(): void;
|
|
298
|
+
prev(): void;
|
|
299
|
+
clear(): void;
|
|
300
|
+
findAvailableSlot(opts: {
|
|
301
|
+
date?: string;
|
|
302
|
+
duration: number;
|
|
303
|
+
resourceId?: string;
|
|
304
|
+
minCapacity?: number;
|
|
305
|
+
}): AvailableSlotResult | null;
|
|
306
|
+
isSlotAvailable(date: string, startTime: string, endTime: string, resourceId: string): boolean;
|
|
307
|
+
showStatus(type: string, message: string, opts?: { autoDismiss?: number; dismissible?: boolean }): void;
|
|
308
|
+
clearStatus(): void;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// --- Event Maps ---
|
|
312
|
+
|
|
313
|
+
export interface CalDatepickerEventMap {
|
|
314
|
+
'cal:change': CustomEvent<CalDatepickerChangeDetail>;
|
|
315
|
+
'cal:month-change': CustomEvent<CalDatepickerMonthChangeDetail>;
|
|
316
|
+
'cal:open': CustomEvent<{}>;
|
|
317
|
+
'cal:close': CustomEvent<{}>;
|
|
318
|
+
'cal:status': CustomEvent<CalStatusEvent>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface CalTimepickerEventMap {
|
|
322
|
+
'cal:time-change': CustomEvent<CalTimepickerChangeDetail>;
|
|
323
|
+
'cal:open': CustomEvent<{}>;
|
|
324
|
+
'cal:close': CustomEvent<{}>;
|
|
325
|
+
'cal:status': CustomEvent<CalStatusEvent>;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface CalBookingEventMap {
|
|
329
|
+
'cal:change': CustomEvent<CalBookingChangeDetail>;
|
|
330
|
+
'cal:selection-invalid': CustomEvent<CalBookingSelectionInvalidDetail>;
|
|
331
|
+
'cal:month-change': CustomEvent<CalDatepickerMonthChangeDetail>;
|
|
332
|
+
'cal:open': CustomEvent<{}>;
|
|
333
|
+
'cal:close': CustomEvent<{}>;
|
|
334
|
+
'cal:status': CustomEvent<CalStatusEvent>;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export interface CalSchedulerEventMap {
|
|
338
|
+
'cal:slot-select': CustomEvent<CalSlotSelectDetail>;
|
|
339
|
+
'cal:slot-create': CustomEvent<CalSlotCreateDetail>;
|
|
340
|
+
'cal:event-click': CustomEvent<CalEventClickDetail>;
|
|
341
|
+
'cal:event-action': CustomEvent<CalEventActionDetail>;
|
|
342
|
+
'cal:event-move': CustomEvent<CalEventMoveDetail>;
|
|
343
|
+
'cal:event-resize': CustomEvent<CalEventResizeDetail>;
|
|
344
|
+
'cal:date-change': CustomEvent<CalDateChangeDetail>;
|
|
345
|
+
'cal:view-change': CustomEvent<CalViewChangeDetail>;
|
|
346
|
+
'cal:fab-create': CustomEvent<CalFabCreateDetail>;
|
|
347
|
+
'cal:status': CustomEvent<CalStatusEvent>;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// --- HTMLElementTagNameMap Augmentation ---
|
|
351
|
+
|
|
352
|
+
declare global {
|
|
353
|
+
interface HTMLElementTagNameMap {
|
|
354
|
+
'cal-datepicker': CalDatepicker;
|
|
355
|
+
'cal-timepicker': CalTimepicker;
|
|
356
|
+
'cal-booking': CalBooking;
|
|
357
|
+
'cal-scheduler': CalScheduler;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// --- JSX IntrinsicElements (React / Preact / Solid) ---
|
|
362
|
+
|
|
363
|
+
type Booleanish = boolean | 'true' | 'false' | '';
|
|
364
|
+
|
|
365
|
+
interface CalDatepickerAttributes {
|
|
366
|
+
mode?: 'single' | 'range' | 'multi';
|
|
367
|
+
display?: 'inline' | 'popover';
|
|
368
|
+
theme?: 'light' | 'dark' | 'auto' | string;
|
|
369
|
+
value?: string;
|
|
370
|
+
'min-date'?: string;
|
|
371
|
+
'max-date'?: string;
|
|
372
|
+
'disabled-dates'?: string;
|
|
373
|
+
'first-day'?: string | number;
|
|
374
|
+
locale?: string;
|
|
375
|
+
presets?: string;
|
|
376
|
+
placeholder?: string;
|
|
377
|
+
loading?: Booleanish;
|
|
378
|
+
dual?: Booleanish;
|
|
379
|
+
class?: string;
|
|
380
|
+
style?: string | Record<string, string>;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
interface CalTimepickerAttributes {
|
|
384
|
+
mode?: 'single' | 'range' | 'multi';
|
|
385
|
+
display?: 'inline' | 'popover';
|
|
386
|
+
theme?: 'light' | 'dark' | 'auto' | string;
|
|
387
|
+
'start-time'?: string;
|
|
388
|
+
'end-time'?: string;
|
|
389
|
+
interval?: string | number;
|
|
390
|
+
format?: '12h' | '24h';
|
|
391
|
+
placeholder?: string;
|
|
392
|
+
value?: string;
|
|
393
|
+
'duration-labels'?: Booleanish;
|
|
394
|
+
loading?: Booleanish;
|
|
395
|
+
locale?: string;
|
|
396
|
+
'min-time'?: string;
|
|
397
|
+
class?: string;
|
|
398
|
+
style?: string | Record<string, string>;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
interface CalBookingAttributes {
|
|
402
|
+
display?: 'inline' | 'popover';
|
|
403
|
+
theme?: 'light' | 'dark' | 'auto' | string;
|
|
404
|
+
'min-date'?: string;
|
|
405
|
+
'max-date'?: string;
|
|
406
|
+
'first-day'?: string | number;
|
|
407
|
+
locale?: string;
|
|
408
|
+
placeholder?: string;
|
|
409
|
+
dual?: Booleanish;
|
|
410
|
+
'show-labels-on-hover'?: Booleanish;
|
|
411
|
+
'time-slots'?: Booleanish;
|
|
412
|
+
'time-start'?: string;
|
|
413
|
+
'time-end'?: string;
|
|
414
|
+
'time-interval'?: string | number;
|
|
415
|
+
'time-format'?: '12h' | '24h';
|
|
416
|
+
'duration-labels'?: Booleanish;
|
|
417
|
+
loading?: Booleanish;
|
|
418
|
+
class?: string;
|
|
419
|
+
style?: string | Record<string, string>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
interface CalSchedulerAttributes {
|
|
423
|
+
view?: 'day' | 'week' | 'month';
|
|
424
|
+
layout?: 'vertical' | 'horizontal';
|
|
425
|
+
theme?: 'light' | 'dark' | 'auto' | string;
|
|
426
|
+
date?: string;
|
|
427
|
+
'start-time'?: string;
|
|
428
|
+
'end-time'?: string;
|
|
429
|
+
interval?: string | number;
|
|
430
|
+
format?: '12h' | '24h';
|
|
431
|
+
'first-day'?: string | number;
|
|
432
|
+
'slot-height'?: string | number;
|
|
433
|
+
'resource-mode'?: 'tabs' | 'columns';
|
|
434
|
+
loading?: Booleanish;
|
|
435
|
+
locale?: string;
|
|
436
|
+
'show-event-time'?: Booleanish;
|
|
437
|
+
'show-fab'?: Booleanish;
|
|
438
|
+
'draggable-events'?: Booleanish;
|
|
439
|
+
'snap-interval'?: string | number;
|
|
440
|
+
'min-duration'?: string | number;
|
|
441
|
+
'max-duration'?: string | number;
|
|
442
|
+
class?: string;
|
|
443
|
+
style?: string | Record<string, string>;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
declare namespace JSX {
|
|
447
|
+
interface IntrinsicElements {
|
|
448
|
+
'cal-datepicker': CalDatepickerAttributes;
|
|
449
|
+
'cal-timepicker': CalTimepickerAttributes;
|
|
450
|
+
'cal-booking': CalBookingAttributes;
|
|
451
|
+
'cal-scheduler': CalSchedulerAttributes;
|
|
452
|
+
}
|
|
453
|
+
}
|