@super-calendar/solid 2.16.0 → 2.17.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 +46 -2
- package/dist/client/index.d.ts +40 -3
- package/dist/client/index.js +538 -101
- package/dist/server/index.d.ts +40 -3
- package/dist/server/index.js +854 -338
- package/package.json +2 -2
- package/src/Calendar.tsx +73 -2
- package/src/MonthView.tsx +435 -86
- package/src/MultiWeekView.tsx +49 -0
- package/src/index.ts +7 -0
- package/src/touch.ts +70 -0
package/src/MonthView.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { Dynamic, type JSX } from "@solidjs/web";
|
|
|
2
2
|
import {
|
|
3
3
|
bandRounding,
|
|
4
4
|
buildMonthGrid,
|
|
5
|
+
buildMultiWeekGrid,
|
|
5
6
|
type CalendarEvent,
|
|
6
7
|
type CalendarLabels,
|
|
7
8
|
compareDayEvents,
|
|
@@ -16,8 +17,8 @@ import {
|
|
|
16
17
|
layoutMonthWeek,
|
|
17
18
|
monthCreateRange,
|
|
18
19
|
monthDropBounds,
|
|
19
|
-
type
|
|
20
|
-
type
|
|
20
|
+
type MonthGridWeekday,
|
|
21
|
+
type MultiWeekGridDay,
|
|
21
22
|
overlapsOtherEvents,
|
|
22
23
|
rangeBandKind,
|
|
23
24
|
resolveCalendarLabels,
|
|
@@ -42,6 +43,7 @@ import {
|
|
|
42
43
|
Show,
|
|
43
44
|
untrack,
|
|
44
45
|
} from "solid-js";
|
|
46
|
+
import { holdDateDrag } from "./touch";
|
|
45
47
|
import { withDefaults } from "./props";
|
|
46
48
|
import { createSlots, dataState, type SlotDefault, type SlotStyleProps } from "./slots";
|
|
47
49
|
import { css, type CSSProperties, type DomKeyboardEvent, type ElementRef } from "./styles";
|
|
@@ -86,6 +88,8 @@ export interface SolidMonthEventArgs<T = unknown> {
|
|
|
86
88
|
event: CalendarEvent<T>;
|
|
87
89
|
/** Call to fire the view's `onPressEvent` for this chip. */
|
|
88
90
|
onPress: () => void;
|
|
91
|
+
/** The current row view. Supplied by the calendar; optional for existing standalone chip callers. */
|
|
92
|
+
mode?: "month" | "multiweek";
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
/** A component that renders a single month-grid event chip. */
|
|
@@ -94,7 +98,7 @@ export type SolidMonthEvent<T = unknown> = Component<SolidMonthEventArgs<T>>;
|
|
|
94
98
|
// An in-progress month drag: either a day span being swept out for a new event,
|
|
95
99
|
// or an existing event being carried to another day. Days are held as start-of-day
|
|
96
100
|
// timestamps, so the reducer-ish updates compare cheaply.
|
|
97
|
-
type MonthDrag<T> =
|
|
101
|
+
type MonthDrag<T> = (
|
|
98
102
|
| {
|
|
99
103
|
kind: "create";
|
|
100
104
|
pointerId: number;
|
|
@@ -107,7 +111,19 @@ type MonthDrag<T> =
|
|
|
107
111
|
event: CalendarEvent<T>;
|
|
108
112
|
from: number;
|
|
109
113
|
to: number;
|
|
110
|
-
}
|
|
114
|
+
}
|
|
115
|
+
) & {
|
|
116
|
+
// The rows the drag began in, so a drag never commits into a different window.
|
|
117
|
+
windowKey: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// A day as the shared rows render it. Month days carry `isCurrentMonth`;
|
|
121
|
+
// multi-week days omit it because every one of them is inside the period.
|
|
122
|
+
type RowDay = MultiWeekGridDay & { isCurrentMonth?: boolean };
|
|
123
|
+
type RowWeek = { id: string; days: RowDay[] };
|
|
124
|
+
|
|
125
|
+
// A leading or trailing day of a neighbouring month in the month grid.
|
|
126
|
+
const isOutsidePeriod = (day: RowDay) => day.isCurrentMonth === false;
|
|
111
127
|
|
|
112
128
|
/** Props for {@link MonthView}. */
|
|
113
129
|
export interface MonthViewProps<T = unknown>
|
|
@@ -228,7 +244,7 @@ export interface MonthViewProps<T = unknown>
|
|
|
228
244
|
// always applied) and `themed` (colour/type/spacing, dropped when a class is set).
|
|
229
245
|
|
|
230
246
|
function dayCellDefault(
|
|
231
|
-
day:
|
|
247
|
+
day: RowDay,
|
|
232
248
|
theme: SolidCalendarTheme,
|
|
233
249
|
highlightWeekends: boolean,
|
|
234
250
|
): SlotDefault {
|
|
@@ -268,7 +284,7 @@ function dayCellDefault(
|
|
|
268
284
|
* event chips (and matches the native renderer's month grid).
|
|
269
285
|
*/
|
|
270
286
|
function rangeBandDefault(
|
|
271
|
-
day:
|
|
287
|
+
day: RowDay,
|
|
272
288
|
theme: SolidCalendarTheme,
|
|
273
289
|
fillCell: boolean,
|
|
274
290
|
eventsMode: boolean,
|
|
@@ -318,7 +334,7 @@ function rangeBandDefault(
|
|
|
318
334
|
},
|
|
319
335
|
};
|
|
320
336
|
}
|
|
321
|
-
function badgeDefault(day:
|
|
337
|
+
function badgeDefault(day: RowDay, theme: SolidCalendarTheme, hovered: boolean): SlotDefault {
|
|
322
338
|
const badge = dayBadgeKind(day, day.isToday);
|
|
323
339
|
const filled = badge !== "none";
|
|
324
340
|
const background = filled
|
|
@@ -349,7 +365,7 @@ function badgeDefault(day: MonthGridDay, theme: SolidCalendarTheme, hovered: boo
|
|
|
349
365
|
// --- Calendar (events) layout styles -------------------------------------
|
|
350
366
|
|
|
351
367
|
function eventCellDefault(
|
|
352
|
-
day:
|
|
368
|
+
day: RowDay,
|
|
353
369
|
theme: SolidCalendarTheme,
|
|
354
370
|
height: number,
|
|
355
371
|
highlightWeekends: boolean,
|
|
@@ -384,7 +400,7 @@ function eventCellDefault(
|
|
|
384
400
|
},
|
|
385
401
|
};
|
|
386
402
|
}
|
|
387
|
-
function compactBadgeDefault(day:
|
|
403
|
+
function compactBadgeDefault(day: RowDay, theme: SolidCalendarTheme): SlotDefault {
|
|
388
404
|
const badge = dayBadgeKind(day, day.isToday);
|
|
389
405
|
const filled = badge !== "none";
|
|
390
406
|
return {
|
|
@@ -443,7 +459,11 @@ function chipDefault(theme: SolidCalendarTheme, chipHeight: number): SlotDefault
|
|
|
443
459
|
},
|
|
444
460
|
};
|
|
445
461
|
}
|
|
446
|
-
function moreButtonDefault(
|
|
462
|
+
function moreButtonDefault(
|
|
463
|
+
theme: SolidCalendarTheme,
|
|
464
|
+
chipHeight: number,
|
|
465
|
+
multiWeek = false,
|
|
466
|
+
): SlotDefault {
|
|
447
467
|
return {
|
|
448
468
|
base: {
|
|
449
469
|
position: "relative",
|
|
@@ -455,6 +475,7 @@ function moreButtonDefault(theme: SolidCalendarTheme, chipHeight: number): SlotD
|
|
|
455
475
|
height: chipHeight,
|
|
456
476
|
lineHeight: `${chipHeight}px`,
|
|
457
477
|
fontFamily: "inherit",
|
|
478
|
+
...(multiWeek ? { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } : {}),
|
|
458
479
|
},
|
|
459
480
|
themed: {
|
|
460
481
|
padding: "0 6px",
|
|
@@ -476,7 +497,7 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
476
497
|
// A multi-day event lives in each covered day's bucket, so dedupe by reference;
|
|
477
498
|
// this scans only the row's days, not every event in the month.
|
|
478
499
|
function collectRowEvents<T>(
|
|
479
|
-
week:
|
|
500
|
+
week: RowWeek,
|
|
480
501
|
eventsByDay: ReadonlyMap<string, CalendarEvent<T>[]>,
|
|
481
502
|
): CalendarEvent<T>[] {
|
|
482
503
|
const seen = new Set<CalendarEvent<T>>();
|
|
@@ -494,6 +515,38 @@ function collectRowEvents<T>(
|
|
|
494
515
|
return out;
|
|
495
516
|
}
|
|
496
517
|
|
|
518
|
+
/**
|
|
519
|
+
* Which rows a {@link DateRows} grid shows. Internal to the package: the public
|
|
520
|
+
* views adapt their own props to it.
|
|
521
|
+
*/
|
|
522
|
+
export type DateRowsSource =
|
|
523
|
+
| {
|
|
524
|
+
kind: "month";
|
|
525
|
+
/** Any day within the month to render. */
|
|
526
|
+
date: Date;
|
|
527
|
+
showAdjacentMonths: boolean;
|
|
528
|
+
}
|
|
529
|
+
| {
|
|
530
|
+
kind: "multiweek";
|
|
531
|
+
/** Any day within the first week to render. */
|
|
532
|
+
date: Date;
|
|
533
|
+
numberOfWeeks: number;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// The localized first and last displayed days, e.g. "Nov 1, 2026 – Nov 14, 2026".
|
|
537
|
+
function rangeTitle(start: Date, endExclusive: Date, locale?: Locale): string {
|
|
538
|
+
const options = locale ? { locale } : undefined;
|
|
539
|
+
return `${format(start, "PP", options)} – ${format(addDays(endExclusive, -1), "PP", options)}`;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** Props for the private {@link DateRows} grid shared by the public row views. */
|
|
543
|
+
export interface DateRowsProps<T = unknown> extends Omit<
|
|
544
|
+
MonthViewInternalProps<T>,
|
|
545
|
+
"date" | "showAdjacentMonths"
|
|
546
|
+
> {
|
|
547
|
+
source: DateRowsSource;
|
|
548
|
+
}
|
|
549
|
+
|
|
497
550
|
/**
|
|
498
551
|
* A single static month grid, rendered with plain DOM elements.
|
|
499
552
|
*
|
|
@@ -502,7 +555,28 @@ function collectRowEvents<T>(
|
|
|
502
555
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
503
556
|
* ```
|
|
504
557
|
*/
|
|
505
|
-
export function MonthView<T = unknown>(
|
|
558
|
+
export function MonthView<T = unknown>(props: MonthViewInternalProps<T>): JSX.Element {
|
|
559
|
+
return (
|
|
560
|
+
<DateRows<T>
|
|
561
|
+
{...props}
|
|
562
|
+
source={{
|
|
563
|
+
kind: "month",
|
|
564
|
+
get date() {
|
|
565
|
+
return props.date;
|
|
566
|
+
},
|
|
567
|
+
get showAdjacentMonths() {
|
|
568
|
+
return props.showAdjacentMonths ?? true;
|
|
569
|
+
},
|
|
570
|
+
}}
|
|
571
|
+
/>
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* The day-row grid behind the public row views: week rows of day cells with
|
|
577
|
+
* spanning event bars, overflow, selection, drag, and keyboard handling.
|
|
578
|
+
*/
|
|
579
|
+
export function DateRows<T = unknown>(incoming: DateRowsProps<T>): JSX.Element {
|
|
506
580
|
const props = withDefaults(
|
|
507
581
|
{
|
|
508
582
|
weekStartsOn: 0,
|
|
@@ -511,7 +585,6 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
511
585
|
chipHeight: CHIP_HEIGHT,
|
|
512
586
|
chipGap: CHIP_GAP,
|
|
513
587
|
moreLabel: "{moreCount} More",
|
|
514
|
-
showAdjacentMonths: true,
|
|
515
588
|
highlightWeekends: true,
|
|
516
589
|
fillCellOnSelection: false,
|
|
517
590
|
showTitle: true,
|
|
@@ -519,16 +592,27 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
519
592
|
eventStartEditable: true,
|
|
520
593
|
eventOverlap: true,
|
|
521
594
|
keyboardDayNavigation: false,
|
|
522
|
-
} satisfies Partial<
|
|
595
|
+
} satisfies Partial<DateRowsProps<T>>,
|
|
523
596
|
incoming,
|
|
524
597
|
);
|
|
525
598
|
const theme = createMemo(() => mergeSolidTheme(props.theme));
|
|
526
599
|
const labels = createMemo(() => resolveCalendarLabels(props.labels));
|
|
527
600
|
const slot = createSlots<MonthViewSlot>(props);
|
|
601
|
+
const multiWeek = createMemo(() => props.source.kind === "multiweek");
|
|
602
|
+
// Multi-week rows only contain days of the requested period, so nothing is blanked.
|
|
603
|
+
const showAdjacentMonths = createMemo(() =>
|
|
604
|
+
props.source.kind === "month" ? props.source.showAdjacentMonths : true,
|
|
605
|
+
);
|
|
606
|
+
const numberOfWeeks = createMemo(() =>
|
|
607
|
+
props.source.kind === "multiweek" ? props.source.numberOfWeeks : undefined,
|
|
608
|
+
);
|
|
609
|
+
// The mode reported to custom renderers and accessibility labels.
|
|
610
|
+
const viewMode = createMemo((): "month" | "multiweek" => (multiWeek() ? "multiweek" : "month"));
|
|
528
611
|
|
|
529
612
|
// Calendar layout (date in the corner + event chips) is on whenever `events`
|
|
530
|
-
// is provided; otherwise the compact picker badge layout is used.
|
|
531
|
-
|
|
613
|
+
// is provided; otherwise the compact picker badge layout is used. Multi-week
|
|
614
|
+
// rows always use the calendar layout.
|
|
615
|
+
const eventsMode = createMemo(() => props.events !== undefined || multiWeek());
|
|
532
616
|
// The day cells form a roving tab stop (arrow keys + Enter) in the picker
|
|
533
617
|
// always, and in events mode only when the consumer opts in. Otherwise events
|
|
534
618
|
// mode tabs through the event chips alone.
|
|
@@ -597,20 +681,50 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
597
681
|
// Reserve `maxVisibleEventCount` rows below the date so every cell is uniform;
|
|
598
682
|
// when a day overflows, the last row becomes the "+N more" affordance.
|
|
599
683
|
const eventRowHeight = createMemo(
|
|
600
|
-
() =>
|
|
684
|
+
() =>
|
|
685
|
+
CELL_PAD * 2 +
|
|
686
|
+
DATE_ROW +
|
|
687
|
+
(multiWeek() ? Math.max(1, props.maxVisibleEventCount) : props.maxVisibleEventCount) *
|
|
688
|
+
(props.chipHeight + props.chipGap),
|
|
601
689
|
);
|
|
602
|
-
const _grid = createMemo(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
690
|
+
const _grid = createMemo(
|
|
691
|
+
(): {
|
|
692
|
+
weeks: RowWeek[];
|
|
693
|
+
weekdays: MonthGridWeekday[];
|
|
694
|
+
title: string;
|
|
695
|
+
period: { start: Date; endExclusive: Date } | null;
|
|
696
|
+
} => {
|
|
697
|
+
const options = {
|
|
698
|
+
weekStartsOn: props.weekStartsOn,
|
|
699
|
+
hiddenDays: props.hiddenDays,
|
|
700
|
+
weekdayFormat: props.weekdayFormat,
|
|
701
|
+
selectedRange: props.selectedRange,
|
|
702
|
+
selectedDates: props.selectedDates,
|
|
703
|
+
minDate: props.minDate,
|
|
704
|
+
maxDate: props.maxDate,
|
|
705
|
+
isDateDisabled: props.isDateDisabled,
|
|
706
|
+
locale: props.locale,
|
|
707
|
+
};
|
|
708
|
+
const weeks = numberOfWeeks();
|
|
709
|
+
if (weeks === undefined) {
|
|
710
|
+
return {
|
|
711
|
+
...buildMonthGrid(props.source.date, options),
|
|
712
|
+
title: format(
|
|
713
|
+
props.source.date,
|
|
714
|
+
"MMMM yyyy",
|
|
715
|
+
props.locale ? { locale: props.locale } : undefined,
|
|
716
|
+
),
|
|
717
|
+
period: null,
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
const grid = buildMultiWeekGrid(props.source.date, { ...options, numberOfWeeks: weeks });
|
|
721
|
+
return {
|
|
722
|
+
weeks: grid.weeks,
|
|
723
|
+
weekdays: grid.weekdays,
|
|
724
|
+
title: rangeTitle(grid.visibleRange.start, grid.visibleRange.endExclusive, props.locale),
|
|
725
|
+
period: grid.period,
|
|
726
|
+
};
|
|
727
|
+
},
|
|
614
728
|
);
|
|
615
729
|
|
|
616
730
|
// Lay out each week row's spanning bars once per data change, not per render, so
|
|
@@ -626,15 +740,47 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
626
740
|
: [],
|
|
627
741
|
);
|
|
628
742
|
|
|
743
|
+
// Multi-week rows rove over the rendered, enabled days only (oldest first), so
|
|
744
|
+
// focus skips hidden and disabled days and never leaves the displayed weeks.
|
|
745
|
+
const focusableDays = createMemo(() =>
|
|
746
|
+
_grid().period
|
|
747
|
+
? _grid()
|
|
748
|
+
.weeks.flatMap((week) => week.days)
|
|
749
|
+
.filter((day) => !day.isDisabled)
|
|
750
|
+
.map((day) => startOfDay(day.date))
|
|
751
|
+
.sort((a, b) => a.getTime() - b.getTime())
|
|
752
|
+
: null,
|
|
753
|
+
);
|
|
754
|
+
const focusableKeys = createMemo(() => {
|
|
755
|
+
const days = focusableDays();
|
|
756
|
+
return days ? new Set(days.map((d) => format(d, "yyyy-MM-dd"))) : null;
|
|
757
|
+
});
|
|
758
|
+
|
|
629
759
|
// Roving tabindex: only one day is in the tab order; arrow keys move focus
|
|
630
760
|
// within the month, so the grid is a single, sensible tab stop.
|
|
631
|
-
const initialFocus = createMemo(() => {
|
|
632
|
-
const
|
|
761
|
+
const initialFocus = createMemo((): Date | null => {
|
|
762
|
+
const days = focusableDays();
|
|
763
|
+
const keys = focusableKeys();
|
|
764
|
+
if (days && keys) {
|
|
765
|
+
// The selected day, then today, then the first enabled day; none when every
|
|
766
|
+
// displayed day is disabled.
|
|
767
|
+
const rendered = (d?: Date | null): d is Date => !!d && keys.has(format(d, "yyyy-MM-dd"));
|
|
768
|
+
const rangeStart = props.selectedRange?.start;
|
|
769
|
+
if (rendered(rangeStart)) return startOfDay(rangeStart);
|
|
770
|
+
const picked = props.selectedDates?.find(rendered);
|
|
771
|
+
if (picked) return startOfDay(picked);
|
|
772
|
+
const today = new Date();
|
|
773
|
+
if (rendered(today)) return startOfDay(today);
|
|
774
|
+
return days[0] ?? null;
|
|
775
|
+
}
|
|
776
|
+
const inMonth = (d?: Date | null) => !!d && isSameMonth(d, props.source.date);
|
|
633
777
|
if (inMonth(props.selectedRange?.start)) return startOfDay(props.selectedRange!.start);
|
|
634
778
|
const picked = props.selectedDates?.find(inMonth);
|
|
635
779
|
if (picked) return startOfDay(picked);
|
|
636
780
|
const today = new Date();
|
|
637
|
-
return isSameMonth(today, props.
|
|
781
|
+
return isSameMonth(today, props.source.date)
|
|
782
|
+
? startOfDay(today)
|
|
783
|
+
: startOfMonth(props.source.date);
|
|
638
784
|
});
|
|
639
785
|
const [focusedDate, setFocusedDate] = createSignal(untrack(() => initialFocus()));
|
|
640
786
|
const initialFocusRef = {
|
|
@@ -646,12 +792,20 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
646
792
|
initialFocusRef.current = value;
|
|
647
793
|
},
|
|
648
794
|
);
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
795
|
+
// The displayed window: the month, or the first week and count of multi-week rows.
|
|
796
|
+
const windowKey = createMemo(() => {
|
|
797
|
+
const period = _grid().period;
|
|
798
|
+
return period
|
|
799
|
+
? `${format(period.start, "yyyy-MM-dd")}+${numberOfWeeks()}:${_grid()
|
|
800
|
+
.weekdays.map((day) => day.date.getDay())
|
|
801
|
+
.join(",")}`
|
|
802
|
+
: format(props.source.date, "yyyy-MM");
|
|
803
|
+
});
|
|
804
|
+
let focusedWindow = untrack(windowKey);
|
|
805
|
+
createEffect(windowKey, (key) =>
|
|
652
806
|
untrack(() => {
|
|
653
|
-
if (
|
|
654
|
-
|
|
807
|
+
if (key === focusedWindow) return;
|
|
808
|
+
focusedWindow = key;
|
|
655
809
|
setFocusedDate(initialFocusRef.current);
|
|
656
810
|
}),
|
|
657
811
|
);
|
|
@@ -659,7 +813,40 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
659
813
|
const gridRef: ElementRef<HTMLDivElement | null> = {
|
|
660
814
|
current: null,
|
|
661
815
|
};
|
|
662
|
-
const
|
|
816
|
+
const lastDayFocus: ElementRef<HTMLElement | null> = { current: null };
|
|
817
|
+
// A multi-week focus target that hidden days or new constraints removed falls
|
|
818
|
+
// back to the initial target, without moving DOM focus.
|
|
819
|
+
const focusKey = createMemo(() => {
|
|
820
|
+
const focused = focusedDate();
|
|
821
|
+
const stored = focused ? format(focused, "yyyy-MM-dd") : null;
|
|
822
|
+
const keys = focusableKeys();
|
|
823
|
+
if (!keys || (stored !== null && keys.has(stored))) return stored;
|
|
824
|
+
const initial = initialFocus();
|
|
825
|
+
return initial && format(initial, "yyyy-MM-dd");
|
|
826
|
+
});
|
|
827
|
+
|
|
828
|
+
createEffect(
|
|
829
|
+
() => ({ enabled: multiWeek(), key: focusKey() }),
|
|
830
|
+
({ enabled, key }) => {
|
|
831
|
+
if (!enabled) return;
|
|
832
|
+
const active = gridRef.current?.ownerDocument.activeElement;
|
|
833
|
+
const removedDay =
|
|
834
|
+
active === gridRef.current?.ownerDocument.body &&
|
|
835
|
+
lastDayFocus.current !== null &&
|
|
836
|
+
!lastDayFocus.current.isConnected;
|
|
837
|
+
if (!removedDay && (!active?.hasAttribute("data-day") || !gridRef.current?.contains(active)))
|
|
838
|
+
return;
|
|
839
|
+
if (
|
|
840
|
+
active?.getAttribute("data-day") === key &&
|
|
841
|
+
active?.getAttribute("aria-disabled") !== "true"
|
|
842
|
+
)
|
|
843
|
+
return;
|
|
844
|
+
const next = key
|
|
845
|
+
? gridRef.current?.querySelector<HTMLElement>(`[data-day="${key}"]`)
|
|
846
|
+
: gridRef.current;
|
|
847
|
+
next?.focus();
|
|
848
|
+
},
|
|
849
|
+
);
|
|
663
850
|
|
|
664
851
|
// Dragging (events mode): press a day and drag across others to sketch an
|
|
665
852
|
// all-day span, or press an event chip and drop it on another day. Both are
|
|
@@ -709,6 +896,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
709
896
|
pointerId,
|
|
710
897
|
anchor: t,
|
|
711
898
|
hover: t,
|
|
899
|
+
windowKey: windowKey(),
|
|
712
900
|
});
|
|
713
901
|
};
|
|
714
902
|
const beginMove = (event: CalendarEvent<T>, day: Date, pointerId: number) => {
|
|
@@ -720,6 +908,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
720
908
|
event,
|
|
721
909
|
from: t,
|
|
722
910
|
to: t,
|
|
911
|
+
windowKey: windowKey(),
|
|
723
912
|
});
|
|
724
913
|
props.onDragStart?.(event);
|
|
725
914
|
};
|
|
@@ -747,6 +936,98 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
747
936
|
props.onSelectDrag?.(new Date(lo), new Date(hi));
|
|
748
937
|
}
|
|
749
938
|
};
|
|
939
|
+
let heldTouch: (() => void) | null = null;
|
|
940
|
+
let heldOrigin: { day: Date; event?: CalendarEvent<T> } | null = null;
|
|
941
|
+
const dayLookup = createMemo(
|
|
942
|
+
() =>
|
|
943
|
+
new Map(
|
|
944
|
+
_grid()
|
|
945
|
+
.weeks.flatMap((week) => week.days)
|
|
946
|
+
.map((day) => [day.id, day]),
|
|
947
|
+
),
|
|
948
|
+
);
|
|
949
|
+
const pressRow = (
|
|
950
|
+
event: PointerEvent & { currentTarget: HTMLElement },
|
|
951
|
+
day: Date,
|
|
952
|
+
moving?: CalendarEvent<T>,
|
|
953
|
+
) => {
|
|
954
|
+
if (event.button !== 0 || heldTouch || !beginPress(event)) return;
|
|
955
|
+
const start = () => {
|
|
956
|
+
if (moving) beginMove(moving, day, event.pointerId);
|
|
957
|
+
else beginCreate(day, event.pointerId);
|
|
958
|
+
};
|
|
959
|
+
if (!multiWeek() || !event.pointerType || event.pointerType === "mouse") {
|
|
960
|
+
start();
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
heldOrigin = { day, event: moving };
|
|
964
|
+
heldTouch = holdDateDrag(
|
|
965
|
+
{
|
|
966
|
+
box: event.currentTarget,
|
|
967
|
+
pointerId: event.pointerId,
|
|
968
|
+
pointerType: event.pointerType,
|
|
969
|
+
clientX: event.clientX,
|
|
970
|
+
clientY: event.clientY,
|
|
971
|
+
},
|
|
972
|
+
start,
|
|
973
|
+
(x, y) => {
|
|
974
|
+
const element = gridRef.current?.ownerDocument
|
|
975
|
+
.elementFromPoint(x, y)
|
|
976
|
+
?.closest<HTMLElement>("[data-day]");
|
|
977
|
+
if (!element || !gridRef.current?.contains(element)) return;
|
|
978
|
+
const day = dayLookup().get(element.dataset.day ?? "");
|
|
979
|
+
if (day && !day.isDisabled) extendDrag(day.date, event.pointerId);
|
|
980
|
+
},
|
|
981
|
+
() => {
|
|
982
|
+
applyDrag(null);
|
|
983
|
+
movedRef.current = false;
|
|
984
|
+
},
|
|
985
|
+
() => {
|
|
986
|
+
heldTouch = null;
|
|
987
|
+
heldOrigin = null;
|
|
988
|
+
},
|
|
989
|
+
);
|
|
990
|
+
};
|
|
991
|
+
createEffect(
|
|
992
|
+
() => windowKey(),
|
|
993
|
+
() => () => {
|
|
994
|
+
heldTouch?.();
|
|
995
|
+
},
|
|
996
|
+
);
|
|
997
|
+
createEffect(
|
|
998
|
+
() => ({
|
|
999
|
+
days: dayLookup(),
|
|
1000
|
+
events: props.events,
|
|
1001
|
+
canCreate: !!(props.onCreateEvent || props.onSelectDrag),
|
|
1002
|
+
canMove: !!props.onDragEvent,
|
|
1003
|
+
eventStartEditable: props.eventStartEditable,
|
|
1004
|
+
}),
|
|
1005
|
+
(state) => {
|
|
1006
|
+
const origin = heldOrigin;
|
|
1007
|
+
if (!origin) return;
|
|
1008
|
+
const current = dragRef.current;
|
|
1009
|
+
const destination = current
|
|
1010
|
+
? new Date(current.kind === "create" ? current.hover : current.to)
|
|
1011
|
+
: origin.day;
|
|
1012
|
+
const enabled = (day: Date) => {
|
|
1013
|
+
const cell = state.days.get(format(day, "yyyy-MM-dd"));
|
|
1014
|
+
return cell != null && !cell.isDisabled;
|
|
1015
|
+
};
|
|
1016
|
+
if (
|
|
1017
|
+
!enabled(origin.day) ||
|
|
1018
|
+
!enabled(destination) ||
|
|
1019
|
+
(origin.event
|
|
1020
|
+
? !state.canMove ||
|
|
1021
|
+
!state.events?.includes(origin.event) ||
|
|
1022
|
+
origin.event.disabled ||
|
|
1023
|
+
origin.event.draggable === false ||
|
|
1024
|
+
!(origin.event.startEditable ?? state.eventStartEditable)
|
|
1025
|
+
: !state.canCreate)
|
|
1026
|
+
) {
|
|
1027
|
+
heldTouch?.();
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
);
|
|
750
1031
|
const isDragging = createMemo(() => drag() !== null);
|
|
751
1032
|
// Whether any month drag is wired up at all, so the cells only take over touch
|
|
752
1033
|
// scrolling and pointer tracking when one of the handlers can actually fire.
|
|
@@ -764,6 +1045,8 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
764
1045
|
applyDrag(null);
|
|
765
1046
|
if (!movedRef.current) return;
|
|
766
1047
|
suppressClickRef.current = true;
|
|
1048
|
+
// Multi-week rows drop a drag whose window was replaced before release.
|
|
1049
|
+
if (multiWeek() && current.windowKey !== windowKey()) return;
|
|
767
1050
|
if (current.kind === "create") {
|
|
768
1051
|
const range = monthCreateRange(new Date(current.anchor), new Date(current.hover));
|
|
769
1052
|
props.onCreateEvent?.(range.start, range.end);
|
|
@@ -795,17 +1078,66 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
795
1078
|
};
|
|
796
1079
|
}),
|
|
797
1080
|
);
|
|
1081
|
+
// Replacing the multi-week window cancels a drag and closes the overflow
|
|
1082
|
+
// popover, so neither acts on days that are no longer shown.
|
|
1083
|
+
let transientWindow = untrack(windowKey);
|
|
1084
|
+
createEffect(windowKey, (key) =>
|
|
1085
|
+
untrack(() => {
|
|
1086
|
+
if (key === transientWindow) return;
|
|
1087
|
+
transientWindow = key;
|
|
1088
|
+
if (!multiWeek()) return;
|
|
1089
|
+
applyDrag(null);
|
|
1090
|
+
setMoreOpenFor(null);
|
|
1091
|
+
}),
|
|
1092
|
+
);
|
|
1093
|
+
// Multi-week roving: the neighbouring focusable day, the same weekday in the
|
|
1094
|
+
// nearest week that has it enabled, or the first/last focusable day.
|
|
1095
|
+
const nextMultiWeekFocus = (key: string): Date | null => {
|
|
1096
|
+
const days = focusableDays();
|
|
1097
|
+
const keys = focusableKeys();
|
|
1098
|
+
const period = _grid().period;
|
|
1099
|
+
if (!days || !keys || !period) return null;
|
|
1100
|
+
const index = days.findIndex((d) => format(d, "yyyy-MM-dd") === focusKey());
|
|
1101
|
+
if (index === -1) return null;
|
|
1102
|
+
if (key === "ArrowLeft") return days[index - 1] ?? null;
|
|
1103
|
+
if (key === "ArrowRight") return days[index + 1] ?? null;
|
|
1104
|
+
if (key === "Home") return days[0];
|
|
1105
|
+
if (key === "End") return days[days.length - 1];
|
|
1106
|
+
const step = key === "ArrowUp" ? -7 : 7;
|
|
1107
|
+
for (
|
|
1108
|
+
let cursor = addDays(days[index], step);
|
|
1109
|
+
cursor >= period.start && cursor < period.endExclusive;
|
|
1110
|
+
cursor = addDays(cursor, step)
|
|
1111
|
+
) {
|
|
1112
|
+
if (keys.has(format(cursor, "yyyy-MM-dd"))) return cursor;
|
|
1113
|
+
}
|
|
1114
|
+
return null;
|
|
1115
|
+
};
|
|
798
1116
|
const onKeyDown = (e: DomKeyboardEvent<HTMLDivElement>) => {
|
|
1117
|
+
if (multiWeek()) {
|
|
1118
|
+
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(e.key)) {
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
e.preventDefault();
|
|
1122
|
+
const target = nextMultiWeekFocus(e.key);
|
|
1123
|
+
if (!target) return;
|
|
1124
|
+
setFocusedDate(target);
|
|
1125
|
+
const targetKey = format(target, "yyyy-MM-dd");
|
|
1126
|
+
gridRef.current?.querySelector<HTMLElement>(`[data-day="${targetKey}"]`)?.focus();
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
const focused = focusedDate();
|
|
1130
|
+
if (!focused) return;
|
|
799
1131
|
let next: Date | null = null;
|
|
800
|
-
if (e.key === "ArrowLeft") next = addDays(
|
|
801
|
-
else if (e.key === "ArrowRight") next = addDays(
|
|
802
|
-
else if (e.key === "ArrowUp") next = addDays(
|
|
803
|
-
else if (e.key === "ArrowDown") next = addDays(
|
|
804
|
-
else if (e.key === "Home") next = startOfMonth(props.date);
|
|
805
|
-
else if (e.key === "End") next = endOfMonth(props.date);
|
|
1132
|
+
if (e.key === "ArrowLeft") next = addDays(focused, -1);
|
|
1133
|
+
else if (e.key === "ArrowRight") next = addDays(focused, 1);
|
|
1134
|
+
else if (e.key === "ArrowUp") next = addDays(focused, -7);
|
|
1135
|
+
else if (e.key === "ArrowDown") next = addDays(focused, 7);
|
|
1136
|
+
else if (e.key === "Home") next = startOfMonth(props.source.date);
|
|
1137
|
+
else if (e.key === "End") next = endOfMonth(props.source.date);
|
|
806
1138
|
else return;
|
|
807
1139
|
e.preventDefault();
|
|
808
|
-
if (!isSameMonth(next, props.date)) return;
|
|
1140
|
+
if (!isSameMonth(next, props.source.date)) return;
|
|
809
1141
|
setFocusedDate(next);
|
|
810
1142
|
const key = format(next, "yyyy-MM-dd");
|
|
811
1143
|
gridRef.current?.querySelector<HTMLElement>(`[data-day="${key}"]`)?.focus();
|
|
@@ -816,6 +1148,9 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
816
1148
|
style={css({
|
|
817
1149
|
fontFamily: theme().fontFamily,
|
|
818
1150
|
color: theme().text,
|
|
1151
|
+
// Multi-week rows keep their full height; when the view is given less
|
|
1152
|
+
// room, the grid scrolls under the title and weekday header.
|
|
1153
|
+
...(multiWeek() ? { display: "flex", flexDirection: "column", minHeight: 0 } : null),
|
|
819
1154
|
...props.style,
|
|
820
1155
|
})}
|
|
821
1156
|
>
|
|
@@ -829,15 +1164,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
829
1164
|
},
|
|
830
1165
|
})}
|
|
831
1166
|
>
|
|
832
|
-
{
|
|
833
|
-
props.date,
|
|
834
|
-
"MMMM yyyy",
|
|
835
|
-
props.locale
|
|
836
|
-
? {
|
|
837
|
-
locale: props.locale,
|
|
838
|
-
}
|
|
839
|
-
: undefined,
|
|
840
|
-
)}
|
|
1167
|
+
{_grid().title}
|
|
841
1168
|
</div>
|
|
842
1169
|
) : null}
|
|
843
1170
|
{props.showWeekdays ? (
|
|
@@ -845,7 +1172,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
845
1172
|
{...slot("weekdays", {
|
|
846
1173
|
base: {
|
|
847
1174
|
display: "grid",
|
|
848
|
-
gridTemplateColumns:
|
|
1175
|
+
gridTemplateColumns: `repeat(${_grid().weekdays.length}, minmax(0, 1fr))`,
|
|
849
1176
|
},
|
|
850
1177
|
themed: {
|
|
851
1178
|
borderBottom: `1px solid ${theme().gridLine}`,
|
|
@@ -876,19 +1203,15 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
876
1203
|
<div
|
|
877
1204
|
ref={(el) => (gridRef.current = el)}
|
|
878
1205
|
role="grid"
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
"MMMM yyyy",
|
|
882
|
-
props.locale
|
|
883
|
-
? {
|
|
884
|
-
locale: props.locale,
|
|
885
|
-
}
|
|
886
|
-
: undefined,
|
|
887
|
-
)}
|
|
1206
|
+
tabindex={multiWeek() ? -1 : undefined}
|
|
1207
|
+
aria-label={_grid().title}
|
|
888
1208
|
// Arrow-key roving applies whenever the day cells are a tab stop: the
|
|
889
1209
|
// picker always, events mode only when keyboardDayNavigation is set.
|
|
890
1210
|
onKeyDown={dayRoving() ? onKeyDown : undefined}
|
|
891
|
-
{...slot(
|
|
1211
|
+
{...slot(
|
|
1212
|
+
"grid",
|
|
1213
|
+
multiWeek() ? { base: { flex: "1 1 auto", minHeight: 0, overflowY: "auto" } } : undefined,
|
|
1214
|
+
)}
|
|
892
1215
|
>
|
|
893
1216
|
{
|
|
894
1217
|
<For each={_grid().weeks} keyed={false}>
|
|
@@ -913,9 +1236,9 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
913
1236
|
const columns = createMemo(() => {
|
|
914
1237
|
let first = 0;
|
|
915
1238
|
let last = cols() - 1;
|
|
916
|
-
if (eventsMode() && !
|
|
917
|
-
const start = week().days.findIndex((d) => d
|
|
918
|
-
const end = [...week().days].reverse().findIndex((d) => d
|
|
1239
|
+
if (eventsMode() && !showAdjacentMonths()) {
|
|
1240
|
+
const start = week().days.findIndex((d) => !isOutsidePeriod(d));
|
|
1241
|
+
const end = [...week().days].reverse().findIndex((d) => !isOutsidePeriod(d));
|
|
919
1242
|
if (start !== -1) {
|
|
920
1243
|
first = start;
|
|
921
1244
|
last = cols() - 1 - end;
|
|
@@ -955,7 +1278,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
955
1278
|
{...slot("week", {
|
|
956
1279
|
base: {
|
|
957
1280
|
display: "grid",
|
|
958
|
-
gridTemplateColumns:
|
|
1281
|
+
gridTemplateColumns: `repeat(${cols()}, minmax(0, 1fr))`,
|
|
959
1282
|
},
|
|
960
1283
|
})}
|
|
961
1284
|
>
|
|
@@ -963,7 +1286,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
963
1286
|
<For each={week().days} keyed={false}>
|
|
964
1287
|
{(day, dayCol) => {
|
|
965
1288
|
const hidden = createMemo(
|
|
966
|
-
() => !
|
|
1289
|
+
() => !showAdjacentMonths() && isOutsidePeriod(day()),
|
|
967
1290
|
);
|
|
968
1291
|
const cellHeight = createMemo(() =>
|
|
969
1292
|
eventsMode() ? eventRowHeight() : theme().cellHeight,
|
|
@@ -1037,7 +1360,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1037
1360
|
"data-selected": day().isSelected,
|
|
1038
1361
|
"data-range": day().isInRange,
|
|
1039
1362
|
"data-weekend": day().isWeekend,
|
|
1040
|
-
"data-outside":
|
|
1363
|
+
"data-outside": isOutsidePeriod(day()),
|
|
1041
1364
|
"data-disabled": day().isDisabled,
|
|
1042
1365
|
"data-creating": inCreate(),
|
|
1043
1366
|
"data-drop": isDropTarget(),
|
|
@@ -1096,8 +1419,26 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1096
1419
|
role="gridcell"
|
|
1097
1420
|
data-day={day().id}
|
|
1098
1421
|
onFocusIn={(event) => {
|
|
1099
|
-
if (event.target === event.currentTarget)
|
|
1422
|
+
if (event.target === event.currentTarget) {
|
|
1423
|
+
lastDayFocus.current = event.currentTarget;
|
|
1100
1424
|
setFocusedDate(day().date);
|
|
1425
|
+
}
|
|
1426
|
+
}}
|
|
1427
|
+
onFocusOut={(event) => {
|
|
1428
|
+
if (event.target !== event.currentTarget) return;
|
|
1429
|
+
const previous = event.currentTarget;
|
|
1430
|
+
if (event.relatedTarget) lastDayFocus.current = null;
|
|
1431
|
+
else {
|
|
1432
|
+
// Removal blurs before detaching the node. Distinguish
|
|
1433
|
+
// it from a manual blur after the DOM update finishes.
|
|
1434
|
+
queueMicrotask(() => {
|
|
1435
|
+
if (
|
|
1436
|
+
lastDayFocus.current === previous &&
|
|
1437
|
+
previous.isConnected
|
|
1438
|
+
)
|
|
1439
|
+
lastDayFocus.current = null;
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1101
1442
|
}}
|
|
1102
1443
|
{...dayData()}
|
|
1103
1444
|
tabindex={
|
|
@@ -1130,7 +1471,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1130
1471
|
dragWired()
|
|
1131
1472
|
? {
|
|
1132
1473
|
...dayCellProps().style,
|
|
1133
|
-
touchAction: "none",
|
|
1474
|
+
touchAction: multiWeek() ? "pan-y" : "none",
|
|
1134
1475
|
userSelect: "none",
|
|
1135
1476
|
}
|
|
1136
1477
|
: dayCellProps().style,
|
|
@@ -1138,8 +1479,8 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1138
1479
|
onPointerDown={
|
|
1139
1480
|
dragWired() && !day().isDisabled
|
|
1140
1481
|
? (e) => {
|
|
1141
|
-
|
|
1142
|
-
|
|
1482
|
+
const date = day().date;
|
|
1483
|
+
pressRow(e, date);
|
|
1143
1484
|
}
|
|
1144
1485
|
: undefined
|
|
1145
1486
|
}
|
|
@@ -1221,14 +1562,10 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1221
1562
|
onPointerDown={
|
|
1222
1563
|
canMove(b().seg.event)
|
|
1223
1564
|
? (e) => {
|
|
1224
|
-
if (e.button !== 0 || !beginPress(e))
|
|
1225
|
-
return;
|
|
1226
1565
|
e.stopPropagation();
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
e.pointerId,
|
|
1231
|
-
);
|
|
1566
|
+
const event = b().seg.event;
|
|
1567
|
+
const date = day().date;
|
|
1568
|
+
pressRow(e, date, event);
|
|
1232
1569
|
}
|
|
1233
1570
|
: undefined
|
|
1234
1571
|
}
|
|
@@ -1244,7 +1581,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1244
1581
|
? props.eventAccessibilityLabel(
|
|
1245
1582
|
b().seg.event,
|
|
1246
1583
|
{
|
|
1247
|
-
mode:
|
|
1584
|
+
mode: viewMode(),
|
|
1248
1585
|
isAllDay: isAllDayEvent(
|
|
1249
1586
|
b().seg.event,
|
|
1250
1587
|
),
|
|
@@ -1274,13 +1611,18 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1274
1611
|
cursor: canMove(b().seg.event)
|
|
1275
1612
|
? "grab"
|
|
1276
1613
|
: undefined,
|
|
1277
|
-
touchAction: dragWired()
|
|
1614
|
+
touchAction: dragWired()
|
|
1615
|
+
? multiWeek()
|
|
1616
|
+
? "pan-y"
|
|
1617
|
+
: "none"
|
|
1618
|
+
: undefined,
|
|
1278
1619
|
zIndex: 2,
|
|
1279
1620
|
})}
|
|
1280
1621
|
>
|
|
1281
1622
|
{Chip() ? (
|
|
1282
1623
|
<Dynamic
|
|
1283
1624
|
component={Chip()}
|
|
1625
|
+
mode={viewMode()}
|
|
1284
1626
|
event={b().seg.event}
|
|
1285
1627
|
onPress={() =>
|
|
1286
1628
|
props.onPressEvent?.(b().seg.event)
|
|
@@ -1361,7 +1703,11 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1361
1703
|
}}
|
|
1362
1704
|
{...slot(
|
|
1363
1705
|
"more",
|
|
1364
|
-
moreButtonDefault(
|
|
1706
|
+
moreButtonDefault(
|
|
1707
|
+
theme(),
|
|
1708
|
+
props.chipHeight,
|
|
1709
|
+
multiWeek(),
|
|
1710
|
+
),
|
|
1365
1711
|
)}
|
|
1366
1712
|
aria-label={`${labels().moreEvents(hiddenEvents().length)}, ${dayLabel()}`}
|
|
1367
1713
|
aria-expanded={
|
|
@@ -1473,6 +1819,7 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1473
1819
|
{Chip() ? (
|
|
1474
1820
|
<Dynamic
|
|
1475
1821
|
component={Chip()}
|
|
1822
|
+
mode={viewMode()}
|
|
1476
1823
|
event={event()}
|
|
1477
1824
|
onPress={() =>
|
|
1478
1825
|
props.onPressEvent?.(event())
|
|
@@ -1508,8 +1855,10 @@ export function MonthView<T = unknown>(incoming: MonthViewInternalProps<T>): JSX
|
|
|
1508
1855
|
role="gridcell"
|
|
1509
1856
|
data-day={day().id}
|
|
1510
1857
|
onFocusIn={(event) => {
|
|
1511
|
-
if (event.target === event.currentTarget)
|
|
1858
|
+
if (event.target === event.currentTarget) {
|
|
1859
|
+
lastDayFocus.current = event.currentTarget;
|
|
1512
1860
|
setFocusedDate(day().date);
|
|
1861
|
+
}
|
|
1513
1862
|
}}
|
|
1514
1863
|
{...dayData()}
|
|
1515
1864
|
tabindex={day().id === focusKey() ? 0 : -1}
|