@savvycal/calendar 0.11.0 → 0.11.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AllDayEventChip.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/AllDayEventChip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,UAAU,oBAAoB;IAC5B,UAAU,EAAE,qBAAqB,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,qBAAqB,KAAK,MAAM,CAAC;IAClD,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,eAAe,4DA+G1B,CAAC"}
1
+ {"version":3,"file":"AllDayEventChip.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/AllDayEventChip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,UAAU,oBAAoB;IAC5B,UAAU,EAAE,qBAAqB,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,qBAAqB,KAAK,MAAM,CAAC;IAClD,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,eAAe,4DAyG1B,CAAC"}
@@ -1,33 +1,33 @@
1
1
  import { jsxs as D, Fragment as x, jsx as n } from "react/jsx-runtime";
2
2
  import { memo as L } from "react";
3
- import { cn as o } from "../../lib/utils.js";
3
+ import { cn as s } from "../../lib/utils.js";
4
4
  import { getEventLabel as N, getClientNameLabel as S } from "../../lib/accessibility.js";
5
- const k = L(function({
6
- positioned: v,
7
- laneOffset: b,
5
+ const w = L(function({
6
+ positioned: p,
7
+ laneOffset: f,
8
8
  cls: t,
9
- onEventClick: s,
10
- selectedEventId: h,
11
- selectedEventRef: C
9
+ onEventClick: c,
10
+ selectedEventId: u,
11
+ selectedEventRef: y
12
12
  }) {
13
13
  const {
14
14
  event: e,
15
- gridColumnStart: c,
16
- gridColumnSpan: d,
17
- lane: E,
18
- continuesBefore: l,
19
- continuesAfter: m
20
- } = v, R = e.id === h, p = E + 1 + b, a = [N(e), "all day"], u = S(e);
21
- u && a.push(u);
22
- const f = l ? 2 : 4, g = m ? 2 : 4, i = {
23
- ...l ? {
15
+ gridColumnStart: g,
16
+ gridColumnSpan: v,
17
+ lane: b,
18
+ continuesBefore: i,
19
+ continuesAfter: d
20
+ } = p, h = e.id === u, C = b + 1 + f, l = [N(e), "all day"], m = S(e);
21
+ m && l.push(m);
22
+ const E = i ? 2 : 4, R = d ? 2 : 4, a = {
23
+ ...i ? {
24
24
  borderTopLeftRadius: 0,
25
25
  borderBottomLeftRadius: 0,
26
26
  paddingLeft: 4
27
27
  } : {},
28
- ...m ? { borderTopRightRadius: 0, borderBottomRightRadius: 0 } : {}
29
- }, r = /* @__PURE__ */ D(x, { children: [
30
- e.color && !l && /* @__PURE__ */ n(
28
+ ...d ? { borderTopRightRadius: 0, borderBottomRightRadius: 0 } : {}
29
+ }, o = /* @__PURE__ */ D(x, { children: [
30
+ e.color && !i && /* @__PURE__ */ n(
31
31
  "div",
32
32
  {
33
33
  className: t("allDayEventColorBar"),
@@ -35,44 +35,38 @@ const k = L(function({
35
35
  }
36
36
  ),
37
37
  /* @__PURE__ */ n("span", { className: t("allDayEventTitle"), children: e.title })
38
- ] }), y = {
39
- gridColumn: `${c} / span ${d}`,
40
- gridRow: p,
41
- marginLeft: f,
42
- marginRight: g
38
+ ] }), r = {
39
+ gridColumn: `${g} / span ${v}`,
40
+ gridRow: C,
41
+ marginLeft: E,
42
+ marginRight: R,
43
+ contain: "inline-size"
43
44
  };
44
45
  return e.interactive === !1 ? /* @__PURE__ */ n(
45
46
  "div",
46
47
  {
47
- className: o(t("allDayEvent"), "relative flex items-center gap-1"),
48
- style: { ...y, ...i, pointerEvents: "none" },
49
- children: r
48
+ className: s(t("allDayEvent"), "relative flex items-center gap-1"),
49
+ style: { ...r, ...a, pointerEvents: "none" },
50
+ children: o
50
51
  }
51
- ) : R ? /* @__PURE__ */ n(
52
+ ) : h ? /* @__PURE__ */ n(
52
53
  "div",
53
54
  {
54
- ref: C,
55
- style: {
56
- gridColumn: `${c} / span ${d}`,
57
- gridRow: p,
58
- display: "flex",
59
- minWidth: 0,
60
- marginLeft: f,
61
- marginRight: g
62
- },
55
+ ref: y,
56
+ style: { ...r, display: "flex", minWidth: 0 },
63
57
  children: /* @__PURE__ */ n(
64
58
  "button",
65
59
  {
66
60
  type: "button",
67
- "aria-label": a.join(", "),
68
- className: o(
61
+ "aria-label": l.join(", "),
62
+ className: s(
69
63
  t("allDayEvent"),
70
64
  t("allDayEventSelected"),
71
65
  "relative flex items-center gap-1 w-full"
72
66
  ),
73
- style: i,
74
- onClick: () => s?.(e),
75
- children: r
67
+ style: a,
68
+ onClick: () => c?.(e),
69
+ children: o
76
70
  }
77
71
  )
78
72
  }
@@ -80,14 +74,14 @@ const k = L(function({
80
74
  "button",
81
75
  {
82
76
  type: "button",
83
- "aria-label": a.join(", "),
84
- className: o(t("allDayEvent"), "relative flex items-center gap-1"),
85
- style: { ...y, ...i },
86
- onClick: () => s?.(e),
87
- children: r
77
+ "aria-label": l.join(", "),
78
+ className: s(t("allDayEvent"), "relative flex items-center gap-1"),
79
+ style: { ...r, ...a },
80
+ onClick: () => c?.(e),
81
+ children: o
88
82
  }
89
83
  );
90
84
  });
91
85
  export {
92
- k as AllDayEventChip
86
+ w as AllDayEventChip
93
87
  };
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,qBAAqB,CAqD/D,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,qBAAqB,CAsD/D,CAAC"}
@@ -28,7 +28,7 @@ const e = {
28
28
  allDayEvent: "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 min-w-0",
29
29
  allDayEventSelected: "shadow-lg shadow-cal-event-shadow ring-cal-event-ring-selected",
30
30
  allDayEventColorBar: "absolute left-0 top-0 bottom-0 w-1",
31
- allDayEventTitle: "text-cal-text-body text-xs/4 font-medium truncate",
31
+ allDayEventTitle: "text-cal-text-body text-xs/4 font-medium whitespace-nowrap",
32
32
  overflowChip: "absolute right-0.5 min-w-9 h-[22px] p-0 border-0 cursor-pointer select-none text-center rounded-md bg-cal-surface ring-1 ring-cal-event-ring shadow-lg shadow-cal-event-shadow hover:ring-cal-event-ring-selected",
33
33
  overflowChipLabel: "block px-1 py-0.5 text-cal-text-body text-xs/4 font-medium",
34
34
  overflowPopover: "w-64 rounded-lg bg-cal-surface p-1 shadow-lg shadow-cal-event-shadow ring-1 ring-cal-event-ring max-h-[min(20rem,calc(100dvh-1rem))] overflow-auto",
@@ -27,7 +27,10 @@ interface UseInitialScrollArgs {
27
27
  * container, so they stay pinned and don't factor into `scrollTop`:
28
28
  *
29
29
  * clamped = clamp(initialScrollHour, startHour, endHour)
30
- * scrollTop = (clamped - startHour) * effectiveHourHeight
30
+ * scrollTop = (clamped - startHour) * effectiveHourHeight + HOUR_LINE_WIDTH
31
+ *
32
+ * The extra `HOUR_LINE_WIDTH` tucks the hour's top border under the sticky
33
+ * header's bottom border, so the two don't stack into a double line.
31
34
  *
32
35
  * It only repositions on a `scrollKey` change — not on unrelated re-renders
33
36
  * (events/availability arriving, selection, hover) or a resize re-measuring
@@ -1 +1 @@
1
- {"version":3,"file":"useInitialScroll.d.ts","sourceRoot":"","sources":["../../../src/components/shared/useInitialScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhE,UAAU,oBAAoB;IAC5B,iEAAiE;IACjE,OAAO,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC1C,8EAA8E;IAC9E,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,SAAS,GACV,EAAE,oBAAoB,GAAG,IAAI,CA+B7B"}
1
+ {"version":3,"file":"useInitialScroll.d.ts","sourceRoot":"","sources":["../../../src/components/shared/useInitialScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKhE,UAAU,oBAAoB;IAC5B,iEAAiE;IACjE,OAAO,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC1C,8EAA8E;IAC9E,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,SAAS,GACV,EAAE,oBAAoB,GAAG,IAAI,CAgC7B"}
@@ -1,31 +1,32 @@
1
- import { useRef as x, useLayoutEffect as M } from "react";
2
- function b({
1
+ import { useRef as I, useLayoutEffect as x } from "react";
2
+ const E = 1;
3
+ function M({
3
4
  rootRef: u,
4
5
  initialScrollHour: n,
5
6
  startHour: t,
6
- endHour: f,
7
- effectiveHourHeight: m,
8
- containerHeight: r,
7
+ endHour: c,
8
+ effectiveHourHeight: f,
9
+ containerHeight: m,
9
10
  scrollKey: e
10
11
  }) {
11
- const c = x(null);
12
- M(() => {
12
+ const r = I(null);
13
+ x(() => {
13
14
  if (n == null || !Number.isFinite(n))
14
15
  return;
15
16
  const s = u.current;
16
- if (!s || r <= 0 || c.current === e) return;
17
- const p = Math.min(Math.max(n, t), f);
18
- s.scrollTop = (p - t) * m, c.current = e;
17
+ if (!s || m <= 0 || r.current === e) return;
18
+ const p = Math.min(Math.max(n, t), c);
19
+ s.scrollTop = (p - t) * f + E, r.current = e;
19
20
  }, [
20
21
  u,
21
22
  n,
22
23
  t,
24
+ c,
23
25
  f,
24
26
  m,
25
- r,
26
27
  e
27
28
  ]);
28
29
  }
29
30
  export {
30
- b as useInitialScroll
31
+ M as useInitialScroll
31
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvycal/calendar",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {