@sunsama/event-calendar 0.2.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/LICENSE +20 -0
- package/README.md +105 -0
- package/lib/commonjs/components/all-day-events.js +117 -0
- package/lib/commonjs/components/all-day-events.js.map +1 -0
- package/lib/commonjs/components/background-hours-content.js +43 -0
- package/lib/commonjs/components/background-hours-content.js.map +1 -0
- package/lib/commonjs/components/background-hours-layout.js +57 -0
- package/lib/commonjs/components/background-hours-layout.js.map +1 -0
- package/lib/commonjs/components/drag-bar.js +84 -0
- package/lib/commonjs/components/drag-bar.js.map +1 -0
- package/lib/commonjs/components/edit-event-container.js +114 -0
- package/lib/commonjs/components/edit-event-container.js.map +1 -0
- package/lib/commonjs/components/event-container.js +37 -0
- package/lib/commonjs/components/event-container.js.map +1 -0
- package/lib/commonjs/components/new-event-container.js +73 -0
- package/lib/commonjs/components/new-event-container.js.map +1 -0
- package/lib/commonjs/components/time-indicator.js +64 -0
- package/lib/commonjs/components/time-indicator.js.map +1 -0
- package/lib/commonjs/components/timed-event-container.js +91 -0
- package/lib/commonjs/components/timed-event-container.js.map +1 -0
- package/lib/commonjs/components/timed-events.js +68 -0
- package/lib/commonjs/components/timed-events.js.map +1 -0
- package/lib/commonjs/components/zoom-provider.js +109 -0
- package/lib/commonjs/components/zoom-provider.js.map +1 -0
- package/lib/commonjs/enums.js +2 -0
- package/lib/commonjs/enums.js.map +1 -0
- package/lib/commonjs/hooks/use-cloned-events.js +25 -0
- package/lib/commonjs/hooks/use-cloned-events.js.map +1 -0
- package/lib/commonjs/hooks/use-events-layout.js +34 -0
- package/lib/commonjs/hooks/use-events-layout.js.map +1 -0
- package/lib/commonjs/hooks/use-is-editing.js +83 -0
- package/lib/commonjs/hooks/use-is-editing.js.map +1 -0
- package/lib/commonjs/index.js +129 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +24 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/calendar-layout.js +113 -0
- package/lib/commonjs/utils/calendar-layout.js.map +1 -0
- package/lib/commonjs/utils/compute-positioning.js +33 -0
- package/lib/commonjs/utils/compute-positioning.js.map +1 -0
- package/lib/commonjs/utils/date-utils.js +152 -0
- package/lib/commonjs/utils/date-utils.js.map +1 -0
- package/lib/commonjs/utils/double-tap-reset-zoom-gesture.js +19 -0
- package/lib/commonjs/utils/double-tap-reset-zoom-gesture.js.map +1 -0
- package/lib/commonjs/utils/generate-event-layouts.js +198 -0
- package/lib/commonjs/utils/generate-event-layouts.js.map +1 -0
- package/lib/commonjs/utils/globals.js +11 -0
- package/lib/commonjs/utils/globals.js.map +1 -0
- package/lib/commonjs/utils/pan-edit-event-gesture.js +41 -0
- package/lib/commonjs/utils/pan-edit-event-gesture.js.map +1 -0
- package/lib/module/components/all-day-events.js +110 -0
- package/lib/module/components/all-day-events.js.map +1 -0
- package/lib/module/components/background-hours-content.js +37 -0
- package/lib/module/components/background-hours-content.js.map +1 -0
- package/lib/module/components/background-hours-layout.js +51 -0
- package/lib/module/components/background-hours-layout.js.map +1 -0
- package/lib/module/components/drag-bar.js +78 -0
- package/lib/module/components/drag-bar.js.map +1 -0
- package/lib/module/components/edit-event-container.js +107 -0
- package/lib/module/components/edit-event-container.js.map +1 -0
- package/lib/module/components/event-container.js +33 -0
- package/lib/module/components/event-container.js.map +1 -0
- package/lib/module/components/new-event-container.js +67 -0
- package/lib/module/components/new-event-container.js.map +1 -0
- package/lib/module/components/time-indicator.js +57 -0
- package/lib/module/components/time-indicator.js.map +1 -0
- package/lib/module/components/timed-event-container.js +84 -0
- package/lib/module/components/timed-event-container.js.map +1 -0
- package/lib/module/components/timed-events.js +63 -0
- package/lib/module/components/timed-events.js.map +1 -0
- package/lib/module/components/zoom-provider.js +102 -0
- package/lib/module/components/zoom-provider.js.map +1 -0
- package/lib/module/enums.js +2 -0
- package/lib/module/enums.js.map +1 -0
- package/lib/module/hooks/use-cloned-events.js +21 -0
- package/lib/module/hooks/use-cloned-events.js.map +1 -0
- package/lib/module/hooks/use-events-layout.js +29 -0
- package/lib/module/hooks/use-events-layout.js.map +1 -0
- package/lib/module/hooks/use-is-editing.js +75 -0
- package/lib/module/hooks/use-is-editing.js.map +1 -0
- package/lib/module/index.js +124 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +20 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/calendar-layout.js +108 -0
- package/lib/module/utils/calendar-layout.js.map +1 -0
- package/lib/module/utils/compute-positioning.js +28 -0
- package/lib/module/utils/compute-positioning.js.map +1 -0
- package/lib/module/utils/date-utils.js +139 -0
- package/lib/module/utils/date-utils.js.map +1 -0
- package/lib/module/utils/double-tap-reset-zoom-gesture.js +15 -0
- package/lib/module/utils/double-tap-reset-zoom-gesture.js.map +1 -0
- package/lib/module/utils/generate-event-layouts.js +192 -0
- package/lib/module/utils/generate-event-layouts.js.map +1 -0
- package/lib/module/utils/globals.js +7 -0
- package/lib/module/utils/globals.js.map +1 -0
- package/lib/module/utils/pan-edit-event-gesture.js +37 -0
- package/lib/module/utils/pan-edit-event-gesture.js.map +1 -0
- package/lib/typescript/commonjs/components/all-day-events.d.ts +3 -0
- package/lib/typescript/commonjs/components/all-day-events.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/background-hours-content.d.ts +7 -0
- package/lib/typescript/commonjs/components/background-hours-content.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/background-hours-layout.d.ts +7 -0
- package/lib/typescript/commonjs/components/background-hours-layout.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/drag-bar.d.ts +14 -0
- package/lib/typescript/commonjs/components/drag-bar.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/edit-event-container.d.ts +7 -0
- package/lib/typescript/commonjs/components/edit-event-container.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/event-container.d.ts +7 -0
- package/lib/typescript/commonjs/components/event-container.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/new-event-container.d.ts +3 -0
- package/lib/typescript/commonjs/components/new-event-container.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/time-indicator.d.ts +3 -0
- package/lib/typescript/commonjs/components/time-indicator.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/timed-event-container.d.ts +9 -0
- package/lib/typescript/commonjs/components/timed-event-container.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/timed-events.d.ts +7 -0
- package/lib/typescript/commonjs/components/timed-events.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/zoom-provider.d.ts +7 -0
- package/lib/typescript/commonjs/components/zoom-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/enums.d.ts +2 -0
- package/lib/typescript/commonjs/enums.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/use-cloned-events.d.ts +11 -0
- package/lib/typescript/commonjs/hooks/use-cloned-events.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/use-events-layout.d.ts +13 -0
- package/lib/typescript/commonjs/hooks/use-events-layout.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/use-is-editing.d.ts +17 -0
- package/lib/typescript/commonjs/hooks/use-is-editing.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +27 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/types.d.ts +128 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/__tests___/compute-positioning.test.d.ts +2 -0
- package/lib/typescript/commonjs/utils/__tests___/compute-positioning.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/__tests___/date-utils.test.d.ts +2 -0
- package/lib/typescript/commonjs/utils/__tests___/date-utils.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/__tests___/generate-event-layout.test.d.ts +2 -0
- package/lib/typescript/commonjs/utils/__tests___/generate-event-layout.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/calendar-layout.d.ts +36 -0
- package/lib/typescript/commonjs/utils/calendar-layout.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/compute-positioning.d.ts +10 -0
- package/lib/typescript/commonjs/utils/compute-positioning.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/date-utils.d.ts +30 -0
- package/lib/typescript/commonjs/utils/date-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/double-tap-reset-zoom-gesture.d.ts +5 -0
- package/lib/typescript/commonjs/utils/double-tap-reset-zoom-gesture.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/generate-event-layouts.d.ts +15 -0
- package/lib/typescript/commonjs/utils/generate-event-layouts.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/globals.d.ts +5 -0
- package/lib/typescript/commonjs/utils/globals.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/pan-edit-event-gesture.d.ts +6 -0
- package/lib/typescript/commonjs/utils/pan-edit-event-gesture.d.ts.map +1 -0
- package/lib/typescript/module/components/all-day-events.d.ts +3 -0
- package/lib/typescript/module/components/all-day-events.d.ts.map +1 -0
- package/lib/typescript/module/components/background-hours-content.d.ts +7 -0
- package/lib/typescript/module/components/background-hours-content.d.ts.map +1 -0
- package/lib/typescript/module/components/background-hours-layout.d.ts +7 -0
- package/lib/typescript/module/components/background-hours-layout.d.ts.map +1 -0
- package/lib/typescript/module/components/drag-bar.d.ts +14 -0
- package/lib/typescript/module/components/drag-bar.d.ts.map +1 -0
- package/lib/typescript/module/components/edit-event-container.d.ts +7 -0
- package/lib/typescript/module/components/edit-event-container.d.ts.map +1 -0
- package/lib/typescript/module/components/event-container.d.ts +7 -0
- package/lib/typescript/module/components/event-container.d.ts.map +1 -0
- package/lib/typescript/module/components/new-event-container.d.ts +3 -0
- package/lib/typescript/module/components/new-event-container.d.ts.map +1 -0
- package/lib/typescript/module/components/time-indicator.d.ts +3 -0
- package/lib/typescript/module/components/time-indicator.d.ts.map +1 -0
- package/lib/typescript/module/components/timed-event-container.d.ts +9 -0
- package/lib/typescript/module/components/timed-event-container.d.ts.map +1 -0
- package/lib/typescript/module/components/timed-events.d.ts +7 -0
- package/lib/typescript/module/components/timed-events.d.ts.map +1 -0
- package/lib/typescript/module/components/zoom-provider.d.ts +7 -0
- package/lib/typescript/module/components/zoom-provider.d.ts.map +1 -0
- package/lib/typescript/module/enums.d.ts +2 -0
- package/lib/typescript/module/enums.d.ts.map +1 -0
- package/lib/typescript/module/hooks/use-cloned-events.d.ts +11 -0
- package/lib/typescript/module/hooks/use-cloned-events.d.ts.map +1 -0
- package/lib/typescript/module/hooks/use-events-layout.d.ts +13 -0
- package/lib/typescript/module/hooks/use-events-layout.d.ts.map +1 -0
- package/lib/typescript/module/hooks/use-is-editing.d.ts +17 -0
- package/lib/typescript/module/hooks/use-is-editing.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +27 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/types.d.ts +128 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/lib/typescript/module/utils/__tests___/compute-positioning.test.d.ts +2 -0
- package/lib/typescript/module/utils/__tests___/compute-positioning.test.d.ts.map +1 -0
- package/lib/typescript/module/utils/__tests___/date-utils.test.d.ts +2 -0
- package/lib/typescript/module/utils/__tests___/date-utils.test.d.ts.map +1 -0
- package/lib/typescript/module/utils/__tests___/generate-event-layout.test.d.ts +2 -0
- package/lib/typescript/module/utils/__tests___/generate-event-layout.test.d.ts.map +1 -0
- package/lib/typescript/module/utils/calendar-layout.d.ts +36 -0
- package/lib/typescript/module/utils/calendar-layout.d.ts.map +1 -0
- package/lib/typescript/module/utils/compute-positioning.d.ts +10 -0
- package/lib/typescript/module/utils/compute-positioning.d.ts.map +1 -0
- package/lib/typescript/module/utils/date-utils.d.ts +30 -0
- package/lib/typescript/module/utils/date-utils.d.ts.map +1 -0
- package/lib/typescript/module/utils/double-tap-reset-zoom-gesture.d.ts +5 -0
- package/lib/typescript/module/utils/double-tap-reset-zoom-gesture.d.ts.map +1 -0
- package/lib/typescript/module/utils/generate-event-layouts.d.ts +15 -0
- package/lib/typescript/module/utils/generate-event-layouts.d.ts.map +1 -0
- package/lib/typescript/module/utils/globals.d.ts +5 -0
- package/lib/typescript/module/utils/globals.d.ts.map +1 -0
- package/lib/typescript/module/utils/pan-edit-event-gesture.d.ts +6 -0
- package/lib/typescript/module/utils/pan-edit-event-gesture.d.ts.map +1 -0
- package/package.json +195 -0
- package/src/components/all-day-events.tsx +134 -0
- package/src/components/background-hours-content.tsx +51 -0
- package/src/components/background-hours-layout.tsx +61 -0
- package/src/components/drag-bar.tsx +120 -0
- package/src/components/edit-event-container.tsx +158 -0
- package/src/components/event-container.tsx +44 -0
- package/src/components/new-event-container.tsx +90 -0
- package/src/components/time-indicator.tsx +72 -0
- package/src/components/timed-event-container.tsx +124 -0
- package/src/components/timed-events.tsx +72 -0
- package/src/components/zoom-provider.tsx +146 -0
- package/src/enums.ts +0 -0
- package/src/hooks/use-cloned-events.ts +26 -0
- package/src/hooks/use-events-layout.ts +55 -0
- package/src/hooks/use-is-editing.tsx +109 -0
- package/src/index.tsx +165 -0
- package/src/types.ts +163 -0
- package/src/utils/__tests___/compute-positioning.test.ts +255 -0
- package/src/utils/__tests___/date-utils.test.ts +41 -0
- package/src/utils/__tests___/generate-event-layout.test.ts +277 -0
- package/src/utils/calendar-layout.ts +139 -0
- package/src/utils/compute-positioning.ts +44 -0
- package/src/utils/date-utils.ts +238 -0
- package/src/utils/double-tap-reset-zoom-gesture.ts +23 -0
- package/src/utils/generate-event-layouts.ts +314 -0
- package/src/utils/globals.ts +8 -0
- package/src/utils/pan-edit-event-gesture.ts +64 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Moment } from "moment-timezone";
|
|
2
|
+
import { TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
import { DerivedValue, SharedValue } from "react-native-reanimated";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
export type CalendarEvent = {
|
|
6
|
+
id: string;
|
|
7
|
+
calendarId: string;
|
|
8
|
+
title: string;
|
|
9
|
+
start: string;
|
|
10
|
+
end: string;
|
|
11
|
+
isAllDay?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type AllDayEventLayoutType = {
|
|
14
|
+
event: CalendarEvent;
|
|
15
|
+
rowIndex?: number;
|
|
16
|
+
visibleWidthDays?: number;
|
|
17
|
+
extend: EventExtend;
|
|
18
|
+
isPrimaryRendered?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type PartDayEventLayoutType = {
|
|
21
|
+
event: CalendarEvent;
|
|
22
|
+
collisions?: {
|
|
23
|
+
total: number;
|
|
24
|
+
order: number;
|
|
25
|
+
};
|
|
26
|
+
position: EventPosition;
|
|
27
|
+
};
|
|
28
|
+
export interface CollisionObject {
|
|
29
|
+
event: CalendarEvent;
|
|
30
|
+
collisions?: {
|
|
31
|
+
total: number;
|
|
32
|
+
order: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export type EventPosition = {
|
|
36
|
+
top: number;
|
|
37
|
+
height: number;
|
|
38
|
+
width: string;
|
|
39
|
+
marginLeft: string;
|
|
40
|
+
};
|
|
41
|
+
export type FullCalendarEventLayout = {
|
|
42
|
+
allDayEventsLayout: AllDayEventLayoutType[];
|
|
43
|
+
partDayEventsLayout: PartDayEventLayoutType[];
|
|
44
|
+
};
|
|
45
|
+
export type ThemeStyle = {
|
|
46
|
+
container?: ViewStyle;
|
|
47
|
+
scrollView?: ViewStyle;
|
|
48
|
+
timedEventsContainer?: ViewStyle;
|
|
49
|
+
borderContainer?: ViewStyle;
|
|
50
|
+
backgroundHoursContainer?: ViewStyle;
|
|
51
|
+
backgroundHoursInnerContainer?: ViewStyle;
|
|
52
|
+
backgroundHoursText?: TextStyle;
|
|
53
|
+
backgroundHoursLayoutContainer?: ViewStyle;
|
|
54
|
+
newEventContainer?: ViewStyle;
|
|
55
|
+
eventTitle?: TextStyle;
|
|
56
|
+
eventSubtitle?: TextStyle;
|
|
57
|
+
eventContainer?: ViewStyle;
|
|
58
|
+
timeIndicator?: ViewStyle;
|
|
59
|
+
allDayContainer?: ViewStyle;
|
|
60
|
+
allDayEventContainer?: ViewStyle;
|
|
61
|
+
allDayShowMoreContainer?: ViewStyle;
|
|
62
|
+
allDayShowMoreText?: TextStyle;
|
|
63
|
+
};
|
|
64
|
+
export type OnCreateEventProps = {
|
|
65
|
+
hour?: number;
|
|
66
|
+
minute?: number;
|
|
67
|
+
isAllDay?: boolean;
|
|
68
|
+
};
|
|
69
|
+
export type onCreateEvent = (arg: OnCreateEventProps) => void;
|
|
70
|
+
export type Config = {
|
|
71
|
+
timezone: string;
|
|
72
|
+
timeFormat: string;
|
|
73
|
+
dayDate: Moment;
|
|
74
|
+
theme?: ThemeStyle;
|
|
75
|
+
zoomLevel: SharedValue<number>;
|
|
76
|
+
layout: FullCalendarEventLayout;
|
|
77
|
+
createY: SharedValue<number>;
|
|
78
|
+
maximumHour: SharedValue<number>;
|
|
79
|
+
onCreateEvent?: onCreateEvent;
|
|
80
|
+
initialZoomLevel: number;
|
|
81
|
+
renderEvent: (event: CalendarEvent, extended: EventExtend, eventHeight?: SharedValue<number>, updatedTimes?: {
|
|
82
|
+
updatedStart: DerivedValue<number>;
|
|
83
|
+
updatedEnd: DerivedValue<number>;
|
|
84
|
+
}) => ReactNode;
|
|
85
|
+
onEventEdit?: (params: {
|
|
86
|
+
event: CalendarEvent;
|
|
87
|
+
status: EditStatus;
|
|
88
|
+
updatedTimes?: {
|
|
89
|
+
updatedStart: string;
|
|
90
|
+
updatedEnd: string;
|
|
91
|
+
};
|
|
92
|
+
}) => void;
|
|
93
|
+
onPressEvent?: (event: CalendarEvent) => void;
|
|
94
|
+
showTimeIndicator?: boolean;
|
|
95
|
+
maxAllDayEvents: number;
|
|
96
|
+
canCreateEvents: boolean;
|
|
97
|
+
canEditEvent: boolean | ((event: CalendarEvent) => boolean);
|
|
98
|
+
renderNewEventContainer?: (hour: number, minute: number) => ReactNode;
|
|
99
|
+
fiveMinuteInterval?: boolean;
|
|
100
|
+
renderDragBars?: {
|
|
101
|
+
top?: () => ReactNode;
|
|
102
|
+
bottom?: () => ReactNode;
|
|
103
|
+
};
|
|
104
|
+
updateLocalStateAfterEdit: boolean;
|
|
105
|
+
extraTimedComponents?: (zoomLevel: SharedValue<number>) => ReactNode;
|
|
106
|
+
onZoomChange?: (zoomLevel: number) => void;
|
|
107
|
+
};
|
|
108
|
+
export type PrefabHour = {
|
|
109
|
+
increment: number;
|
|
110
|
+
hourFormatted: string;
|
|
111
|
+
hourMoment: Moment;
|
|
112
|
+
};
|
|
113
|
+
export type CalendarViewIntervalType = "month" | "workweek" | "3day" | "1day" | "week";
|
|
114
|
+
/**
|
|
115
|
+
* Tells us if an event extends into the next day, the previous day, or both.
|
|
116
|
+
* Used for all day events.
|
|
117
|
+
*/
|
|
118
|
+
export declare enum EventExtend {
|
|
119
|
+
None = 0,
|
|
120
|
+
Past = 1,
|
|
121
|
+
Future = 2,
|
|
122
|
+
Both = 3
|
|
123
|
+
}
|
|
124
|
+
export declare enum EditStatus {
|
|
125
|
+
Start = 0,
|
|
126
|
+
Finish = 1
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IAC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CAAC;AAEX;;;GAGG;AACH,oBAAY,WAAW;IAErB,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,MAAM,IAAA;IACN,IAAI,IAAA;CACL;AAED,oBAAY,UAAU;IACpB,KAAK,IAAA;IACL,MAAM,IAAA;CACP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-positioning.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/__tests___/compute-positioning.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/__tests___/date-utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-event-layout.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/__tests___/generate-event-layout.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EventExtend } from "src/types";
|
|
2
|
+
export declare class CalendarLayout {
|
|
3
|
+
array2d: any[];
|
|
4
|
+
visibleX: Set<number>;
|
|
5
|
+
enableWeekBreaks: boolean;
|
|
6
|
+
startOfWeekXOffset: number;
|
|
7
|
+
constructor({ visibleX, enableWeekBreaks, startOfWeekXOffset, }: {
|
|
8
|
+
visibleX: number[];
|
|
9
|
+
enableWeekBreaks: boolean;
|
|
10
|
+
startOfWeekXOffset: number;
|
|
11
|
+
});
|
|
12
|
+
getAt(x: number, y: number): any;
|
|
13
|
+
setAt(x: number, y: number, value: {
|
|
14
|
+
value: any;
|
|
15
|
+
meta: {
|
|
16
|
+
x: any;
|
|
17
|
+
};
|
|
18
|
+
}): void;
|
|
19
|
+
setRange(x: number, y: number, duration: number, value: any): void;
|
|
20
|
+
fit(x: number, y: number, duration: number): boolean;
|
|
21
|
+
findFit(x: number, duration: number): number;
|
|
22
|
+
findFitAndInsert(eventStartIndex: number, eventDurationDays: number, event: any): void;
|
|
23
|
+
height(): any;
|
|
24
|
+
getViewAt(x: number, y: number): {
|
|
25
|
+
event?: undefined;
|
|
26
|
+
visibleWidthDays?: undefined;
|
|
27
|
+
isPrimaryRendered?: undefined;
|
|
28
|
+
extend?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
event: any;
|
|
31
|
+
visibleWidthDays: number;
|
|
32
|
+
isPrimaryRendered: boolean;
|
|
33
|
+
extend: EventExtend;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=calendar-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-layout.d.ts","sourceRoot":"","sources":["../../../../src/utils/calendar-layout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,cAAc;IAIzB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;gBAEf,EACV,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,GACnB,EAAE;QACD,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;KAC5B;IAOD,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAI1B,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE;YAAE,CAAC,EAAE,GAAG,CAAA;SAAE,CAAA;KAAE;IASnE,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAM3D,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAS1C,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAQnC,gBAAgB,CACd,eAAe,EAAE,MAAM,EACvB,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,GAAG;IAMZ,MAAM;IAMN,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;;;;;;;;CA4D/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Moment } from "moment-timezone";
|
|
2
|
+
import { CollisionObject, EventPosition } from "src/types";
|
|
3
|
+
type ComputePositioning = {
|
|
4
|
+
collisionObject: CollisionObject;
|
|
5
|
+
startOfDayMoment: Moment;
|
|
6
|
+
timezone: string;
|
|
7
|
+
};
|
|
8
|
+
declare const computePositioning: ({ collisionObject, startOfDayMoment, timezone, }: ComputePositioning) => EventPosition;
|
|
9
|
+
export default computePositioning;
|
|
10
|
+
//# sourceMappingURL=compute-positioning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-positioning.d.ts","sourceRoot":"","sources":["../../../../src/utils/compute-positioning.ts"],"names":[],"mappings":"AAAA,OAAe,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE3D,KAAK,kBAAkB,GAAG;IAExB,eAAe,EAAE,eAAe,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,kBAAkB,qDAIrB,kBAAkB,KAAG,aA2BvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import moment, { type Moment } from "moment-timezone";
|
|
2
|
+
import { CalendarEvent, PrefabHour } from "src/types";
|
|
3
|
+
export declare const generatePrefabHours: (timeFormat?: string) => PrefabHour[];
|
|
4
|
+
export declare const startOfUserWeek: (startDayOfWeekOffset: number, dateOrMoment: Date | Moment | string, timezone: string) => moment.Moment;
|
|
5
|
+
export declare const isAllDayOrSpansMidnight: (calendarEvent: CalendarEvent, timezone: string) => boolean;
|
|
6
|
+
export declare const getDurationInDays: (calendarEvent: CalendarEvent, timezone: string) => number;
|
|
7
|
+
export declare const daysInRange: ({ startDate, endDate, timezone, }: {
|
|
8
|
+
startDate: Date | string;
|
|
9
|
+
endDate: Date | string;
|
|
10
|
+
timezone: string;
|
|
11
|
+
}) => string[];
|
|
12
|
+
export declare const getDuration: (calendarEvent: CalendarEvent, trueDuration?: boolean) => number;
|
|
13
|
+
export declare const computeCalendarDateRange: (date: string | Date | Moment, tz: string, viewType: "month" | "workweek" | "3day" | "1day" | "week", startDayOfWeekOffset: number) => {
|
|
14
|
+
basisDate: Date;
|
|
15
|
+
dayIndexes: number[];
|
|
16
|
+
days: Date[];
|
|
17
|
+
startDate: Date;
|
|
18
|
+
endDate: Date;
|
|
19
|
+
calendarDates: string[];
|
|
20
|
+
startCalendarDate: string;
|
|
21
|
+
endCalendarDate: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const dateRangeIntersect: ({ startDate: start0, endDate: end0 }: {
|
|
24
|
+
startDate: Date;
|
|
25
|
+
endDate: Date;
|
|
26
|
+
}, { startDate: start1, endDate: end1 }: {
|
|
27
|
+
startDate: Date;
|
|
28
|
+
endDate: Date;
|
|
29
|
+
}) => boolean;
|
|
30
|
+
//# sourceMappingURL=date-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/date-utils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEtD,eAAO,MAAM,mBAAmB,gBAClB,MAAM,KACjB,UAAU,EAwBZ,CAAC;AAIF,eAAO,MAAM,eAAe,yBACJ,MAAM,gBACd,IAAI,GAAG,MAAM,GAAG,MAAM,YAC1B,MAAM,kBAejB,CAAC;AAEF,eAAO,MAAM,uBAAuB,kBACnB,aAAa,YAClB,MAAM,YAiBjB,CAAC;AAGF,eAAO,MAAM,iBAAiB,kBACb,aAAa,YAClB,MAAM,WAcjB,CAAC;AAGF,eAAO,MAAM,WAAW,sCAIrB;IACD,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,OAAO,EAAE,IAAI,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,aAqBA,CAAC;AAEF,eAAO,MAAM,WAAW,kBACP,aAAa,iBACb,OAAO,WAWvB,CAAC;AAEF,eAAO,MAAM,wBAAwB,SAC7B,MAAM,GAAG,IAAI,GAAG,MAAM,MACxB,MAAM,YACA,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,wBACnC,MAAM;;;;;;;;;CAiE7B,CAAC;AAGF,eAAO,MAAM,kBAAkB,yCACS;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,wCAClC;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,YAgBzE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SharedValue } from "react-native-reanimated";
|
|
2
|
+
import { Config } from "src/types";
|
|
3
|
+
declare const doubleTapGesture: (zoomLevel: SharedValue<number>, initialZoomLevel: number, onZoomChange?: Config["onZoomChange"]) => import("react-native-gesture-handler/lib/typescript/handlers/gestures/tapGesture").TapGesture;
|
|
4
|
+
export default doubleTapGesture;
|
|
5
|
+
//# sourceMappingURL=double-tap-reset-zoom-gesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"double-tap-reset-zoom-gesture.d.ts","sourceRoot":"","sources":["../../../../src/utils/double-tap-reset-zoom-gesture.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,QAAA,MAAM,gBAAgB,cACT,WAAW,CAAC,MAAM,CAAC,oBACZ,MAAM,iBACT,MAAM,CAAC,cAAc,CAAC,kGAajC,CAAC;AAEP,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CalendarEvent, CalendarViewIntervalType, FullCalendarEventLayout } from "src/types";
|
|
2
|
+
interface GenerateEventLayouts {
|
|
3
|
+
events: CalendarEvent[];
|
|
4
|
+
userCalendarId: string;
|
|
5
|
+
timezone: string;
|
|
6
|
+
startCalendarDate: string;
|
|
7
|
+
endCalendarDate: string;
|
|
8
|
+
startDayOfWeekOffset?: number;
|
|
9
|
+
calendarViewInterval?: CalendarViewIntervalType;
|
|
10
|
+
}
|
|
11
|
+
export declare const generateEventLayouts: ({ events, startCalendarDate, endCalendarDate, userCalendarId, calendarViewInterval, startDayOfWeekOffset, timezone, }: GenerateEventLayouts) => {
|
|
12
|
+
[day: string]: FullCalendarEventLayout;
|
|
13
|
+
};
|
|
14
|
+
export default generateEventLayouts;
|
|
15
|
+
//# sourceMappingURL=generate-event-layouts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-event-layouts.d.ts","sourceRoot":"","sources":["../../../../src/utils/generate-event-layouts.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL,aAAa,EACb,wBAAwB,EAGxB,uBAAuB,EAExB,MAAM,WAAW,CAAC;AAEnB,UAAU,oBAAoB;IAC5B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,wBAAwB,CAAC;CACjD;AAED,eAAO,MAAM,oBAAoB,0HAQ9B,oBAAoB;;CA8JtB,CAAC;AAgHF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../../src/utils/globals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,eAAO,MAAM,cAAc,iCAA4C,CAAC;AAExE,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SharedValue } from "react-native-reanimated";
|
|
2
|
+
import { RefObject } from "react";
|
|
3
|
+
import { PartDayEventLayoutType } from "src/types";
|
|
4
|
+
declare const gesturePan: (startY: SharedValue<number>, top: SharedValue<number>, currentY: SharedValue<number>, zoomLevel: SharedValue<number>, maximumHour: SharedValue<number>, height: SharedValue<number>, refNewEvent: RefObject<any>, fiveMinuteInterval?: boolean, isEditing?: null | PartDayEventLayoutType, startEditing?: () => void) => import("react-native-gesture-handler/lib/typescript/handlers/gestures/panGesture").PanGesture;
|
|
5
|
+
export default gesturePan;
|
|
6
|
+
//# sourceMappingURL=pan-edit-event-gesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pan-edit-event-gesture.d.ts","sourceRoot":"","sources":["../../../../src/utils/pan-edit-event-gesture.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEnD,QAAA,MAAM,UAAU,WACN,WAAW,CAAC,MAAM,CAAC,OACtB,WAAW,CAAC,MAAM,CAAC,YACd,WAAW,CAAC,MAAM,CAAC,aAClB,WAAW,CAAC,MAAM,CAAC,eACjB,WAAW,CAAC,MAAM,CAAC,UACxB,WAAW,CAAC,MAAM,CAAC,eACd,SAAS,CAAC,GAAG,CAAC,uBACN,OAAO,cAChB,IAAI,GAAG,sBAAsB,iBAC1B,MAAM,IAAI,kGA8CrB,CAAC;AAEP,eAAe,UAAU,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sunsama/event-calendar",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Event calendar.",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"android",
|
|
24
|
+
"ios",
|
|
25
|
+
"cpp",
|
|
26
|
+
"*.podspec",
|
|
27
|
+
"react-native.config.js",
|
|
28
|
+
"!ios/build",
|
|
29
|
+
"!android/build",
|
|
30
|
+
"!android/gradle",
|
|
31
|
+
"!android/gradlew",
|
|
32
|
+
"!android/gradlew.bat",
|
|
33
|
+
"!android/local.properties",
|
|
34
|
+
"!**/__tests__",
|
|
35
|
+
"!**/__fixtures__",
|
|
36
|
+
"!**/__mocks__",
|
|
37
|
+
"!**/.*"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"example": "yarn workspace example start",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"typecheck": "tsc",
|
|
43
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
44
|
+
"clean": "del-cli lib",
|
|
45
|
+
"prepare": "bob build",
|
|
46
|
+
"release": "release-it"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react-native",
|
|
50
|
+
"ios",
|
|
51
|
+
"android"
|
|
52
|
+
],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/sunsama/event-calendar.git"
|
|
56
|
+
},
|
|
57
|
+
"author": "Sunsama <development@sunsama.com> (https://sunsama.com)",
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/sunsama/event-calendar/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/sunsama/event-calendar#readme",
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"registry": "https://registry.npmjs.org/"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"immer": "^10.1.1",
|
|
68
|
+
"lodash": "^4.17.21",
|
|
69
|
+
"moment-timezone": "^0.5.47",
|
|
70
|
+
"react-native-gesture-handler": "^2.24.0",
|
|
71
|
+
"react-native-reanimated": "^3.16.7",
|
|
72
|
+
"zustand": "^5.0.3"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@commitlint/config-conventional": "^19.7.1",
|
|
76
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
77
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
78
|
+
"@release-it/conventional-changelog": "^10.0.0",
|
|
79
|
+
"@types/jest": "^29.5.5",
|
|
80
|
+
"@types/lodash": "^4.17.15",
|
|
81
|
+
"@types/react": "^18.2.44",
|
|
82
|
+
"commitlint": "^19.7.1",
|
|
83
|
+
"del-cli": "^5.1.0",
|
|
84
|
+
"eslint": "^8.51.0",
|
|
85
|
+
"eslint-config-prettier": "^9.0.0",
|
|
86
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
87
|
+
"jest": "^29.7.0",
|
|
88
|
+
"prettier": "^3.0.3",
|
|
89
|
+
"react": "18.3.1",
|
|
90
|
+
"react-native": "0.76.7",
|
|
91
|
+
"react-native-builder-bob": "^0.37.0",
|
|
92
|
+
"release-it": "^17.10.0",
|
|
93
|
+
"ts-jest": "^29.2.6",
|
|
94
|
+
"typescript": "^5.2.2"
|
|
95
|
+
},
|
|
96
|
+
"resolutions": {
|
|
97
|
+
"@types/react": "^18.2.44"
|
|
98
|
+
},
|
|
99
|
+
"peerDependencies": {
|
|
100
|
+
"react": "*",
|
|
101
|
+
"react-native": "*"
|
|
102
|
+
},
|
|
103
|
+
"workspaces": [
|
|
104
|
+
"example"
|
|
105
|
+
],
|
|
106
|
+
"packageManager": "yarn@3.6.4",
|
|
107
|
+
"commitlint": {
|
|
108
|
+
"extends": [
|
|
109
|
+
"@commitlint/config-conventional"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"release-it": {
|
|
113
|
+
"git": {
|
|
114
|
+
"commitMessage": "chore: release ${version}",
|
|
115
|
+
"tagName": "v${version}"
|
|
116
|
+
},
|
|
117
|
+
"npm": {
|
|
118
|
+
"publish": true
|
|
119
|
+
},
|
|
120
|
+
"github": {
|
|
121
|
+
"release": true
|
|
122
|
+
},
|
|
123
|
+
"plugins": {
|
|
124
|
+
"@release-it/conventional-changelog": {
|
|
125
|
+
"preset": "angular"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"eslintConfig": {
|
|
130
|
+
"root": true,
|
|
131
|
+
"extends": [
|
|
132
|
+
"@react-native",
|
|
133
|
+
"prettier"
|
|
134
|
+
],
|
|
135
|
+
"rules": {
|
|
136
|
+
"react/react-in-jsx-scope": "off",
|
|
137
|
+
"prettier/prettier": [
|
|
138
|
+
"error",
|
|
139
|
+
{
|
|
140
|
+
"quoteProps": "consistent",
|
|
141
|
+
"singleQuote": false,
|
|
142
|
+
"tabWidth": 2,
|
|
143
|
+
"trailingComma": "es5",
|
|
144
|
+
"useTabs": false
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"eslintIgnore": [
|
|
150
|
+
"node_modules/",
|
|
151
|
+
"lib/"
|
|
152
|
+
],
|
|
153
|
+
"prettier": {
|
|
154
|
+
"quoteProps": "consistent",
|
|
155
|
+
"singleQuote": false,
|
|
156
|
+
"tabWidth": 2,
|
|
157
|
+
"trailingComma": "es5",
|
|
158
|
+
"useTabs": false
|
|
159
|
+
},
|
|
160
|
+
"react-native-builder-bob": {
|
|
161
|
+
"source": "src",
|
|
162
|
+
"output": "lib",
|
|
163
|
+
"targets": [
|
|
164
|
+
[
|
|
165
|
+
"commonjs",
|
|
166
|
+
{
|
|
167
|
+
"esm": true
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
[
|
|
171
|
+
"module",
|
|
172
|
+
{
|
|
173
|
+
"esm": true
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
"typescript",
|
|
178
|
+
{
|
|
179
|
+
"project": "tsconfig.build.json",
|
|
180
|
+
"esm": true
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
],
|
|
184
|
+
"exclude": [
|
|
185
|
+
"**/__tests__/**",
|
|
186
|
+
"**/*.test.ts",
|
|
187
|
+
"**/*.test.tsx"
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
"create-react-native-library": {
|
|
191
|
+
"languages": "js",
|
|
192
|
+
"type": "library",
|
|
193
|
+
"version": "0.48.2"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { memo, useCallback, useContext, useState } from "react";
|
|
2
|
+
import { ConfigProvider } from "src/utils/globals";
|
|
3
|
+
import { LayoutChangeEvent, StyleSheet, Text, View } from "react-native";
|
|
4
|
+
import EventContainer from "src/components/event-container";
|
|
5
|
+
import { Pressable } from "react-native-gesture-handler";
|
|
6
|
+
import Animated, {
|
|
7
|
+
runOnJS,
|
|
8
|
+
useAnimatedStyle,
|
|
9
|
+
useSharedValue,
|
|
10
|
+
withTiming,
|
|
11
|
+
} from "react-native-reanimated";
|
|
12
|
+
|
|
13
|
+
const AllDayEvents = memo(
|
|
14
|
+
() => {
|
|
15
|
+
const { layout, theme, maxAllDayEvents } = useContext(ConfigProvider);
|
|
16
|
+
const [showAllDayEvents, setShowAllDayEvents] = useState(false);
|
|
17
|
+
|
|
18
|
+
const measuredHeight = useSharedValue(0);
|
|
19
|
+
const originalHeight = useSharedValue(0);
|
|
20
|
+
|
|
21
|
+
const onPress = useCallback(() => {
|
|
22
|
+
const newState = !showAllDayEvents;
|
|
23
|
+
|
|
24
|
+
if (!newState) {
|
|
25
|
+
measuredHeight.value = withTiming(
|
|
26
|
+
originalHeight.value,
|
|
27
|
+
{
|
|
28
|
+
duration: 250,
|
|
29
|
+
},
|
|
30
|
+
() => {
|
|
31
|
+
runOnJS(setShowAllDayEvents)(newState);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
} else {
|
|
35
|
+
setShowAllDayEvents(newState);
|
|
36
|
+
}
|
|
37
|
+
}, [measuredHeight, originalHeight, showAllDayEvents]);
|
|
38
|
+
|
|
39
|
+
const allDayEvents = showAllDayEvents
|
|
40
|
+
? layout.allDayEventsLayout
|
|
41
|
+
: layout.allDayEventsLayout.slice(0, maxAllDayEvents);
|
|
42
|
+
const restEventAmount =
|
|
43
|
+
layout.allDayEventsLayout.length - allDayEvents.length;
|
|
44
|
+
|
|
45
|
+
// Called whenever the content inside changes layout
|
|
46
|
+
const onContentLayout = useCallback(
|
|
47
|
+
(e: LayoutChangeEvent) => {
|
|
48
|
+
const { height } = e.nativeEvent.layout;
|
|
49
|
+
|
|
50
|
+
if (!originalHeight.value) {
|
|
51
|
+
originalHeight.value = height;
|
|
52
|
+
measuredHeight.value = height;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Animate from the old height to the new height
|
|
57
|
+
measuredHeight.value = withTiming(height, { duration: 250 });
|
|
58
|
+
},
|
|
59
|
+
[measuredHeight, originalHeight]
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Apply the animated height to the wrapping container
|
|
63
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
64
|
+
return {
|
|
65
|
+
// This ensures the container’s height animates smoothly
|
|
66
|
+
height: measuredHeight.value,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<View style={[styles.container, theme?.allDayContainer]}>
|
|
72
|
+
<View style={[styles.eventContainer, theme?.allDayEventContainer]}>
|
|
73
|
+
<Animated.View
|
|
74
|
+
style={[
|
|
75
|
+
animatedStyle,
|
|
76
|
+
{
|
|
77
|
+
overflow: "hidden", // so children get clipped during animation
|
|
78
|
+
backgroundColor: "lightgrey",
|
|
79
|
+
minHeight: 1,
|
|
80
|
+
},
|
|
81
|
+
]}
|
|
82
|
+
>
|
|
83
|
+
<View onLayout={onContentLayout}>
|
|
84
|
+
{allDayEvents.map((allDayLayout) => (
|
|
85
|
+
<EventContainer
|
|
86
|
+
key={allDayLayout.event.id}
|
|
87
|
+
layout={allDayLayout}
|
|
88
|
+
/>
|
|
89
|
+
))}
|
|
90
|
+
</View>
|
|
91
|
+
</Animated.View>
|
|
92
|
+
{layout.allDayEventsLayout.length > maxAllDayEvents ? (
|
|
93
|
+
<Pressable onPress={onPress}>
|
|
94
|
+
<View
|
|
95
|
+
style={[styles.moreContainer, theme?.allDayShowMoreContainer]}
|
|
96
|
+
>
|
|
97
|
+
<Text
|
|
98
|
+
style={[styles.moreContainerText, theme?.allDayShowMoreText]}
|
|
99
|
+
>
|
|
100
|
+
{restEventAmount ? `${restEventAmount} more` : "Show less"}
|
|
101
|
+
</Text>
|
|
102
|
+
</View>
|
|
103
|
+
</Pressable>
|
|
104
|
+
) : null}
|
|
105
|
+
</View>
|
|
106
|
+
</View>
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
() => true
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
export default AllDayEvents;
|
|
113
|
+
|
|
114
|
+
const styles = StyleSheet.create({
|
|
115
|
+
container: {
|
|
116
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
117
|
+
borderColor: "black",
|
|
118
|
+
overflow: "hidden",
|
|
119
|
+
},
|
|
120
|
+
eventContainer: {
|
|
121
|
+
marginLeft: 50,
|
|
122
|
+
marginRight: 10,
|
|
123
|
+
borderLeftWidth: StyleSheet.hairlineWidth,
|
|
124
|
+
borderColor: "black",
|
|
125
|
+
},
|
|
126
|
+
moreContainer: {
|
|
127
|
+
padding: 5,
|
|
128
|
+
},
|
|
129
|
+
moreContainerText: {
|
|
130
|
+
fontSize: 12,
|
|
131
|
+
fontWeight: "bold",
|
|
132
|
+
color: "grey",
|
|
133
|
+
},
|
|
134
|
+
});
|