@savvycal/calendar 0.12.1 → 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 +1 -1
- package/dist/components/shared/EventChip.js +62 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -775,7 +775,7 @@ The calendar includes built-in ARIA support for screen readers:
|
|
|
775
775
|
|
|
776
776
|
### Custom renderers
|
|
777
777
|
|
|
778
|
-
|
|
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.
|
|
779
779
|
|
|
780
780
|
## License
|
|
781
781
|
|
|
@@ -1,114 +1,118 @@
|
|
|
1
|
-
import { jsx as
|
|
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:
|
|
8
|
-
fallbackColor:
|
|
7
|
+
positioned: s,
|
|
8
|
+
fallbackColor: I,
|
|
9
9
|
timeZone: y,
|
|
10
10
|
cls: n,
|
|
11
11
|
onClick: N,
|
|
12
|
-
renderEvent:
|
|
13
|
-
interactive:
|
|
14
|
-
eventGap:
|
|
15
|
-
eventLayout:
|
|
16
|
-
stackOffset:
|
|
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:
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
|
|
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
|
|
27
|
-
|
|
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
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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:
|
|
42
|
-
left:
|
|
43
|
-
width:
|
|
44
|
-
zIndex:
|
|
45
|
-
pointerEvents:
|
|
51
|
+
height: m,
|
|
52
|
+
left: p,
|
|
53
|
+
width: d,
|
|
54
|
+
zIndex: c,
|
|
55
|
+
pointerEvents: v ? "auto" : "none"
|
|
46
56
|
},
|
|
47
|
-
children:
|
|
57
|
+
children: e
|
|
48
58
|
}
|
|
49
59
|
);
|
|
50
60
|
}
|
|
51
|
-
const f = A(
|
|
61
|
+
const f = A(t.startTime, y);
|
|
52
62
|
return /* @__PURE__ */ x(
|
|
53
63
|
"div",
|
|
54
64
|
{
|
|
55
65
|
ref: C,
|
|
56
|
-
...
|
|
66
|
+
...k,
|
|
57
67
|
className: q(
|
|
58
68
|
n("event"),
|
|
59
|
-
|
|
69
|
+
b && n("eventSelected"),
|
|
60
70
|
u && n("eventOutline")
|
|
61
71
|
),
|
|
62
72
|
style: {
|
|
63
|
-
...u && { "--cal-event-color":
|
|
73
|
+
...u && { "--cal-event-color": r },
|
|
64
74
|
top: T,
|
|
65
|
-
height:
|
|
66
|
-
left:
|
|
67
|
-
width:
|
|
68
|
-
zIndex:
|
|
69
|
-
pointerEvents:
|
|
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
|
-
|
|
82
|
+
r && !u && /* @__PURE__ */ i(
|
|
79
83
|
"div",
|
|
80
84
|
{
|
|
81
85
|
className: n("eventColorBar"),
|
|
82
|
-
style:
|
|
86
|
+
style: t.status === "tentative" ? {
|
|
83
87
|
backgroundImage: `repeating-linear-gradient(
|
|
84
88
|
-45deg,
|
|
85
|
-
${
|
|
86
|
-
${
|
|
89
|
+
${r},
|
|
90
|
+
${r} 3px,
|
|
87
91
|
transparent 3px,
|
|
88
92
|
transparent 6px
|
|
89
93
|
)`
|
|
90
|
-
} : { backgroundColor:
|
|
94
|
+
} : { backgroundColor: r }
|
|
91
95
|
}
|
|
92
96
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ i(
|
|
94
98
|
"div",
|
|
95
99
|
{
|
|
96
100
|
className: n("eventTitle"),
|
|
97
101
|
style: {
|
|
98
|
-
...
|
|
99
|
-
...
|
|
102
|
+
...l,
|
|
103
|
+
...L ? { textDecoration: "line-through" } : {}
|
|
100
104
|
},
|
|
101
|
-
children:
|
|
105
|
+
children: t.title
|
|
102
106
|
}
|
|
103
107
|
),
|
|
104
|
-
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
|
|
107
|
-
] }) :
|
|
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
|
-
|
|
111
|
-
] }) : /* @__PURE__ */
|
|
114
|
+
t.clientName
|
|
115
|
+
] }) : /* @__PURE__ */ i("div", { className: n("eventTime"), style: l, children: f }))
|
|
112
116
|
]
|
|
113
117
|
}
|
|
114
118
|
);
|