@savvycal/calendar 0.12.1 → 0.14.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 +109 -41
- package/dist/components/day-grid-view/AllDaySection.d.ts +2 -0
- package/dist/components/day-grid-view/AllDaySection.d.ts.map +1 -1
- package/dist/components/day-grid-view/AllDaySection.js +111 -75
- package/dist/components/day-grid-view/DayColumn.d.ts +2 -24
- package/dist/components/day-grid-view/DayColumn.d.ts.map +1 -1
- package/dist/components/day-grid-view/DayGridView.d.ts +1 -1
- package/dist/components/day-grid-view/DayGridView.d.ts.map +1 -1
- package/dist/components/day-grid-view/DayGridView.js +330 -275
- package/dist/components/day-grid-view/defaults.d.ts.map +1 -1
- package/dist/components/day-grid-view/defaults.js +1 -0
- package/dist/components/month-view/MonthView.d.ts.map +1 -1
- package/dist/components/month-view/MonthView.js +184 -165
- package/dist/components/month-view/MonthWeekRow.d.ts +1 -0
- package/dist/components/month-view/MonthWeekRow.d.ts.map +1 -1
- package/dist/components/month-view/MonthWeekRow.js +95 -89
- package/dist/components/resource-grid-view/ResourceColumn.d.ts +3 -21
- package/dist/components/resource-grid-view/ResourceColumn.d.ts.map +1 -1
- package/dist/components/resource-grid-view/ResourceColumn.js +13 -6
- package/dist/components/resource-grid-view/ResourceGridView.d.ts +1 -1
- package/dist/components/resource-grid-view/ResourceGridView.d.ts.map +1 -1
- package/dist/components/resource-grid-view/ResourceGridView.js +348 -300
- package/dist/components/resource-grid-view/defaults.d.ts.map +1 -1
- package/dist/components/resource-grid-view/defaults.js +1 -0
- package/dist/components/shared/AllDayRow.d.ts.map +1 -1
- package/dist/components/shared/AllDayRow.js +21 -22
- package/dist/components/shared/EventChip.d.ts +4 -0
- package/dist/components/shared/EventChip.d.ts.map +1 -1
- package/dist/components/shared/EventChip.js +63 -51
- package/dist/components/shared/SelectionOverlay.d.ts +4 -0
- package/dist/components/shared/SelectionOverlay.d.ts.map +1 -1
- package/dist/components/shared/SelectionOverlay.js +38 -33
- package/dist/components/shared/SlotInteractionLayer.d.ts +5 -0
- package/dist/components/shared/SlotInteractionLayer.d.ts.map +1 -1
- package/dist/components/shared/SlotInteractionLayer.js +201 -176
- package/dist/components/shared/TimedEventLayer.d.ts +5 -2
- package/dist/components/shared/TimedEventLayer.d.ts.map +1 -1
- package/dist/components/shared/TimedEventLayer.js +57 -51
- package/dist/components/shared/useEventDrag.d.ts +36 -0
- package/dist/components/shared/useEventDrag.d.ts.map +1 -0
- package/dist/components/shared/useEventDrag.js +156 -0
- package/dist/components/shared/useLingeringValue.d.ts +7 -0
- package/dist/components/shared/useLingeringValue.d.ts.map +1 -0
- package/dist/components/shared/useLingeringValue.js +17 -0
- package/dist/components/shared/useTouchDrag.d.ts +38 -0
- package/dist/components/shared/useTouchDrag.d.ts.map +1 -0
- package/dist/components/shared/useTouchDrag.js +51 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/autoScroll.d.ts +30 -9
- package/dist/lib/autoScroll.d.ts.map +1 -1
- package/dist/lib/autoScroll.js +57 -51
- package/dist/types/calendar.d.ts +50 -0
- package/dist/types/calendar.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,179 +1,185 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { DAYS_PER_WEEK as
|
|
1
|
+
import { jsx as n, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import { memo as H, useRef as W } from "react";
|
|
3
|
+
import { cn as g } from "../../lib/utils.js";
|
|
4
|
+
import { DAYS_PER_WEEK as A } from "../../lib/month.js";
|
|
5
5
|
import { formatDateLabel as D } from "../../lib/time.js";
|
|
6
|
-
import { MonthEventItem as
|
|
7
|
-
import { MonthMoreButton as
|
|
6
|
+
import { MonthEventItem as T } from "./MonthEventItem.js";
|
|
7
|
+
import { MonthMoreButton as G } from "./MonthMoreButton.js";
|
|
8
|
+
import { TOUCH_DRAG_STYLE as Y } from "../shared/useTouchDrag.js";
|
|
8
9
|
import { DISMISS_ONLY_ATTR as j } from "../shared/AnchoredPopover.js";
|
|
9
|
-
const
|
|
10
|
-
weekIndex:
|
|
11
|
-
layout:
|
|
12
|
-
month:
|
|
10
|
+
const I = 28, P = 2, ee = H(function({
|
|
11
|
+
weekIndex: l,
|
|
12
|
+
layout: a,
|
|
13
|
+
month: m,
|
|
13
14
|
todayStr: B,
|
|
14
|
-
lanes:
|
|
15
|
-
eventHeight:
|
|
16
|
-
timeZone:
|
|
17
|
-
cls:
|
|
18
|
-
onEventClick:
|
|
15
|
+
lanes: _,
|
|
16
|
+
eventHeight: L,
|
|
17
|
+
timeZone: s,
|
|
18
|
+
cls: r,
|
|
19
|
+
onEventClick: c,
|
|
19
20
|
onDayNumberClick: d,
|
|
20
|
-
onCellMouseDown:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
onCellMouseDown: v,
|
|
22
|
+
onCellPointerDown: u,
|
|
23
|
+
onOverflowClick: M,
|
|
24
|
+
renderOverflowPopover: N,
|
|
25
|
+
highlight: f,
|
|
26
|
+
selectionRef: R,
|
|
27
|
+
selectedEventId: S,
|
|
28
|
+
selectedEventAnchor: p,
|
|
29
|
+
selectedEventRef: y
|
|
28
30
|
}) {
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
const
|
|
31
|
+
const h = W(null);
|
|
32
|
+
let w = !1;
|
|
33
|
+
const x = a.days.reduce(
|
|
32
34
|
(e, t) => t.moreCount > 0 ? Math.max(e, t.moreLane + 1) : e,
|
|
33
|
-
|
|
35
|
+
_
|
|
34
36
|
);
|
|
35
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ n(
|
|
36
38
|
"div",
|
|
37
39
|
{
|
|
38
|
-
ref:
|
|
39
|
-
"data-month-week":
|
|
40
|
-
className:
|
|
40
|
+
ref: h,
|
|
41
|
+
"data-month-week": l,
|
|
42
|
+
className: r("week"),
|
|
41
43
|
style: { gridColumn: "1 / -1" },
|
|
42
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ k(
|
|
43
45
|
"div",
|
|
44
46
|
{
|
|
45
47
|
style: {
|
|
46
48
|
position: "absolute",
|
|
47
49
|
inset: 0,
|
|
48
50
|
display: "grid",
|
|
49
|
-
gridTemplateColumns: `repeat(${
|
|
50
|
-
gridTemplateRows: `${
|
|
51
|
+
gridTemplateColumns: `repeat(${A}, minmax(0, 1fr))`,
|
|
52
|
+
gridTemplateRows: `${I}px repeat(${x}, ${L}px) 1fr`,
|
|
51
53
|
rowGap: P,
|
|
52
54
|
// Very short rows can't fit even one lane; don't paint into the next week
|
|
53
55
|
overflow: "hidden"
|
|
54
56
|
},
|
|
55
57
|
children: [
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */
|
|
58
|
+
a.dates.map((e, t) => {
|
|
59
|
+
const o = e.month !== m.month || e.year !== m.year;
|
|
60
|
+
return /* @__PURE__ */ n(
|
|
59
61
|
"div",
|
|
60
62
|
{
|
|
61
63
|
[j]: "",
|
|
62
|
-
className:
|
|
64
|
+
className: g(r("dayCell"), o && r("dayCellOutside")),
|
|
63
65
|
style: {
|
|
64
66
|
gridRow: "1 / -1",
|
|
65
67
|
gridColumn: t + 1,
|
|
66
|
-
...
|
|
67
|
-
...t ===
|
|
68
|
+
...l === 0 ? { borderTopWidth: 0 } : {},
|
|
69
|
+
...t === A - 1 ? { borderRightWidth: 0 } : {},
|
|
70
|
+
// A long press starts a touch drag: keep it from opening the
|
|
71
|
+
// iOS callout
|
|
72
|
+
...u && Y
|
|
68
73
|
},
|
|
69
|
-
onMouseDown:
|
|
74
|
+
onMouseDown: v ? (i) => v(e, i) : void 0,
|
|
75
|
+
onPointerDown: u ? (i) => u(e, i) : void 0
|
|
70
76
|
},
|
|
71
77
|
e.toString()
|
|
72
78
|
);
|
|
73
79
|
}),
|
|
74
|
-
|
|
80
|
+
f && /* @__PURE__ */ n(
|
|
75
81
|
"div",
|
|
76
82
|
{
|
|
77
|
-
ref:
|
|
83
|
+
ref: R,
|
|
78
84
|
"aria-hidden": "true",
|
|
79
|
-
className:
|
|
85
|
+
className: r("selectionHighlight"),
|
|
80
86
|
style: {
|
|
81
87
|
gridRow: "1 / -1",
|
|
82
|
-
gridColumn: `${
|
|
88
|
+
gridColumn: `${f.startCol + 1} / ${f.endCol + 2}`,
|
|
83
89
|
pointerEvents: "none"
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
),
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
d &&
|
|
92
|
-
|
|
93
|
-
),
|
|
93
|
+
a.dates.map((e, t) => {
|
|
94
|
+
const o = e.toString(), i = o === B, E = e.month !== m.month || e.year !== m.year, C = e.day === 1 ? `${e.toLocaleString("en-US", { month: "short" })} ${e.day}` : String(e.day), $ = g(
|
|
95
|
+
r("dayNumber"),
|
|
96
|
+
E && r("dayNumberOutside"),
|
|
97
|
+
d && r("dayNumberButton"),
|
|
98
|
+
i && r("dayNumberToday")
|
|
99
|
+
), b = {
|
|
94
100
|
gridRow: 1,
|
|
95
101
|
gridColumn: t + 1,
|
|
96
102
|
justifySelf: "center",
|
|
97
103
|
alignSelf: "center"
|
|
98
104
|
};
|
|
99
|
-
return d ? /* @__PURE__ */
|
|
105
|
+
return d ? /* @__PURE__ */ n(
|
|
100
106
|
"button",
|
|
101
107
|
{
|
|
102
108
|
type: "button",
|
|
103
|
-
className:
|
|
104
|
-
style:
|
|
109
|
+
className: $,
|
|
110
|
+
style: b,
|
|
105
111
|
"aria-label": D(e),
|
|
106
|
-
"aria-current":
|
|
107
|
-
onMouseDown: (
|
|
112
|
+
"aria-current": i ? "date" : void 0,
|
|
113
|
+
onMouseDown: (O) => O.stopPropagation(),
|
|
108
114
|
onClick: () => d(e),
|
|
109
115
|
children: C
|
|
110
116
|
},
|
|
111
|
-
|
|
112
|
-
) : /* @__PURE__ */
|
|
117
|
+
o
|
|
118
|
+
) : /* @__PURE__ */ n(
|
|
113
119
|
"span",
|
|
114
120
|
{
|
|
115
|
-
className:
|
|
116
|
-
style: {
|
|
117
|
-
"aria-current":
|
|
121
|
+
className: $,
|
|
122
|
+
style: { ...b, pointerEvents: "none" },
|
|
123
|
+
"aria-current": i ? "date" : void 0,
|
|
118
124
|
children: C
|
|
119
125
|
},
|
|
120
|
-
|
|
126
|
+
o
|
|
121
127
|
);
|
|
122
128
|
}),
|
|
123
|
-
|
|
129
|
+
a.visibleSegments.map((e) => {
|
|
124
130
|
if (e.pinned)
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
|
|
131
|
+
return /* @__PURE__ */ n(
|
|
132
|
+
T,
|
|
127
133
|
{
|
|
128
134
|
event: e.event,
|
|
129
135
|
isBar: !0,
|
|
130
136
|
continuesBefore: e.continuesBefore,
|
|
131
137
|
continuesAfter: e.continuesAfter,
|
|
132
|
-
timeZone:
|
|
133
|
-
cls:
|
|
138
|
+
timeZone: s,
|
|
139
|
+
cls: r,
|
|
134
140
|
interactive: !1,
|
|
135
141
|
isSelected: !0,
|
|
136
|
-
itemRef:
|
|
142
|
+
itemRef: R,
|
|
137
143
|
gridRow: e.lane + 2,
|
|
138
144
|
gridColumn: `${e.startCol + 1} / span ${e.span}`
|
|
139
145
|
},
|
|
140
146
|
e.event.id
|
|
141
147
|
);
|
|
142
|
-
const t = e.event.id ===
|
|
143
|
-
return
|
|
144
|
-
|
|
148
|
+
const t = e.event.id === S, o = t && p?.kind === "segment" && !w;
|
|
149
|
+
return o && (w = !0), /* @__PURE__ */ n(
|
|
150
|
+
T,
|
|
145
151
|
{
|
|
146
152
|
event: e.event,
|
|
147
153
|
isBar: e.isBar,
|
|
148
154
|
continuesBefore: e.continuesBefore,
|
|
149
155
|
continuesAfter: e.continuesAfter,
|
|
150
|
-
timeZone:
|
|
151
|
-
cls:
|
|
152
|
-
onClick:
|
|
156
|
+
timeZone: s,
|
|
157
|
+
cls: r,
|
|
158
|
+
onClick: c,
|
|
153
159
|
isSelected: t,
|
|
154
|
-
itemRef:
|
|
160
|
+
itemRef: o ? y : void 0,
|
|
155
161
|
gridRow: e.lane + 2,
|
|
156
162
|
gridColumn: `${e.startCol + 1} / span ${e.span}`
|
|
157
163
|
},
|
|
158
164
|
e.event.id
|
|
159
165
|
);
|
|
160
166
|
}),
|
|
161
|
-
|
|
162
|
-
(e, t) => e.moreCount > 0 ? /* @__PURE__ */
|
|
163
|
-
|
|
167
|
+
a.days.map(
|
|
168
|
+
(e, t) => e.moreCount > 0 ? /* @__PURE__ */ n(
|
|
169
|
+
G,
|
|
164
170
|
{
|
|
165
171
|
date: e.date,
|
|
166
172
|
events: e.events,
|
|
167
173
|
count: e.moreCount,
|
|
168
174
|
col: t,
|
|
169
|
-
weekRef:
|
|
170
|
-
timeZone:
|
|
171
|
-
cls:
|
|
172
|
-
onEventClick:
|
|
173
|
-
onOverflowClick:
|
|
174
|
-
renderOverflowPopover:
|
|
175
|
-
selectedEventId:
|
|
176
|
-
anchorRef:
|
|
175
|
+
weekRef: h,
|
|
176
|
+
timeZone: s,
|
|
177
|
+
cls: r,
|
|
178
|
+
onEventClick: c,
|
|
179
|
+
onOverflowClick: M,
|
|
180
|
+
renderOverflowPopover: N,
|
|
181
|
+
selectedEventId: S,
|
|
182
|
+
anchorRef: p?.kind === "more" && p.col === t ? y : void 0,
|
|
177
183
|
style: { gridRow: e.moreLane + 2, gridColumn: t + 1 }
|
|
178
184
|
},
|
|
179
185
|
`more-${e.date.toString()}`
|
|
@@ -186,7 +192,7 @@ const G = 28, P = 2, V = O(function({
|
|
|
186
192
|
);
|
|
187
193
|
});
|
|
188
194
|
export {
|
|
189
|
-
|
|
195
|
+
I as DAY_HEADER_HEIGHT,
|
|
190
196
|
P as LANE_GAP,
|
|
191
|
-
|
|
197
|
+
ee as MonthWeekRow
|
|
192
198
|
};
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
interface ResourceColumnProps {
|
|
1
|
+
import { CalendarResource } from '../../types/calendar';
|
|
2
|
+
import { TimedEventLayerProps } from '../shared/TimedEventLayer';
|
|
3
|
+
interface ResourceColumnProps extends Omit<TimedEventLayerProps, 'columnId' | 'fallbackColor'> {
|
|
4
4
|
resource: CalendarResource;
|
|
5
|
-
positionedEvents: PositionedEvent[];
|
|
6
|
-
column: number;
|
|
7
|
-
timeZone: string;
|
|
8
|
-
cls: (key: keyof GridViewClassNames) => string;
|
|
9
|
-
onEventClick?: (event: CalendarEvent) => void;
|
|
10
|
-
renderEvent?: (props: {
|
|
11
|
-
event: TimedCalendarEvent;
|
|
12
|
-
position: PositionedEvent;
|
|
13
|
-
}) => React.ReactNode;
|
|
14
|
-
eventGap?: number;
|
|
15
|
-
eventLayout?: EventLayout;
|
|
16
|
-
stackOffset?: number;
|
|
17
|
-
selectedEventId?: string | null;
|
|
18
|
-
selectedEventRef?: Ref<HTMLDivElement>;
|
|
19
|
-
eventMinWidth?: number;
|
|
20
|
-
eventMaxStack?: number;
|
|
21
|
-
onOverflowClick?: (info: OverflowClickInfo) => void;
|
|
22
|
-
renderOverflowPopover?: (props: OverflowPopoverRenderProps) => React.ReactNode;
|
|
23
5
|
}
|
|
24
6
|
export declare const ResourceColumn: import('react').NamedExoticComponent<ResourceColumnProps>;
|
|
25
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceColumn.d.ts","sourceRoot":"","sources":["../../../src/components/resource-grid-view/ResourceColumn.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResourceColumn.d.ts","sourceRoot":"","sources":["../../../src/components/resource-grid-view/ResourceColumn.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,UAAU,mBAAoB,SAAQ,IAAI,CACxC,oBAAoB,EACpB,UAAU,GAAG,eAAe,CAC7B;IACC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,2DAWzB,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { memo as e } from "react";
|
|
3
|
-
import { TimedEventLayer as
|
|
4
|
-
const
|
|
3
|
+
import { TimedEventLayer as n } from "../shared/TimedEventLayer.js";
|
|
4
|
+
const u = e(function({
|
|
5
5
|
resource: o,
|
|
6
|
-
...
|
|
6
|
+
...m
|
|
7
7
|
}) {
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ r(
|
|
9
|
+
n,
|
|
10
|
+
{
|
|
11
|
+
...m,
|
|
12
|
+
columnId: o.id,
|
|
13
|
+
fallbackColor: o.color
|
|
14
|
+
}
|
|
15
|
+
);
|
|
9
16
|
});
|
|
10
17
|
export {
|
|
11
|
-
|
|
18
|
+
u as ResourceColumn
|
|
12
19
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ResourceGridViewProps } from '../../types/calendar';
|
|
2
|
-
export declare function ResourceGridView({ date, timeZone, resources, events, availability, unavailability, defaultUnavailable, timeAxis, initialScrollHour, onEventClick, snapDuration, placeholderDuration, selectedRange, onSelect, onSlotClick, className, classNames, hourHeight, columnMinWidth, renderHeader, renderEvent, selectionAppearance, dragPreviewAppearance, selectionRef, selectionLingerMs, selectedEventId, selectedEventRef, renderCorner, formatGutterLabel, eventGap, eventLayout, stackOffset, eventMinWidth, eventMaxStack, onOverflowClick, renderOverflowPopover, }: ResourceGridViewProps): import("react").JSX.Element;
|
|
2
|
+
export declare function ResourceGridView({ date, timeZone, resources, events, availability, unavailability, defaultUnavailable, timeAxis, initialScrollHour, onEventClick, snapDuration, placeholderDuration, selectedRange, onSelect, onSlotClick, className, classNames, hourHeight, columnMinWidth, renderHeader, renderEvent, selectionAppearance, dragPreviewAppearance, selectionRef, selectionLingerMs, onEventDrop, pendingDrop, pendingDropRef, selectedEventId, selectedEventRef, renderCorner, formatGutterLabel, eventGap, eventLayout, stackOffset, eventMinWidth, eventMaxStack, onOverflowClick, renderOverflowPopover, }: ResourceGridViewProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=ResourceGridView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceGridView.d.ts","sourceRoot":"","sources":["../../../src/components/resource-grid-view/ResourceGridView.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ResourceGridView.d.ts","sourceRoot":"","sources":["../../../src/components/resource-grid-view/ResourceGridView.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAKV,qBAAqB,EAGtB,MAAM,kBAAkB,CAAC;AAiB1B,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,MAAM,EACN,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAe,EACf,cAAoB,EACpB,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,iBAAqB,EACrB,WAAW,EACX,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,WAAuB,EACvB,WAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,EAAE,qBAAqB,+BA8fvB"}
|