@super-calendar/dom 2.8.0 → 2.8.2
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/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +10 -8
- package/dist/index.mjs +10 -8
- package/package.json +2 -2
- package/src/Calendar.tsx +1 -0
- package/src/MonthList.tsx +4 -0
- package/src/MonthView.tsx +27 -6
package/dist/index.d.mts
CHANGED
|
@@ -222,6 +222,8 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
222
222
|
selectedDates?: Date[];
|
|
223
223
|
/** Render days from the neighbouring months in the leading/trailing cells (default true). */
|
|
224
224
|
showAdjacentMonths?: boolean;
|
|
225
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
226
|
+
highlightWeekends?: boolean;
|
|
225
227
|
/**
|
|
226
228
|
* Fill the whole cell with the range background instead of the default
|
|
227
229
|
* centered rounded "pill" strip. Default false.
|
|
@@ -268,7 +270,7 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
268
270
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
269
271
|
* ```
|
|
270
272
|
*/
|
|
271
|
-
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
273
|
+
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
272
274
|
//#endregion
|
|
273
275
|
//#region src/TimeGrid.d.ts
|
|
274
276
|
/**
|
|
@@ -615,6 +617,8 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
615
617
|
weekStartsOn?: WeekStartsOn$1;
|
|
616
618
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
617
619
|
weekdayFormat?: WeekdayFormat$1;
|
|
620
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
621
|
+
highlightWeekends?: boolean;
|
|
618
622
|
/** Events to render as chips in each day cell (calendar layout when provided). */
|
|
619
623
|
events?: CalendarEvent$1<T>[];
|
|
620
624
|
/** Custom chip renderer; falls back to the built-in titled chip. */
|
|
@@ -663,7 +667,7 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
663
667
|
* Legend List's DOM renderer and the library's headless grid logic. Selection is
|
|
664
668
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
665
669
|
*/
|
|
666
|
-
declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
670
|
+
declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
667
671
|
//#endregion
|
|
668
672
|
//#region src/DateRangePicker.d.ts
|
|
669
673
|
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,8 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
222
222
|
selectedDates?: Date[];
|
|
223
223
|
/** Render days from the neighbouring months in the leading/trailing cells (default true). */
|
|
224
224
|
showAdjacentMonths?: boolean;
|
|
225
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
226
|
+
highlightWeekends?: boolean;
|
|
225
227
|
/**
|
|
226
228
|
* Fill the whole cell with the range background instead of the default
|
|
227
229
|
* centered rounded "pill" strip. Default false.
|
|
@@ -268,7 +270,7 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
268
270
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
269
271
|
* ```
|
|
270
272
|
*/
|
|
271
|
-
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
273
|
+
declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
272
274
|
//#endregion
|
|
273
275
|
//#region src/TimeGrid.d.ts
|
|
274
276
|
/**
|
|
@@ -615,6 +617,8 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
615
617
|
weekStartsOn?: WeekStartsOn$1;
|
|
616
618
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
617
619
|
weekdayFormat?: WeekdayFormat$1;
|
|
620
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
621
|
+
highlightWeekends?: boolean;
|
|
618
622
|
/** Events to render as chips in each day cell (calendar layout when provided). */
|
|
619
623
|
events?: CalendarEvent$1<T>[];
|
|
620
624
|
/** Custom chip renderer; falls back to the built-in titled chip. */
|
|
@@ -663,7 +667,7 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
663
667
|
* Legend List's DOM renderer and the library's headless grid logic. Selection is
|
|
664
668
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
665
669
|
*/
|
|
666
|
-
declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
670
|
+
declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
667
671
|
//#endregion
|
|
668
672
|
//#region src/DateRangePicker.d.ts
|
|
669
673
|
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|
package/dist/index.js
CHANGED
|
@@ -422,7 +422,7 @@ const DATE_ROW = 24;
|
|
|
422
422
|
const CHIP_HEIGHT = 18;
|
|
423
423
|
const CHIP_GAP = 2;
|
|
424
424
|
const CELL_PAD = 4;
|
|
425
|
-
function dayCellDefault(day, theme) {
|
|
425
|
+
function dayCellDefault(day, theme, highlightWeekends) {
|
|
426
426
|
return {
|
|
427
427
|
base: {
|
|
428
428
|
position: "relative",
|
|
@@ -437,7 +437,7 @@ function dayCellDefault(day, theme) {
|
|
|
437
437
|
WebkitTapHighlightColor: "transparent"
|
|
438
438
|
},
|
|
439
439
|
themed: {
|
|
440
|
-
background: day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
440
|
+
background: highlightWeekends && day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
441
441
|
fontSize: 15,
|
|
442
442
|
color: day.isDisabled ? theme.textDisabled : theme.text
|
|
443
443
|
}
|
|
@@ -499,7 +499,7 @@ function badgeDefault(day, theme, hovered) {
|
|
|
499
499
|
}
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
|
-
function eventCellDefault(day, theme, height) {
|
|
502
|
+
function eventCellDefault(day, theme, height, highlightWeekends) {
|
|
503
503
|
return {
|
|
504
504
|
base: {
|
|
505
505
|
position: "relative",
|
|
@@ -517,7 +517,7 @@ function eventCellDefault(day, theme, height) {
|
|
|
517
517
|
},
|
|
518
518
|
themed: {
|
|
519
519
|
borderTop: `1px solid ${theme.gridLine}`,
|
|
520
|
-
background: day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
520
|
+
background: highlightWeekends && day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
521
521
|
color: day.isDisabled ? theme.textDisabled : theme.text
|
|
522
522
|
}
|
|
523
523
|
};
|
|
@@ -617,7 +617,7 @@ function collectRowEvents(week, eventsByDay) {
|
|
|
617
617
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
618
618
|
* ```
|
|
619
619
|
*/
|
|
620
|
-
function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short", events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount = 3, moreLabel = "{moreCount} More", onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths = true, fillCellOnSelection = false, showTitle = true, showWeekdays = true, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation = false, className, style, classNames, styles }) {
|
|
620
|
+
function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short", events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount = 3, moreLabel = "{moreCount} More", onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths = true, highlightWeekends = true, fillCellOnSelection = false, showTitle = true, showWeekdays = true, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation = false, className, style, classNames, styles }) {
|
|
621
621
|
const theme = (0, react.useMemo)(() => mergeDomTheme(themeOverrides), [themeOverrides]);
|
|
622
622
|
const slot = createSlots({
|
|
623
623
|
classNames,
|
|
@@ -863,7 +863,7 @@ function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short"
|
|
|
863
863
|
const dayEvents = eventsByDay.get((0, date_fns.startOfDay)(day.date).toISOString()) ?? [];
|
|
864
864
|
const hiddenEvents = rowLayout.segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= visibleLanes).map((s) => s.event);
|
|
865
865
|
const dayLabel = (0, date_fns.format)(day.date, "d MMMM", locale ? { locale } : void 0);
|
|
866
|
-
const dayCellProps = slot("day", eventCellDefault(day, theme, cellHeight));
|
|
866
|
+
const dayCellProps = slot("day", eventCellDefault(day, theme, cellHeight, highlightWeekends));
|
|
867
867
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
868
868
|
role: "gridcell",
|
|
869
869
|
"data-day": day.id,
|
|
@@ -1063,7 +1063,7 @@ function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short"
|
|
|
1063
1063
|
"aria-disabled": day.isDisabled || void 0,
|
|
1064
1064
|
"aria-label": label,
|
|
1065
1065
|
"aria-pressed": day.isSelected || day.isInRange,
|
|
1066
|
-
...slot("day", dayCellDefault(day, theme)),
|
|
1066
|
+
...slot("day", dayCellDefault(day, theme, highlightWeekends)),
|
|
1067
1067
|
onClick: day.isDisabled ? void 0 : () => onPressDay?.(day.date),
|
|
1068
1068
|
onMouseEnter: day.isDisabled ? void 0 : () => setHoveredKey(day.id),
|
|
1069
1069
|
onMouseLeave: () => setHoveredKey((k) => k === day.id ? null : k),
|
|
@@ -2197,6 +2197,7 @@ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0,
|
|
|
2197
2197
|
weekStartsOn,
|
|
2198
2198
|
hiddenDays,
|
|
2199
2199
|
weekdayFormat,
|
|
2200
|
+
highlightWeekends,
|
|
2200
2201
|
locale,
|
|
2201
2202
|
theme,
|
|
2202
2203
|
className,
|
|
@@ -2280,7 +2281,7 @@ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0,
|
|
|
2280
2281
|
* Legend List's DOM renderer and the library's headless grid logic. Selection is
|
|
2281
2282
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
2282
2283
|
*/
|
|
2283
|
-
function MonthList({ date, pastMonths = 1, futureMonths = 12, weekdayFormat = "short", weekStartsOn = 0, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection = false, locale, theme: themeOverrides, height = 480, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }) {
|
|
2284
|
+
function MonthList({ date, pastMonths = 1, futureMonths = 12, weekdayFormat = "short", highlightWeekends = true, weekStartsOn = 0, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection = false, locale, theme: themeOverrides, height = 480, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }) {
|
|
2284
2285
|
const theme = (0, react.useMemo)(() => mergeDomTheme(themeOverrides), [themeOverrides]);
|
|
2285
2286
|
const slot = createSlots({
|
|
2286
2287
|
classNames,
|
|
@@ -2361,6 +2362,7 @@ function MonthList({ date, pastMonths = 1, futureMonths = 12, weekdayFormat = "s
|
|
|
2361
2362
|
renderItem: ({ item }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthView, {
|
|
2362
2363
|
date: item,
|
|
2363
2364
|
weekStartsOn,
|
|
2365
|
+
highlightWeekends,
|
|
2364
2366
|
events,
|
|
2365
2367
|
eventsByDay,
|
|
2366
2368
|
renderEvent,
|
package/dist/index.mjs
CHANGED
|
@@ -421,7 +421,7 @@ const DATE_ROW = 24;
|
|
|
421
421
|
const CHIP_HEIGHT = 18;
|
|
422
422
|
const CHIP_GAP = 2;
|
|
423
423
|
const CELL_PAD = 4;
|
|
424
|
-
function dayCellDefault(day, theme) {
|
|
424
|
+
function dayCellDefault(day, theme, highlightWeekends) {
|
|
425
425
|
return {
|
|
426
426
|
base: {
|
|
427
427
|
position: "relative",
|
|
@@ -436,7 +436,7 @@ function dayCellDefault(day, theme) {
|
|
|
436
436
|
WebkitTapHighlightColor: "transparent"
|
|
437
437
|
},
|
|
438
438
|
themed: {
|
|
439
|
-
background: day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
439
|
+
background: highlightWeekends && day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
440
440
|
fontSize: 15,
|
|
441
441
|
color: day.isDisabled ? theme.textDisabled : theme.text
|
|
442
442
|
}
|
|
@@ -498,7 +498,7 @@ function badgeDefault(day, theme, hovered) {
|
|
|
498
498
|
}
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
|
-
function eventCellDefault(day, theme, height) {
|
|
501
|
+
function eventCellDefault(day, theme, height, highlightWeekends) {
|
|
502
502
|
return {
|
|
503
503
|
base: {
|
|
504
504
|
position: "relative",
|
|
@@ -516,7 +516,7 @@ function eventCellDefault(day, theme, height) {
|
|
|
516
516
|
},
|
|
517
517
|
themed: {
|
|
518
518
|
borderTop: `1px solid ${theme.gridLine}`,
|
|
519
|
-
background: day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
519
|
+
background: highlightWeekends && day.isWeekend && !day.isInRange ? theme.weekendBackground : "transparent",
|
|
520
520
|
color: day.isDisabled ? theme.textDisabled : theme.text
|
|
521
521
|
}
|
|
522
522
|
};
|
|
@@ -616,7 +616,7 @@ function collectRowEvents(week, eventsByDay) {
|
|
|
616
616
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
617
617
|
* ```
|
|
618
618
|
*/
|
|
619
|
-
function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short", events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount = 3, moreLabel = "{moreCount} More", onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths = true, fillCellOnSelection = false, showTitle = true, showWeekdays = true, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation = false, className, style, classNames, styles }) {
|
|
619
|
+
function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short", events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount = 3, moreLabel = "{moreCount} More", onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths = true, highlightWeekends = true, fillCellOnSelection = false, showTitle = true, showWeekdays = true, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onCreateEvent, keyboardDayNavigation = false, className, style, classNames, styles }) {
|
|
620
620
|
const theme = useMemo(() => mergeDomTheme(themeOverrides), [themeOverrides]);
|
|
621
621
|
const slot = createSlots({
|
|
622
622
|
classNames,
|
|
@@ -862,7 +862,7 @@ function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short"
|
|
|
862
862
|
const dayEvents = eventsByDay.get(startOfDay(day.date).toISOString()) ?? [];
|
|
863
863
|
const hiddenEvents = rowLayout.segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= visibleLanes).map((s) => s.event);
|
|
864
864
|
const dayLabel = format(day.date, "d MMMM", locale ? { locale } : void 0);
|
|
865
|
-
const dayCellProps = slot("day", eventCellDefault(day, theme, cellHeight));
|
|
865
|
+
const dayCellProps = slot("day", eventCellDefault(day, theme, cellHeight, highlightWeekends));
|
|
866
866
|
return /* @__PURE__ */ jsxs("div", {
|
|
867
867
|
role: "gridcell",
|
|
868
868
|
"data-day": day.id,
|
|
@@ -1062,7 +1062,7 @@ function MonthView({ date, weekStartsOn = 0, hiddenDays, weekdayFormat = "short"
|
|
|
1062
1062
|
"aria-disabled": day.isDisabled || void 0,
|
|
1063
1063
|
"aria-label": label,
|
|
1064
1064
|
"aria-pressed": day.isSelected || day.isInRange,
|
|
1065
|
-
...slot("day", dayCellDefault(day, theme)),
|
|
1065
|
+
...slot("day", dayCellDefault(day, theme, highlightWeekends)),
|
|
1066
1066
|
onClick: day.isDisabled ? void 0 : () => onPressDay?.(day.date),
|
|
1067
1067
|
onMouseEnter: day.isDisabled ? void 0 : () => setHoveredKey(day.id),
|
|
1068
1068
|
onMouseLeave: () => setHoveredKey((k) => k === day.id ? null : k),
|
|
@@ -2196,6 +2196,7 @@ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0,
|
|
|
2196
2196
|
weekStartsOn,
|
|
2197
2197
|
hiddenDays,
|
|
2198
2198
|
weekdayFormat,
|
|
2199
|
+
highlightWeekends,
|
|
2199
2200
|
locale,
|
|
2200
2201
|
theme,
|
|
2201
2202
|
className,
|
|
@@ -2279,7 +2280,7 @@ function Calendar({ mode = "week", date, events, onChangeDate, weekStartsOn = 0,
|
|
|
2279
2280
|
* Legend List's DOM renderer and the library's headless grid logic. Selection is
|
|
2280
2281
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
2281
2282
|
*/
|
|
2282
|
-
function MonthList({ date, pastMonths = 1, futureMonths = 12, weekdayFormat = "short", weekStartsOn = 0, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection = false, locale, theme: themeOverrides, height = 480, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }) {
|
|
2283
|
+
function MonthList({ date, pastMonths = 1, futureMonths = 12, weekdayFormat = "short", highlightWeekends = true, weekStartsOn = 0, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection = false, locale, theme: themeOverrides, height = 480, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }) {
|
|
2283
2284
|
const theme = useMemo(() => mergeDomTheme(themeOverrides), [themeOverrides]);
|
|
2284
2285
|
const slot = createSlots({
|
|
2285
2286
|
classNames,
|
|
@@ -2360,6 +2361,7 @@ function MonthList({ date, pastMonths = 1, futureMonths = 12, weekdayFormat = "s
|
|
|
2360
2361
|
renderItem: ({ item }) => /* @__PURE__ */ jsx(MonthView, {
|
|
2361
2362
|
date: item,
|
|
2362
2363
|
weekStartsOn,
|
|
2364
|
+
highlightWeekends,
|
|
2363
2365
|
events,
|
|
2364
2366
|
eventsByDay,
|
|
2365
2367
|
renderEvent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/dom",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "Virtualized month / week / day calendar and date picker for react-dom. No React Native, no react-native-web.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"calendar",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@super-calendar/core": "2.8.
|
|
51
|
+
"@super-calendar/core": "2.8.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@legendapp/list": ">=3",
|
package/src/Calendar.tsx
CHANGED
package/src/MonthList.tsx
CHANGED
|
@@ -37,6 +37,8 @@ export interface MonthListProps<T = unknown>
|
|
|
37
37
|
weekStartsOn?: WeekStartsOn;
|
|
38
38
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
39
39
|
weekdayFormat?: WeekdayFormat;
|
|
40
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
41
|
+
highlightWeekends?: boolean;
|
|
40
42
|
/** Events to render as chips in each day cell (calendar layout when provided). */
|
|
41
43
|
events?: CalendarEvent<T>[];
|
|
42
44
|
/** Custom chip renderer; falls back to the built-in titled chip. */
|
|
@@ -91,6 +93,7 @@ export function MonthList<T = unknown>({
|
|
|
91
93
|
pastMonths = 1,
|
|
92
94
|
futureMonths = 12,
|
|
93
95
|
weekdayFormat = "short",
|
|
96
|
+
highlightWeekends = true,
|
|
94
97
|
weekStartsOn = 0,
|
|
95
98
|
events,
|
|
96
99
|
renderEvent,
|
|
@@ -189,6 +192,7 @@ export function MonthList<T = unknown>({
|
|
|
189
192
|
<MonthView<T>
|
|
190
193
|
date={item}
|
|
191
194
|
weekStartsOn={weekStartsOn}
|
|
195
|
+
highlightWeekends={highlightWeekends}
|
|
192
196
|
events={events}
|
|
193
197
|
eventsByDay={eventsByDay}
|
|
194
198
|
renderEvent={renderEvent}
|
package/src/MonthView.tsx
CHANGED
|
@@ -122,6 +122,8 @@ export interface MonthViewProps<T = unknown>
|
|
|
122
122
|
selectedDates?: Date[];
|
|
123
123
|
/** Render days from the neighbouring months in the leading/trailing cells (default true). */
|
|
124
124
|
showAdjacentMonths?: boolean;
|
|
125
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
126
|
+
highlightWeekends?: boolean;
|
|
125
127
|
/**
|
|
126
128
|
* Fill the whole cell with the range background instead of the default
|
|
127
129
|
* centered rounded "pill" strip. Default false.
|
|
@@ -161,7 +163,11 @@ export interface MonthViewProps<T = unknown>
|
|
|
161
163
|
// Each helper returns the slot's built-in styling split into `base` (structural,
|
|
162
164
|
// always applied) and `themed` (colour/type/spacing, dropped when a class is set).
|
|
163
165
|
|
|
164
|
-
function dayCellDefault(
|
|
166
|
+
function dayCellDefault(
|
|
167
|
+
day: MonthGridDay,
|
|
168
|
+
theme: DomCalendarTheme,
|
|
169
|
+
highlightWeekends: boolean,
|
|
170
|
+
): SlotDefault {
|
|
165
171
|
return {
|
|
166
172
|
base: {
|
|
167
173
|
position: "relative",
|
|
@@ -177,7 +183,10 @@ function dayCellDefault(day: MonthGridDay, theme: DomCalendarTheme): SlotDefault
|
|
|
177
183
|
},
|
|
178
184
|
themed: {
|
|
179
185
|
// The range band is a separate layer; the cell only carries the weekend tint.
|
|
180
|
-
background:
|
|
186
|
+
background:
|
|
187
|
+
highlightWeekends && day.isWeekend && !day.isInRange
|
|
188
|
+
? theme.weekendBackground
|
|
189
|
+
: "transparent",
|
|
181
190
|
fontSize: 15,
|
|
182
191
|
color: day.isDisabled ? theme.textDisabled : theme.text,
|
|
183
192
|
},
|
|
@@ -254,7 +263,12 @@ function badgeDefault(day: MonthGridDay, theme: DomCalendarTheme, hovered: boole
|
|
|
254
263
|
|
|
255
264
|
// --- Calendar (events) layout styles -------------------------------------
|
|
256
265
|
|
|
257
|
-
function eventCellDefault(
|
|
266
|
+
function eventCellDefault(
|
|
267
|
+
day: MonthGridDay,
|
|
268
|
+
theme: DomCalendarTheme,
|
|
269
|
+
height: number,
|
|
270
|
+
highlightWeekends: boolean,
|
|
271
|
+
): SlotDefault {
|
|
258
272
|
return {
|
|
259
273
|
base: {
|
|
260
274
|
position: "relative",
|
|
@@ -272,7 +286,10 @@ function eventCellDefault(day: MonthGridDay, theme: DomCalendarTheme, height: nu
|
|
|
272
286
|
},
|
|
273
287
|
themed: {
|
|
274
288
|
borderTop: `1px solid ${theme.gridLine}`,
|
|
275
|
-
background:
|
|
289
|
+
background:
|
|
290
|
+
highlightWeekends && day.isWeekend && !day.isInRange
|
|
291
|
+
? theme.weekendBackground
|
|
292
|
+
: "transparent",
|
|
276
293
|
color: day.isDisabled ? theme.textDisabled : theme.text,
|
|
277
294
|
},
|
|
278
295
|
};
|
|
@@ -415,6 +432,7 @@ export function MonthView<T = unknown>({
|
|
|
415
432
|
selectedRange,
|
|
416
433
|
selectedDates,
|
|
417
434
|
showAdjacentMonths = true,
|
|
435
|
+
highlightWeekends = true,
|
|
418
436
|
fillCellOnSelection = false,
|
|
419
437
|
showTitle = true,
|
|
420
438
|
showWeekdays = true,
|
|
@@ -748,7 +766,10 @@ export function MonthView<T = unknown>({
|
|
|
748
766
|
)
|
|
749
767
|
.map((s) => s.event);
|
|
750
768
|
const dayLabel = format(day.date, "d MMMM", locale ? { locale } : undefined);
|
|
751
|
-
const dayCellProps = slot(
|
|
769
|
+
const dayCellProps = slot(
|
|
770
|
+
"day",
|
|
771
|
+
eventCellDefault(day, theme, cellHeight, highlightWeekends),
|
|
772
|
+
);
|
|
752
773
|
return (
|
|
753
774
|
// Events mode: by default the cell is not a tab stop, so keyboard
|
|
754
775
|
// focus moves through the event chips (real buttons) only, not
|
|
@@ -1002,7 +1023,7 @@ export function MonthView<T = unknown>({
|
|
|
1002
1023
|
aria-disabled={day.isDisabled || undefined}
|
|
1003
1024
|
aria-label={label}
|
|
1004
1025
|
aria-pressed={day.isSelected || day.isInRange}
|
|
1005
|
-
{...slot("day", dayCellDefault(day, theme))}
|
|
1026
|
+
{...slot("day", dayCellDefault(day, theme, highlightWeekends))}
|
|
1006
1027
|
onClick={day.isDisabled ? undefined : () => onPressDay?.(day.date)}
|
|
1007
1028
|
onMouseEnter={day.isDisabled ? undefined : () => setHoveredKey(day.id)}
|
|
1008
1029
|
onMouseLeave={() => setHoveredKey((k) => (k === day.id ? null : k))}
|