@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.
Files changed (55) hide show
  1. package/README.md +109 -41
  2. package/dist/components/day-grid-view/AllDaySection.d.ts +2 -0
  3. package/dist/components/day-grid-view/AllDaySection.d.ts.map +1 -1
  4. package/dist/components/day-grid-view/AllDaySection.js +111 -75
  5. package/dist/components/day-grid-view/DayColumn.d.ts +2 -24
  6. package/dist/components/day-grid-view/DayColumn.d.ts.map +1 -1
  7. package/dist/components/day-grid-view/DayGridView.d.ts +1 -1
  8. package/dist/components/day-grid-view/DayGridView.d.ts.map +1 -1
  9. package/dist/components/day-grid-view/DayGridView.js +330 -275
  10. package/dist/components/day-grid-view/defaults.d.ts.map +1 -1
  11. package/dist/components/day-grid-view/defaults.js +1 -0
  12. package/dist/components/month-view/MonthView.d.ts.map +1 -1
  13. package/dist/components/month-view/MonthView.js +184 -165
  14. package/dist/components/month-view/MonthWeekRow.d.ts +1 -0
  15. package/dist/components/month-view/MonthWeekRow.d.ts.map +1 -1
  16. package/dist/components/month-view/MonthWeekRow.js +95 -89
  17. package/dist/components/resource-grid-view/ResourceColumn.d.ts +3 -21
  18. package/dist/components/resource-grid-view/ResourceColumn.d.ts.map +1 -1
  19. package/dist/components/resource-grid-view/ResourceColumn.js +13 -6
  20. package/dist/components/resource-grid-view/ResourceGridView.d.ts +1 -1
  21. package/dist/components/resource-grid-view/ResourceGridView.d.ts.map +1 -1
  22. package/dist/components/resource-grid-view/ResourceGridView.js +348 -300
  23. package/dist/components/resource-grid-view/defaults.d.ts.map +1 -1
  24. package/dist/components/resource-grid-view/defaults.js +1 -0
  25. package/dist/components/shared/AllDayRow.d.ts.map +1 -1
  26. package/dist/components/shared/AllDayRow.js +21 -22
  27. package/dist/components/shared/EventChip.d.ts +4 -0
  28. package/dist/components/shared/EventChip.d.ts.map +1 -1
  29. package/dist/components/shared/EventChip.js +63 -51
  30. package/dist/components/shared/SelectionOverlay.d.ts +4 -0
  31. package/dist/components/shared/SelectionOverlay.d.ts.map +1 -1
  32. package/dist/components/shared/SelectionOverlay.js +38 -33
  33. package/dist/components/shared/SlotInteractionLayer.d.ts +5 -0
  34. package/dist/components/shared/SlotInteractionLayer.d.ts.map +1 -1
  35. package/dist/components/shared/SlotInteractionLayer.js +201 -176
  36. package/dist/components/shared/TimedEventLayer.d.ts +5 -2
  37. package/dist/components/shared/TimedEventLayer.d.ts.map +1 -1
  38. package/dist/components/shared/TimedEventLayer.js +57 -51
  39. package/dist/components/shared/useEventDrag.d.ts +36 -0
  40. package/dist/components/shared/useEventDrag.d.ts.map +1 -0
  41. package/dist/components/shared/useEventDrag.js +156 -0
  42. package/dist/components/shared/useLingeringValue.d.ts +7 -0
  43. package/dist/components/shared/useLingeringValue.d.ts.map +1 -0
  44. package/dist/components/shared/useLingeringValue.js +17 -0
  45. package/dist/components/shared/useTouchDrag.d.ts +38 -0
  46. package/dist/components/shared/useTouchDrag.d.ts.map +1 -0
  47. package/dist/components/shared/useTouchDrag.js +51 -0
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/lib/autoScroll.d.ts +30 -9
  51. package/dist/lib/autoScroll.d.ts.map +1 -1
  52. package/dist/lib/autoScroll.js +57 -51
  53. package/dist/types/calendar.d.ts +50 -0
  54. package/dist/types/calendar.d.ts.map +1 -1
  55. package/package.json +1 -1
@@ -1,246 +1,271 @@
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,
1
+ import { jsxs as bt, jsx as B } from "react/jsx-runtime";
2
+ import { memo as xt, useState as lt, useRef as e, useCallback as u, useLayoutEffect as wt, useEffect as It } from "react";
3
+ import { findVerticalScrollParent as Yt, createAutoScroller as Ht } from "../../lib/autoScroll.js";
4
+ import { buildSyntheticEvent as Ot } from "../../lib/selection.js";
5
+ import { minutesToZonedDateTime as g } from "../../lib/time.js";
6
+ import { EventChip as Bt } from "./EventChip.js";
7
+ import { DISMISS_ONLY_ATTR as Nt } from "./AnchoredPopover.js";
8
+ import { useTouchDrag as _t, TOUCH_DRAG_STYLE as Ft } from "./useTouchDrag.js";
9
+ const Jt = xt(function({
10
+ columnId: s,
11
+ fallbackColor: at,
12
+ column: ft,
12
13
  date: a,
13
- timeZone: s,
14
- startHour: ut,
15
- endHour: st,
16
- hourHeight: it,
17
- snapDuration: y,
18
- placeholderDuration: i,
19
- cls: P,
20
- onSlotClick: Y,
21
- onSelect: g,
22
- onSlotHover: J,
23
- resolveColumnId: K,
24
- onDragPreviewChange: O,
25
- previewRange: lt,
26
- dragPreviewAppearance: Q = "highlight",
27
- renderEvent: at
14
+ timeZone: i,
15
+ startHour: dt,
16
+ endHour: mt,
17
+ hourHeight: Mt,
18
+ snapDuration: L,
19
+ placeholderDuration: l,
20
+ cls: D,
21
+ onSlotClick: b,
22
+ onSelect: f,
23
+ onSlotHover: W,
24
+ resolveColumnId: $,
25
+ getScrollViewportLeft: Z,
26
+ onDragPreviewChange: N,
27
+ previewRange: gt,
28
+ dragPreviewAppearance: tt = "highlight",
29
+ renderEvent: ht
28
30
  }) {
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
+ const [_, F] = lt(null), [vt, pt] = lt(null), d = N ? gt : vt, h = e(null), v = e(null), U = e(!1), x = e(0), w = e(0), nt = e(null), X = e(null), p = e(null), rt = e(() => {
32
+ }), et = e(f), I = e($), ot = e(Z), ut = e(N), j = e(s), A = e(a), V = e(i), R = dt * 60, Y = mt * 60, m = Mt / 60, M = u(
31
33
  (t) => {
32
- const e = t / d, n = Math.floor(e / y) * y, c = p + n;
33
- return c + i > I || c < p ? null : c;
34
+ const n = t / m, r = Math.floor(n / L) * L, c = R + r;
35
+ return c + l > Y || c < R ? null : c;
34
36
  },
35
37
  [
36
- d,
37
- y,
38
- i,
39
- p,
40
- I
38
+ m,
39
+ L,
40
+ l,
41
+ R,
42
+ Y
41
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
+ ), ct = e(M), z = e(Y), Rt = e(L), G = e(l), st = u((t, n) => {
45
+ const r = Math.min(t, n), c = Math.min(
46
+ Math.max(t, n) + G.current,
47
+ z.current
46
48
  );
47
- return { startMin: n, endMin: c };
48
- }, []), R = l((t) => {
49
- const e = tt.current;
50
- e ? e(t) : dt(
49
+ return { startMin: r, endMin: c };
50
+ }, []), E = u((t) => {
51
+ const n = ut.current;
52
+ n ? n(t) : pt(
51
53
  t && { startMin: t.startMin, endMin: t.endMin }
52
54
  );
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({
55
+ }, []), k = u(
56
+ (t, n) => {
57
+ const r = v.current, c = h.current;
58
+ if (!r || !c) return;
59
+ const o = c.getBoundingClientRect(), T = Math.max(0, Math.min(n - o.top, o.height));
60
+ let K = ct.current(T);
61
+ K == null && (K = z.current - G.current);
62
+ const P = st(r.anchorSlotStart, K), Q = I.current?.(t) ?? r.currentColumnId, Dt = r.moved && r.currentStartMin === P.startMin && r.currentEndMin === P.endMin && r.currentColumnId === Q;
63
+ r.currentStartMin = P.startMin, r.currentEndMin = P.endMin, r.currentColumnId = Q, r.moved = !0, Dt || E({
62
64
  columnId: j.current,
63
- endColumnId: G,
64
- ...L
65
+ endColumnId: Q,
66
+ ...P
65
67
  });
66
68
  },
67
- [et, R]
68
- ), E = l(
69
+ [st, E]
70
+ ), H = u(
71
+ (t, n) => {
72
+ x.current = n, w.current = t, k(t, n), p.current?.ensure();
73
+ },
74
+ [k]
75
+ ), C = u(
76
+ (t) => H(t.clientX, t.clientY),
77
+ [H]
78
+ ), q = e(() => {
79
+ }), y = u(
69
80
  (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();
81
+ p.current?.stop(), p.current = null, X.current = null;
82
+ const n = v.current;
83
+ n && t && (n.moved && (U.current = !0), et.current?.({
84
+ columnId: j.current,
85
+ ...I.current ? { endColumnId: n.currentColumnId } : {},
86
+ startTime: g(
87
+ A.current,
88
+ n.currentStartMin,
89
+ V.current
90
+ ),
91
+ endTime: g(
92
+ A.current,
93
+ n.currentEndMin,
94
+ V.current
95
+ )
96
+ })), v.current = null, E(null), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", q.current);
75
97
  },
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
88
- ),
89
- endTime: M(
90
- A.current,
91
- t.currentEndMin,
92
- D.current
93
- )
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);
100
- }, [E]);
101
- const S = l(
98
+ [C, E]
99
+ ), J = u(() => y(!0), [y]);
100
+ wt(() => {
101
+ et.current = f, I.current = $, ot.current = Z, ut.current = N, j.current = s, A.current = a, V.current = i, ct.current = M, z.current = Y, Rt.current = L, G.current = l, q.current = J, rt.current = k;
102
+ }), It(() => () => {
103
+ p.current?.stop(), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", q.current);
104
+ }, [C]);
105
+ const S = u(
102
106
  (t) => {
103
- W.current !== t && (W.current = t, J?.(
107
+ nt.current !== t && (nt.current = t, W?.(
104
108
  t == null ? null : {
105
- columnId: u,
106
- startTime: M(a, t, s),
107
- endTime: M(
109
+ columnId: s,
110
+ startTime: g(a, t, i),
111
+ endTime: g(
108
112
  a,
109
- t + i,
110
- s
113
+ t + l,
114
+ i
111
115
  )
112
116
  }
113
117
  ));
114
118
  },
115
- [J, u, a, s, i]
116
- ), Mt = l(
117
- (t) => {
118
- if (!g) return;
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 = {
119
+ [W, s, a, i, l]
120
+ ), O = u(
121
+ (t, n) => {
122
+ const r = h.current;
123
+ if (!f || !r) return !1;
124
+ const c = r.getBoundingClientRect(), o = M(n - c.top);
125
+ if (o == null) return !1;
126
+ f(null), F(null), S(null);
127
+ const T = o + l;
128
+ return v.current = {
126
129
  anchorSlotStart: o,
127
- currentColumnId: u,
130
+ currentColumnId: s,
128
131
  currentStartMin: o,
129
- currentEndMin: C,
132
+ currentEndMin: T,
130
133
  moved: !1
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
134
+ }, x.current = n, w.current = t, X.current = Yt(r), p.current?.stop(), p.current = Ht({
135
+ getPointerY: () => x.current,
136
+ getScrollParent: () => X.current,
137
+ // Only a drag that can span columns has a reason to scroll sideways
138
+ horizontal: I.current && {
139
+ getPointerX: () => w.current,
140
+ getViewportLeft: () => ot.current?.()
141
+ },
142
+ onScroll: () => rt.current(
143
+ w.current,
144
+ x.current
137
145
  )
138
- }), R({
139
- columnId: u,
140
- endColumnId: u,
146
+ }), E({
147
+ columnId: s,
148
+ endColumnId: s,
141
149
  startMin: o,
142
- endMin: C
143
- }), document.addEventListener("mousemove", E), document.addEventListener("mouseup", q);
150
+ endMin: T
151
+ }), !0;
144
152
  },
145
153
  [
146
- g,
147
- m,
148
- i,
154
+ f,
155
+ M,
156
+ l,
157
+ s,
149
158
  E,
150
- q,
151
- u,
152
- R,
153
159
  S
154
160
  ]
155
- ), gt = l(
161
+ ), Et = u(
162
+ (t) => {
163
+ O(t.clientX, t.clientY) && (t.preventDefault(), document.addEventListener("mousemove", C), document.addEventListener("mouseup", J));
164
+ },
165
+ [O, C, J]
166
+ ), it = _t(h, f != null), Ct = u(
167
+ (t) => {
168
+ f && it(t, {
169
+ start: O,
170
+ move: H,
171
+ end: () => y(!0),
172
+ cancel: () => y(!1)
173
+ });
174
+ },
175
+ [f, it, O, H, y]
176
+ ), St = u(
156
177
  (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);
178
+ if (v.current || t.buttons !== 0) return;
179
+ const n = h.current;
180
+ if (!n) return;
181
+ const r = n.getBoundingClientRect(), c = t.clientY - r.top, o = M(c);
182
+ F(o), S(o);
162
183
  },
163
- [m, S]
164
- ), ht = l(() => {
165
- h.current || (H(null), S(null));
166
- }, [S]), vt = l(
184
+ [M, S]
185
+ ), Tt = u(() => {
186
+ v.current || (F(null), S(null));
187
+ }, [S]), Lt = u(
167
188
  (t) => {
168
- if (N.current) {
169
- N.current = !1;
189
+ if (U.current) {
190
+ U.current = !1;
170
191
  return;
171
192
  }
172
- const e = T.current;
173
- if (!e) return;
174
- const n = e.getBoundingClientRect(), c = t.clientY - n.top, o = m(c);
193
+ const n = h.current;
194
+ if (!n) return;
195
+ const r = n.getBoundingClientRect(), c = t.clientY - r.top, o = M(c);
175
196
  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)
197
+ const T = o + l;
198
+ b && b({
199
+ columnId: s,
200
+ startTime: g(a, o, i),
201
+ endTime: g(a, T, i)
181
202
  });
182
203
  },
183
- [Y, m, i, u, a, s]
184
- ), pt = w != null ? (w - p) * d : 0, Rt = i * d;
185
- return /* @__PURE__ */ St(
204
+ [b, M, l, s, a, i]
205
+ ), yt = _ != null ? (_ - R) * m : 0, Pt = l * m;
206
+ return /* @__PURE__ */ bt(
186
207
  "div",
187
208
  {
188
- ref: T,
189
- [It]: "",
190
- "data-slot-column": u,
209
+ ref: h,
210
+ [Nt]: "",
211
+ "data-slot-column": s,
191
212
  style: {
192
213
  gridRow: "3 / -1",
193
- gridColumn: ct,
214
+ gridColumn: ft,
194
215
  position: "relative",
195
216
  pointerEvents: "auto",
196
- cursor: Y || g ? "pointer" : void 0
217
+ cursor: b || f ? "pointer" : void 0,
218
+ // A long press starts a touch drag: keep it from selecting text or
219
+ // opening the iOS callout
220
+ ...f && Ft
197
221
  },
198
- onMouseDown: Mt,
199
- onMouseMove: gt,
200
- onMouseLeave: ht,
201
- onClick: vt,
222
+ onPointerDown: Ct,
223
+ onMouseDown: Et,
224
+ onMouseMove: St,
225
+ onMouseLeave: Tt,
226
+ onClick: Lt,
202
227
  children: [
203
- w != null && !f && /* @__PURE__ */ B(
228
+ _ != null && !d && /* @__PURE__ */ B(
204
229
  "div",
205
230
  {
206
231
  "aria-hidden": "true",
207
- className: P("slotHighlight"),
232
+ className: D("slotHighlight"),
208
233
  style: {
209
234
  position: "absolute",
210
- top: pt,
235
+ top: yt,
211
236
  left: 0,
212
237
  right: 0,
213
- height: Rt,
238
+ height: Pt,
214
239
  pointerEvents: "none"
215
240
  }
216
241
  }
217
242
  ),
218
- f && (Q !== "highlight" ? /* @__PURE__ */ B(
243
+ d && (tt !== "highlight" ? /* @__PURE__ */ B(
219
244
  "div",
220
245
  {
221
246
  "aria-hidden": "true",
222
- className: P("eventColumn"),
247
+ className: D("eventColumn"),
223
248
  style: { pointerEvents: "none" },
224
249
  children: /* @__PURE__ */ B(
225
- xt,
250
+ Bt,
226
251
  {
227
252
  interactive: !1,
228
253
  positioned: {
229
- event: bt(
254
+ event: Ot(
230
255
  "",
231
- M(a, f.startMin, s),
232
- M(a, f.endMin, s),
233
- Q.eventData
256
+ g(a, d.startMin, i),
257
+ g(a, d.endMin, i),
258
+ tt.eventData
234
259
  ),
235
- top: (f.startMin - p) * d,
236
- height: (f.endMin - f.startMin) * d,
260
+ top: (d.startMin - R) * m,
261
+ height: (d.endMin - d.startMin) * m,
237
262
  subColumn: 0,
238
263
  totalSubColumns: 1
239
264
  },
240
- fallbackColor: ot,
241
- timeZone: s,
242
- cls: P,
243
- renderEvent: at
265
+ fallbackColor: at,
266
+ timeZone: i,
267
+ cls: D,
268
+ renderEvent: ht
244
269
  }
245
270
  )
246
271
  }
@@ -248,13 +273,13 @@ const At = Ct(function({
248
273
  "div",
249
274
  {
250
275
  "aria-hidden": "true",
251
- className: P("selectionHighlight"),
276
+ className: D("selectionHighlight"),
252
277
  style: {
253
278
  position: "absolute",
254
- top: (f.startMin - p) * d,
279
+ top: (d.startMin - R) * m,
255
280
  left: 0,
256
281
  right: 0,
257
- height: (f.endMin - f.startMin) * d,
282
+ height: (d.endMin - d.startMin) * m,
258
283
  pointerEvents: "none"
259
284
  }
260
285
  }
@@ -264,5 +289,5 @@ const At = Ct(function({
264
289
  );
265
290
  });
266
291
  export {
267
- At as SlotInteractionLayer
292
+ Jt as SlotInteractionLayer
268
293
  };
@@ -1,6 +1,8 @@
1
1
  import { Ref } from 'react';
2
2
  import { CalendarEvent, EventLayout, GridViewClassNames, OverflowClickInfo, OverflowPopoverRenderProps, PositionedEvent, TimedCalendarEvent } from '../../types/calendar';
3
- interface TimedEventLayerProps {
3
+ export interface TimedEventLayerProps {
4
+ /** Identifies the column to event drags (`data-event-column`). */
5
+ columnId: string;
4
6
  positionedEvents: PositionedEvent[];
5
7
  column: number;
6
8
  timeZone: string;
@@ -20,7 +22,8 @@ interface TimedEventLayerProps {
20
22
  eventMaxStack?: number;
21
23
  onOverflowClick?: (info: OverflowClickInfo) => void;
22
24
  renderOverflowPopover?: (props: OverflowPopoverRenderProps) => React.ReactNode;
25
+ dragSourceId?: string | null;
26
+ onEventDragStart?: (event: TimedCalendarEvent, e: React.PointerEvent<HTMLElement>) => void;
23
27
  }
24
28
  export declare const TimedEventLayer: import('react').NamedExoticComponent<TimedEventLayerProps>;
25
- export {};
26
29
  //# sourceMappingURL=TimedEventLayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimedEventLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/TimedEventLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,iBA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, jsx as f } from "react/jsx-runtime";
2
- import { memo as L, useMemo as N } from "react";
3
- import { applyEventOverflow as V, DEFAULT_EVENT_MIN_WIDTH as _, computeMaxVisibleColumns as j } from "../../lib/overlap.js";
4
- import { EventChip as D } from "./EventChip.js";
5
- import { OverflowChip as I } from "./OverflowChip.js";
6
- import { useColumnWidth as O } from "./useColumnWidth.js";
7
- const W = L(function({
8
- positionedEvents: r,
9
- column: p,
10
- timeZone: m,
11
- cls: o,
12
- fallbackColor: v,
13
- onEventClick: t,
1
+ import { jsxs as L, jsx as a } from "react/jsx-runtime";
2
+ import { memo as N, useMemo as V } from "react";
3
+ import { applyEventOverflow as _, DEFAULT_EVENT_MIN_WIDTH as j, computeMaxVisibleColumns as I } from "../../lib/overlap.js";
4
+ import { EventChip as O } from "./EventChip.js";
5
+ import { OverflowChip as R } from "./OverflowChip.js";
6
+ import { useColumnWidth as S } from "./useColumnWidth.js";
7
+ const z = N(function({
8
+ columnId: v,
9
+ positionedEvents: o,
10
+ column: f,
11
+ timeZone: t,
12
+ cls: r,
13
+ fallbackColor: u,
14
+ onEventClick: m,
14
15
  renderEvent: d,
15
- eventGap: u,
16
- eventLayout: a,
17
- stackOffset: c,
18
- selectedEventId: E,
19
- selectedEventRef: C,
20
- eventMinWidth: i = _,
16
+ eventGap: c,
17
+ eventLayout: p,
18
+ stackOffset: E,
19
+ selectedEventId: C,
20
+ selectedEventRef: w,
21
+ eventMinWidth: i = j,
21
22
  eventMaxStack: n,
22
- onOverflowClick: w,
23
- renderOverflowPopover: T
23
+ onOverflowClick: T,
24
+ renderOverflowPopover: h,
25
+ dragSourceId: x,
26
+ onEventDragStart: y
24
27
  }) {
25
- const { ref: h, width: s } = O(), { visible: x, overflows: y } = N(() => {
26
- const e = j(
27
- s,
28
+ const { ref: D, width: l } = S(), { visible: b, overflows: g } = V(() => {
29
+ const e = I(
30
+ l,
28
31
  i,
29
32
  n
30
33
  );
31
- return V(r, e);
32
- }, [r, s, i, n]);
33
- return /* @__PURE__ */ b(
34
+ return _(o, e);
35
+ }, [o, l, i, n]);
36
+ return /* @__PURE__ */ L(
34
37
  "div",
35
38
  {
36
- ref: h,
37
- className: o("eventColumn"),
39
+ ref: D,
40
+ "data-event-column": v,
41
+ className: r("eventColumn"),
38
42
  style: {
39
43
  gridRow: "3 / -1",
40
- gridColumn: p,
44
+ gridColumn: f,
41
45
  pointerEvents: "none",
42
46
  isolation: "isolate"
43
47
  },
44
48
  children: [
45
- x.map((e) => {
46
- const l = e.event.id === E;
47
- return /* @__PURE__ */ f(
48
- D,
49
+ b.map((e) => {
50
+ const s = e.event.id === C;
51
+ return /* @__PURE__ */ a(
52
+ O,
49
53
  {
50
54
  positioned: e,
51
- fallbackColor: v,
52
- timeZone: m,
53
- cls: o,
54
- onClick: t,
55
+ fallbackColor: u,
56
+ timeZone: t,
57
+ cls: r,
58
+ onClick: m,
55
59
  renderEvent: d,
56
- eventGap: u,
57
- eventLayout: a,
58
- stackOffset: c,
59
- isSelected: l,
60
- selectedEventRef: l ? C : void 0
60
+ eventGap: c,
61
+ eventLayout: p,
62
+ stackOffset: E,
63
+ isSelected: s,
64
+ selectedEventRef: s ? w : void 0,
65
+ isDragSource: e.event.id === x,
66
+ onDragStart: y
61
67
  },
62
68
  e.event.id
63
69
  );
64
70
  }),
65
- y.map((e) => /* @__PURE__ */ f(
66
- I,
71
+ g.map((e) => /* @__PURE__ */ a(
72
+ R,
67
73
  {
68
74
  group: e,
69
- timeZone: m,
70
- cls: o,
71
- onEventClick: t,
72
- onOverflowClick: w,
73
- renderOverflowPopover: T
75
+ timeZone: t,
76
+ cls: r,
77
+ onEventClick: m,
78
+ onOverflowClick: T,
79
+ renderOverflowPopover: h
74
80
  },
75
81
  e.id
76
82
  ))
@@ -79,5 +85,5 @@ const W = L(function({
79
85
  );
80
86
  });
81
87
  export {
82
- W as TimedEventLayer
88
+ z as TimedEventLayer
83
89
  };