@open-webapp/calendar 0.14.2 → 0.16.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 +19 -3
- package/dist/core/events.d.ts +8 -2
- package/dist/core/events.js +10 -2
- package/dist/react/CalendarPane.d.ts +11 -1
- package/dist/react/CalendarPane.js +4 -4
- package/dist/react/EventDetails.d.ts +6 -2
- package/dist/react/EventDetails.js +45 -9
- package/dist/styles.css +58 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Multi-account Google Calendar read-only sync (controller) plus React UI (`CalendarPane`, `CalendarSelector`). Storage and encryption are host-supplied adapters.
|
|
4
4
|
|
|
5
|
+
> **0.16.0 is additive and non-breaking.** New optional `resolveContact` prop supplies contact names and avatars in the event details overlay. See [0.16.0](#0160-minor-additive-non-breaking).
|
|
6
|
+
|
|
7
|
+
> **0.15.0 is additive and non-breaking.** RSVP changes in the overlay now take an optional note and are sent with a Send button; `onRsvpChange` gets an optional third `note` argument. See [0.15.0](#0150-minor-additive-non-breaking).
|
|
8
|
+
>
|
|
5
9
|
> **0.14.0 is additive and non-breaking.** The event details overlay is redesigned, and the optional `onRsvpChange` prop lets the host write RSVP changes. See [0.14.0](#0140-minor-additive-non-breaking).
|
|
6
10
|
>
|
|
7
11
|
> **0.13.0 is BREAKING.** Clicking an event title now opens an in-pane event details overlay instead of a popup window. See [0.13.0](#0130-breaking-pre-10-minor).
|
|
@@ -165,13 +169,14 @@ Call at top level of a vitest file; it registers a `describe('StorageAdapter con
|
|
|
165
169
|
| `sourceNotice?` | `(source) => ReactNode` | per-source slot, rendered for `needs-scope` sources (e.g. re-consent button); without it the built-in reauth block is shown |
|
|
166
170
|
| `onClose?` | `() => void` | |
|
|
167
171
|
| `popupName?` | `string` | `window.open` name for the event popup window (default `notesdiary-cal-event`). The popup now opens only from the overlay's "Open in Google Calendar" link |
|
|
168
|
-
| `
|
|
172
|
+
| `resolveContact?` | `(email: string) => { name?: string; photoUrl?: string } \| undefined` | 0.16.0. Contact lookup for overlay invitee and organizer rows and list-row organizer labels: `name` beats `displayName`; avatar only when `photoUrl`, overlay only. Absent = unchanged. No dependency on contacts. |
|
|
173
|
+
| `onRsvpChange?` | `(event: CalendarEvent, status: RsvpStatus, note?: string) => Promise<void>` | 0.14.0 (`note` added in 0.15.0). Host-owned RSVP writer. When absent, the overlay has no "Change RSVP" row. The package never writes to Google itself. See [Change RSVP](#change-rsvp-onrsvpchange) |
|
|
169
174
|
|
|
170
175
|
#### Event details overlay
|
|
171
176
|
|
|
172
177
|
A plain left click on an event title opens a bottom-sheet overlay inside the pane (`role="dialog"`, `aria-modal="true"`). The sheet is laid out like the event card, but larger, top to bottom:
|
|
173
178
|
|
|
174
|
-
1. Top row, same information as the card: time range (or `All day`), Join (only when `joinUrl` is set), a
|
|
179
|
+
1. Top row, same information as the card: time range (or `All day`), Join (only when `joinUrl` is set), a status tint (no glyph since 0.15.0), and the close (×) button.
|
|
175
180
|
2. Title (the dialog's accessible name, an `h2`).
|
|
176
181
|
3. Organizer row: the label "Organizer", the organizer label, and "(you)" when `organizer.self` is true. Hidden when there is no organizer label.
|
|
177
182
|
4. Calendar line: calendar color dot, calendar name, source (account) label, and location when set.
|
|
@@ -209,7 +214,7 @@ A plain left click on an event title opens a bottom-sheet overlay inside the pan
|
|
|
209
214
|
`onRsvpChange` is an optional prop on `CalendarPane`. The host does the write; the package makes no Google request for it and asks for no new OAuth scopes. Recurring events are handled per instance: the `event` passed to the host is the instance the user opened.
|
|
210
215
|
|
|
211
216
|
- The row is a radiogroup labeled "Change RSVP" with three options: Yes (accepted), Maybe (tentative), and No (declined). Unaccepted is not offered. Each option is a radio with `aria-checked`. Arrow keys move between options. The row shows only when the prop is set, you are an attendee, and the event has attendees.
|
|
212
|
-
- Choosing an option calls `onRsvpChange(event, status)` once.
|
|
217
|
+
- Choosing an option only selects it; nothing is written. A "Note to organizer (optional)" input (max 500 chars) and a Send button appear. Send calls `onRsvpChange(event, status, note)` once; `note` is trimmed, or `undefined` when empty. Re-clicking the saved status or pressing Escape in the note field cancels the draft (Escape does not close the overlay). Retry resends status and note. Pass the note to Google as `attendees[].comment` with `sendUpdates`; only the organizer sees it.
|
|
213
218
|
- Optimistic update: the overlay and the event card show the new status at once. The options are disabled while the write is pending, and a live region reads "Updating RSVP...".
|
|
214
219
|
- Success: the override stays until a controller refresh delivers that event, so the server's status takes over then. If the new status is hidden by the RSVP filter chips, the overlay stays open, and the card leaves the list only after the overlay closes. Changing filter chips still closes the overlay, as before.
|
|
215
220
|
- Failure: if the promise rejects or throws, or does not settle within **60 seconds** (`RSVP_PENDING_TIMEOUT_MS = 60000`), the previous status comes back and the live region shows "Couldn't update RSVP. Retry". Retry sends the last chosen status again. A result that arrives after the timeout is ignored. The timer is not cleared by closing the overlay, so a timed-out write still rolls back. In that case no error message shows, because the overlay is closed.
|
|
@@ -334,6 +339,17 @@ The shared `.calendar-selector-trigger` uses border-box inline-flex, centered al
|
|
|
334
339
|
|
|
335
340
|
Done, Select all and Clear use the approved action-only flat styling via `.calendar-selector-actions > button` in standalone and grouped footer dropdowns: transparent resting background, zero border, no shadow, inherited font, `--calendar-selector-text` color and pointer cursor. Hover uses `--calendar-hover`; pointer focus has no decorative outline, while keyboard `:focus-visible` uses a 2px solid `--calendar-focus` outline with 2px offset. Action padding, row flex layout and 8px gap/top/bottom margins, footer/dropdown geometry, trigger/search/option styling, other native controls and all selection, callback and focus-return contracts are preserved.
|
|
336
341
|
|
|
342
|
+
## 0.16.0 (minor, additive, non-breaking)
|
|
343
|
+
|
|
344
|
+
- Optional `resolveContact?: (email: string) => { name?: string; photoUrl?: string } | undefined` on `CalendarPane`: in the event details overlay, a returned `name` wins over the event `displayName` (and email) on invitee rows and the organizer row, and the organizer label in list rows resolves the same way (via `getOrganizerLabel(event, resolveContact?)`, "You" kept when `organizer.self` and nothing resolves, multi-source rows keep the `· <account email>` suffix); a 20px round avatar `img` renders only when `photoUrl` is returned, in the overlay only (list rows never render avatars). The host normalizes emails; the package passes the email as given by the event. Absent prop or `undefined` result leaves output unchanged. Calendar has no dependency on `@open-webapp/contacts`; hosts wire any lookup.
|
|
345
|
+
|
|
346
|
+
## 0.15.0 (minor, additive, non-breaking)
|
|
347
|
+
|
|
348
|
+
- `onRsvpChange` gains an optional third argument `note?: string`.
|
|
349
|
+
- Overlay RSVP is now select, optional note, then Send. Selecting alone no longer calls the host.
|
|
350
|
+
- The overlay top row no longer shows the RSVP glyph (status tint and Join colors remain).
|
|
351
|
+
- Update hosts that relied on one call per click: the call now happens on Send.
|
|
352
|
+
|
|
337
353
|
## 0.14.2 (patch)
|
|
338
354
|
|
|
339
355
|
- The overlay top row carries the card's `calendar-event-row--rsvp-{status}` class so the Join link gets the same status-coloured styling as on the card. The Organizer row under the title is dropped when the invitee list is shown (the organizer is tagged in the list), and invitee statuses use the card's icon-only status badge instead of a text pill. No API change.
|
package/dist/core/events.d.ts
CHANGED
|
@@ -23,8 +23,14 @@ export declare function getRollingWindow(now: Date): {
|
|
|
23
23
|
* declined is a normal, independently-selectable status now, not hard-excluded.
|
|
24
24
|
*/
|
|
25
25
|
export declare function filterByRsvp(events: CalendarEvent[], selected: ReadonlySet<RsvpStatus>): CalendarEvent[];
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* contact name (optional resolver) -> displayName -> email -> "You" (only when organizer.self
|
|
28
|
+
* is true and all above are absent).
|
|
29
|
+
*/
|
|
30
|
+
export declare function getOrganizerLabel(event: CalendarEvent, resolveContact?: (email: string) => {
|
|
31
|
+
name?: string;
|
|
32
|
+
photoUrl?: string;
|
|
33
|
+
} | undefined): string;
|
|
28
34
|
/**
|
|
29
35
|
* True iff `event` is a timed (non-all-day) event currently in progress at `now`:
|
|
30
36
|
* both `start.dateTime` and `end.dateTime` exist and parse to valid instants,
|
package/dist/core/events.js
CHANGED
|
@@ -46,9 +46,17 @@ export function getRollingWindow(now) {
|
|
|
46
46
|
export function filterByRsvp(events, selected) {
|
|
47
47
|
return events.filter((e) => selected.has(e.selfResponseStatus));
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
50
|
-
|
|
49
|
+
/**
|
|
50
|
+
* contact name (optional resolver) -> displayName -> email -> "You" (only when organizer.self
|
|
51
|
+
* is true and all above are absent).
|
|
52
|
+
*/
|
|
53
|
+
export function getOrganizerLabel(event, resolveContact) {
|
|
51
54
|
const { organizer } = event;
|
|
55
|
+
if (resolveContact && organizer.email) {
|
|
56
|
+
const name = resolveContact(organizer.email)?.name;
|
|
57
|
+
if (name)
|
|
58
|
+
return name;
|
|
59
|
+
}
|
|
52
60
|
if (organizer.displayName)
|
|
53
61
|
return organizer.displayName;
|
|
54
62
|
if (organizer.email)
|
|
@@ -3,6 +3,14 @@ import type { CalendarEvent, RsvpStatus, Source } from '../core/types.js';
|
|
|
3
3
|
import type { CalendarController } from '../core/controller.js';
|
|
4
4
|
export type RsvpSelection = Set<RsvpStatus>;
|
|
5
5
|
export interface CalendarPaneProps {
|
|
6
|
+
/**
|
|
7
|
+
* Optional host lookup by attendee/organizer email (as given by the event). A returned `name` wins
|
|
8
|
+
* over the event displayName; an avatar renders only when `photoUrl` is returned. Absent = unchanged.
|
|
9
|
+
*/
|
|
10
|
+
resolveContact?: (email: string) => {
|
|
11
|
+
name?: string;
|
|
12
|
+
photoUrl?: string;
|
|
13
|
+
} | undefined;
|
|
6
14
|
theme?: 'system' | 'light' | 'dark';
|
|
7
15
|
sources: Source[];
|
|
8
16
|
controller: CalendarController;
|
|
@@ -23,8 +31,10 @@ export interface CalendarPaneProps {
|
|
|
23
31
|
/**
|
|
24
32
|
* Optional host-provided RSVP writer. When present, the event details overlay shows a
|
|
25
33
|
* "Change RSVP" row. The package never writes to Google itself; the host performs the write.
|
|
34
|
+
* `comment` is the optional trimmed note to the organizer (omitted when empty); hosts may pass it
|
|
35
|
+
* to Google `attendees[].comment`.
|
|
26
36
|
*/
|
|
27
|
-
onRsvpChange?: (event: CalendarEvent, status: RsvpStatus) => Promise<void>;
|
|
37
|
+
onRsvpChange?: (event: CalendarEvent, status: RsvpStatus, comment?: string) => Promise<void>;
|
|
28
38
|
}
|
|
29
39
|
export declare const RSVP_PENDING_TIMEOUT_MS = 60000;
|
|
30
40
|
export declare const RSVP_CHIPS: {
|
|
@@ -196,7 +196,7 @@ export function CalendarPane(props) {
|
|
|
196
196
|
setRsvpPending(false);
|
|
197
197
|
setRsvpError(false);
|
|
198
198
|
}, [detailKey]);
|
|
199
|
-
function handleRsvpChange(_event, status) {
|
|
199
|
+
function handleRsvpChange(_event, status, comment) {
|
|
200
200
|
const onRsvpChange = props.onRsvpChange;
|
|
201
201
|
const raw = detail?.snapshot;
|
|
202
202
|
if (!onRsvpChange || !raw || rsvpPendingRef.current)
|
|
@@ -234,7 +234,7 @@ export function CalendarPane(props) {
|
|
|
234
234
|
rsvpTimerRef.current = setTimeout(() => finish(false), RSVP_PENDING_TIMEOUT_MS);
|
|
235
235
|
let p;
|
|
236
236
|
try {
|
|
237
|
-
p = Promise.resolve(onRsvpChange(raw, status));
|
|
237
|
+
p = Promise.resolve(onRsvpChange(raw, status, comment));
|
|
238
238
|
}
|
|
239
239
|
catch {
|
|
240
240
|
p = Promise.reject(new Error('rsvp failed'));
|
|
@@ -528,7 +528,7 @@ export function CalendarPane(props) {
|
|
|
528
528
|
const eventKey = getCalendarEventKey(event);
|
|
529
529
|
const calendar = calendarsByKey.get(`${event.sourceId}\u0000${event.calendarId}`);
|
|
530
530
|
const showCalendarLabel = calendar && !calendar.primary;
|
|
531
|
-
const organizerLabel = getOrganizerLabel(event);
|
|
531
|
+
const organizerLabel = getOrganizerLabel(event, props.resolveContact);
|
|
532
532
|
const showOrganizerLabel = multi
|
|
533
533
|
? true
|
|
534
534
|
: organizerLabel && (!showCalendarLabel || organizerLabel !== calendar.summary);
|
|
@@ -566,5 +566,5 @@ export function CalendarPane(props) {
|
|
|
566
566
|
})) }) })), detail && (_jsx(EventDetails, { event: (() => {
|
|
567
567
|
const o = overrides.get(detailKey);
|
|
568
568
|
return o ? { ...detail.snapshot, selfResponseStatus: o } : detail.snapshot;
|
|
569
|
-
})(), onRsvpChange: props.onRsvpChange ? handleRsvpChange : undefined, pending: rsvpPending, error: rsvpError, calendar: calendarsByKey.get(`${detail.snapshot.sourceId}\u0000${detail.snapshot.calendarId}`), sourceLabel: multi ? sourceEmail(detail.snapshot.sourceId) : '', onClose: () => closeDetail(true), onOpenLink: (url) => openEventPopup(url, popupRef, popupName) }))] }));
|
|
569
|
+
})(), onRsvpChange: props.onRsvpChange ? handleRsvpChange : undefined, resolveContact: props.resolveContact, pending: rsvpPending, error: rsvpError, calendar: calendarsByKey.get(`${detail.snapshot.sourceId}\u0000${detail.snapshot.calendarId}`), sourceLabel: multi ? sourceEmail(detail.snapshot.sourceId) : '', onClose: () => closeDetail(true), onOpenLink: (url) => openEventPopup(url, popupRef, popupName) }))] }));
|
|
570
570
|
}
|
|
@@ -5,9 +5,13 @@ export interface EventDetailsProps {
|
|
|
5
5
|
sourceLabel: string;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
onOpenLink: (url: string) => void;
|
|
8
|
-
onRsvpChange?: (event: CalendarEvent, status: RsvpStatus) => void | Promise<void>;
|
|
8
|
+
onRsvpChange?: (event: CalendarEvent, status: RsvpStatus, note?: string) => void | Promise<void>;
|
|
9
9
|
pending?: boolean;
|
|
10
10
|
error?: boolean | string;
|
|
11
11
|
onRetry?: () => void;
|
|
12
|
+
resolveContact?: (email: string) => {
|
|
13
|
+
name?: string;
|
|
14
|
+
photoUrl?: string;
|
|
15
|
+
} | undefined;
|
|
12
16
|
}
|
|
13
|
-
export declare function EventDetails({ event, calendar, sourceLabel, onClose, onOpenLink, onRsvpChange, pending, error, onRetry }: EventDetailsProps): import("react").JSX.Element;
|
|
17
|
+
export declare function EventDetails({ event, calendar, sourceLabel, onClose, onOpenLink, onRsvpChange, pending, error, onRetry, resolveContact }: EventDetailsProps): import("react").JSX.Element;
|
|
@@ -14,15 +14,28 @@ const FOCUSABLE = 'a[href],button:not([disabled]),[tabindex]:not([tabindex="-1"]
|
|
|
14
14
|
function rsvpOf(status) {
|
|
15
15
|
return RSVP_CHIPS.find((c) => c.status === status) ?? RSVP_CHIPS[3];
|
|
16
16
|
}
|
|
17
|
-
export function EventDetails({ event, calendar, sourceLabel, onClose, onOpenLink, onRsvpChange, pending, error, onRetry }) {
|
|
17
|
+
export function EventDetails({ event, calendar, sourceLabel, onClose, onOpenLink, onRsvpChange, pending, error, onRetry, resolveContact }) {
|
|
18
18
|
const sheetRef = useRef(null);
|
|
19
|
-
const lastStatus = useRef(null);
|
|
20
19
|
const [expanded, setExpanded] = useState(false);
|
|
20
|
+
const [selected, setSelected] = useState(null);
|
|
21
|
+
const [note, setNote] = useState('');
|
|
22
|
+
const wasPending = useRef(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (pending)
|
|
25
|
+
wasPending.current = true;
|
|
26
|
+
else if (wasPending.current) {
|
|
27
|
+
wasPending.current = false;
|
|
28
|
+
if (!error) {
|
|
29
|
+
setSelected(null);
|
|
30
|
+
setNote('');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [pending, error]);
|
|
21
34
|
useEffect(() => {
|
|
22
35
|
sheetRef.current?.focus();
|
|
23
36
|
}, []);
|
|
24
37
|
const time = event.isAllDay ? 'All day' : formatTimeRange(event);
|
|
25
|
-
const organizer = getOrganizerLabel(event);
|
|
38
|
+
const organizer = getOrganizerLabel(event, resolveContact);
|
|
26
39
|
const description = htmlToPlainText(event.description);
|
|
27
40
|
const attendees = event.attendees ?? [];
|
|
28
41
|
const onlySelf = attendees.length === 1 && !!attendees[0].self;
|
|
@@ -32,16 +45,25 @@ export function EventDetails({ event, calendar, sourceLabel, onClose, onOpenLink
|
|
|
32
45
|
const sorted = showInvitees ? sortInvitees(attendees) : [];
|
|
33
46
|
const visible = expanded ? sorted : sorted.slice(0, MAX_INVITEES);
|
|
34
47
|
function choose(status) {
|
|
35
|
-
if (pending
|
|
48
|
+
if (pending)
|
|
49
|
+
return;
|
|
50
|
+
if (status === event.selfResponseStatus || status === selected) {
|
|
51
|
+
setSelected(null);
|
|
52
|
+
setNote('');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
setSelected(status);
|
|
56
|
+
}
|
|
57
|
+
function send() {
|
|
58
|
+
if (pending || !onRsvpChange || !selected)
|
|
36
59
|
return;
|
|
37
|
-
|
|
38
|
-
void onRsvpChange(event, status);
|
|
60
|
+
void onRsvpChange(event, selected, note.trim() || undefined);
|
|
39
61
|
}
|
|
40
62
|
function retry() {
|
|
41
63
|
if (onRetry)
|
|
42
64
|
onRetry();
|
|
43
|
-
else
|
|
44
|
-
|
|
65
|
+
else
|
|
66
|
+
send();
|
|
45
67
|
}
|
|
46
68
|
function onRadioKeyDown(e) {
|
|
47
69
|
const dir = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? -1 : 0;
|
|
@@ -78,7 +100,21 @@ export function EventDetails({ event, calendar, sourceLabel, onClose, onOpenLink
|
|
|
78
100
|
const checkedStatus = RSVP_OPTIONS.some((o) => o.status === event.selfResponseStatus)
|
|
79
101
|
? event.selfResponseStatus
|
|
80
102
|
: RSVP_OPTIONS[0].status;
|
|
81
|
-
return (_jsx("div", { className: "calendar-event-details", onClick: onClose, onKeyDown: onKeyDown, children: _jsxs("div", { ref: sheetRef, className: "calendar-event-details-sheet", role: "dialog", "aria-modal": "true", "aria-label": event.summary, tabIndex: -1, onClick: (e) => e.stopPropagation(), children: [_jsx("div", { className: "calendar-event-details-grabber", "aria-hidden": "true" }), _jsxs("div", { className: `calendar-event-header calendar-event-details-toprow calendar-event-row--rsvp-${rsvpOf(event.selfResponseStatus).status}`, children: [_jsx("span", { className: "calendar-event-time", children: time }), _jsxs("div", { className: "calendar-event-actions", children: [event.joinUrl && (_jsx("a", { className: "calendar-event-join", href: event.joinUrl, target: "_blank", rel: "noopener noreferrer", children: "Join" })), _jsx(
|
|
103
|
+
return (_jsx("div", { className: "calendar-event-details", onClick: onClose, onKeyDown: onKeyDown, children: _jsxs("div", { ref: sheetRef, className: "calendar-event-details-sheet", role: "dialog", "aria-modal": "true", "aria-label": event.summary, tabIndex: -1, onClick: (e) => e.stopPropagation(), children: [_jsx("div", { className: "calendar-event-details-grabber", "aria-hidden": "true" }), _jsxs("div", { className: `calendar-event-header calendar-event-details-toprow calendar-event-row--rsvp-${rsvpOf(event.selfResponseStatus).status}`, children: [_jsx("span", { className: "calendar-event-time", children: time }), _jsxs("div", { className: "calendar-event-actions", children: [event.joinUrl && (_jsx("a", { className: "calendar-event-join", href: event.joinUrl, target: "_blank", rel: "noopener noreferrer", children: "Join" })), _jsx("button", { type: "button", className: "calendar-event-details-close", "aria-label": "Close", onClick: onClose, children: "\u00D7" })] })] }), _jsx("div", { className: "calendar-event-details-header", children: _jsx("h2", { className: "calendar-event-details-title", children: event.summary }) }), _jsxs("div", { className: "calendar-event-details-body", children: [organizer && !showInvitees && (_jsxs("section", { className: "calendar-event-details-organizer", children: [_jsx("span", { children: "Organizer" }), " ", _jsx("span", { children: organizer }), event.organizer.self && _jsx("span", { children: " (you)" })] })), (calendar || sourceLabel || event.location) && (_jsxs("section", { className: "calendar-event-details-calendar", children: [_jsx("span", { className: "calendar-event-details-dot", "aria-hidden": "true", style: { background: calendar?.backgroundColor } }), calendar?.summary && _jsx("span", { children: calendar.summary }), sourceLabel && _jsxs("span", { children: [" ", sourceLabel] }), event.location && _jsxs("span", { className: "calendar-event-details-location", children: [" ", event.location] })] })), description && (_jsx("section", { className: "calendar-event-details-description", style: { whiteSpace: 'pre-wrap' }, children: linkifyText(description).map((t, i) => t.type === 'link' ? (_jsx("a", { href: t.href, target: "_blank", rel: "noopener noreferrer", children: t.text }, i)) : (_jsx("span", { children: t.text }, i))) })), showInvitees && (_jsxs("section", { className: "calendar-event-details-invitees", children: [_jsxs("h3", { children: ["Invitees (", attendees.length, ")"] }), _jsx("div", { className: "calendar-event-details-invitee-summary", children: summarizeInvitees(attendees) }), _jsx("ul", { children: visible.map((a, i) => {
|
|
104
|
+
const contact = resolveContact && a.email ? resolveContact(a.email) : undefined;
|
|
105
|
+
return (_jsxs("li", { children: [contact?.photoUrl && (_jsx("img", { className: "calendar-event-details-avatar", src: contact.photoUrl, alt: "", width: 20, height: 20 })), _jsx("span", { children: contact?.name || a.displayName || a.email }), a.organizer && _jsx("span", { className: "calendar-event-details-tag", children: " Organizer" }), a.self && _jsx("span", { className: "calendar-event-details-tag", children: " (you)" }), ' ', _jsx(RsvpStatusIcon, { status: a.responseStatus })] }, `${a.email}-${i}`));
|
|
106
|
+
}) }), sorted.length > MAX_INVITEES && (_jsx("button", { type: "button", "aria-expanded": expanded, onClick: () => setExpanded((v) => !v), children: expanded ? 'Show fewer' : `Show all ${sorted.length}` }))] })), showRsvp && (_jsxs("section", { className: "calendar-event-details-rsvp", children: [_jsx("div", { role: "radiogroup", "aria-label": "Change RSVP", children: RSVP_OPTIONS.map((o) => (_jsx("button", { type: "button", role: "radio", "aria-checked": (selected ?? event.selfResponseStatus) === o.status, tabIndex: o.status === (selected ?? checkedStatus) ? 0 : -1, disabled: !!pending, onClick: () => choose(o.status), onKeyDown: onRadioKeyDown, children: o.label }, o.status))) }), selected && (_jsxs("div", { className: "calendar-event-details-rsvp-note", children: [_jsxs("label", { children: [_jsx("span", { className: "calendar-event-details-rsvp-note-label", children: "Note to organizer (optional)" }), _jsx("input", { type: "text", maxLength: 500, value: note, disabled: !!pending, onChange: (e) => setNote(e.target.value), onKeyDown: (e) => {
|
|
107
|
+
if (e.key === 'Escape') {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
setSelected(null);
|
|
110
|
+
setNote('');
|
|
111
|
+
sheetRef.current?.querySelector('[role="radio"][tabindex="0"]')?.focus();
|
|
112
|
+
}
|
|
113
|
+
else if (e.key === 'Enter') {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
send();
|
|
116
|
+
}
|
|
117
|
+
} })] }), _jsx("button", { type: "button", className: "calendar-event-details-rsvp-send", disabled: !!pending, onClick: send, children: "Send" })] })), _jsx("div", { "aria-live": "polite", className: "calendar-event-details-rsvp-status", children: pending ? ('Updating RSVP...') : error ? (_jsxs(_Fragment, { children: [_jsx("span", { children: "Couldn't update RSVP." }), ' ', _jsx("button", { type: "button", onClick: retry, children: "Retry" })] })) : null })] })), event.htmlLink && (_jsx("section", { className: "calendar-event-details-open", children: _jsx("a", { href: event.htmlLink, target: "_blank", rel: "noopener noreferrer", onClick: (e) => {
|
|
82
118
|
e.preventDefault();
|
|
83
119
|
onOpenLink(event.htmlLink);
|
|
84
120
|
}, children: "Open in Google Calendar" }) }))] })] }) }));
|
package/dist/styles.css
CHANGED
|
@@ -945,6 +945,14 @@
|
|
|
945
945
|
font-size: 0.9em;
|
|
946
946
|
}
|
|
947
947
|
|
|
948
|
+
.calendar-event-details-avatar {
|
|
949
|
+
width: 20px;
|
|
950
|
+
height: 20px;
|
|
951
|
+
border-radius: 50%;
|
|
952
|
+
object-fit: cover;
|
|
953
|
+
background: var(--calendar-badge);
|
|
954
|
+
}
|
|
955
|
+
|
|
948
956
|
.calendar-event-details-tag {
|
|
949
957
|
padding: 0 6px;
|
|
950
958
|
border-radius: 8px;
|
|
@@ -985,6 +993,56 @@
|
|
|
985
993
|
cursor: default;
|
|
986
994
|
}
|
|
987
995
|
|
|
996
|
+
.calendar-event-details-rsvp-note {
|
|
997
|
+
display: flex;
|
|
998
|
+
align-items: flex-end;
|
|
999
|
+
gap: 6px;
|
|
1000
|
+
margin-top: 8px;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
.calendar-event-details-rsvp-note label {
|
|
1004
|
+
flex: 1 1 auto;
|
|
1005
|
+
min-width: 0;
|
|
1006
|
+
display: flex;
|
|
1007
|
+
flex-direction: column;
|
|
1008
|
+
gap: 2px;
|
|
1009
|
+
font-size: 0.85em;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.calendar-event-details-rsvp-note input {
|
|
1013
|
+
width: 100%;
|
|
1014
|
+
box-sizing: border-box;
|
|
1015
|
+
padding: 4px 8px;
|
|
1016
|
+
border: 1px solid var(--calendar-chip-border);
|
|
1017
|
+
border-radius: 6px;
|
|
1018
|
+
background: transparent;
|
|
1019
|
+
color: inherit;
|
|
1020
|
+
font: inherit;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
.calendar-event-details-rsvp-note input:focus-visible,
|
|
1024
|
+
.calendar-event-details-rsvp-send:focus-visible {
|
|
1025
|
+
outline: 2px solid var(--calendar-focus);
|
|
1026
|
+
outline-offset: 2px;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
.calendar-event-details-rsvp-send {
|
|
1030
|
+
flex: 0 0 auto;
|
|
1031
|
+
padding: 4px 12px;
|
|
1032
|
+
border: 1px solid var(--calendar-chip-selected);
|
|
1033
|
+
border-radius: 14px;
|
|
1034
|
+
background: var(--calendar-chip-selected);
|
|
1035
|
+
color: var(--calendar-chip-selected-text);
|
|
1036
|
+
font: inherit;
|
|
1037
|
+
cursor: pointer;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
.calendar-event-details-rsvp-send:disabled,
|
|
1041
|
+
.calendar-event-details-rsvp-note input:disabled {
|
|
1042
|
+
opacity: 0.6;
|
|
1043
|
+
cursor: default;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
988
1046
|
.calendar-event-details-rsvp-status {
|
|
989
1047
|
margin-top: 6px;
|
|
990
1048
|
font-size: 0.85em;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-webapp/calendar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsc && cp src/react/styles.css dist/styles.css",
|
|
27
27
|
"test": "vitest run",
|
|
28
|
-
"test:theme-browser": "vitest run --config vitest.browser.config.ts"
|
|
28
|
+
"test:theme-browser": "vitest run --config vitest.browser.config.ts",
|
|
29
|
+
"lint": "oxlint --type-aware src"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"react": "^19",
|
|
@@ -41,6 +42,8 @@
|
|
|
41
42
|
"@vitest/browser": "2.1.9",
|
|
42
43
|
"fake-indexeddb": "^6.0.0",
|
|
43
44
|
"jsdom": "^30.0.1",
|
|
45
|
+
"oxlint": "^1.94.0",
|
|
46
|
+
"oxlint-tsgolint": "^7.0.2007",
|
|
44
47
|
"playwright": "1.51.1",
|
|
45
48
|
"react": "^19.0.0",
|
|
46
49
|
"react-dom": "^19.0.0",
|