@savvycal/calendar 0.13.0 → 0.15.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 (58) hide show
  1. package/README.md +112 -40
  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 +113 -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 +347 -289
  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 +77 -69
  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/lib/lanes.d.ts +2 -2
  54. package/dist/lib/lanes.d.ts.map +1 -1
  55. package/dist/lib/lanes.js +18 -18
  56. package/dist/types/calendar.d.ts +56 -0
  57. package/dist/types/calendar.d.ts.map +1 -1
  58. package/package.json +2 -2
@@ -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":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAI1B,UAAU,cAAc;IACtB,UAAU,EAAE,eAAe,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,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;CACxC;AAED,eAAO,MAAM,SAAS,sDAwKpB,CAAC"}
1
+ {"version":3,"file":"EventChip.d.ts","sourceRoot":"","sources":["../../../src/components/shared/EventChip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAK1B,UAAU,cAAc;IACtB,UAAU,EAAE,eAAe,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,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,97 +1,105 @@
1
- import { jsx as i, 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({
7
- positioned: s,
8
- fallbackColor: I,
9
- timeZone: y,
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({
8
+ positioned: m,
9
+ fallbackColor: F,
10
+ timeZone: x,
10
11
  cls: n,
11
- onClick: N,
12
- renderEvent: g,
13
- interactive: D = !0,
14
- eventGap: F = 2,
15
- eventLayout: O = "columns",
16
- stackOffset: $ = 8,
17
- isSelected: b,
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: t, top: T, height: m, subColumn: a, totalSubColumns: o } = s, v = D && t.interactive !== !1, S = s.colSpan ?? 1, r = t.color ?? I;
21
- let p, d, c;
22
- if (O === "stacked") {
23
- const e = (o - 1) * $;
24
- p = a > 0 ? `${a * $}px` : "0", d = e > 0 ? `calc(100% - ${e}px)` : "100%", c = a + 1;
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;
24
+ let d, p, l;
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 e = a / o * 100, w = S / o * 100, E = F, z = a * E / o, h = (o - S) * E / o;
27
- p = h ? `calc(${e}% + ${z}px)` : `${e}%`, d = h ? `calc(${w}% - ${h}px)` : `${w}%`;
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
- s.overlay && (c = 8), b && (c = 20);
30
- const P = m >= 36, j = m >= 52, L = t.status === "canceled", u = t.appearance === "outline", l = u ? { color: "inherit" } : void 0, k = v ? {
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,
31
35
  role: "button",
32
36
  tabIndex: 0,
33
- "aria-label": G(t, y, { includeStatus: !0 }),
34
- onClick: () => N?.(t),
35
- onKeyDown: (e) => {
36
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), N?.(t));
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));
37
41
  }
38
42
  } : {};
39
- if (g) {
40
- const e = g({ event: t, position: s });
41
- if (e)
43
+ if (N) {
44
+ const t = N({ event: e, position: m });
45
+ if (t)
42
46
  return /* @__PURE__ */ i(
43
47
  "div",
44
48
  {
45
49
  ref: C,
46
- ...k,
50
+ ...I,
51
+ className: S ? n("eventDragSource") : void 0,
47
52
  style: {
48
53
  position: "absolute",
49
- cursor: v ? "pointer" : void 0,
50
- top: T,
51
- height: m,
52
- left: p,
53
- width: d,
54
- zIndex: c,
55
- pointerEvents: v ? "auto" : "none"
54
+ cursor: r ? "pointer" : void 0,
55
+ top: w,
56
+ height: v,
57
+ left: d,
58
+ width: p,
59
+ zIndex: l,
60
+ pointerEvents: r ? "auto" : "none",
61
+ ...k
56
62
  },
57
- children: e
63
+ children: t
58
64
  }
59
65
  );
60
66
  }
61
- const f = A(t.startTime, y);
62
- return /* @__PURE__ */ x(
67
+ const f = Y(e.startTime, x);
68
+ return /* @__PURE__ */ g(
63
69
  "div",
64
70
  {
65
71
  ref: C,
66
- ...k,
67
- className: q(
72
+ ...I,
73
+ className: U(
68
74
  n("event"),
69
- b && n("eventSelected"),
70
- u && n("eventOutline")
75
+ T && n("eventSelected"),
76
+ u && n("eventOutline"),
77
+ S && n("eventDragSource")
71
78
  ),
72
79
  style: {
73
- ...u && { "--cal-event-color": r },
74
- top: T,
75
- height: m,
76
- left: p,
77
- width: d,
78
- zIndex: c,
79
- pointerEvents: v ? "auto" : "none"
80
+ ...u && { "--cal-event-color": c },
81
+ top: w,
82
+ height: v,
83
+ left: d,
84
+ width: p,
85
+ zIndex: l,
86
+ pointerEvents: r ? "auto" : "none",
87
+ ...k
80
88
  },
81
89
  children: [
82
- r && !u && /* @__PURE__ */ i(
90
+ c && !u && /* @__PURE__ */ i(
83
91
  "div",
84
92
  {
85
93
  className: n("eventColorBar"),
86
- style: t.status === "tentative" ? {
94
+ style: e.status === "tentative" ? {
87
95
  backgroundImage: `repeating-linear-gradient(
88
96
  -45deg,
89
- ${r},
90
- ${r} 3px,
97
+ ${c},
98
+ ${c} 3px,
91
99
  transparent 3px,
92
100
  transparent 6px
93
101
  )`
94
- } : { backgroundColor: r }
102
+ } : { backgroundColor: c }
95
103
  }
96
104
  ),
97
105
  /* @__PURE__ */ i(
@@ -99,24 +107,24 @@ const W = K(function({
99
107
  {
100
108
  className: n("eventTitle"),
101
109
  style: {
102
- ...l,
103
- ...L ? { textDecoration: "line-through" } : {}
110
+ ...s,
111
+ ...B ? { textDecoration: "line-through" } : {}
104
112
  },
105
- children: t.title
113
+ children: e.title
106
114
  }
107
115
  ),
108
- P && (j ? /* @__PURE__ */ x(B, { children: [
109
- /* @__PURE__ */ i("div", { className: n("eventTime"), style: l, children: f }),
110
- t.clientName && /* @__PURE__ */ i("div", { className: n("eventClientName"), style: l, children: t.clientName })
111
- ] }) : t.clientName ? /* @__PURE__ */ x("div", { className: n("eventTime"), style: l, 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: [
112
120
  f,
113
121
  ", ",
114
- t.clientName
115
- ] }) : /* @__PURE__ */ i("div", { className: n("eventTime"), style: l, children: f }))
122
+ e.clientName
123
+ ] }) : /* @__PURE__ */ i("div", { className: n("eventTime"), style: s, children: f }))
116
124
  ]
117
125
  }
118
126
  );
119
127
  });
120
128
  export {
121
- W as EventChip
129
+ ee as EventChip
122
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,K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AAK,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,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;IAClC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;QAClC,OAAO,EAAE,QAAQ,CAA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