@savvycal/calendar 0.12.0 → 0.12.1
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 +17 -15
- package/dist/components/day-grid-view/defaults.js +2 -2
- package/dist/components/month-view/MonthEventItem.d.ts.map +1 -1
- package/dist/components/month-view/MonthEventItem.js +24 -21
- package/dist/components/month-view/defaults.d.ts.map +1 -1
- package/dist/components/month-view/defaults.js +2 -2
- package/dist/components/resource-grid-view/defaults.js +1 -1
- package/dist/preset.css +13 -0
- package/package.json +1 -1
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.
|
|
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
|
|
506
|
-
| --------------------------------- |
|
|
507
|
-
| `--color-cal-surface` | `white`
|
|
508
|
-
| `--color-cal-border` | `zinc-300`
|
|
509
|
-
| `--color-cal-text` | `zinc-950`
|
|
510
|
-
| `--color-cal-text-body` | `zinc-900`
|
|
511
|
-
| `--color-cal-text-muted` | `zinc-600`
|
|
512
|
-
| `--color-cal-event-bg` | `zinc-100 @ 90%`
|
|
513
|
-
| `--color-cal-event-ring` | `zinc-900 @ 15%`
|
|
514
|
-
| `--color-cal-event-ring-selected` | `zinc-900 @ 30%`
|
|
515
|
-
| `--color-cal-event-shadow` | `black @ 10%`
|
|
516
|
-
| `--color-cal-now` | `orange-500`
|
|
517
|
-
| `--color-cal-slot-highlight` | `blue-400 @ 15%`
|
|
518
|
-
| `--color-cal-selection` | `blue-400 @ 25%`
|
|
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
|
|
|
@@ -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-
|
|
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-
|
|
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,
|
|
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:
|
|
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:
|
|
21
|
-
gridColumn:
|
|
22
|
-
style:
|
|
20
|
+
gridRow: b,
|
|
21
|
+
gridColumn: f,
|
|
22
|
+
style: x
|
|
23
23
|
}) {
|
|
24
|
-
const D = t.status === "canceled",
|
|
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 && !
|
|
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
|
-
|
|
33
|
+
o && e("eventOutline")
|
|
34
34
|
), l = {
|
|
35
|
-
...
|
|
36
|
-
marginLeft:
|
|
35
|
+
...o && { "--cal-event-color": t.color },
|
|
36
|
+
marginLeft: a ? 0 : 4,
|
|
37
37
|
marginRight: u ? 0 : 4,
|
|
38
|
-
...
|
|
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 && !
|
|
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
|
-
...
|
|
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:
|
|
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
|
-
|
|
59
|
+
o && e("timedEventOutline")
|
|
60
60
|
), l = {
|
|
61
|
-
...
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
101
|
-
gridColumn:
|
|
103
|
+
gridRow: b,
|
|
104
|
+
gridColumn: f,
|
|
102
105
|
pointerEvents: "none",
|
|
103
|
-
...
|
|
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,
|
|
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-
|
|
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-
|
|
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-
|
|
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",
|
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
|