@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 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/resource-grid-view/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAEnE,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,0BAA0B,CA4CzE,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/resource-grid-view/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAEnE,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,0BAA0B,CA6CzE,CAAC"}
@@ -14,6 +14,7 @@ const e = {
14
14
  event: "absolute inset-x-0.5 rounded-md pl-2.5 pr-1.5 py-0.5 overflow-hidden cursor-pointer select-none text-left bg-cal-event-bg ring-1 ring-inset ring-cal-event-ring",
15
15
  eventSelected: "shadow-lg shadow-cal-event-shadow ring-cal-event-ring-selected",
16
16
  eventOutline: "bg-cal-surface text-cal-event-outline ring-cal-event-outline dark:text-cal-event-outline-dark dark:ring-cal-event-outline-dark/65",
17
+ eventDragSource: "opacity-40",
17
18
  eventColorBar: "absolute left-0 top-0 bottom-0 w-1",
18
19
  eventTitle: "text-cal-text-body text-xs/4 font-medium",
19
20
  eventTime: "text-cal-text-muted text-xs/4",
@@ -1 +1 @@
1
- {"version":3,"file":"AllDayRow.d.ts","sourceRoot":"","sources":["../../../src/components/shared/AllDayRow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,UAAU,cAAc;IACtB,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,SAAS,sDAoEpB,CAAC"}
1
+ {"version":3,"file":"AllDayRow.d.ts","sourceRoot":"","sources":["../../../src/components/shared/AllDayRow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,UAAU,cAAc;IACtB,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,SAAS,sDAiEpB,CAAC"}
@@ -2,17 +2,17 @@ import { jsx as e, Fragment as u, jsxs as p } from "react/jsx-runtime";
2
2
  import { memo as f } from "react";
3
3
  import { cn as b } from "../../lib/utils.js";
4
4
  import { getEventLabel as h, getClientNameLabel as y } from "../../lib/accessibility.js";
5
- const L = f(function({
5
+ const v = f(function({
6
6
  events: i,
7
7
  cls: o,
8
- onEventClick: s,
9
- selectedEventId: m,
8
+ onEventClick: c,
9
+ selectedEventId: s,
10
10
  selectedEventRef: d
11
11
  }) {
12
- return i.length === 0 ? null : /* @__PURE__ */ e(u, { children: i.map((t) => {
13
- const r = t.id === m, l = t.appearance === "outline", n = [h(t), "all day"], a = y(t);
12
+ return i.length === 0 ? null : /* @__PURE__ */ e(u, { children: i.map((l) => {
13
+ const r = l.id === s, t = l.appearance === "outline", n = [h(l), "all day"], a = y(l);
14
14
  a && n.push(a);
15
- const c = /* @__PURE__ */ p(
15
+ const m = /* @__PURE__ */ p(
16
16
  "button",
17
17
  {
18
18
  type: "button",
@@ -20,48 +20,47 @@ const L = f(function({
20
20
  className: b(
21
21
  o("event"),
22
22
  r && o("eventSelected"),
23
- l && o("eventOutline")
23
+ t && o("eventOutline")
24
24
  ),
25
25
  style: {
26
- ...l && { "--cal-event-color": t.color },
26
+ ...t && { "--cal-event-color": l.color },
27
27
  position: "relative",
28
28
  inset: "unset",
29
29
  cursor: "pointer",
30
30
  flex: "1 1 0",
31
31
  minWidth: 0
32
32
  },
33
- onClick: () => s?.(t),
33
+ onClick: () => c?.(l),
34
34
  children: [
35
- t.color && !l && /* @__PURE__ */ e(
35
+ l.color && !t && /* @__PURE__ */ e(
36
36
  "div",
37
37
  {
38
38
  className: o("eventColorBar"),
39
- style: { backgroundColor: t.color }
39
+ style: { backgroundColor: l.color }
40
40
  }
41
41
  ),
42
42
  /* @__PURE__ */ e(
43
43
  "div",
44
44
  {
45
45
  className: o("eventTitle"),
46
- style: l ? { color: "inherit" } : void 0,
47
- children: t.title
46
+ style: t ? { color: "inherit" } : void 0,
47
+ children: l.title
48
48
  }
49
49
  )
50
50
  ]
51
- },
52
- t.id
51
+ }
53
52
  );
54
- return r ? /* @__PURE__ */ e(
53
+ return /* @__PURE__ */ e(
55
54
  "div",
56
55
  {
57
- ref: d,
58
- style: { flex: "1 1 0", minWidth: 0 },
59
- children: c
56
+ ref: r ? d : void 0,
57
+ style: { flex: "1 1 0", minWidth: 0, display: "flex" },
58
+ children: m
60
59
  },
61
- t.id
62
- ) : c;
60
+ l.id
61
+ );
63
62
  }) });
64
63
  });
65
64
  export {
66
- L as AllDayRow
65
+ v as AllDayRow
67
66
  };
@@ -16,6 +16,10 @@ interface EventChipProps {
16
16
  stackOffset?: number;
17
17
  isSelected?: boolean;
18
18
  selectedEventRef?: Ref<HTMLDivElement>;
19
+ /** Dims the event while it's dragged or a drop of it awaits confirmation. */
20
+ isDragSource?: boolean;
21
+ /** Makes the event draggable: called when the user presses on it. */
22
+ onDragStart?: (event: TimedCalendarEvent, e: React.PointerEvent<HTMLElement>) => void;
19
23
  }
20
24
  export declare const EventChip: import('react').NamedExoticComponent<EventChipProps>;
21
25
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"EventChip.d.ts","sourceRoot":"","sources":["../../../src/components/shared/EventChip.tsx"],"names":[],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CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACvC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qEAAqE;IACrE,WAAW,CAAC,EAAE,CACZ,KAAK,EAAE,kBAAkB,EACzB,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,KAC/B,IAAI,CAAC;CACX;AAED,eAAO,MAAM,SAAS,sDAqLpB,CAAC"}
@@ -1,81 +1,93 @@
1
- import { jsx as o, jsxs as x, Fragment as B } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as g, Fragment as H } from "react/jsx-runtime";
2
2
  import { memo as K } from "react";
3
- import { cn as q } from "../../lib/utils.js";
4
- import { formatEventStartTime as A } from "../../lib/time.js";
5
- import { describeEvent as G } from "../../lib/accessibility.js";
6
- const W = K(function({
3
+ import { cn as U } from "../../lib/utils.js";
4
+ import { formatEventStartTime as Y } from "../../lib/time.js";
5
+ import { describeEvent as q } from "../../lib/accessibility.js";
6
+ import { TOUCH_DRAG_STYLE as J } from "./useTouchDrag.js";
7
+ const ee = K(function({
7
8
  positioned: m,
8
- fallbackColor: E,
9
- timeZone: y,
9
+ fallbackColor: F,
10
+ timeZone: x,
10
11
  cls: n,
11
- onClick: N,
12
- renderEvent: b,
13
- interactive: I = !0,
14
- eventGap: D = 2,
15
- eventLayout: F = "columns",
16
- stackOffset: g = 8,
17
- isSelected: $,
18
- selectedEventRef: C
12
+ onClick: y,
13
+ renderEvent: N,
14
+ interactive: L = !0,
15
+ eventGap: j = 2,
16
+ eventLayout: _ = "columns",
17
+ stackOffset: b = 8,
18
+ isSelected: T,
19
+ selectedEventRef: C,
20
+ isDragSource: S,
21
+ onDragStart: $
19
22
  }) {
20
- const { event: e, top: T, height: v, subColumn: a, totalSubColumns: i } = m, r = I && e.interactive !== !1, S = m.colSpan ?? 1, c = e.color ?? E;
23
+ const { event: e, top: w, height: v, subColumn: a, totalSubColumns: o } = m, r = L && e.interactive !== !1, D = m.colSpan ?? 1, c = e.color ?? F;
21
24
  let d, p, l;
22
- if (F === "stacked") {
23
- const t = (i - 1) * g;
24
- d = a > 0 ? `${a * g}px` : "0", p = t > 0 ? `calc(100% - ${t}px)` : "100%", l = a + 1;
25
+ if (_ === "stacked") {
26
+ const t = (o - 1) * b;
27
+ d = a > 0 ? `${a * b}px` : "0", p = t > 0 ? `calc(100% - ${t}px)` : "100%", l = a + 1;
25
28
  } else {
26
- const t = a / i * 100, k = S / i * 100, w = D, z = a * w / i, h = (i - S) * w / i;
27
- d = h ? `calc(${t}% + ${z}px)` : `${t}%`, p = h ? `calc(${k}% - ${h}px)` : `${k}%`;
29
+ const t = a / o * 100, O = D / o * 100, P = j, G = a * P / o, h = (o - D) * P / o;
30
+ d = h ? `calc(${t}% + ${G}px)` : `${t}%`, p = h ? `calc(${O}% - ${h}px)` : `${O}%`;
28
31
  }
29
- m.overlay && (l = 8), $ && (l = 20);
30
- const L = v >= 36, O = v >= 52, j = e.status === "canceled", u = e.appearance === "outline", s = u ? { color: "inherit" } : void 0;
31
- if (b) {
32
- const t = b({ event: e, position: m });
32
+ m.overlay && (l = 8), T && (l = 20);
33
+ const z = v >= 36, A = v >= 52, B = e.status === "canceled", u = e.appearance === "outline", s = u ? { color: "inherit" } : void 0, E = r && e.draggable !== !1 && $, k = E ? J : void 0, I = r ? {
34
+ onPointerDown: E ? (t) => $(e, t) : void 0,
35
+ role: "button",
36
+ tabIndex: 0,
37
+ "aria-label": q(e, x, { includeStatus: !0 }),
38
+ onClick: () => y?.(e),
39
+ onKeyDown: (t) => {
40
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), y?.(e));
41
+ }
42
+ } : {};
43
+ if (N) {
44
+ const t = N({ event: e, position: m });
33
45
  if (t)
34
- return /* @__PURE__ */ o(
46
+ return /* @__PURE__ */ i(
35
47
  "div",
36
48
  {
37
49
  ref: C,
50
+ ...I,
51
+ className: S ? n("eventDragSource") : void 0,
38
52
  style: {
39
53
  position: "absolute",
40
- top: T,
54
+ cursor: r ? "pointer" : void 0,
55
+ top: w,
41
56
  height: v,
42
57
  left: d,
43
58
  width: p,
44
59
  zIndex: l,
45
- pointerEvents: r ? "auto" : "none"
60
+ pointerEvents: r ? "auto" : "none",
61
+ ...k
46
62
  },
47
63
  children: t
48
64
  }
49
65
  );
50
66
  }
51
- const f = A(e.startTime, y), P = r ? G(e, y, { includeStatus: !0 }) : void 0;
52
- return /* @__PURE__ */ x(
67
+ const f = Y(e.startTime, x);
68
+ return /* @__PURE__ */ g(
53
69
  "div",
54
70
  {
55
71
  ref: C,
56
- ...r ? { role: "button", tabIndex: 0, "aria-label": P } : {},
57
- className: q(
72
+ ...I,
73
+ className: U(
58
74
  n("event"),
59
- $ && n("eventSelected"),
60
- u && n("eventOutline")
75
+ T && n("eventSelected"),
76
+ u && n("eventOutline"),
77
+ S && n("eventDragSource")
61
78
  ),
62
79
  style: {
63
80
  ...u && { "--cal-event-color": c },
64
- top: T,
81
+ top: w,
65
82
  height: v,
66
83
  left: d,
67
84
  width: p,
68
85
  zIndex: l,
69
- pointerEvents: r ? "auto" : "none"
86
+ pointerEvents: r ? "auto" : "none",
87
+ ...k
70
88
  },
71
- ...r ? {
72
- onClick: () => N?.(e),
73
- onKeyDown: (t) => {
74
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), N?.(e));
75
- }
76
- } : {},
77
89
  children: [
78
- c && !u && /* @__PURE__ */ o(
90
+ c && !u && /* @__PURE__ */ i(
79
91
  "div",
80
92
  {
81
93
  className: n("eventColorBar"),
@@ -90,29 +102,29 @@ const W = K(function({
90
102
  } : { backgroundColor: c }
91
103
  }
92
104
  ),
93
- /* @__PURE__ */ o(
105
+ /* @__PURE__ */ i(
94
106
  "div",
95
107
  {
96
108
  className: n("eventTitle"),
97
109
  style: {
98
110
  ...s,
99
- ...j ? { textDecoration: "line-through" } : {}
111
+ ...B ? { textDecoration: "line-through" } : {}
100
112
  },
101
113
  children: e.title
102
114
  }
103
115
  ),
104
- L && (O ? /* @__PURE__ */ x(B, { children: [
105
- /* @__PURE__ */ o("div", { className: n("eventTime"), style: s, children: f }),
106
- e.clientName && /* @__PURE__ */ o("div", { className: n("eventClientName"), style: s, children: e.clientName })
107
- ] }) : e.clientName ? /* @__PURE__ */ x("div", { className: n("eventTime"), style: s, children: [
116
+ z && (A ? /* @__PURE__ */ g(H, { children: [
117
+ /* @__PURE__ */ i("div", { className: n("eventTime"), style: s, children: f }),
118
+ e.clientName && /* @__PURE__ */ i("div", { className: n("eventClientName"), style: s, children: e.clientName })
119
+ ] }) : e.clientName ? /* @__PURE__ */ g("div", { className: n("eventTime"), style: s, children: [
108
120
  f,
109
121
  ", ",
110
122
  e.clientName
111
- ] }) : /* @__PURE__ */ o("div", { className: n("eventTime"), style: s, children: f }))
123
+ ] }) : /* @__PURE__ */ i("div", { className: n("eventTime"), style: s, children: f }))
112
124
  ]
113
125
  }
114
126
  );
115
127
  });
116
128
  export {
117
- W as EventChip
129
+ ee as EventChip
118
130
  };
@@ -18,6 +18,10 @@ interface SelectionOverlayProps {
18
18
  event: TimedCalendarEvent;
19
19
  position: PositionedEvent;
20
20
  }) => React.ReactNode;
21
+ /** Draws this event, moved to `startTime`–`endTime`, instead of a placeholder. */
22
+ event?: TimedCalendarEvent;
23
+ /** Keeps the overlay laid out, as a popover anchor, but invisible. */
24
+ hidden?: boolean;
21
25
  }
22
26
  export declare const SelectionOverlay: import('react').NamedExoticComponent<SelectionOverlayProps>;
23
27
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SelectionOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAK1B,UAAU,qBAAqB;IAC7B,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;IAClC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,YAAY,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,6DAsF3B,CAAC"}
1
+ {"version":3,"file":"SelectionOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SelectionOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAK1B,UAAU,qBAAqB;IAC7B,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;IAClC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,YAAY,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,kFAAkF;IAClF,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,gBAAgB,6DA6F3B,CAAC"}
@@ -1,68 +1,73 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { memo as b } from "react";
3
- import { getMinuteRange as x } from "../../lib/time.js";
4
- import { buildSyntheticEvent as C } from "../../lib/selection.js";
5
- import { EventChip as E } from "./EventChip.js";
6
- const P = b(function({
7
- startTime: o,
8
- endTime: r,
2
+ import { memo as E } from "react";
3
+ import { getMinuteRange as N } from "../../lib/time.js";
4
+ import { buildSyntheticEvent as O } from "../../lib/selection.js";
5
+ import { EventChip as R } from "./EventChip.js";
6
+ const q = E(function({
7
+ startTime: i,
8
+ endTime: n,
9
9
  fallbackColor: c,
10
- column: m,
10
+ column: g,
11
11
  viewDate: v,
12
- timeZone: l,
13
- startHour: d,
14
- endHour: g,
12
+ timeZone: h,
13
+ startHour: m,
14
+ endHour: f,
15
15
  hourHeight: p,
16
16
  cls: e,
17
- appearance: s = "highlight",
18
- selectionRef: f,
19
- renderEvent: y
17
+ appearance: o = "highlight",
18
+ selectionRef: y,
19
+ renderEvent: M,
20
+ event: l,
21
+ hidden: S
20
22
  }) {
21
- const a = p / 60, h = d * 60, i = x(o, r, v, l);
22
- if (!i) return null;
23
- const u = Math.max(i.startMin, h), M = Math.min(i.endMin, g * 60), S = (u - h) * a, n = (M - u) * a;
24
- return n <= 0 ? null : /* @__PURE__ */ t(
23
+ const u = p / 60, d = m * 60, r = N(i, n, v, h);
24
+ if (!r) return null;
25
+ const a = Math.max(r.startMin, d), b = Math.min(r.endMin, f * 60), x = (a - d) * u, s = (b - a) * u;
26
+ if (s <= 0) return null;
27
+ const C = l != null || o !== "highlight";
28
+ return /* @__PURE__ */ t(
25
29
  "div",
26
30
  {
27
31
  "aria-hidden": "true",
28
32
  style: {
29
33
  gridRow: "3 / -1",
30
- gridColumn: m,
34
+ gridColumn: g,
31
35
  position: "relative",
32
- pointerEvents: "none"
36
+ pointerEvents: "none",
37
+ visibility: S ? "hidden" : void 0
33
38
  },
34
39
  children: /* @__PURE__ */ t(
35
40
  "div",
36
41
  {
37
- ref: f,
42
+ ref: y,
38
43
  style: {
39
44
  position: "absolute",
40
- top: S,
45
+ top: x,
41
46
  left: 0,
42
47
  right: 0,
43
- height: n
48
+ height: s
44
49
  },
45
- children: s !== "highlight" ? /* @__PURE__ */ t("div", { className: e("eventColumn"), style: { height: "100%" }, children: /* @__PURE__ */ t(
46
- E,
50
+ children: C ? /* @__PURE__ */ t("div", { className: e("eventColumn"), style: { height: "100%" }, children: /* @__PURE__ */ t(
51
+ R,
47
52
  {
48
53
  interactive: !1,
49
54
  isSelected: !0,
50
55
  positioned: {
51
- event: C(
56
+ event: l ? { ...l, startTime: i, endTime: n } : O(
52
57
  "",
53
- o,
54
- r,
55
- s.eventData
58
+ i,
59
+ n,
60
+ o !== "highlight" ? o.eventData : void 0
56
61
  ),
57
62
  top: 0,
58
- height: n,
63
+ height: s,
59
64
  subColumn: 0,
60
65
  totalSubColumns: 1
61
66
  },
62
67
  fallbackColor: c,
63
- timeZone: l,
68
+ timeZone: h,
64
69
  cls: e,
65
- renderEvent: y
70
+ renderEvent: M
66
71
  }
67
72
  ) }) : /* @__PURE__ */ t(
68
73
  "div",
@@ -80,5 +85,5 @@ const P = b(function({
80
85
  );
81
86
  });
82
87
  export {
83
- P as SelectionOverlay
88
+ q as SelectionOverlay
84
89
  };
@@ -38,6 +38,11 @@ interface SlotInteractionLayerProps {
38
38
  * draws `previewRange` instead of its own preview.
39
39
  */
40
40
  resolveColumnId?: (clientX: number) => string | null;
41
+ /**
42
+ * Left edge of the grid's visible area, right of its sticky gutter. A drag
43
+ * that spans columns scrolls sideways when it nears this or the right edge.
44
+ */
45
+ getScrollViewportLeft?: () => number | undefined;
41
46
  onDragPreviewChange?: (preview: DragPreview | null) => void;
42
47
  /** This column's part of a drag preview that spans columns. */
43
48
  previewRange?: {
@@ -1 +1 @@
1
- {"version":3,"file":"SlotInteractionLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SlotInteractionLayer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAY1B,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,o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