@super-calendar/native 2.6.0 → 2.7.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/dist/{DefaultMonthEvent-BSvuJUFk.d.ts → DefaultMonthEvent-DCPDsnvq.d.ts} +10 -6
- package/dist/{DefaultMonthEvent-zDj9dHEv.d.mts → DefaultMonthEvent-DMOC5aNL.d.mts} +10 -6
- package/dist/{MonthList-Gu6p64fE.js → MonthList-CJs1vq5T.js} +80 -11
- package/dist/{MonthList-CMzYn9T0.mjs → MonthList-Dn37Ezj0.mjs} +82 -13
- package/dist/index.d.mts +80 -17
- package/dist/index.d.ts +80 -17
- package/dist/index.js +627 -125
- package/dist/index.mjs +606 -128
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +2 -2
- package/src/components/Agenda.tsx +5 -2
- package/src/components/AllDayLane.tsx +3 -2
- package/src/components/Calendar.tsx +29 -0
- package/src/components/DefaultEvent.tsx +3 -1
- package/src/components/MonthPager.tsx +12 -3
- package/src/components/MonthView.tsx +95 -8
- package/src/components/ResourceTimeline.tsx +270 -29
- package/src/components/TimeGrid.tsx +656 -97
- package/src/components/YearView.tsx +14 -4
- package/src/index.tsx +10 -1
- package/src/types.ts +1 -0
|
@@ -14,9 +14,11 @@ import { createSlots, type SlotStyleProps } from "../utils/slots";
|
|
|
14
14
|
import {
|
|
15
15
|
buildMonthWeeks,
|
|
16
16
|
getIsToday,
|
|
17
|
+
filterHiddenDays,
|
|
17
18
|
getWeekDays,
|
|
18
19
|
getYearMonths,
|
|
19
20
|
groupEventsByDay,
|
|
21
|
+
isBackgroundEvent,
|
|
20
22
|
isSameCalendarDay,
|
|
21
23
|
weekdayFormatToken,
|
|
22
24
|
} from "@super-calendar/core";
|
|
@@ -43,6 +45,8 @@ export type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
|
|
|
43
45
|
/** Days holding at least one event get a dot. Omit for a plain year. */
|
|
44
46
|
events?: CalendarEvent<T>[];
|
|
45
47
|
weekStartsOn: WeekStartsOn;
|
|
48
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
49
|
+
hiddenDays?: number[];
|
|
46
50
|
locale?: Locale;
|
|
47
51
|
/** Highlight this date instead of the real "today". */
|
|
48
52
|
activeDate?: Date;
|
|
@@ -65,6 +69,7 @@ function YearViewInner<T>({
|
|
|
65
69
|
date,
|
|
66
70
|
events,
|
|
67
71
|
weekStartsOn,
|
|
72
|
+
hiddenDays,
|
|
68
73
|
locale,
|
|
69
74
|
activeDate,
|
|
70
75
|
minMonthWidth = 150,
|
|
@@ -87,14 +92,19 @@ function YearViewInner<T>({
|
|
|
87
92
|
// Weekday initials for one shared header per mini month.
|
|
88
93
|
const weekdayLabels = useMemo(
|
|
89
94
|
() =>
|
|
90
|
-
getWeekDays(date, weekStartsOn).map((d) =>
|
|
95
|
+
filterHiddenDays(getWeekDays(date, weekStartsOn), hiddenDays).map((d) =>
|
|
91
96
|
format(d, weekdayFormatToken("narrow"), { locale }),
|
|
92
97
|
),
|
|
93
|
-
[date, weekStartsOn, locale],
|
|
98
|
+
[date, weekStartsOn, locale, hiddenDays],
|
|
94
99
|
);
|
|
95
100
|
// Days that hold at least one event, keyed like `groupEventsByDay`.
|
|
96
101
|
const eventDays = useMemo(
|
|
97
|
-
() =>
|
|
102
|
+
() =>
|
|
103
|
+
new Set(
|
|
104
|
+
events && events.length > 0
|
|
105
|
+
? groupEventsByDay(events.filter((e) => !isBackgroundEvent(e))).keys()
|
|
106
|
+
: [],
|
|
107
|
+
),
|
|
98
108
|
[events],
|
|
99
109
|
);
|
|
100
110
|
|
|
@@ -102,7 +112,7 @@ function YearViewInner<T>({
|
|
|
102
112
|
<ScrollView onLayout={handleLayout} showsVerticalScrollIndicator>
|
|
103
113
|
<View {...slot("grid", { base: styles.grid })}>
|
|
104
114
|
{months.map((month) => {
|
|
105
|
-
const weeks = buildMonthWeeks(month, weekStartsOn);
|
|
115
|
+
const weeks = buildMonthWeeks(month, weekStartsOn, { hiddenDays });
|
|
106
116
|
const title = format(month, "MMMM", { locale });
|
|
107
117
|
const monthLabel = format(month, "MMMM yyyy", { locale });
|
|
108
118
|
const titleText = (
|
package/src/index.tsx
CHANGED
|
@@ -55,6 +55,7 @@ export {
|
|
|
55
55
|
} from "./theme";
|
|
56
56
|
export type {
|
|
57
57
|
BusinessHours,
|
|
58
|
+
BusinessHoursBand,
|
|
58
59
|
CalendarEvent,
|
|
59
60
|
CalendarMode,
|
|
60
61
|
EventAccessibilityLabelContext,
|
|
@@ -80,6 +81,8 @@ export {
|
|
|
80
81
|
isWithinDateRange,
|
|
81
82
|
nextDateRange,
|
|
82
83
|
useDateRange,
|
|
84
|
+
useEventSource,
|
|
85
|
+
useNow,
|
|
83
86
|
} from "@super-calendar/core";
|
|
84
87
|
export {
|
|
85
88
|
buildMonthGrid,
|
|
@@ -108,4 +111,10 @@ export {
|
|
|
108
111
|
isSameCalendarDay,
|
|
109
112
|
minutesIntoDay,
|
|
110
113
|
} from "@super-calendar/core";
|
|
111
|
-
export {
|
|
114
|
+
export {
|
|
115
|
+
layoutDayEvents,
|
|
116
|
+
isAllDayEvent,
|
|
117
|
+
isBackgroundEvent,
|
|
118
|
+
backgroundBandsForDay,
|
|
119
|
+
type PositionedEvent,
|
|
120
|
+
} from "@super-calendar/core";
|
package/src/types.ts
CHANGED