@rapidmx/web-client 0.6.0 → 0.7.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/apps/shared/components/admin/settings/BrandingForm.tsx +398 -385
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +119 -112
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +159 -152
- package/apps/shared/components/admin/settings/PluginsManager.tsx +1288 -1235
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +9 -1
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +288 -290
- package/apps/shared/components/admin/setup/SetupWizard.tsx +443 -416
- package/apps/shared/components/layout/AppShell.tsx +288 -288
- package/apps/shared/components/mail/ConversationList.tsx +225 -33
- package/apps/shared/components/mail/ConversationThreadPane.tsx +434 -216
- package/apps/shared/components/mail/MailListToolbar.tsx +265 -0
- package/apps/shared/components/mail/MailSelectionBar.tsx +222 -0
- package/apps/shared/components/mail/MenuButton.tsx +384 -0
- package/apps/shared/components/mail/MessageDetailPane.tsx +280 -215
- package/apps/shared/components/mail/MoveToFolderDialog.tsx +263 -0
- package/apps/shared/components/mail/compose/ComposeContext.tsx +29 -2
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +1700 -1652
- package/apps/shared/components/mail/compose/RecipientInput.tsx +356 -0
- package/apps/shared/components/mail/compose/RichTextEditor.tsx +38 -3
- package/apps/shared/components/mail/compose/quotedBody.ts +100 -0
- package/apps/shared/components/mail/compose/recipients.ts +104 -0
- package/apps/shared/components/mail/labelMenu.tsx +278 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +445 -420
- package/apps/shared/components/mail/listPreferences.ts +228 -0
- package/apps/shared/components/settings/layout/SettingsShell.tsx +0 -1
- package/apps/shared/styles/app.css +28 -5
- package/apps/www/index.tsx +1854 -1314
- package/apps/www/messages/[uid].tsx +5 -4
- package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +7 -3
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +6 -5
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.d.ts +4 -1
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.d.ts +4 -1
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/settings/PluginsManager.d.ts +8 -1
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +33 -14
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.d.ts +4 -1
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.js +1 -1
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +14 -10
- package/dist/apps/shared/components/mail/ConversationList.d.ts +42 -6
- package/dist/apps/shared/components/mail/ConversationList.js +84 -10
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +52 -13
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +217 -60
- package/dist/apps/shared/components/mail/MailListToolbar.d.ts +55 -0
- package/dist/apps/shared/components/mail/MailListToolbar.js +149 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +59 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.js +48 -0
- package/dist/apps/shared/components/mail/MenuButton.d.ts +71 -0
- package/dist/apps/shared/components/mail/MenuButton.js +211 -0
- package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +27 -19
- package/dist/apps/shared/components/mail/MessageDetailPane.js +126 -129
- package/dist/apps/shared/components/mail/MoveToFolderDialog.d.ts +57 -0
- package/dist/apps/shared/components/mail/MoveToFolderDialog.js +138 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +16 -1
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +3 -1
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +52 -20
- package/dist/apps/shared/components/mail/compose/RecipientInput.d.ts +36 -0
- package/dist/apps/shared/components/mail/compose/RecipientInput.js +203 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +10 -1
- package/dist/apps/shared/components/mail/compose/RichTextEditor.js +21 -3
- package/dist/apps/shared/components/mail/compose/quotedBody.d.ts +37 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.js +85 -0
- package/dist/apps/shared/components/mail/compose/recipients.d.ts +24 -0
- package/dist/apps/shared/components/mail/compose/recipients.js +87 -0
- package/dist/apps/shared/components/mail/labelMenu.d.ts +97 -0
- package/dist/apps/shared/components/mail/labelMenu.js +134 -0
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +8 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +15 -3
- package/dist/apps/shared/components/mail/listPreferences.d.ts +101 -0
- package/dist/apps/shared/components/mail/listPreferences.js +186 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +0 -1
- package/dist/apps/shared/styles/app.css +28 -5
- package/dist/apps/www/index.js +506 -112
- package/dist/apps/www/messages/[uid].js +2 -3
- package/package.json +2 -2
- package/apps/www/settings/focused-inbox/index.tsx +0 -150
- package/dist/apps/www/settings/focused-inbox/index.d.ts +0 -4
- package/dist/apps/www/settings/focused-inbox/index.js +0 -71
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
5
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
8
|
+
import { HiOutlineXMark } from "react-icons/hi2";
|
|
9
|
+
import { fetchRecipientSuggestions, RECIPIENT_SUGGESTION_MIN_QUERY_LENGTH, } from "@rapidmx/react-shared/mail/directoryApi.js";
|
|
10
|
+
import { formatRecipient, isValidRecipientAddress, parseRecipient, splitRecipientList, splitTypedRecipients } from "./recipients.js";
|
|
11
|
+
/** How long typing must pause before suggestions are requested. */
|
|
12
|
+
export const RECIPIENT_SUGGESTION_DEBOUNCE_MS = 150;
|
|
13
|
+
const KIND_LABELS = {
|
|
14
|
+
contact: "Contact",
|
|
15
|
+
user: "Person",
|
|
16
|
+
shared: "Shared mailbox",
|
|
17
|
+
room: "Room",
|
|
18
|
+
equipment: "Equipment",
|
|
19
|
+
list: "Group",
|
|
20
|
+
};
|
|
21
|
+
/** Where the suggestions go: under the field (or above it when there's much more room there), as wide as the field. */
|
|
22
|
+
function dropdownPosition(anchor) {
|
|
23
|
+
const rect = anchor.getBoundingClientRect();
|
|
24
|
+
const margin = 8;
|
|
25
|
+
const width = Math.min(Math.max(rect.width, 260), window.innerWidth - margin * 2);
|
|
26
|
+
const left = Math.min(Math.max(rect.left, margin), window.innerWidth - width - margin);
|
|
27
|
+
const below = window.innerHeight - rect.bottom - margin;
|
|
28
|
+
const above = rect.top - margin;
|
|
29
|
+
if (below < 160 && above > below) {
|
|
30
|
+
return { left, width, bottom: window.innerHeight - rect.top + 2, maxHeight: Math.min(320, above) };
|
|
31
|
+
}
|
|
32
|
+
return { left, width, top: rect.bottom + 2, maxHeight: Math.max(120, Math.min(320, below)) };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A To/Cc/Bcc field: committed recipients as removable chips, and a WAI-ARIA combobox for the one being typed that
|
|
36
|
+
* suggests the caller's contacts and the server directory (contacts first, one entry per address). The field's value is
|
|
37
|
+
* still plain text (recipients separated by commas), so drafts, autosave and sending read it as before.
|
|
38
|
+
*
|
|
39
|
+
* Typing a comma or semicolon (outside a quoted name or angle brackets), pressing Enter, or leaving the field turns the
|
|
40
|
+
* typed text into a chip; pasted lists split the same way. Suggestions load `debounceMs` after typing pauses, for at
|
|
41
|
+
* least two characters, and a newer query aborts an older request. Arrow keys move through them, Enter or Tab picks
|
|
42
|
+
* one (as `Name <address>`), Escape closes them, and Backspace in an empty input removes the last chip.
|
|
43
|
+
*/
|
|
44
|
+
export default function RecipientInput({ id, label, value, onChange, onBlur, onCommit, mailboxUid, fetchSuggestions = fetchRecipientSuggestions, debounceMs = RECIPIENT_SUGGESTION_DEBOUNCE_MS, disabled, autoFocus, }) {
|
|
45
|
+
const [pending, setPending] = useState("");
|
|
46
|
+
const [suggestions, setSuggestions] = useState([]);
|
|
47
|
+
const [open, setOpen] = useState(false);
|
|
48
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
49
|
+
const [position, setPosition] = useState(null);
|
|
50
|
+
const anchorRef = useRef(null);
|
|
51
|
+
const inputRef = useRef(null);
|
|
52
|
+
const fetchRef = useRef(fetchSuggestions);
|
|
53
|
+
fetchRef.current = fetchSuggestions;
|
|
54
|
+
const tokens = splitRecipientList(value);
|
|
55
|
+
const pendingText = pending.trim();
|
|
56
|
+
// The typed text is the value's last recipient; a value changed from outside that doesn't end with it drops it.
|
|
57
|
+
const pendingActive = pendingText !== "" && tokens[tokens.length - 1] === pendingText;
|
|
58
|
+
const chips = pendingActive ? tokens.slice(0, -1) : tokens;
|
|
59
|
+
const inputValue = pendingActive ? pending : "";
|
|
60
|
+
const query = pendingActive ? pendingText : "";
|
|
61
|
+
const listboxId = `${id}-suggestions`;
|
|
62
|
+
const optionId = (index) => `${id}-suggestion-${index}`;
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (pending !== "" && !pendingActive) {
|
|
65
|
+
setPending("");
|
|
66
|
+
}
|
|
67
|
+
}, [pending, pendingActive]);
|
|
68
|
+
const committedAddresses = new Set(chips.map((chip) => parseRecipient(chip).address.toLowerCase()));
|
|
69
|
+
const visible = suggestions.filter((suggestion) => !committedAddresses.has(suggestion.address.toLowerCase()));
|
|
70
|
+
const expanded = open && visible.length > 0 && query.length >= RECIPIENT_SUGGESTION_MIN_QUERY_LENGTH;
|
|
71
|
+
const active = Math.min(activeIndex, visible.length - 1);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (query.length < RECIPIENT_SUGGESTION_MIN_QUERY_LENGTH) {
|
|
74
|
+
setSuggestions([]);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const controller = new AbortController();
|
|
78
|
+
const timer = setTimeout(() => {
|
|
79
|
+
fetchRef.current(query, { mailboxUid, signal: controller.signal }).then((result) => {
|
|
80
|
+
if (!controller.signal.aborted) {
|
|
81
|
+
setSuggestions(result);
|
|
82
|
+
setActiveIndex(0);
|
|
83
|
+
}
|
|
84
|
+
}, () => {
|
|
85
|
+
if (!controller.signal.aborted) {
|
|
86
|
+
setSuggestions([]);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}, debounceMs);
|
|
90
|
+
return () => {
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
controller.abort();
|
|
93
|
+
};
|
|
94
|
+
}, [query, mailboxUid, debounceMs]);
|
|
95
|
+
useLayoutEffect(() => {
|
|
96
|
+
if (!expanded) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const anchor = anchorRef.current;
|
|
100
|
+
const update = () => setPosition(dropdownPosition(anchor));
|
|
101
|
+
update();
|
|
102
|
+
window.addEventListener("resize", update);
|
|
103
|
+
window.addEventListener("scroll", update, true);
|
|
104
|
+
return () => {
|
|
105
|
+
window.removeEventListener("resize", update);
|
|
106
|
+
window.removeEventListener("scroll", update, true);
|
|
107
|
+
};
|
|
108
|
+
}, [expanded]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (expanded) {
|
|
111
|
+
document.getElementById(optionId(active))?.scrollIntoView?.({ block: "nearest" });
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
function emit(nextChips, nextPending) {
|
|
115
|
+
onChange([...nextChips, nextPending.trim()].filter((part) => part.length > 0).join(", "));
|
|
116
|
+
}
|
|
117
|
+
function handleInputChange(e) {
|
|
118
|
+
const { finished, rest } = splitTypedRecipients(e.target.value);
|
|
119
|
+
const nextPending = rest.replace(/^\s+/, "");
|
|
120
|
+
setPending(nextPending);
|
|
121
|
+
setOpen(true);
|
|
122
|
+
emit([...chips, ...finished], nextPending);
|
|
123
|
+
}
|
|
124
|
+
function commitPending() {
|
|
125
|
+
const next = [...chips, pendingText].filter((part) => part.length > 0).join(", ");
|
|
126
|
+
setPending("");
|
|
127
|
+
setOpen(false);
|
|
128
|
+
return next;
|
|
129
|
+
}
|
|
130
|
+
function select(suggestion) {
|
|
131
|
+
const next = [...chips, formatRecipient({ address: suggestion.address, displayName: suggestion.displayName || undefined })].join(", ");
|
|
132
|
+
setPending("");
|
|
133
|
+
setOpen(false);
|
|
134
|
+
setSuggestions([]);
|
|
135
|
+
onChange(next);
|
|
136
|
+
onCommit?.(next);
|
|
137
|
+
}
|
|
138
|
+
function removeChip(index) {
|
|
139
|
+
emit(chips.filter((_, i) => i !== index), inputValue);
|
|
140
|
+
inputRef.current?.focus();
|
|
141
|
+
}
|
|
142
|
+
function handleKeyDown(e) {
|
|
143
|
+
switch (e.key) {
|
|
144
|
+
case "ArrowDown":
|
|
145
|
+
case "ArrowUp": {
|
|
146
|
+
if (visible.length === 0) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
if (!expanded) {
|
|
151
|
+
setOpen(true);
|
|
152
|
+
setActiveIndex(e.key === "ArrowDown" ? 0 : visible.length - 1);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const step = e.key === "ArrowDown" ? 1 : -1;
|
|
156
|
+
setActiveIndex((active + step + visible.length) % visible.length);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
case "Enter":
|
|
160
|
+
if (expanded) {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
select(visible[active]);
|
|
163
|
+
}
|
|
164
|
+
else if (pendingText) {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
const next = commitPending();
|
|
167
|
+
onCommit?.(next);
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
case "Tab":
|
|
171
|
+
if (expanded && !e.shiftKey) {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
select(visible[active]);
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
case "Escape":
|
|
177
|
+
if (expanded) {
|
|
178
|
+
e.preventDefault();
|
|
179
|
+
e.stopPropagation();
|
|
180
|
+
setOpen(false);
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
case "Backspace":
|
|
184
|
+
if (inputValue === "" && chips.length > 0) {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
emit(chips.slice(0, -1), "");
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function handleBlur() {
|
|
192
|
+
const next = commitPending();
|
|
193
|
+
onBlur?.(next);
|
|
194
|
+
}
|
|
195
|
+
return (_jsxs("div", { ref: anchorRef, className: "flex-1 min-w-0 flex flex-wrap items-center gap-1", children: [chips.length > 0 && (_jsx("ul", { role: "list", "aria-label": `${label} recipients`, className: "contents", children: chips.map((chip, index) => {
|
|
196
|
+
const recipient = parseRecipient(chip);
|
|
197
|
+
const valid = isValidRecipientAddress(recipient.address);
|
|
198
|
+
const name = recipient.displayName || recipient.address;
|
|
199
|
+
return (_jsxs("li", { title: chip, className: `flex items-center gap-1 max-w-full min-w-0 rounded-pill border pl-2 pr-0.5 py-px text-xs ${valid ? "bg-surface-alt border-border text-text" : "bg-danger-bg border-danger text-danger"}`, children: [_jsx("span", { className: "truncate", children: name }), !valid && _jsx("span", { className: "sr-only", children: " (not a valid email address)" }), _jsx("button", { type: "button", tabIndex: -1, "aria-label": `Remove ${recipient.address}`, disabled: disabled, onMouseDown: (e) => e.preventDefault(), onClick: () => removeChip(index), className: "shrink-0 w-4 h-4 flex items-center justify-center rounded-pill text-text-muted hover:bg-border hover:text-text", children: _jsx(HiOutlineXMark, { size: 10 }) })] }, `${index}-${chip}`));
|
|
200
|
+
}) })), _jsx("input", { ref: inputRef, id: id, type: "text", role: "combobox", autoComplete: "off", "aria-autocomplete": "list", "aria-expanded": expanded, "aria-controls": listboxId, "aria-activedescendant": expanded ? optionId(active) : undefined, disabled: disabled, autoFocus: autoFocus, className: "flex-1 min-w-[6rem] text-sm bg-transparent outline-none py-0.5", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onBlur: handleBlur }), _jsx("span", { className: "sr-only", "aria-live": "polite", children: expanded ? `${visible.length} ${visible.length === 1 ? "suggestion" : "suggestions"}` : "" }), expanded &&
|
|
201
|
+
position &&
|
|
202
|
+
createPortal(_jsx("ul", { id: listboxId, role: "listbox", "aria-label": `${label} suggestions`, onMouseDown: (e) => e.preventDefault(), style: { position: "fixed", left: position.left, width: position.width, top: position.top, bottom: position.bottom, maxHeight: position.maxHeight }, className: "z-[60] overflow-y-auto bg-surface border border-border rounded-md shadow-modal py-1", children: visible.map((suggestion, index) => (_jsxs("li", { id: optionId(index), role: "option", "aria-selected": index === active, onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setActiveIndex(index), onClick: () => select(suggestion), className: `flex items-center gap-2 px-3 py-1.5 cursor-pointer ${index === active ? "bg-primary/10" : ""}`, children: [_jsxs("span", { className: "flex-1 min-w-0", children: [_jsx("span", { className: "block truncate text-sm text-text", children: suggestion.displayName || suggestion.address }), suggestion.displayName && _jsx("span", { className: "block truncate text-xs text-text-muted", children: suggestion.address })] }), _jsx("span", { className: "shrink-0 text-[11px] leading-4 px-1.5 rounded-pill bg-surface-alt text-text-muted", children: KIND_LABELS[suggestion.kind] ?? "Directory" })] }, `${index}-${suggestion.address}`))) }), document.body)] }));
|
|
203
|
+
}
|
|
@@ -9,6 +9,15 @@ export interface RichTextEditorProps {
|
|
|
9
9
|
fill?: boolean;
|
|
10
10
|
/** Passed straight through to `ComposeToolbar` — see its own doc comment on this prop. */
|
|
11
11
|
onUploadImage: (file: File) => Promise<string | null>;
|
|
12
|
+
/** Focuses the editor with the caret at the very start of the document once it mounts - a reply or forward, whose
|
|
13
|
+
* body starts with an empty paragraph above the signature and quote, so typing goes above them. Only read when
|
|
14
|
+
* the editor is created. */
|
|
15
|
+
autoFocusStart?: boolean;
|
|
16
|
+
/** Called once the editor is ready, with `value` as the editor itself serializes it: TipTap drops what its schema
|
|
17
|
+
* doesn't hold (e.g. a blockquote's `style`) and adds an empty paragraph after a trailing non-paragraph node (a
|
|
18
|
+
* quote). That normalization happens on the editor's first transaction - even one that only moves the caret -
|
|
19
|
+
* and isn't reported through `onChange`, so a caller can compare later edits against this instead of `value`. */
|
|
20
|
+
onInitialized?: (value: string) => void;
|
|
12
21
|
}
|
|
13
22
|
/**
|
|
14
23
|
* A WYSIWYG rich-text editor for the Compose window's message body — replaces `MonacoHtmlEditor` (an HTML
|
|
@@ -31,4 +40,4 @@ export interface RichTextEditorProps {
|
|
|
31
40
|
* sufficient here since TipTap (unlike Monaco) never touches the DOM at module-evaluation time, only when
|
|
32
41
|
* an editor view actually mounts.
|
|
33
42
|
*/
|
|
34
|
-
export default function RichTextEditor({ value, onChange, height, fill, onUploadImage }: RichTextEditorProps): React.JSX.Element;
|
|
43
|
+
export default function RichTextEditor({ value, onChange, height, fill, onUploadImage, autoFocusStart, onInitialized, }: RichTextEditorProps): React.JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
4
|
// SPDX-License-Identifier: MPL-2.0
|
|
5
5
|
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
-
import { useRef } from "react";
|
|
6
|
+
import { useRef, useState } from "react";
|
|
7
7
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
8
8
|
import StarterKit from "@tiptap/starter-kit";
|
|
9
9
|
import { TextStyleKit } from "@tiptap/extension-text-style";
|
|
@@ -34,9 +34,16 @@ import ComposeToolbar from "./ComposeToolbar.js";
|
|
|
34
34
|
* sufficient here since TipTap (unlike Monaco) never touches the DOM at module-evaluation time, only when
|
|
35
35
|
* an editor view actually mounts.
|
|
36
36
|
*/
|
|
37
|
-
export default function RichTextEditor({ value, onChange, height = "360px", fill = false, onUploadImage }) {
|
|
37
|
+
export default function RichTextEditor({ value, onChange, height = "360px", fill = false, onUploadImage, autoFocusStart = false, onInitialized, }) {
|
|
38
38
|
const onChangeRef = useRef(onChange);
|
|
39
39
|
onChangeRef.current = onChange;
|
|
40
|
+
const onInitializedRef = useRef(onInitialized);
|
|
41
|
+
onInitializedRef.current = onInitialized;
|
|
42
|
+
// Transactions before `create` (the autofocus, and the normalizing one below) aren't edits.
|
|
43
|
+
const initializedRef = useRef(false);
|
|
44
|
+
// Held for this editor's lifetime: TipTap focuses a tick after creating the editor, and a re-render passing a
|
|
45
|
+
// different value in between would replace the option (via `setOptions`) before it's read.
|
|
46
|
+
const [autofocus] = useState(autoFocusStart ? "start" : false);
|
|
40
47
|
const editor = useEditor({
|
|
41
48
|
extensions: [
|
|
42
49
|
StarterKit.configure({ link: { openOnClick: false } }),
|
|
@@ -48,8 +55,19 @@ export default function RichTextEditor({ value, onChange, height = "360px", fill
|
|
|
48
55
|
Placeholder.configure({ placeholder: "Write your message…" }),
|
|
49
56
|
],
|
|
50
57
|
content: value,
|
|
58
|
+
autofocus,
|
|
51
59
|
immediatelyRender: false,
|
|
52
|
-
|
|
60
|
+
onCreate: ({ editor: created }) => {
|
|
61
|
+
// An empty transaction runs the schema's append-transaction normalization now, before any edit.
|
|
62
|
+
created.view.dispatch(created.state.tr);
|
|
63
|
+
initializedRef.current = true;
|
|
64
|
+
onInitializedRef.current?.(created.getHTML());
|
|
65
|
+
},
|
|
66
|
+
onUpdate: ({ editor: updated }) => {
|
|
67
|
+
if (initializedRef.current) {
|
|
68
|
+
onChangeRef.current(updated.getHTML());
|
|
69
|
+
}
|
|
70
|
+
},
|
|
53
71
|
});
|
|
54
72
|
return (_jsxs("div", { className: ["border border-border rounded-sm overflow-hidden", fill ? "h-full flex flex-col" : ""].filter(Boolean).join(" "), children: [_jsx(ComposeToolbar, { editor: editor, onUploadImage: onUploadImage }), _jsx(EditorContent, { editor: editor, style: fill ? undefined : { height }, className: [
|
|
55
73
|
"overflow-y-auto px-3 py-2 text-sm [&_.tiptap]:outline-none [&_.tiptap]:h-full",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Message, Recipient } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
2
|
+
import type { QuotedBody } from "@rapidmx/react-shared/mail/compose/composeQuoting.js";
|
|
3
|
+
import type { MessageSecurityResult } from "@rapidmx/react-shared/crypto/messageSecurity.js";
|
|
4
|
+
/** What a Reply/Reply All/Forward needs from the message being answered, beyond what its `Message` record holds. */
|
|
5
|
+
export interface OriginalMessage {
|
|
6
|
+
/** The body to quote. Empty when none could be loaded - the quote builders then fall back to `bodyPreview`. */
|
|
7
|
+
body: QuotedBody;
|
|
8
|
+
/** The original To and Cc recipients, recovered from the message's own headers - `undefined` when they couldn't
|
|
9
|
+
* be. Only asked for by Reply All (see `loadOriginalMessage()`). */
|
|
10
|
+
recipients?: Recipient[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Loads what a Reply/Reply All/Forward needs from `message`: the full body to quote - the same content
|
|
14
|
+
* `MessageDetailPane` shows, never the truncated `bodyPreview` unless nothing else can be had - and, with
|
|
15
|
+
* `options.recipients`, who the message was originally addressed to. Never rejects.
|
|
16
|
+
*
|
|
17
|
+
* Content the pane recovered client-side (`security.text`/`security.html`: a decrypted or verified body) is used as
|
|
18
|
+
* is. For an encrypted message that's the plaintext, so the caller must keep the reply encrypted (see
|
|
19
|
+
* `MessageDetailPane`'s reply handlers).
|
|
20
|
+
*
|
|
21
|
+
* An encrypted message without recovered content (locked keys, a failed decrypt, evaluation still running) quotes
|
|
22
|
+
* nothing: the server only holds ciphertext, which is never fetched or quoted.
|
|
23
|
+
*
|
|
24
|
+
* Otherwise the server's sanitized HTML body (`GET /mail/messages/:id/content`) is used. That route falls back to the
|
|
25
|
+
* preview for a message without an HTML part, so a `text/plain` answer is replaced by the text part of the message's
|
|
26
|
+
* raw MIME.
|
|
27
|
+
*
|
|
28
|
+
* The recipients come from the verified message's protected headers when it has them, else from the raw message's own
|
|
29
|
+
* `To`/`Cc` headers - restapi records only the envelope recipient of a delivered message (`ScanQueueJob`), so
|
|
30
|
+
* `message.recipients` alone would reduce every Reply All to a plain reply. Unprotected headers are the sender's own
|
|
31
|
+
* claim, exactly as in every other mail client's Reply All.
|
|
32
|
+
*
|
|
33
|
+
* The quote builders sanitize whatever HTML this returns (`sanitizeQuotedHtml()`), whichever source it came from.
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadOriginalMessage(message: Message, security: MessageSecurityResult | null, options?: {
|
|
36
|
+
recipients?: boolean;
|
|
37
|
+
}): Promise<OriginalMessage>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import { apiUrl } from "@rapidmx/react-shared/util/api.js";
|
|
6
|
+
import { getMessageRawContent } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
7
|
+
import { decodeHeaderText, extractDisplayBody, parseMimeEntity } from "@rapidmx/react-shared/crypto/mime.js";
|
|
8
|
+
import { parseRecipientList } from "./recipients.js";
|
|
9
|
+
/** The recipients one address-list header names, RFC 2047-decoded, with their display names. */
|
|
10
|
+
function headerRecipients(value, type) {
|
|
11
|
+
if (!value) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
return parseRecipientList(decodeHeaderText(value))
|
|
15
|
+
.filter((recipient) => recipient.address.includes("@"))
|
|
16
|
+
.map((recipient) => ({ address: recipient.address, ...(recipient.displayName ? { displayName: recipient.displayName } : {}), type }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Loads what a Reply/Reply All/Forward needs from `message`: the full body to quote - the same content
|
|
20
|
+
* `MessageDetailPane` shows, never the truncated `bodyPreview` unless nothing else can be had - and, with
|
|
21
|
+
* `options.recipients`, who the message was originally addressed to. Never rejects.
|
|
22
|
+
*
|
|
23
|
+
* Content the pane recovered client-side (`security.text`/`security.html`: a decrypted or verified body) is used as
|
|
24
|
+
* is. For an encrypted message that's the plaintext, so the caller must keep the reply encrypted (see
|
|
25
|
+
* `MessageDetailPane`'s reply handlers).
|
|
26
|
+
*
|
|
27
|
+
* An encrypted message without recovered content (locked keys, a failed decrypt, evaluation still running) quotes
|
|
28
|
+
* nothing: the server only holds ciphertext, which is never fetched or quoted.
|
|
29
|
+
*
|
|
30
|
+
* Otherwise the server's sanitized HTML body (`GET /mail/messages/:id/content`) is used. That route falls back to the
|
|
31
|
+
* preview for a message without an HTML part, so a `text/plain` answer is replaced by the text part of the message's
|
|
32
|
+
* raw MIME.
|
|
33
|
+
*
|
|
34
|
+
* The recipients come from the verified message's protected headers when it has them, else from the raw message's own
|
|
35
|
+
* `To`/`Cc` headers - restapi records only the envelope recipient of a delivered message (`ScanQueueJob`), so
|
|
36
|
+
* `message.recipients` alone would reduce every Reply All to a plain reply. Unprotected headers are the sender's own
|
|
37
|
+
* claim, exactly as in every other mail client's Reply All.
|
|
38
|
+
*
|
|
39
|
+
* The quote builders sanitize whatever HTML this returns (`sanitizeQuotedHtml()`), whichever source it came from.
|
|
40
|
+
*/
|
|
41
|
+
export async function loadOriginalMessage(message, security, options = {}) {
|
|
42
|
+
const recovered = security?.text !== undefined ? { text: security.text } : security?.html !== undefined ? { html: security.html } : undefined;
|
|
43
|
+
const protectedHeaders = security?.protectedHeaders;
|
|
44
|
+
const protectedRecipients = protectedHeaders
|
|
45
|
+
? [...headerRecipients(protectedHeaders.to, "to"), ...headerRecipients(protectedHeaders.cc, "cc")]
|
|
46
|
+
: [];
|
|
47
|
+
const result = { body: recovered ?? {}, ...(protectedRecipients.length > 0 ? { recipients: protectedRecipients } : {}) };
|
|
48
|
+
if (message.encrypted) {
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
let needsRaw = !!options.recipients && result.recipients === undefined;
|
|
52
|
+
if (!recovered) {
|
|
53
|
+
try {
|
|
54
|
+
const res = await fetch(apiUrl(`/mail/messages/${encodeURIComponent(message.uid)}/content`), { credentials: "include" });
|
|
55
|
+
if (res.ok && (res.headers.get("content-type") ?? "").includes("text/html")) {
|
|
56
|
+
result.body = { html: await res.text() };
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
needsRaw = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// The raw message below is the other way to the body.
|
|
64
|
+
needsRaw = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
if (needsRaw) {
|
|
69
|
+
const entity = parseMimeEntity(await getMessageRawContent(message.uid));
|
|
70
|
+
if (!recovered && result.body.html === undefined) {
|
|
71
|
+
const body = extractDisplayBody(entity);
|
|
72
|
+
result.body = body.html !== undefined ? { html: body.html } : body.text !== undefined ? { text: body.text } : {};
|
|
73
|
+
}
|
|
74
|
+
const headers = [...headerRecipients(entity.headers["to"], "to"), ...headerRecipients(entity.headers["cc"], "cc")];
|
|
75
|
+
if (options.recipients && result.recipients === undefined && headers.length > 0) {
|
|
76
|
+
result.recipients = headers;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Whatever was loaded before the failure stands: the quote falls back to the preview, Reply All to the
|
|
82
|
+
// message's own recipients.
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsing and formatting of the To/Cc/Bcc fields' text. A field's value is a list of recipients separated by commas or
|
|
3
|
+
* semicolons, each either a bare address or `Display Name <address>` (the name optionally quoted, so it can hold a comma
|
|
4
|
+
* or semicolon itself). Separators inside quotes or angle brackets don't split.
|
|
5
|
+
*/
|
|
6
|
+
import type { ComposeRecipientInput } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
7
|
+
/** Splits a field's text into trimmed, non-empty recipient strings - see `splitRaw()`. */
|
|
8
|
+
export declare function splitRecipientList(value: string): string[];
|
|
9
|
+
/** Splits text typed into a field: the recipients finished by a separator, and the text after the last separator
|
|
10
|
+
* (untrimmed; the whole text when there is no separator). */
|
|
11
|
+
export declare function splitTypedRecipients(text: string): {
|
|
12
|
+
finished: string[];
|
|
13
|
+
rest: string;
|
|
14
|
+
};
|
|
15
|
+
/** Parses one recipient string: `Name <address>`, `"Name" <address>`, `<address>` or a bare address. Anything else is
|
|
16
|
+
* kept whole as the address (so it's still sent, and flagged as invalid by the field). */
|
|
17
|
+
export declare function parseRecipient(text: string): ComposeRecipientInput;
|
|
18
|
+
/** Every recipient in a field's text. */
|
|
19
|
+
export declare function parseRecipientList(value: string): ComposeRecipientInput[];
|
|
20
|
+
/** Formats a recipient for a field: `Name <address>` (the name quoted when it holds a special character), or the bare
|
|
21
|
+
* address without a name. */
|
|
22
|
+
export declare function formatRecipient(recipient: ComposeRecipientInput): string;
|
|
23
|
+
/** Whether `address` looks like one plain email address. */
|
|
24
|
+
export declare function isValidRecipientAddress(address: string): boolean;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** One plain address: something, one `@`, something - no whitespace, brackets, quotes or separators. */
|
|
2
|
+
const ADDRESS_PATTERN = /^[^\s@<>()",;]+@[^\s@<>()",;]+$/;
|
|
3
|
+
/** Characters that make a display name need quoting. */
|
|
4
|
+
const NAME_SPECIALS = /[",;<>@()\\]/;
|
|
5
|
+
/** Splits at commas and semicolons outside quotes and angle brackets, keeping every part as is (empty ones too). An
|
|
6
|
+
* unterminated quote or bracket runs to the end of the text. */
|
|
7
|
+
function splitRaw(value) {
|
|
8
|
+
const parts = [];
|
|
9
|
+
let current = "";
|
|
10
|
+
let quoted = false;
|
|
11
|
+
let bracketed = false;
|
|
12
|
+
for (let i = 0; i < value.length; i++) {
|
|
13
|
+
const ch = value[i];
|
|
14
|
+
if (quoted && ch === "\\" && i + 1 < value.length) {
|
|
15
|
+
current += ch + value[i + 1];
|
|
16
|
+
i++;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (ch === '"' && !bracketed) {
|
|
20
|
+
quoted = !quoted;
|
|
21
|
+
}
|
|
22
|
+
else if (ch === "<" && !quoted) {
|
|
23
|
+
bracketed = true;
|
|
24
|
+
}
|
|
25
|
+
else if (ch === ">" && !quoted) {
|
|
26
|
+
bracketed = false;
|
|
27
|
+
}
|
|
28
|
+
else if ((ch === "," || ch === ";") && !quoted && !bracketed) {
|
|
29
|
+
parts.push(current);
|
|
30
|
+
current = "";
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
current += ch;
|
|
34
|
+
}
|
|
35
|
+
parts.push(current);
|
|
36
|
+
return parts;
|
|
37
|
+
}
|
|
38
|
+
/** Splits a field's text into trimmed, non-empty recipient strings - see `splitRaw()`. */
|
|
39
|
+
export function splitRecipientList(value) {
|
|
40
|
+
return splitRaw(value)
|
|
41
|
+
.map((part) => part.trim())
|
|
42
|
+
.filter((part) => part.length > 0);
|
|
43
|
+
}
|
|
44
|
+
/** Splits text typed into a field: the recipients finished by a separator, and the text after the last separator
|
|
45
|
+
* (untrimmed; the whole text when there is no separator). */
|
|
46
|
+
export function splitTypedRecipients(text) {
|
|
47
|
+
const parts = splitRaw(text);
|
|
48
|
+
const rest = parts.pop();
|
|
49
|
+
return { finished: parts.map((part) => part.trim()).filter((part) => part.length > 0), rest };
|
|
50
|
+
}
|
|
51
|
+
function unquote(name) {
|
|
52
|
+
const trimmed = name.trim();
|
|
53
|
+
if (trimmed.length >= 2 && trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
54
|
+
return trimmed.slice(1, -1).replace(/\\(.)/g, "$1").trim();
|
|
55
|
+
}
|
|
56
|
+
return trimmed;
|
|
57
|
+
}
|
|
58
|
+
/** Parses one recipient string: `Name <address>`, `"Name" <address>`, `<address>` or a bare address. Anything else is
|
|
59
|
+
* kept whole as the address (so it's still sent, and flagged as invalid by the field). */
|
|
60
|
+
export function parseRecipient(text) {
|
|
61
|
+
const trimmed = text.trim();
|
|
62
|
+
const match = /^(.*)<([^<>]*)>\s*$/.exec(trimmed);
|
|
63
|
+
if (match) {
|
|
64
|
+
const address = match[2].trim();
|
|
65
|
+
const displayName = unquote(match[1]);
|
|
66
|
+
return displayName ? { address, displayName } : { address };
|
|
67
|
+
}
|
|
68
|
+
return { address: trimmed };
|
|
69
|
+
}
|
|
70
|
+
/** Every recipient in a field's text. */
|
|
71
|
+
export function parseRecipientList(value) {
|
|
72
|
+
return splitRecipientList(value).map(parseRecipient);
|
|
73
|
+
}
|
|
74
|
+
/** Formats a recipient for a field: `Name <address>` (the name quoted when it holds a special character), or the bare
|
|
75
|
+
* address without a name. */
|
|
76
|
+
export function formatRecipient(recipient) {
|
|
77
|
+
const name = recipient.displayName?.trim();
|
|
78
|
+
if (!name) {
|
|
79
|
+
return recipient.address;
|
|
80
|
+
}
|
|
81
|
+
const safeName = NAME_SPECIALS.test(name) ? `"${name.replace(/(["\\])/g, "\\$1")}"` : name;
|
|
82
|
+
return `${safeName} <${recipient.address}>`;
|
|
83
|
+
}
|
|
84
|
+
/** Whether `address` looks like one plain email address. */
|
|
85
|
+
export function isValidRecipientAddress(address) {
|
|
86
|
+
return ADDRESS_PATTERN.test(address);
|
|
87
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Label } from "@rapidmx/react-shared/mail/labelsApi.js";
|
|
3
|
+
import { MenuSectionSpec } from "./MenuButton.js";
|
|
4
|
+
/**
|
|
5
|
+
* The one multi-select label list this app uses everywhere labels are picked: the Filter menu's "Labels"
|
|
6
|
+
* submenu, the bulk Apply label action in select mode, and the reading pane's own Labels button. All three
|
|
7
|
+
* tick several labels with the menu staying open and commit them with one command, so the keyboard
|
|
8
|
+
* handling, the checkmarks and the partially-applied state behave identically wherever they appear.
|
|
9
|
+
*/
|
|
10
|
+
/** What the reader has ticked so far, before committing. */
|
|
11
|
+
export interface LabelDraft {
|
|
12
|
+
/** Labels currently ticked. */
|
|
13
|
+
draft: string[];
|
|
14
|
+
/** Labels still showing as partially applied - some of the messages being acted on carry them and some
|
|
15
|
+
* don't, and the reader hasn't touched the row, so committing leaves each message as it is. */
|
|
16
|
+
mixed: string[];
|
|
17
|
+
toggle: (labelUid: string) => void;
|
|
18
|
+
/** Unticks everything, including anything still partially applied. */
|
|
19
|
+
clear: () => void;
|
|
20
|
+
/** `true` once the draft differs from what it started as - what the commit row is enabled by. */
|
|
21
|
+
dirty: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Holds the ticked/partially-applied state of a label list while its menu is open, starting again from
|
|
25
|
+
* `applied`/`partial` every time the menu is reopened - so dismissing a menu (Escape, a click outside)
|
|
26
|
+
* discards the draft rather than silently keeping half a change.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useLabelDraft(applied: string[], partial: string[], open: boolean): LabelDraft;
|
|
29
|
+
export interface LabelSectionsOptions {
|
|
30
|
+
labels: Label[];
|
|
31
|
+
state: LabelDraft;
|
|
32
|
+
/** The row that commits the draft. */
|
|
33
|
+
commit: {
|
|
34
|
+
label: string;
|
|
35
|
+
onSelect: () => void;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** The row that unticks everything. `keepOpen` false lets a caller (the filter) apply it straight away. */
|
|
39
|
+
clear: {
|
|
40
|
+
label: string;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
keepOpen?: boolean;
|
|
43
|
+
onSelect?: () => void;
|
|
44
|
+
};
|
|
45
|
+
/** What to say instead of the list when this mailbox has no labels. */
|
|
46
|
+
emptyNote: string;
|
|
47
|
+
/** Adds a "New label" row. A `role="menu"` can't hold the text field that needs, so the row closes the
|
|
48
|
+
* menu and opens `NewLabelDialog` - see `LabelMenuButton` and the Filter menu's own use of it. */
|
|
49
|
+
onCreate?: () => void;
|
|
50
|
+
/** Where labels are renamed, recoloured and deleted. */
|
|
51
|
+
managePath?: string;
|
|
52
|
+
/** A line under the list explaining what committing will do. */
|
|
53
|
+
note?: string;
|
|
54
|
+
/** Holds every row while a request is in flight. */
|
|
55
|
+
busy?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The label rows plus their commit/clear rows, as `MenuButton` sections - so the same list can be a menu of
|
|
59
|
+
* its own (`LabelMenuButton` below) or a submenu of another menu (the Filter menu's "Labels" row).
|
|
60
|
+
*/
|
|
61
|
+
export declare function labelSections({ labels, state, commit, clear, emptyNote, note, busy, onCreate, managePath, }: LabelSectionsOptions): MenuSectionSpec[];
|
|
62
|
+
export interface NewLabelDialogProps {
|
|
63
|
+
open: boolean;
|
|
64
|
+
onClose: () => void;
|
|
65
|
+
mailboxUid: string;
|
|
66
|
+
/** Handed the label the server created, for the caller to add to its own list. */
|
|
67
|
+
onCreated: (label: Label) => void;
|
|
68
|
+
}
|
|
69
|
+
/** The "New label" form the menus open - a dialog rather than more menu rows, because a `role="menu"`
|
|
70
|
+
* has no place for a text field. Colour is left to Settings > Labels; this is the quick path from a
|
|
71
|
+
* message, so it only asks for the name. */
|
|
72
|
+
export declare function NewLabelDialog({ open, onClose, mailboxUid, onCreated }: NewLabelDialogProps): React.JSX.Element;
|
|
73
|
+
export interface LabelMenuButtonProps extends Omit<LabelSectionsOptions, "state" | "commit"> {
|
|
74
|
+
/** The commit row - this component supplies its action (`onCommit` below) and disables it until the
|
|
75
|
+
* draft actually differs from what it started as. */
|
|
76
|
+
commit: {
|
|
77
|
+
label: string;
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/** The labels every target already carries. */
|
|
81
|
+
applied: string[];
|
|
82
|
+
/** The labels only some of them carry. */
|
|
83
|
+
partial?: string[];
|
|
84
|
+
/** Called with the labels to end up with, and the ones left partially applied (each target keeps those
|
|
85
|
+
* exactly as they are). */
|
|
86
|
+
onCommit: (labelUids: string[], keepPartial: string[]) => void;
|
|
87
|
+
label: string;
|
|
88
|
+
"aria-label": string;
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
title?: string;
|
|
91
|
+
className?: string;
|
|
92
|
+
/** With `onLabelCreated`, adds a "New label" row that opens this component's own dialog. */
|
|
93
|
+
mailboxUid?: string;
|
|
94
|
+
onLabelCreated?: (label: Label) => void;
|
|
95
|
+
}
|
|
96
|
+
/** The label list as a menu button of its own - the bulk Apply label action and the reading pane's Labels. */
|
|
97
|
+
export default function LabelMenuButton({ applied, partial, onCommit, labels, commit, clear, emptyNote, note, busy, label, "aria-label": ariaLabel, disabled, title, className, mailboxUid, onLabelCreated, }: LabelMenuButtonProps): React.JSX.Element;
|