@savvycal/calendar 0.12.0 → 0.13.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 CHANGED
@@ -449,7 +449,7 @@ The optional `ariaLabel` field provides a plain-text label used for `aria-label`
449
449
 
450
450
  Set `interactive: false` for a display-only event: it ignores clicks and the pointer, so clicks, hovers, and drags reach the time slot beneath it.
451
451
 
452
- Set `appearance: 'outline'` to draw an event as an outline in its color, with its text in that color and no fill or color bar, the way calendar apps show invitations awaiting a reply. In month view, an outlined single-day timed event gets a hollow dot and text in its color. In dark mode, the text takes a lighter tint of the color and the outline is softer, so both stay readable. The shell exposes the color as the `--cal-event-color` CSS variable; style the outline with the `eventOutline`, `allDayEventOutline`, and `timedEventOutline` class names.
452
+ Set `appearance: 'outline'` to draw an event as an outline in its color, with its text in that color and no fill or color bar, the way calendar apps show invitations awaiting a reply. In month view, an outlined single-day timed event gets a hollow dot and text in its color. So that every color stays readable, the text and outline keep the color's hue but cap its lightness in light mode and raise it in dark mode, where the outline is also softer. Colors that already contrast well with the surface are unchanged. The shell exposes the color as the `--cal-event-color` CSS variable; style the outline with the `eventOutline`, `allDayEventOutline`, and `timedEventOutline` class names.
453
453
 
454
454
  `priority` controls overlap packing. Higher values are placed in earlier columns, so they stay visible when `eventMaxStack` or `eventMinWidth` caps how many overlapping events are shown. Omit it (or use `0`) for the default. Use this to keep product appointments on the grid ahead of connected-calendar events.
455
455
 
@@ -502,20 +502,22 @@ interface PositionedEvent {
502
502
 
503
503
  The preset defines a set of `--color-cal-*` CSS custom properties under `@theme`. Override them in your own CSS to change the calendar's color palette:
504
504
 
505
- | Variable | Light default | Description |
506
- | --------------------------------- | ---------------- | --------------------------------- |
507
- | `--color-cal-surface` | `white` | Background color of the calendar. |
508
- | `--color-cal-border` | `zinc-300` | Border color for grid lines. |
509
- | `--color-cal-text` | `zinc-950` | Primary text color (headers). |
510
- | `--color-cal-text-body` | `zinc-900` | Body text color (event titles). |
511
- | `--color-cal-text-muted` | `zinc-600` | Muted text color (times, labels). |
512
- | `--color-cal-event-bg` | `zinc-100 @ 90%` | Event background. |
513
- | `--color-cal-event-ring` | `zinc-900 @ 15%` | Event border ring. |
514
- | `--color-cal-event-ring-selected` | `zinc-900 @ 30%` | Ring color for selected events. |
515
- | `--color-cal-event-shadow` | `black @ 10%` | Shadow color for selected events. |
516
- | `--color-cal-now` | `orange-500` | Now indicator line color. |
517
- | `--color-cal-slot-highlight` | `blue-400 @ 15%` | Hover slot highlight. |
518
- | `--color-cal-selection` | `blue-400 @ 25%` | Drag selection highlight. |
505
+ | Variable | Light default | Description |
506
+ | --------------------------------- | ------------------------------------------------- | -------------------------------------- |
507
+ | `--color-cal-surface` | `white` | Background color of the calendar. |
508
+ | `--color-cal-border` | `zinc-300` | Border color for grid lines. |
509
+ | `--color-cal-text` | `zinc-950` | Primary text color (headers). |
510
+ | `--color-cal-text-body` | `zinc-900` | Body text color (event titles). |
511
+ | `--color-cal-text-muted` | `zinc-600` | Muted text color (times, labels). |
512
+ | `--color-cal-event-bg` | `zinc-100 @ 90%` | Event background. |
513
+ | `--color-cal-event-ring` | `zinc-900 @ 15%` | Event border ring. |
514
+ | `--color-cal-event-ring-selected` | `zinc-900 @ 30%` | Ring color for selected events. |
515
+ | `--color-cal-event-shadow` | `black @ 10%` | Shadow color for selected events. |
516
+ | `--color-cal-now` | `orange-500` | Now indicator line color. |
517
+ | `--color-cal-slot-highlight` | `blue-400 @ 15%` | Hover slot highlight. |
518
+ | `--color-cal-selection` | `blue-400 @ 25%` | Drag selection highlight. |
519
+ | `--color-cal-event-outline` | the event color, lightness capped at 0.53 (OKLCH) | Text and outline of an outlined event. |
520
+ | `--color-cal-event-outline-dark` | the event color, lightness at least 0.75 (OKLCH) | The same, in dark mode. |
519
521
 
520
522
  Example override:
521
523
 
@@ -773,7 +775,7 @@ The calendar includes built-in ARIA support for screen readers:
773
775
 
774
776
  ### Custom renderers
775
777
 
776
- When using `renderEvent`, the library does **not** add `aria-label` or `role` attributes to the wrapper `<div>`. Your custom renderer is responsible for providing its own accessible markup.
778
+ An interactive event drawn by `renderEvent` gets the same wrapper behavior as a default chip: `role="button"`, `tabIndex`, an `aria-label`, and `onEventClick` on click, Enter, or Space. Return non-interactive content from `renderEvent`, without your own button, to avoid nesting interactive elements.
777
779
 
778
780
  ## License
779
781
 
@@ -12,7 +12,7 @@ const e = {
12
12
  eventColumn: "relative mr-3",
13
13
  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",
14
14
  eventSelected: "shadow-lg shadow-cal-event-shadow ring-cal-event-ring-selected",
15
- eventOutline: "bg-cal-surface text-(--cal-event-color) ring-(--cal-event-color) dark:text-[color-mix(in_oklab,var(--cal-event-color)_55%,white)] dark:ring-[color-mix(in_oklab,var(--cal-event-color)_65%,transparent)]",
15
+ 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",
16
16
  eventColorBar: "absolute left-0 top-0 bottom-0 w-1",
17
17
  eventTitle: "text-cal-text-body text-xs/4 font-medium",
18
18
  eventTime: "text-cal-text-muted text-xs/4",
@@ -28,7 +28,7 @@ const e = {
28
28
  allDayLane: "bg-cal-surface border-b border-cal-border",
29
29
  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",
30
30
  allDayEventSelected: "shadow-lg shadow-cal-event-shadow ring-cal-event-ring-selected",
31
- allDayEventOutline: "bg-cal-surface text-(--cal-event-color) ring-(--cal-event-color) dark:text-[color-mix(in_oklab,var(--cal-event-color)_55%,white)] dark:ring-[color-mix(in_oklab,var(--cal-event-color)_65%,transparent)]",
31
+ allDayEventOutline: "bg-cal-surface text-cal-event-outline ring-cal-event-outline dark:text-cal-event-outline-dark dark:ring-cal-event-outline-dark/65",
32
32
  allDayEventColorBar: "absolute left-0 top-0 bottom-0 w-1",
33
33
  allDayEventTitle: "text-cal-text-body text-xs/4 font-medium whitespace-nowrap",
34
34
  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",
@@ -1 +1 @@
1
- {"version":3,"file":"MonthEventItem.d.ts","sourceRoot":"","sources":["../../../src/components/month-view/MonthEventItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,aAAa,EAAkB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAI3E,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,UAAU,mBAAmB;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,mBAAmB,KAAK,MAAM,CAAC;IAChD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kGAAkG;IAClG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IAC3B,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAMD,eAAO,MAAM,cAAc,2DAmJzB,CAAC"}
1
+ {"version":3,"file":"MonthEventItem.d.ts","sourceRoot":"","sources":["../../../src/components/month-view/MonthEventItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,aAAa,EAAkB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAI3E,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,UAAU,mBAAmB;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,mBAAmB,KAAK,MAAM,CAAC;IAChD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kGAAkG;IAClG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IAC3B,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAMD,eAAO,MAAM,cAAc,2DAsJzB,CAAC"}
@@ -9,7 +9,7 @@ function M(m) {
9
9
  const P = L(function({
10
10
  event: t,
11
11
  isBar: R,
12
- continuesBefore: o = !1,
12
+ continuesBefore: a = !1,
13
13
  continuesAfter: u = !1,
14
14
  timeZone: h,
15
15
  cls: e,
@@ -17,48 +17,48 @@ const P = L(function({
17
17
  isSelected: c,
18
18
  interactive: C = !0,
19
19
  itemRef: g,
20
- gridRow: f,
21
- gridColumn: b,
22
- style: y
20
+ gridRow: b,
21
+ gridColumn: f,
22
+ style: x
23
23
  }) {
24
- const D = t.status === "canceled", v = t.status === "tentative", a = t.appearance === "outline", p = a ? { color: "inherit" } : void 0, x = {
24
+ const D = t.status === "canceled", y = t.status === "tentative", o = t.appearance === "outline", p = o ? { color: "inherit" } : void 0, v = {
25
25
  ...p,
26
26
  ...D ? { textDecoration: "line-through" } : {}
27
- }, n = !t.allDay && !o ? k(t.startTime, h) : null;
27
+ }, n = !t.allDay && !a ? k(t.startTime, h) : null;
28
28
  let i, l, s;
29
29
  if (R)
30
30
  i = N(
31
31
  e("event"),
32
32
  c && e("eventSelected"),
33
- a && e("eventOutline")
33
+ o && e("eventOutline")
34
34
  ), l = {
35
- ...a && { "--cal-event-color": t.color },
36
- marginLeft: o ? 0 : 4,
35
+ ...o && { "--cal-event-color": t.color },
36
+ marginLeft: a ? 0 : 4,
37
37
  marginRight: u ? 0 : 4,
38
- ...o ? { borderTopLeftRadius: 0, borderBottomLeftRadius: 0, paddingLeft: 6 } : {},
38
+ ...a ? { borderTopLeftRadius: 0, borderBottomLeftRadius: 0, paddingLeft: 6 } : {},
39
39
  ...u ? { borderTopRightRadius: 0, borderBottomRightRadius: 0 } : {}
40
40
  }, s = /* @__PURE__ */ E(T, { children: [
41
- t.color && !o && !a && /* @__PURE__ */ r(
41
+ t.color && !a && !o && /* @__PURE__ */ r(
42
42
  "span",
43
43
  {
44
44
  className: e("eventColorBar"),
45
45
  style: {
46
46
  borderRadius: "inherit",
47
- ...v ? { backgroundImage: M(t.color) } : { backgroundColor: t.color }
47
+ ...y ? { backgroundImage: M(t.color) } : { backgroundColor: t.color }
48
48
  }
49
49
  }
50
50
  ),
51
51
  n && /* @__PURE__ */ r("span", { className: e("eventTime"), style: p, children: n }),
52
- /* @__PURE__ */ r("span", { className: e("eventTitle"), style: x, children: t.title })
52
+ /* @__PURE__ */ r("span", { className: e("eventTitle"), style: v, children: t.title })
53
53
  ] });
54
54
  else {
55
55
  const d = t.color ?? "var(--color-cal-text-muted)";
56
56
  i = N(
57
57
  e("timedEvent"),
58
58
  c && e("timedEventSelected"),
59
- a && e("timedEventOutline")
59
+ o && e("timedEventOutline")
60
60
  ), l = {
61
- ...a && { "--cal-event-color": t.color },
61
+ ...o && { "--cal-event-color": t.color },
62
62
  marginLeft: 4,
63
63
  marginRight: 4
64
64
  }, s = /* @__PURE__ */ E(T, { children: [
@@ -66,11 +66,14 @@ const P = L(function({
66
66
  "span",
67
67
  {
68
68
  className: e("timedEventDot"),
69
- style: v || a ? { boxShadow: `inset 0 0 0 1.5px ${d}` } : { backgroundColor: d }
69
+ style: o ? (
70
+ // Matches the text, whose color is readable on the surface
71
+ { boxShadow: "inset 0 0 0 1.5px currentColor" }
72
+ ) : y ? { boxShadow: `inset 0 0 0 1.5px ${d}` } : { backgroundColor: d }
70
73
  }
71
74
  ),
72
75
  n && /* @__PURE__ */ r("span", { className: e("timedEventTime"), style: p, children: n }),
73
- /* @__PURE__ */ r("span", { className: e("timedEventTitle"), style: x, children: t.title })
76
+ /* @__PURE__ */ r("span", { className: e("timedEventTitle"), style: v, children: t.title })
74
77
  ] });
75
78
  }
76
79
  return C ? /* @__PURE__ */ r(
@@ -84,7 +87,7 @@ const P = L(function({
84
87
  }),
85
88
  "aria-pressed": c || void 0,
86
89
  className: i,
87
- style: { ...l, gridRow: f, gridColumn: b, ...y },
90
+ style: { ...l, gridRow: b, gridColumn: f, ...x },
88
91
  onClick: () => S?.(t),
89
92
  onMouseDown: (d) => d.stopPropagation(),
90
93
  children: s
@@ -97,10 +100,10 @@ const P = L(function({
97
100
  className: i,
98
101
  style: {
99
102
  ...l,
100
- gridRow: f,
101
- gridColumn: b,
103
+ gridRow: b,
104
+ gridColumn: f,
102
105
  pointerEvents: "none",
103
- ...y
106
+ ...x
104
107
  },
105
108
  children: s
106
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/month-view/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,mBAAmB,CAwC3D,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/month-view/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,mBAAmB,CAuC3D,CAAC"}
@@ -11,13 +11,13 @@ const e = {
11
11
  dayNumberButton: "cursor-pointer hover:bg-cal-event-bg",
12
12
  event: "relative flex items-center gap-1 h-full rounded-md pl-2.5 pr-1.5 overflow-hidden cursor-pointer select-none text-left bg-cal-event-bg ring-1 ring-inset ring-cal-event-ring min-w-0",
13
13
  eventSelected: "shadow-lg shadow-cal-event-shadow ring-cal-event-ring-selected",
14
- eventOutline: "bg-cal-surface text-(--cal-event-color) ring-(--cal-event-color) dark:text-[color-mix(in_oklab,var(--cal-event-color)_55%,white)] dark:ring-[color-mix(in_oklab,var(--cal-event-color)_65%,transparent)]",
14
+ 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",
15
15
  eventColorBar: "absolute left-0 top-0 bottom-0 w-1",
16
16
  eventTitle: "text-cal-text-body text-xs/4 font-medium truncate",
17
17
  eventTime: "text-cal-text-muted text-xs/4 shrink-0",
18
18
  timedEvent: "flex items-center gap-1.5 h-full rounded-md px-1.5 overflow-hidden cursor-pointer select-none text-left min-w-0 hover:bg-cal-event-bg",
19
19
  timedEventSelected: "bg-cal-event-bg ring-1 ring-inset ring-cal-event-ring-selected shadow-lg shadow-cal-event-shadow",
20
- timedEventOutline: "text-(--cal-event-color) dark:text-[color-mix(in_oklab,var(--cal-event-color)_55%,white)]",
20
+ timedEventOutline: "text-cal-event-outline dark:text-cal-event-outline-dark",
21
21
  timedEventDot: "size-2 shrink-0 rounded-full",
22
22
  timedEventTime: "text-cal-text-muted text-xs/4 shrink-0",
23
23
  timedEventTitle: "text-cal-text-body text-xs/4 font-medium truncate",
@@ -13,7 +13,7 @@ const e = {
13
13
  eventColumn: "relative mr-3",
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
- eventOutline: "bg-cal-surface text-(--cal-event-color) ring-(--cal-event-color) dark:text-[color-mix(in_oklab,var(--cal-event-color)_55%,white)] dark:ring-[color-mix(in_oklab,var(--cal-event-color)_65%,transparent)]",
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
17
  eventColorBar: "absolute left-0 top-0 bottom-0 w-1",
18
18
  eventTitle: "text-cal-text-body text-xs/4 font-medium",
19
19
  eventTime: "text-cal-text-muted text-xs/4",
@@ -1,114 +1,118 @@
1
- import { jsx as o, jsxs as x, Fragment as B } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as x, Fragment as B } from "react/jsx-runtime";
2
2
  import { memo as K } from "react";
3
3
  import { cn as q } from "../../lib/utils.js";
4
4
  import { formatEventStartTime as A } from "../../lib/time.js";
5
5
  import { describeEvent as G } from "../../lib/accessibility.js";
6
6
  const W = K(function({
7
- positioned: m,
8
- fallbackColor: E,
7
+ positioned: s,
8
+ fallbackColor: I,
9
9
  timeZone: y,
10
10
  cls: n,
11
11
  onClick: N,
12
- renderEvent: b,
13
- interactive: I = !0,
14
- eventGap: D = 2,
15
- eventLayout: F = "columns",
16
- stackOffset: g = 8,
17
- isSelected: $,
12
+ renderEvent: g,
13
+ interactive: D = !0,
14
+ eventGap: F = 2,
15
+ eventLayout: O = "columns",
16
+ stackOffset: $ = 8,
17
+ isSelected: b,
18
18
  selectedEventRef: C
19
19
  }) {
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;
21
- 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;
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;
25
25
  } 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}%`;
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}%`;
28
28
  }
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 });
33
- if (t)
34
- return /* @__PURE__ */ o(
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 ? {
31
+ role: "button",
32
+ 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
+ }
38
+ } : {};
39
+ if (g) {
40
+ const e = g({ event: t, position: s });
41
+ if (e)
42
+ return /* @__PURE__ */ i(
35
43
  "div",
36
44
  {
37
45
  ref: C,
46
+ ...k,
38
47
  style: {
39
48
  position: "absolute",
49
+ cursor: v ? "pointer" : void 0,
40
50
  top: T,
41
- height: v,
42
- left: d,
43
- width: p,
44
- zIndex: l,
45
- pointerEvents: r ? "auto" : "none"
51
+ height: m,
52
+ left: p,
53
+ width: d,
54
+ zIndex: c,
55
+ pointerEvents: v ? "auto" : "none"
46
56
  },
47
- children: t
57
+ children: e
48
58
  }
49
59
  );
50
60
  }
51
- const f = A(e.startTime, y), P = r ? G(e, y, { includeStatus: !0 }) : void 0;
61
+ const f = A(t.startTime, y);
52
62
  return /* @__PURE__ */ x(
53
63
  "div",
54
64
  {
55
65
  ref: C,
56
- ...r ? { role: "button", tabIndex: 0, "aria-label": P } : {},
66
+ ...k,
57
67
  className: q(
58
68
  n("event"),
59
- $ && n("eventSelected"),
69
+ b && n("eventSelected"),
60
70
  u && n("eventOutline")
61
71
  ),
62
72
  style: {
63
- ...u && { "--cal-event-color": c },
73
+ ...u && { "--cal-event-color": r },
64
74
  top: T,
65
- height: v,
66
- left: d,
67
- width: p,
68
- zIndex: l,
69
- pointerEvents: r ? "auto" : "none"
75
+ height: m,
76
+ left: p,
77
+ width: d,
78
+ zIndex: c,
79
+ pointerEvents: v ? "auto" : "none"
70
80
  },
71
- ...r ? {
72
- onClick: () => N?.(e),
73
- onKeyDown: (t) => {
74
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), N?.(e));
75
- }
76
- } : {},
77
81
  children: [
78
- c && !u && /* @__PURE__ */ o(
82
+ r && !u && /* @__PURE__ */ i(
79
83
  "div",
80
84
  {
81
85
  className: n("eventColorBar"),
82
- style: e.status === "tentative" ? {
86
+ style: t.status === "tentative" ? {
83
87
  backgroundImage: `repeating-linear-gradient(
84
88
  -45deg,
85
- ${c},
86
- ${c} 3px,
89
+ ${r},
90
+ ${r} 3px,
87
91
  transparent 3px,
88
92
  transparent 6px
89
93
  )`
90
- } : { backgroundColor: c }
94
+ } : { backgroundColor: r }
91
95
  }
92
96
  ),
93
- /* @__PURE__ */ o(
97
+ /* @__PURE__ */ i(
94
98
  "div",
95
99
  {
96
100
  className: n("eventTitle"),
97
101
  style: {
98
- ...s,
99
- ...j ? { textDecoration: "line-through" } : {}
102
+ ...l,
103
+ ...L ? { textDecoration: "line-through" } : {}
100
104
  },
101
- children: e.title
105
+ children: t.title
102
106
  }
103
107
  ),
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: [
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: [
108
112
  f,
109
113
  ", ",
110
- e.clientName
111
- ] }) : /* @__PURE__ */ o("div", { className: n("eventTime"), style: s, children: f }))
114
+ t.clientName
115
+ ] }) : /* @__PURE__ */ i("div", { className: n("eventTime"), style: l, children: f }))
112
116
  ]
113
117
  }
114
118
  );
package/dist/preset.css CHANGED
@@ -52,6 +52,19 @@
52
52
  );
53
53
  }
54
54
 
55
+ /*
56
+ * An outlined event's text and outline color: its own color, with the
57
+ * lightness capped (light mode) or floored (dark mode) so pale and deep
58
+ * colors stay readable, and colors that already are keep their exact hue.
59
+ * Inline, because --cal-event-color is set on each event, not on :root.
60
+ */
61
+ @theme inline {
62
+ --color-cal-event-outline: oklch(from var(--cal-event-color) min(l, 0.53) c h);
63
+ --color-cal-event-outline-dark: oklch(
64
+ from var(--cal-event-color) max(l, 0.75) c h
65
+ );
66
+ }
67
+
55
68
  /*
56
69
  * Dark mode overrides.
57
70
  * @theme output lands in @layer theme, so unlayered CSS always wins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvycal/calendar",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {