@savvycal/calendar 0.10.3 → 0.11.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 +187 -20
- package/dist/components/day-grid-view/AllDayEventChip.d.ts.map +1 -1
- package/dist/components/day-grid-view/AllDayEventChip.js +47 -41
- package/dist/components/day-grid-view/AllDaySection.d.ts +15 -0
- package/dist/components/day-grid-view/AllDaySection.d.ts.map +1 -1
- package/dist/components/day-grid-view/AllDaySection.js +93 -29
- package/dist/components/day-grid-view/BackgroundEventLayer.d.ts +19 -0
- package/dist/components/day-grid-view/BackgroundEventLayer.d.ts.map +1 -0
- package/dist/components/day-grid-view/BackgroundEventLayer.js +55 -0
- 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 +375 -263
- package/dist/components/day-grid-view/defaults.js +1 -1
- package/dist/components/month-view/MonthEventItem.d.ts +22 -0
- package/dist/components/month-view/MonthEventItem.d.ts.map +1 -0
- package/dist/components/month-view/MonthEventItem.js +95 -0
- package/dist/components/month-view/MonthMoreButton.d.ts +22 -0
- package/dist/components/month-view/MonthMoreButton.d.ts.map +1 -0
- package/dist/components/month-view/MonthMoreButton.js +122 -0
- package/dist/components/month-view/MonthView.d.ts +3 -0
- package/dist/components/month-view/MonthView.d.ts.map +1 -0
- package/dist/components/month-view/MonthView.js +281 -0
- package/dist/components/month-view/MonthWeekRow.d.ts +40 -0
- package/dist/components/month-view/MonthWeekRow.d.ts.map +1 -0
- package/dist/components/month-view/MonthWeekRow.js +192 -0
- package/dist/components/month-view/defaults.d.ts +3 -0
- package/dist/components/month-view/defaults.d.ts.map +1 -0
- package/dist/components/month-view/defaults.js +32 -0
- package/dist/components/month-view/index.d.ts +3 -0
- package/dist/components/month-view/index.d.ts.map +1 -0
- 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 +163 -155
- package/dist/components/resource-grid-view/defaults.js +1 -1
- package/dist/components/shared/AnchoredPopover.d.ts +35 -0
- package/dist/components/shared/AnchoredPopover.d.ts.map +1 -0
- package/dist/components/shared/AnchoredPopover.js +91 -0
- package/dist/components/shared/EventChip.d.ts.map +1 -1
- package/dist/components/shared/EventChip.js +58 -64
- package/dist/components/shared/OverflowChip.d.ts.map +1 -1
- package/dist/components/shared/OverflowChip.js +67 -89
- package/dist/components/shared/SelectionOverlay.d.ts +1 -0
- package/dist/components/shared/SelectionOverlay.d.ts.map +1 -1
- package/dist/components/shared/SelectionOverlay.js +28 -27
- package/dist/components/shared/SlotInteractionLayer.d.ts +27 -5
- package/dist/components/shared/SlotInteractionLayer.d.ts.map +1 -1
- package/dist/components/shared/SlotInteractionLayer.js +186 -145
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -10
- package/dist/lib/accessibility.d.ts +8 -0
- package/dist/lib/accessibility.d.ts.map +1 -1
- package/dist/lib/accessibility.js +31 -4
- package/dist/lib/lanes.d.ts +25 -0
- package/dist/lib/lanes.d.ts.map +1 -0
- package/dist/lib/lanes.js +32 -0
- package/dist/lib/month.d.ts +64 -0
- package/dist/lib/month.d.ts.map +1 -0
- package/dist/lib/month.js +110 -0
- package/dist/lib/overlap.d.ts.map +1 -1
- package/dist/lib/overlap.js +157 -179
- package/dist/lib/time.d.ts +4 -0
- package/dist/lib/time.d.ts.map +1 -1
- package/dist/lib/time.js +20 -12
- package/dist/types/calendar.d.ts +164 -0
- package/dist/types/calendar.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,205 +1,246 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { computeAutoScrollIntensity as
|
|
4
|
-
import { buildSyntheticEvent as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
endHour: $,
|
|
18
|
-
hourHeight: Z,
|
|
1
|
+
import { jsxs as St, jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { memo as Ct, useState as rt, useRef as r, useCallback as l, useLayoutEffect as yt, useEffect as Tt } from "react";
|
|
3
|
+
import { computeAutoScrollIntensity as Lt, findVerticalScrollParent as Pt, createVerticalAutoScroller as Yt } from "../../lib/autoScroll.js";
|
|
4
|
+
import { buildSyntheticEvent as bt } from "../../lib/selection.js";
|
|
5
|
+
import { minutesToZonedDateTime as M } from "../../lib/time.js";
|
|
6
|
+
import { EventChip as xt } from "./EventChip.js";
|
|
7
|
+
import { DISMISS_ONLY_ATTR as It } from "./AnchoredPopover.js";
|
|
8
|
+
const At = Ct(function({
|
|
9
|
+
columnId: u,
|
|
10
|
+
fallbackColor: ot,
|
|
11
|
+
column: ct,
|
|
12
|
+
date: a,
|
|
13
|
+
timeZone: s,
|
|
14
|
+
startHour: ut,
|
|
15
|
+
endHour: st,
|
|
16
|
+
hourHeight: it,
|
|
19
17
|
snapDuration: y,
|
|
20
18
|
placeholderDuration: i,
|
|
21
|
-
cls:
|
|
22
|
-
onSlotClick:
|
|
19
|
+
cls: P,
|
|
20
|
+
onSlotClick: Y,
|
|
23
21
|
onSelect: g,
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
onSlotHover: J,
|
|
23
|
+
resolveColumnId: K,
|
|
24
|
+
onDragPreviewChange: O,
|
|
25
|
+
previewRange: lt,
|
|
26
|
+
dragPreviewAppearance: Q = "highlight",
|
|
27
|
+
renderEvent: at
|
|
26
28
|
}) {
|
|
27
|
-
const [
|
|
28
|
-
}),
|
|
29
|
-
(
|
|
30
|
-
const
|
|
31
|
-
return
|
|
29
|
+
const [w, H] = rt(null), [ft, dt] = rt(null), f = O ? lt : ft, T = r(null), h = r(null), N = r(!1), b = r(0), X = r(0), W = r(null), x = r(null), v = r(null), $ = r(() => {
|
|
30
|
+
}), Z = r(g), F = r(K), tt = r(O), j = r(u), A = r(a), D = r(s), p = ut * 60, I = st * 60, d = it / 60, m = l(
|
|
31
|
+
(t) => {
|
|
32
|
+
const e = t / d, n = Math.floor(e / y) * y, c = p + n;
|
|
33
|
+
return c + i > I || c < p ? null : c;
|
|
32
34
|
},
|
|
33
35
|
[
|
|
34
|
-
|
|
36
|
+
d,
|
|
35
37
|
y,
|
|
36
38
|
i,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
p,
|
|
40
|
+
I
|
|
39
41
|
]
|
|
40
|
-
),
|
|
41
|
-
const
|
|
42
|
-
Math.max(
|
|
43
|
-
|
|
42
|
+
), nt = r(m), U = r(I), mt = r(y), V = r(i), et = l((t, e) => {
|
|
43
|
+
const n = Math.min(t, e), c = Math.min(
|
|
44
|
+
Math.max(t, e) + V.current,
|
|
45
|
+
U.current
|
|
44
46
|
);
|
|
45
|
-
return { startMin:
|
|
46
|
-
}, []),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
47
|
+
return { startMin: n, endMin: c };
|
|
48
|
+
}, []), R = l((t) => {
|
|
49
|
+
const e = tt.current;
|
|
50
|
+
e ? e(t) : dt(
|
|
51
|
+
t && { startMin: t.startMin, endMin: t.endMin }
|
|
52
|
+
);
|
|
53
|
+
}, []), _ = l(
|
|
54
|
+
(t, e) => {
|
|
55
|
+
const n = h.current, c = T.current;
|
|
56
|
+
if (!n || !c) return;
|
|
57
|
+
const o = c.getBoundingClientRect(), C = Math.max(0, Math.min(e - o.top, o.height));
|
|
58
|
+
let z = nt.current(C);
|
|
59
|
+
z == null && (z = U.current - V.current);
|
|
60
|
+
const L = et(n.anchorSlotStart, z), G = F.current?.(t) ?? n.currentColumnId, Et = n.moved && n.currentStartMin === L.startMin && n.currentEndMin === L.endMin && n.currentColumnId === G;
|
|
61
|
+
n.currentStartMin = L.startMin, n.currentEndMin = L.endMin, n.currentColumnId = G, n.moved = !0, Et || R({
|
|
62
|
+
columnId: j.current,
|
|
63
|
+
endColumnId: G,
|
|
64
|
+
...L
|
|
65
|
+
});
|
|
55
66
|
},
|
|
56
|
-
[
|
|
67
|
+
[et, R]
|
|
57
68
|
), E = l(
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
const
|
|
63
|
-
|
|
69
|
+
(t) => {
|
|
70
|
+
b.current = t.clientY, X.current = t.clientX, _(t.clientX, t.clientY);
|
|
71
|
+
const e = x.current;
|
|
72
|
+
if (!e) return;
|
|
73
|
+
const n = e.getBoundingClientRect();
|
|
74
|
+
Lt(t.clientY, n.top, n.bottom) !== 0 && v.current?.ensure();
|
|
64
75
|
},
|
|
65
|
-
[
|
|
66
|
-
),
|
|
67
|
-
}),
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
columnId:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
[_]
|
|
77
|
+
), k = r(() => {
|
|
78
|
+
}), q = l(() => {
|
|
79
|
+
v.current?.stop(), v.current = null, x.current = null;
|
|
80
|
+
const t = h.current;
|
|
81
|
+
t && (t.moved && (N.current = !0), Z.current?.({
|
|
82
|
+
columnId: j.current,
|
|
83
|
+
...F.current ? { endColumnId: t.currentColumnId } : {},
|
|
84
|
+
startTime: M(
|
|
85
|
+
A.current,
|
|
86
|
+
t.currentStartMin,
|
|
87
|
+
D.current
|
|
76
88
|
),
|
|
77
|
-
endTime:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
endTime: M(
|
|
90
|
+
A.current,
|
|
91
|
+
t.currentEndMin,
|
|
92
|
+
D.current
|
|
81
93
|
)
|
|
82
|
-
})),
|
|
94
|
+
})), h.current = null, R(null), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", k.current);
|
|
95
|
+
}, [E, R]);
|
|
96
|
+
yt(() => {
|
|
97
|
+
Z.current = g, F.current = K, tt.current = O, j.current = u, A.current = a, D.current = s, nt.current = m, U.current = I, mt.current = y, V.current = i, k.current = q, $.current = _;
|
|
98
|
+
}), Tt(() => () => {
|
|
99
|
+
v.current?.stop(), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", k.current);
|
|
83
100
|
}, [E]);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
const S = l(
|
|
102
|
+
(t) => {
|
|
103
|
+
W.current !== t && (W.current = t, J?.(
|
|
104
|
+
t == null ? null : {
|
|
105
|
+
columnId: u,
|
|
106
|
+
startTime: M(a, t, s),
|
|
107
|
+
endTime: M(
|
|
108
|
+
a,
|
|
109
|
+
t + i,
|
|
110
|
+
s
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
));
|
|
114
|
+
},
|
|
115
|
+
[J, u, a, s, i]
|
|
116
|
+
), Mt = l(
|
|
117
|
+
(t) => {
|
|
91
118
|
if (!g) return;
|
|
92
|
-
const
|
|
93
|
-
if (!
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
anchorSlotStart:
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
const e = T.current;
|
|
120
|
+
if (!e) return;
|
|
121
|
+
const n = e.getBoundingClientRect(), c = t.clientY - n.top, o = m(c);
|
|
122
|
+
if (o == null) return;
|
|
123
|
+
t.preventDefault(), g(null), H(null), S(null);
|
|
124
|
+
const C = o + i;
|
|
125
|
+
h.current = {
|
|
126
|
+
anchorSlotStart: o,
|
|
127
|
+
currentColumnId: u,
|
|
128
|
+
currentStartMin: o,
|
|
129
|
+
currentEndMin: C,
|
|
102
130
|
moved: !1
|
|
103
|
-
},
|
|
104
|
-
getPointerY: () =>
|
|
105
|
-
getScrollParent: () =>
|
|
106
|
-
onScroll: () =>
|
|
107
|
-
|
|
131
|
+
}, b.current = t.clientY, X.current = t.clientX, x.current = Pt(e), v.current?.stop(), v.current = Yt({
|
|
132
|
+
getPointerY: () => b.current,
|
|
133
|
+
getScrollParent: () => x.current,
|
|
134
|
+
onScroll: () => $.current(
|
|
135
|
+
X.current,
|
|
136
|
+
b.current
|
|
137
|
+
)
|
|
138
|
+
}), R({
|
|
139
|
+
columnId: u,
|
|
140
|
+
endColumnId: u,
|
|
141
|
+
startMin: o,
|
|
142
|
+
endMin: C
|
|
143
|
+
}), document.addEventListener("mousemove", E), document.addEventListener("mouseup", q);
|
|
108
144
|
},
|
|
109
145
|
[
|
|
110
146
|
g,
|
|
111
|
-
|
|
147
|
+
m,
|
|
112
148
|
i,
|
|
113
149
|
E,
|
|
114
|
-
|
|
150
|
+
q,
|
|
151
|
+
u,
|
|
152
|
+
R,
|
|
153
|
+
S
|
|
115
154
|
]
|
|
116
|
-
),
|
|
117
|
-
(
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
const
|
|
122
|
-
|
|
155
|
+
), gt = l(
|
|
156
|
+
(t) => {
|
|
157
|
+
if (h.current || t.buttons !== 0) return;
|
|
158
|
+
const e = T.current;
|
|
159
|
+
if (!e) return;
|
|
160
|
+
const n = e.getBoundingClientRect(), c = t.clientY - n.top, o = m(c);
|
|
161
|
+
H(o), S(o);
|
|
123
162
|
},
|
|
124
|
-
[
|
|
125
|
-
),
|
|
126
|
-
|
|
127
|
-
}, []),
|
|
128
|
-
(
|
|
129
|
-
if (
|
|
130
|
-
|
|
163
|
+
[m, S]
|
|
164
|
+
), ht = l(() => {
|
|
165
|
+
h.current || (H(null), S(null));
|
|
166
|
+
}, [S]), vt = l(
|
|
167
|
+
(t) => {
|
|
168
|
+
if (N.current) {
|
|
169
|
+
N.current = !1;
|
|
131
170
|
return;
|
|
132
171
|
}
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
columnId:
|
|
140
|
-
startTime:
|
|
141
|
-
endTime:
|
|
172
|
+
const e = T.current;
|
|
173
|
+
if (!e) return;
|
|
174
|
+
const n = e.getBoundingClientRect(), c = t.clientY - n.top, o = m(c);
|
|
175
|
+
if (o == null) return;
|
|
176
|
+
const C = o + i;
|
|
177
|
+
Y && Y({
|
|
178
|
+
columnId: u,
|
|
179
|
+
startTime: M(a, o, s),
|
|
180
|
+
endTime: M(a, C, s)
|
|
142
181
|
});
|
|
143
182
|
},
|
|
144
|
-
[
|
|
145
|
-
),
|
|
146
|
-
return /* @__PURE__ */
|
|
183
|
+
[Y, m, i, u, a, s]
|
|
184
|
+
), pt = w != null ? (w - p) * d : 0, Rt = i * d;
|
|
185
|
+
return /* @__PURE__ */ St(
|
|
147
186
|
"div",
|
|
148
187
|
{
|
|
149
|
-
ref:
|
|
188
|
+
ref: T,
|
|
189
|
+
[It]: "",
|
|
190
|
+
"data-slot-column": u,
|
|
150
191
|
style: {
|
|
151
192
|
gridRow: "3 / -1",
|
|
152
|
-
gridColumn:
|
|
193
|
+
gridColumn: ct,
|
|
153
194
|
position: "relative",
|
|
154
195
|
pointerEvents: "auto",
|
|
155
|
-
cursor:
|
|
196
|
+
cursor: Y || g ? "pointer" : void 0
|
|
156
197
|
},
|
|
157
|
-
onMouseDown:
|
|
158
|
-
onMouseMove:
|
|
159
|
-
onMouseLeave:
|
|
160
|
-
onClick:
|
|
198
|
+
onMouseDown: Mt,
|
|
199
|
+
onMouseMove: gt,
|
|
200
|
+
onMouseLeave: ht,
|
|
201
|
+
onClick: vt,
|
|
161
202
|
children: [
|
|
162
|
-
|
|
203
|
+
w != null && !f && /* @__PURE__ */ B(
|
|
163
204
|
"div",
|
|
164
205
|
{
|
|
165
206
|
"aria-hidden": "true",
|
|
166
|
-
className:
|
|
207
|
+
className: P("slotHighlight"),
|
|
167
208
|
style: {
|
|
168
209
|
position: "absolute",
|
|
169
|
-
top:
|
|
210
|
+
top: pt,
|
|
170
211
|
left: 0,
|
|
171
212
|
right: 0,
|
|
172
|
-
height:
|
|
213
|
+
height: Rt,
|
|
173
214
|
pointerEvents: "none"
|
|
174
215
|
}
|
|
175
216
|
}
|
|
176
217
|
),
|
|
177
|
-
|
|
218
|
+
f && (Q !== "highlight" ? /* @__PURE__ */ B(
|
|
178
219
|
"div",
|
|
179
220
|
{
|
|
180
221
|
"aria-hidden": "true",
|
|
181
|
-
className:
|
|
222
|
+
className: P("eventColumn"),
|
|
182
223
|
style: { pointerEvents: "none" },
|
|
183
224
|
children: /* @__PURE__ */ B(
|
|
184
|
-
|
|
225
|
+
xt,
|
|
185
226
|
{
|
|
186
227
|
interactive: !1,
|
|
187
228
|
positioned: {
|
|
188
|
-
event:
|
|
229
|
+
event: bt(
|
|
189
230
|
"",
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
231
|
+
M(a, f.startMin, s),
|
|
232
|
+
M(a, f.endMin, s),
|
|
233
|
+
Q.eventData
|
|
193
234
|
),
|
|
194
|
-
top: (
|
|
195
|
-
height: (
|
|
235
|
+
top: (f.startMin - p) * d,
|
|
236
|
+
height: (f.endMin - f.startMin) * d,
|
|
196
237
|
subColumn: 0,
|
|
197
238
|
totalSubColumns: 1
|
|
198
239
|
},
|
|
199
|
-
fallbackColor:
|
|
200
|
-
timeZone:
|
|
201
|
-
cls:
|
|
202
|
-
renderEvent:
|
|
240
|
+
fallbackColor: ot,
|
|
241
|
+
timeZone: s,
|
|
242
|
+
cls: P,
|
|
243
|
+
renderEvent: at
|
|
203
244
|
}
|
|
204
245
|
)
|
|
205
246
|
}
|
|
@@ -207,13 +248,13 @@ const Ct = at(function({
|
|
|
207
248
|
"div",
|
|
208
249
|
{
|
|
209
250
|
"aria-hidden": "true",
|
|
210
|
-
className:
|
|
251
|
+
className: P("selectionHighlight"),
|
|
211
252
|
style: {
|
|
212
253
|
position: "absolute",
|
|
213
|
-
top: (
|
|
254
|
+
top: (f.startMin - p) * d,
|
|
214
255
|
left: 0,
|
|
215
256
|
right: 0,
|
|
216
|
-
height: (
|
|
257
|
+
height: (f.endMin - f.startMin) * d,
|
|
217
258
|
pointerEvents: "none"
|
|
218
259
|
}
|
|
219
260
|
}
|
|
@@ -223,5 +264,5 @@ const Ct = at(function({
|
|
|
223
264
|
);
|
|
224
265
|
});
|
|
225
266
|
export {
|
|
226
|
-
|
|
267
|
+
At as SlotInteractionLayer
|
|
227
268
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { Temporal } from 'temporal-polyfill';
|
|
2
2
|
export { ResourceGridView } from './components/resource-grid-view';
|
|
3
3
|
export { DayGridView } from './components/day-grid-view';
|
|
4
|
+
export { MonthView } from './components/month-view';
|
|
4
5
|
export { resourceGridViewDefaults } from './components/resource-grid-view';
|
|
5
6
|
export { dayGridViewDefaults } from './components/day-grid-view';
|
|
6
|
-
export
|
|
7
|
+
export { monthViewDefaults } from './components/month-view';
|
|
8
|
+
export type { CalendarResource, CalendarEvent, TimedCalendarEvent, AllDayCalendarEvent, TimeSlot, AvailabilityRange, BackgroundEvent, TimeAxisConfig, ResourceGridViewProps, ResourceGridViewClassNames, GridViewClassNames, DayGridViewProps, DayGridViewClassNames, DayGridSelectedRange, PositionedEvent, OverflowClickInfo, OverflowPopoverRenderProps, SelectedRange, SelectionAppearance, SelectionEventData, EventLayout, MonthViewProps, MonthViewClassNames, MonthSelectedRange, MonthOverflowClickInfo, MonthOverflowPopoverRenderProps, } from './types/calendar';
|
|
7
9
|
export { cn } from './lib/utils';
|
|
8
10
|
export { timedEvent, allDayEvent } from './lib/events';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { Temporal as o } from "temporal-polyfill";
|
|
2
2
|
import { cn as f } from "./lib/utils.js";
|
|
3
|
-
import { allDayEvent as
|
|
4
|
-
import { DayGridView as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { allDayEvent as i, timedEvent as p } from "./lib/events.js";
|
|
4
|
+
import { DayGridView as a } from "./components/day-grid-view/DayGridView.js";
|
|
5
|
+
import { MonthView as l } from "./components/month-view/MonthView.js";
|
|
6
|
+
import { ResourceGridView as V } from "./components/resource-grid-view/ResourceGridView.js";
|
|
7
|
+
import { dayGridViewDefaults as s } from "./components/day-grid-view/defaults.js";
|
|
8
|
+
import { monthViewDefaults as D } from "./components/month-view/defaults.js";
|
|
9
|
+
import { resourceGridViewDefaults as c } from "./components/resource-grid-view/defaults.js";
|
|
8
10
|
export {
|
|
9
|
-
|
|
10
|
-
l as
|
|
11
|
+
a as DayGridView,
|
|
12
|
+
l as MonthView,
|
|
13
|
+
V as ResourceGridView,
|
|
11
14
|
o as Temporal,
|
|
12
|
-
|
|
15
|
+
i as allDayEvent,
|
|
13
16
|
f as cn,
|
|
14
|
-
|
|
15
|
-
D as
|
|
17
|
+
s as dayGridViewDefaults,
|
|
18
|
+
D as monthViewDefaults,
|
|
19
|
+
c as resourceGridViewDefaults,
|
|
16
20
|
p as timedEvent
|
|
17
21
|
};
|
|
@@ -3,4 +3,12 @@ import { CalendarEvent } from '../types/calendar';
|
|
|
3
3
|
export declare function getEventLabel(event: CalendarEvent): string;
|
|
4
4
|
/** Returns a plain-text client name string, or undefined if not set. */
|
|
5
5
|
export declare function getClientNameLabel(event: CalendarEvent): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Plain-text description of an event: title, optionally the date(s) it
|
|
8
|
+
* covers, time range (or "all day"), client name, and optionally its status.
|
|
9
|
+
*/
|
|
10
|
+
export declare function describeEvent(event: CalendarEvent, timeZone: string, { includeStatus, includeDate, }?: {
|
|
11
|
+
includeStatus?: boolean;
|
|
12
|
+
includeDate?: boolean;
|
|
13
|
+
}): string;
|
|
6
14
|
//# sourceMappingURL=accessibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../src/lib/accessibility.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../src/lib/accessibility.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAK3E;AAUD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,MAAM,EAChB,EACE,aAAqB,EACrB,WAAmB,GACpB,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACzD,MAAM,CAuBR"}
|
|
@@ -1,11 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
import { getMonthEventSpan as c } from "./month.js";
|
|
2
|
+
import { formatTimeRange as u } from "./time.js";
|
|
3
|
+
function f(t) {
|
|
2
4
|
return t.ariaLabel ?? String(t.title);
|
|
3
5
|
}
|
|
4
|
-
function
|
|
6
|
+
function m(t) {
|
|
5
7
|
if (t.clientName)
|
|
6
8
|
return typeof t.clientName == "string" ? t.clientName : String(t.clientName);
|
|
7
9
|
}
|
|
10
|
+
function i(t) {
|
|
11
|
+
return t.toLocaleString("en-US", {
|
|
12
|
+
weekday: "long",
|
|
13
|
+
month: "long",
|
|
14
|
+
day: "numeric"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function d(t, n, {
|
|
18
|
+
includeStatus: o = !1,
|
|
19
|
+
includeDate: s = !1
|
|
20
|
+
} = {}) {
|
|
21
|
+
const a = [f(t)];
|
|
22
|
+
if (s) {
|
|
23
|
+
const { startDate: e, endDate: l } = c(t, n);
|
|
24
|
+
a.push(
|
|
25
|
+
e.equals(l) ? i(e) : `${i(e)} to ${i(l)}`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
a.push(
|
|
29
|
+
t.allDay ? "all day" : u(t.startTime, t.endTime, n)
|
|
30
|
+
);
|
|
31
|
+
const r = m(t);
|
|
32
|
+
return r && a.push(r), o && (t.status === "canceled" ? a.push("canceled") : t.status === "tentative" && a.push("tentative")), a.join(", ");
|
|
33
|
+
}
|
|
8
34
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
35
|
+
d as describeEvent,
|
|
36
|
+
m as getClientNameLabel,
|
|
37
|
+
f as getEventLabel
|
|
11
38
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
export interface ClippedSpan {
|
|
3
|
+
/** 0-based first column */
|
|
4
|
+
startCol: number;
|
|
5
|
+
/** Number of columns covered */
|
|
6
|
+
span: number;
|
|
7
|
+
/** Starts before the first date */
|
|
8
|
+
continuesBefore: boolean;
|
|
9
|
+
/** Ends after the last date */
|
|
10
|
+
continuesAfter: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Clips an inclusive date range to a run of consecutive dates, or returns
|
|
14
|
+
* null when it doesn't overlap them.
|
|
15
|
+
*/
|
|
16
|
+
export declare function clipDateSpan(startDate: Temporal.PlainDate, endDate: Temporal.PlainDate, dates: Temporal.PlainDate[]): ClippedSpan | null;
|
|
17
|
+
/**
|
|
18
|
+
* Greedily gives each item, in order, the first lane that's free across
|
|
19
|
+
* every column it covers. Returns the lane for each item.
|
|
20
|
+
*/
|
|
21
|
+
export declare function assignLanes(items: {
|
|
22
|
+
startCol: number;
|
|
23
|
+
span: number;
|
|
24
|
+
}[], columnCount: number): number[];
|
|
25
|
+
//# sourceMappingURL=lanes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lanes.d.ts","sourceRoot":"","sources":["../../src/lib/lanes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,+BAA+B;IAC/B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,OAAO,EAAE,QAAQ,CAAC,SAAS,EAC3B,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,GAC1B,WAAW,GAAG,IAAI,CA0BpB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAC3C,WAAW,EAAE,MAAM,GAClB,MAAM,EAAE,CAiBV"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Temporal as s } from "temporal-polyfill";
|
|
2
|
+
function f(l, o, n) {
|
|
3
|
+
if (n.length === 0) return null;
|
|
4
|
+
const e = n[0], i = n[n.length - 1];
|
|
5
|
+
if (s.PlainDate.compare(l, i) > 0 || s.PlainDate.compare(o, e) < 0)
|
|
6
|
+
return null;
|
|
7
|
+
const a = s.PlainDate.compare(l, e) < 0, t = s.PlainDate.compare(o, i) > 0, r = a ? 0 : l.since(e, { largestUnit: "days" }).days, c = t ? n.length - 1 : o.since(e, { largestUnit: "days" }).days;
|
|
8
|
+
return {
|
|
9
|
+
startCol: r,
|
|
10
|
+
span: c - r + 1,
|
|
11
|
+
continuesBefore: a,
|
|
12
|
+
continuesAfter: t
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function p(l, o) {
|
|
16
|
+
const n = [];
|
|
17
|
+
return l.map(({ startCol: e, span: i }) => {
|
|
18
|
+
const a = e + i - 1;
|
|
19
|
+
let t = n.findIndex((r) => {
|
|
20
|
+
for (let c = e; c <= a; c++)
|
|
21
|
+
if (r[c]) return !1;
|
|
22
|
+
return !0;
|
|
23
|
+
});
|
|
24
|
+
t === -1 && (t = n.length, n.push(new Array(o).fill(!1)));
|
|
25
|
+
for (let r = e; r <= a; r++) n[t][r] = !0;
|
|
26
|
+
return t;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
p as assignLanes,
|
|
31
|
+
f as clipDateSpan
|
|
32
|
+
};
|