@super-calendar/solid 2.17.0 → 2.19.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 -9
- package/dist/client/index.d.ts +56 -14
- package/dist/client/index.js +683 -406
- package/dist/server/index.d.ts +56 -14
- package/dist/server/index.js +1418 -1238
- package/package.json +7 -7
- package/src/Agenda.tsx +19 -2
- package/src/Calendar.tsx +108 -30
- package/src/MonthList.tsx +1 -1
- package/src/MonthView.tsx +220 -29
- package/src/TimeGrid.tsx +350 -155
- package/src/YearView.tsx +17 -1
package/src/YearView.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
daySelectionState,
|
|
12
12
|
filterHiddenDays,
|
|
13
13
|
getIsToday,
|
|
14
|
+
nowInTimeZone,
|
|
14
15
|
getWeekDays,
|
|
15
16
|
getYearMonths,
|
|
16
17
|
groupEventsByDay,
|
|
@@ -59,6 +60,13 @@ export interface YearViewProps<T = unknown>
|
|
|
59
60
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
60
61
|
hiddenDays?: number[];
|
|
61
62
|
locale?: Locale;
|
|
63
|
+
/**
|
|
64
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
65
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
66
|
+
*/
|
|
67
|
+
now?: Date;
|
|
68
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
69
|
+
timeZone?: string;
|
|
62
70
|
/** Translations for the screen-reader words; omitted keys use English. */
|
|
63
71
|
labels?: Partial<CalendarLabels>;
|
|
64
72
|
/** Highlight this date instead of the real "today". */
|
|
@@ -115,6 +123,12 @@ export function YearView<T = unknown>(incoming: YearViewProps<T>): JSX.Element {
|
|
|
115
123
|
);
|
|
116
124
|
const theme = createMemo(() => mergeSolidTheme(props.theme));
|
|
117
125
|
const labels = createMemo(() => resolveCalendarLabels(props.labels));
|
|
126
|
+
// One memo for every day cell, yielding the day (not the instant) so the cells
|
|
127
|
+
// re-run only when it changes. Tracking `date` re-reads the clock on navigation.
|
|
128
|
+
const todayKey = createMemo(() => {
|
|
129
|
+
void props.date;
|
|
130
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
131
|
+
});
|
|
118
132
|
const slot = createSlots<YearViewSlot>(props);
|
|
119
133
|
|
|
120
134
|
// Drag-to-select / drag-to-create: press a day and sweep across others (mini
|
|
@@ -360,7 +374,9 @@ export function YearView<T = unknown>(incoming: YearViewProps<T>): JSX.Element {
|
|
|
360
374
|
/>
|
|
361
375
|
);
|
|
362
376
|
}
|
|
363
|
-
const isToday = createMemo(() =>
|
|
377
|
+
const isToday = createMemo(() =>
|
|
378
|
+
getIsToday(day(), new Date(todayKey())),
|
|
379
|
+
);
|
|
364
380
|
const isHighlighted = createMemo(() =>
|
|
365
381
|
props.activeDate
|
|
366
382
|
? isSameCalendarDay(day(), props.activeDate)
|