@skyscanner/backpack-web 28.1.0 → 28.1.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/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +72 -30
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.d.ts +2 -7
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.js +8 -16
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.d.ts +4 -26
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +75 -94
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
declare const _default: {
|
|
21
21
|
new (props: Omit<{
|
|
22
22
|
changeMonthLabel?: string | null | undefined;
|
|
23
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
23
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
24
24
|
formatDateFull: (date: Date) => string | Date;
|
|
25
25
|
formatMonth: (date: Date) => string | Date;
|
|
26
26
|
id: string;
|
|
@@ -43,7 +43,7 @@ declare const _default: {
|
|
|
43
43
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
44
44
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
45
45
|
preventKeyboardFocus?: boolean | undefined;
|
|
46
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
46
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
47
47
|
gridClassName?: string | null | undefined;
|
|
48
48
|
weekDayKey?: string | undefined;
|
|
49
49
|
navProps?: {} | null | undefined;
|
|
@@ -59,18 +59,22 @@ declare const _default: {
|
|
|
59
59
|
month: Date;
|
|
60
60
|
source: string;
|
|
61
61
|
}) => void) | null | undefined;
|
|
62
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
62
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
63
63
|
initiallyFocusedDate?: Date | null | undefined;
|
|
64
|
+
markToday?: boolean | undefined;
|
|
65
|
+
markOutsideDays?: boolean | undefined;
|
|
64
66
|
}, keyof {
|
|
65
67
|
onDateClick: ((date: Date) => void) | null;
|
|
66
68
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
67
69
|
month: Date;
|
|
70
|
+
minDate: Date;
|
|
71
|
+
maxDate: Date;
|
|
68
72
|
}> & {
|
|
69
73
|
[rest: string]: any;
|
|
70
74
|
}): {
|
|
71
75
|
UNSAFE_componentWillReceiveProps(nextProps: Omit<{
|
|
72
76
|
changeMonthLabel?: string | null | undefined;
|
|
73
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
77
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
74
78
|
formatDateFull: (date: Date) => string | Date;
|
|
75
79
|
formatMonth: (date: Date) => string | Date;
|
|
76
80
|
id: string;
|
|
@@ -93,7 +97,7 @@ declare const _default: {
|
|
|
93
97
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
94
98
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
95
99
|
preventKeyboardFocus?: boolean | undefined;
|
|
96
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
100
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
97
101
|
gridClassName?: string | null | undefined;
|
|
98
102
|
weekDayKey?: string | undefined;
|
|
99
103
|
navProps?: {} | null | undefined;
|
|
@@ -109,12 +113,16 @@ declare const _default: {
|
|
|
109
113
|
month: Date;
|
|
110
114
|
source: string;
|
|
111
115
|
}) => void) | null | undefined;
|
|
112
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
116
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
113
117
|
initiallyFocusedDate?: Date | null | undefined;
|
|
118
|
+
markToday?: boolean | undefined;
|
|
119
|
+
markOutsideDays?: boolean | undefined;
|
|
114
120
|
}, keyof {
|
|
115
121
|
onDateClick: ((date: Date) => void) | null;
|
|
116
122
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
117
123
|
month: Date;
|
|
124
|
+
minDate: Date;
|
|
125
|
+
maxDate: Date;
|
|
118
126
|
}> & {
|
|
119
127
|
[rest: string]: any;
|
|
120
128
|
}): void;
|
|
@@ -141,7 +149,7 @@ declare const _default: {
|
|
|
141
149
|
focusedDate: Date;
|
|
142
150
|
}>, props: Readonly<Omit<{
|
|
143
151
|
changeMonthLabel?: string | null | undefined;
|
|
144
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
152
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
145
153
|
formatDateFull: (date: Date) => string | Date;
|
|
146
154
|
formatMonth: (date: Date) => string | Date;
|
|
147
155
|
id: string;
|
|
@@ -164,7 +172,7 @@ declare const _default: {
|
|
|
164
172
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
165
173
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
166
174
|
preventKeyboardFocus?: boolean | undefined;
|
|
167
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
175
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
168
176
|
gridClassName?: string | null | undefined;
|
|
169
177
|
weekDayKey?: string | undefined;
|
|
170
178
|
navProps?: {} | null | undefined;
|
|
@@ -180,12 +188,16 @@ declare const _default: {
|
|
|
180
188
|
month: Date;
|
|
181
189
|
source: string;
|
|
182
190
|
}) => void) | null | undefined;
|
|
183
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
191
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
184
192
|
initiallyFocusedDate?: Date | null | undefined;
|
|
193
|
+
markToday?: boolean | undefined;
|
|
194
|
+
markOutsideDays?: boolean | undefined;
|
|
185
195
|
}, keyof {
|
|
186
196
|
onDateClick: ((date: Date) => void) | null;
|
|
187
197
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
188
198
|
month: Date;
|
|
199
|
+
minDate: Date;
|
|
200
|
+
maxDate: Date;
|
|
189
201
|
}> & {
|
|
190
202
|
[rest: string]: any;
|
|
191
203
|
}>) => {
|
|
@@ -201,7 +213,7 @@ declare const _default: {
|
|
|
201
213
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
202
214
|
readonly props: Readonly<Omit<{
|
|
203
215
|
changeMonthLabel?: string | null | undefined;
|
|
204
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
216
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
205
217
|
formatDateFull: (date: Date) => string | Date;
|
|
206
218
|
formatMonth: (date: Date) => string | Date;
|
|
207
219
|
id: string;
|
|
@@ -224,7 +236,7 @@ declare const _default: {
|
|
|
224
236
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
225
237
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
226
238
|
preventKeyboardFocus?: boolean | undefined;
|
|
227
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
239
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
228
240
|
gridClassName?: string | null | undefined;
|
|
229
241
|
weekDayKey?: string | undefined;
|
|
230
242
|
navProps?: {} | null | undefined;
|
|
@@ -240,12 +252,16 @@ declare const _default: {
|
|
|
240
252
|
month: Date;
|
|
241
253
|
source: string;
|
|
242
254
|
}) => void) | null | undefined;
|
|
243
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
255
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
244
256
|
initiallyFocusedDate?: Date | null | undefined;
|
|
257
|
+
markToday?: boolean | undefined;
|
|
258
|
+
markOutsideDays?: boolean | undefined;
|
|
245
259
|
}, keyof {
|
|
246
260
|
onDateClick: ((date: Date) => void) | null;
|
|
247
261
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
248
262
|
month: Date;
|
|
263
|
+
minDate: Date;
|
|
264
|
+
maxDate: Date;
|
|
249
265
|
}> & {
|
|
250
266
|
[rest: string]: any;
|
|
251
267
|
}> & Readonly<{
|
|
@@ -261,7 +277,7 @@ declare const _default: {
|
|
|
261
277
|
componentDidMount?(): void;
|
|
262
278
|
shouldComponentUpdate?(nextProps: Readonly<Omit<{
|
|
263
279
|
changeMonthLabel?: string | null | undefined;
|
|
264
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
280
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
265
281
|
formatDateFull: (date: Date) => string | Date;
|
|
266
282
|
formatMonth: (date: Date) => string | Date;
|
|
267
283
|
id: string;
|
|
@@ -284,7 +300,7 @@ declare const _default: {
|
|
|
284
300
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
285
301
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
286
302
|
preventKeyboardFocus?: boolean | undefined;
|
|
287
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
303
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
288
304
|
gridClassName?: string | null | undefined;
|
|
289
305
|
weekDayKey?: string | undefined;
|
|
290
306
|
navProps?: {} | null | undefined;
|
|
@@ -300,12 +316,16 @@ declare const _default: {
|
|
|
300
316
|
month: Date;
|
|
301
317
|
source: string;
|
|
302
318
|
}) => void) | null | undefined;
|
|
303
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
319
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
304
320
|
initiallyFocusedDate?: Date | null | undefined;
|
|
321
|
+
markToday?: boolean | undefined;
|
|
322
|
+
markOutsideDays?: boolean | undefined;
|
|
305
323
|
}, keyof {
|
|
306
324
|
onDateClick: ((date: Date) => void) | null;
|
|
307
325
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
308
326
|
month: Date;
|
|
327
|
+
minDate: Date;
|
|
328
|
+
maxDate: Date;
|
|
309
329
|
}> & {
|
|
310
330
|
[rest: string]: any;
|
|
311
331
|
}>, nextState: Readonly<{
|
|
@@ -316,7 +336,7 @@ declare const _default: {
|
|
|
316
336
|
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
317
337
|
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<{
|
|
318
338
|
changeMonthLabel?: string | null | undefined;
|
|
319
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
339
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
320
340
|
formatDateFull: (date: Date) => string | Date;
|
|
321
341
|
formatMonth: (date: Date) => string | Date;
|
|
322
342
|
id: string;
|
|
@@ -339,7 +359,7 @@ declare const _default: {
|
|
|
339
359
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
340
360
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
341
361
|
preventKeyboardFocus?: boolean | undefined;
|
|
342
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
362
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
343
363
|
gridClassName?: string | null | undefined;
|
|
344
364
|
weekDayKey?: string | undefined;
|
|
345
365
|
navProps?: {} | null | undefined;
|
|
@@ -355,12 +375,16 @@ declare const _default: {
|
|
|
355
375
|
month: Date;
|
|
356
376
|
source: string;
|
|
357
377
|
}) => void) | null | undefined;
|
|
358
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
378
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
359
379
|
initiallyFocusedDate?: Date | null | undefined;
|
|
380
|
+
markToday?: boolean | undefined;
|
|
381
|
+
markOutsideDays?: boolean | undefined;
|
|
360
382
|
}, keyof {
|
|
361
383
|
onDateClick: ((date: Date) => void) | null;
|
|
362
384
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
363
385
|
month: Date;
|
|
386
|
+
minDate: Date;
|
|
387
|
+
maxDate: Date;
|
|
364
388
|
}> & {
|
|
365
389
|
[rest: string]: any;
|
|
366
390
|
}>, prevState: Readonly<{
|
|
@@ -369,7 +393,7 @@ declare const _default: {
|
|
|
369
393
|
}>): any;
|
|
370
394
|
componentDidUpdate?(prevProps: Readonly<Omit<{
|
|
371
395
|
changeMonthLabel?: string | null | undefined;
|
|
372
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
396
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
373
397
|
formatDateFull: (date: Date) => string | Date;
|
|
374
398
|
formatMonth: (date: Date) => string | Date;
|
|
375
399
|
id: string;
|
|
@@ -392,7 +416,7 @@ declare const _default: {
|
|
|
392
416
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
393
417
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
394
418
|
preventKeyboardFocus?: boolean | undefined;
|
|
395
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
419
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
396
420
|
gridClassName?: string | null | undefined;
|
|
397
421
|
weekDayKey?: string | undefined;
|
|
398
422
|
navProps?: {} | null | undefined;
|
|
@@ -408,12 +432,16 @@ declare const _default: {
|
|
|
408
432
|
month: Date;
|
|
409
433
|
source: string;
|
|
410
434
|
}) => void) | null | undefined;
|
|
411
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
435
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
412
436
|
initiallyFocusedDate?: Date | null | undefined;
|
|
437
|
+
markToday?: boolean | undefined;
|
|
438
|
+
markOutsideDays?: boolean | undefined;
|
|
413
439
|
}, keyof {
|
|
414
440
|
onDateClick: ((date: Date) => void) | null;
|
|
415
441
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
416
442
|
month: Date;
|
|
443
|
+
minDate: Date;
|
|
444
|
+
maxDate: Date;
|
|
417
445
|
}> & {
|
|
418
446
|
[rest: string]: any;
|
|
419
447
|
}>, prevState: Readonly<{
|
|
@@ -424,7 +452,7 @@ declare const _default: {
|
|
|
424
452
|
UNSAFE_componentWillMount?(): void;
|
|
425
453
|
componentWillReceiveProps?(nextProps: Readonly<Omit<{
|
|
426
454
|
changeMonthLabel?: string | null | undefined;
|
|
427
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
455
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
428
456
|
formatDateFull: (date: Date) => string | Date;
|
|
429
457
|
formatMonth: (date: Date) => string | Date;
|
|
430
458
|
id: string;
|
|
@@ -447,7 +475,7 @@ declare const _default: {
|
|
|
447
475
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
448
476
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
449
477
|
preventKeyboardFocus?: boolean | undefined;
|
|
450
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
478
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
451
479
|
gridClassName?: string | null | undefined;
|
|
452
480
|
weekDayKey?: string | undefined;
|
|
453
481
|
navProps?: {} | null | undefined;
|
|
@@ -463,18 +491,22 @@ declare const _default: {
|
|
|
463
491
|
month: Date;
|
|
464
492
|
source: string;
|
|
465
493
|
}) => void) | null | undefined;
|
|
466
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
494
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
467
495
|
initiallyFocusedDate?: Date | null | undefined;
|
|
496
|
+
markToday?: boolean | undefined;
|
|
497
|
+
markOutsideDays?: boolean | undefined;
|
|
468
498
|
}, keyof {
|
|
469
499
|
onDateClick: ((date: Date) => void) | null;
|
|
470
500
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
471
501
|
month: Date;
|
|
502
|
+
minDate: Date;
|
|
503
|
+
maxDate: Date;
|
|
472
504
|
}> & {
|
|
473
505
|
[rest: string]: any;
|
|
474
506
|
}>, nextContext: any): void;
|
|
475
507
|
componentWillUpdate?(nextProps: Readonly<Omit<{
|
|
476
508
|
changeMonthLabel?: string | null | undefined;
|
|
477
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
509
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
478
510
|
formatDateFull: (date: Date) => string | Date;
|
|
479
511
|
formatMonth: (date: Date) => string | Date;
|
|
480
512
|
id: string;
|
|
@@ -497,7 +529,7 @@ declare const _default: {
|
|
|
497
529
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
498
530
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
499
531
|
preventKeyboardFocus?: boolean | undefined;
|
|
500
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
532
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
501
533
|
gridClassName?: string | null | undefined;
|
|
502
534
|
weekDayKey?: string | undefined;
|
|
503
535
|
navProps?: {} | null | undefined;
|
|
@@ -513,12 +545,16 @@ declare const _default: {
|
|
|
513
545
|
month: Date;
|
|
514
546
|
source: string;
|
|
515
547
|
}) => void) | null | undefined;
|
|
516
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
548
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
517
549
|
initiallyFocusedDate?: Date | null | undefined;
|
|
550
|
+
markToday?: boolean | undefined;
|
|
551
|
+
markOutsideDays?: boolean | undefined;
|
|
518
552
|
}, keyof {
|
|
519
553
|
onDateClick: ((date: Date) => void) | null;
|
|
520
554
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
521
555
|
month: Date;
|
|
556
|
+
minDate: Date;
|
|
557
|
+
maxDate: Date;
|
|
522
558
|
}> & {
|
|
523
559
|
[rest: string]: any;
|
|
524
560
|
}>, nextState: Readonly<{
|
|
@@ -527,7 +563,7 @@ declare const _default: {
|
|
|
527
563
|
}>, nextContext: any): void;
|
|
528
564
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<{
|
|
529
565
|
changeMonthLabel?: string | null | undefined;
|
|
530
|
-
daysOfWeek: import("../../bpk-component-calendar
|
|
566
|
+
daysOfWeek: import("../../bpk-component-calendar").DaysOfWeek;
|
|
531
567
|
formatDateFull: (date: Date) => string | Date;
|
|
532
568
|
formatMonth: (date: Date) => string | Date;
|
|
533
569
|
id: string;
|
|
@@ -550,7 +586,7 @@ declare const _default: {
|
|
|
550
586
|
onDateClick?: ((date: Date) => void) | null | undefined;
|
|
551
587
|
onDateKeyDown?: ((event: KeyboardEvent) => void) | null | undefined;
|
|
552
588
|
preventKeyboardFocus?: boolean | undefined;
|
|
553
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
589
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
554
590
|
gridClassName?: string | null | undefined;
|
|
555
591
|
weekDayKey?: string | undefined;
|
|
556
592
|
navProps?: {} | null | undefined;
|
|
@@ -566,12 +602,16 @@ declare const _default: {
|
|
|
566
602
|
month: Date;
|
|
567
603
|
source: string;
|
|
568
604
|
}) => void) | null | undefined;
|
|
569
|
-
selectionConfiguration?: import("../../bpk-component-calendar
|
|
605
|
+
selectionConfiguration?: import("../../bpk-component-calendar").SelectionConfiguration | undefined;
|
|
570
606
|
initiallyFocusedDate?: Date | null | undefined;
|
|
607
|
+
markToday?: boolean | undefined;
|
|
608
|
+
markOutsideDays?: boolean | undefined;
|
|
571
609
|
}, keyof {
|
|
572
610
|
onDateClick: ((date: Date) => void) | null;
|
|
573
611
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
574
612
|
month: Date;
|
|
613
|
+
minDate: Date;
|
|
614
|
+
maxDate: Date;
|
|
575
615
|
}> & {
|
|
576
616
|
[rest: string]: any;
|
|
577
617
|
}>, nextState: Readonly<{
|
|
@@ -590,6 +630,8 @@ declare const _default: {
|
|
|
590
630
|
date: null;
|
|
591
631
|
};
|
|
592
632
|
initiallyFocusedDate: null;
|
|
633
|
+
markToday: boolean;
|
|
634
|
+
markOutsideDays: boolean;
|
|
593
635
|
};
|
|
594
636
|
contextType?: import("react").Context<any> | undefined;
|
|
595
637
|
};
|
|
@@ -16,17 +16,12 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/// <reference types="react" />
|
|
20
20
|
import type { BpkCalendarDateProps } from '../../bpk-component-calendar';
|
|
21
21
|
type Props = Partial<BpkCalendarDateProps> & {
|
|
22
22
|
date: Date;
|
|
23
23
|
isOutside?: boolean;
|
|
24
24
|
[rest: string]: any;
|
|
25
25
|
};
|
|
26
|
-
declare
|
|
27
|
-
static defaultProps: {
|
|
28
|
-
isOutside: boolean;
|
|
29
|
-
};
|
|
30
|
-
render(): JSX.Element | null;
|
|
31
|
-
}
|
|
26
|
+
declare const BpkScrollableCalendarDate: ({ isOutside, ...rest }: Props) => JSX.Element | null;
|
|
32
27
|
export default BpkScrollableCalendarDate;
|
|
@@ -16,22 +16,14 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { PureComponent } from 'react';
|
|
20
19
|
import { BpkCalendarDate } from "../../bpk-component-calendar";
|
|
21
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = this.props;
|
|
31
|
-
// Returning null when isOutside is true ensures only focused month displays in grid
|
|
32
|
-
return !isOutside ? /*#__PURE__*/_jsx(BpkCalendarDate, {
|
|
33
|
-
...rest
|
|
34
|
-
}) : null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
21
|
+
const BpkScrollableCalendarDate = ({
|
|
22
|
+
isOutside = false,
|
|
23
|
+
...rest
|
|
24
|
+
}) =>
|
|
25
|
+
// Returning null when isOutside is true ensures only focused month displays in grid
|
|
26
|
+
!isOutside ? /*#__PURE__*/_jsx(BpkCalendarDate, {
|
|
27
|
+
...rest
|
|
28
|
+
}) : null;
|
|
37
29
|
export default BpkScrollableCalendarDate;
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { Component } from 'react';
|
|
20
19
|
import type { ElementType } from 'react';
|
|
21
|
-
import type { BpkCalendarGridProps } from '../../bpk-component-calendar';
|
|
20
|
+
import type { BpkCalendarGridProps, SelectionConfiguration } from '../../bpk-component-calendar';
|
|
22
21
|
type Props = Partial<BpkCalendarGridProps> & {
|
|
23
22
|
minDate: Date;
|
|
24
23
|
maxDate: Date;
|
|
@@ -28,29 +27,8 @@ type Props = Partial<BpkCalendarGridProps> & {
|
|
|
28
27
|
weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
29
28
|
formatMonth: (date: Date) => Date | string;
|
|
30
29
|
focusedDate?: Date | null;
|
|
30
|
+
selectionConfiguration?: SelectionConfiguration;
|
|
31
|
+
className?: string | null;
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
months: Date[];
|
|
34
|
-
monthItemHeights: number[];
|
|
35
|
-
outerHeight: number;
|
|
36
|
-
};
|
|
37
|
-
declare class BpkScrollableCalendarGridList extends Component<Props, State> {
|
|
38
|
-
outerDiv: HTMLDivElement | null;
|
|
39
|
-
static defaultProps: {
|
|
40
|
-
className: null;
|
|
41
|
-
focusedDate: null;
|
|
42
|
-
};
|
|
43
|
-
constructor(props: Props);
|
|
44
|
-
componentDidMount: () => void;
|
|
45
|
-
componentWillUnmount: () => void;
|
|
46
|
-
getHtmlElement: () => {} | null;
|
|
47
|
-
getItemSize: (index: number) => number;
|
|
48
|
-
setComponentHeight: () => void;
|
|
49
|
-
rowRenderer: ({ index, style }: {
|
|
50
|
-
index: number;
|
|
51
|
-
style: {};
|
|
52
|
-
}) => JSX.Element;
|
|
53
|
-
calculateOffsetInPixels: (numberOfMonths: number) => number;
|
|
54
|
-
render(): JSX.Element;
|
|
55
|
-
}
|
|
33
|
+
declare const BpkScrollableCalendarGridList: (props: Props) => JSX.Element;
|
|
56
34
|
export default BpkScrollableCalendarGridList;
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
20
20
|
import { startOfDay, startOfMonth } from 'date-fns';
|
|
21
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
21
|
import { VariableSizeList as List } from 'react-window';
|
|
22
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
23
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
24
24
|
import { CALENDAR_SELECTION_TYPE, DateUtils } from "../../bpk-component-calendar";
|
|
25
25
|
import STYLES from "./BpkScrollableCalendarGridList.module.css";
|
|
@@ -28,120 +28,101 @@ import { getMonthsArray, getMonthItemHeights } from "./utils";
|
|
|
28
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
29
|
const getClassName = cssModules(STYLES);
|
|
30
30
|
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
const ROW_HEIGHT =
|
|
31
|
+
// These constants are here to facilitate calculating the height
|
|
32
|
+
// Row and month item heights are defined in rem to support text scaling
|
|
33
|
+
const ROW_HEIGHT = 2.75;
|
|
34
34
|
// This is the additional height of each grid without any rows.
|
|
35
|
-
const BASE_MONTH_ITEM_HEIGHT =
|
|
35
|
+
const BASE_MONTH_ITEM_HEIGHT = 8.125;
|
|
36
36
|
const COLUMN_COUNT = 7;
|
|
37
|
-
// Most
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
componentWillUnmount() {
|
|
69
|
-
if (typeof document !== 'undefined') {
|
|
70
|
-
window.removeEventListener('resize', this.setComponentHeight);
|
|
71
|
-
document.removeEventListener('orientationchange', this.setComponentHeight);
|
|
72
|
-
document.removeEventListener('fullscreenchange', this.setComponentHeight);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
getHtmlElement = () => typeof document !== 'undefined' ? document.querySelector('html') : {};
|
|
76
|
-
getItemSize = index => this.state.monthItemHeights[index] || ESTIMATED_MONTH_ITEM_HEIGHT;
|
|
77
|
-
setComponentHeight = () => {
|
|
78
|
-
const outerNode = this.outerDiv;
|
|
79
|
-
if (outerNode) {
|
|
80
|
-
if (outerNode.clientHeight > 0) {
|
|
81
|
-
const newHeight = outerNode.clientHeight;
|
|
82
|
-
this.setState({
|
|
83
|
-
outerHeight: newHeight
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
this.setState({
|
|
88
|
-
outerHeight: ESTIMATED_MONTH_ITEM_HEIGHT
|
|
89
|
-
});
|
|
37
|
+
// Most browsers have by default 16px root font size
|
|
38
|
+
const DEFAULT_ROOT_FONT_SIZE = 16;
|
|
39
|
+
// Most calendar grids have 5 rows. Calculate height in px as this is what react-window expects.
|
|
40
|
+
const ESTIMATED_MONTH_ITEM_HEIGHT = (BASE_MONTH_ITEM_HEIGHT + 5 * ROW_HEIGHT) * DEFAULT_ROOT_FONT_SIZE;
|
|
41
|
+
// Minimum month item width (useful for server-side rendering. This value will be overridden with an accurate width after mounting)
|
|
42
|
+
const ESTIMATED_MONTH_ITEM_WIDTH = BASE_MONTH_ITEM_HEIGHT * 7 * DEFAULT_ROOT_FONT_SIZE;
|
|
43
|
+
const BpkScrollableCalendarGridList = props => {
|
|
44
|
+
const {
|
|
45
|
+
className = null,
|
|
46
|
+
focusedDate = null,
|
|
47
|
+
minDate,
|
|
48
|
+
selectionConfiguration,
|
|
49
|
+
...rest
|
|
50
|
+
} = props;
|
|
51
|
+
const listRef = useRef(null);
|
|
52
|
+
const startDate = startOfDay(startOfMonth(minDate));
|
|
53
|
+
const endDate = startOfDay(startOfMonth(rest.maxDate));
|
|
54
|
+
const monthsCount = DateUtils.differenceInCalendarMonths(endDate, startDate);
|
|
55
|
+
const getInitialRootFontSize = () => parseFloat(getComputedStyle(document.documentElement).fontSize) || DEFAULT_ROOT_FONT_SIZE;
|
|
56
|
+
|
|
57
|
+
// The `react-window` API requires the height in pixels to be specified
|
|
58
|
+
// To be able to scale text size, we use rem and then we get the root font size so that we can calculate the final value in px
|
|
59
|
+
const [rootFontSize, setRootFontSize] = useState(getInitialRootFontSize);
|
|
60
|
+
const months = useMemo(() => getMonthsArray(startDate, monthsCount), [minDate, monthsCount]);
|
|
61
|
+
const monthItemHeights = useMemo(() => getMonthItemHeights(months, rest.weekStartsOn, COLUMN_COUNT, ROW_HEIGHT * rootFontSize, BASE_MONTH_ITEM_HEIGHT * rootFontSize), [rootFontSize, months, rest.weekStartsOn]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
// this is required by the react-window library in order to re-render the list whenever an item's size changes
|
|
64
|
+
if (listRef.current) {
|
|
65
|
+
listRef.current.resetAfterIndex(0);
|
|
90
66
|
}
|
|
91
|
-
};
|
|
92
|
-
|
|
67
|
+
}, [monthItemHeights]);
|
|
68
|
+
const getHtmlElement = () => typeof document !== 'undefined' ? document.querySelector('html') : {};
|
|
69
|
+
const getItemSize = index => monthItemHeights[index] || ESTIMATED_MONTH_ITEM_HEIGHT;
|
|
70
|
+
const rowRenderer = ({
|
|
93
71
|
index,
|
|
94
72
|
style
|
|
95
73
|
}) => /*#__PURE__*/_jsx("div", {
|
|
96
74
|
style: style,
|
|
97
75
|
children: /*#__PURE__*/_jsx(BpkScrollableCalendarGrid, {
|
|
98
|
-
onDateClick:
|
|
99
|
-
...
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
76
|
+
onDateClick: rest.onDateClick,
|
|
77
|
+
...rest,
|
|
78
|
+
minDate: minDate,
|
|
79
|
+
selectionConfiguration: selectionConfiguration,
|
|
80
|
+
month: months[index],
|
|
81
|
+
focusedDate: focusedDate,
|
|
82
|
+
preventKeyboardFocus: rest.preventKeyboardFocus,
|
|
103
83
|
"aria-hidden": index !== 1,
|
|
104
84
|
className: getClassName('bpk-scrollable-calendar-grid-list__item')
|
|
105
85
|
})
|
|
106
86
|
});
|
|
107
|
-
calculateOffsetInPixels = numberOfMonths => {
|
|
87
|
+
const calculateOffsetInPixels = numberOfMonths => {
|
|
108
88
|
// The `react-window` API requires the scroll offset to be provided in pixels.
|
|
109
89
|
// Here we use the pre-calculated item heights to find the correct pixel offset
|
|
110
90
|
let result = 0;
|
|
111
91
|
for (let i = 0; i < numberOfMonths; i += 1) {
|
|
112
|
-
result +=
|
|
92
|
+
result += getItemSize(i);
|
|
113
93
|
}
|
|
114
94
|
return result;
|
|
115
95
|
};
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
96
|
+
const onResize = () => {
|
|
97
|
+
const newRootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize) || DEFAULT_ROOT_FONT_SIZE;
|
|
98
|
+
setRootFontSize(newRootFontSize);
|
|
99
|
+
};
|
|
100
|
+
const date = selectionConfiguration?.type === CALENDAR_SELECTION_TYPE.single ? selectionConfiguration?.date : selectionConfiguration?.startDate;
|
|
101
|
+
const selectedDate = focusedDate || date;
|
|
102
|
+
return /*#__PURE__*/_jsx("div", {
|
|
103
|
+
className: getClassName('bpk-scrollable-calendar-grid-list', className),
|
|
104
|
+
children: /*#__PURE__*/_jsx(AutoSizer, {
|
|
105
|
+
onResize: onResize,
|
|
106
|
+
defaultHeight: ESTIMATED_MONTH_ITEM_HEIGHT,
|
|
107
|
+
defaultWidth: ESTIMATED_MONTH_ITEM_WIDTH,
|
|
108
|
+
children: ({
|
|
109
|
+
height,
|
|
110
|
+
width
|
|
111
|
+
}) => /*#__PURE__*/_jsx(List, {
|
|
112
|
+
style: getHtmlElement().dir === 'rtl' ? {
|
|
132
113
|
direction: 'rtl'
|
|
133
114
|
} : {},
|
|
134
|
-
width:
|
|
135
|
-
height:
|
|
115
|
+
width: width,
|
|
116
|
+
height: height,
|
|
136
117
|
estimatedItemSize: ESTIMATED_MONTH_ITEM_HEIGHT,
|
|
137
|
-
itemSize:
|
|
138
|
-
itemCount:
|
|
139
|
-
rowCount: this.state.months.length,
|
|
118
|
+
itemSize: getItemSize,
|
|
119
|
+
itemCount: months.length,
|
|
140
120
|
overscanCount: 1,
|
|
141
|
-
initialScrollOffset:
|
|
142
|
-
|
|
121
|
+
initialScrollOffset: calculateOffsetInPixels(selectedDate ? DateUtils.differenceInCalendarMonths(selectedDate, minDate) : 0),
|
|
122
|
+
ref: listRef,
|
|
123
|
+
children: rowRenderer
|
|
143
124
|
})
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
}
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
};
|
|
147
128
|
export default BpkScrollableCalendarGridList;
|