@remit/ui 0.0.221 → 0.0.223
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/package.json +14 -3
- package/src/components/DropdownMenu.tsx +100 -0
- package/src/components/EmptyState.tsx +11 -0
- package/src/components/ErrorBanner.render.test.ts +107 -0
- package/src/components/ErrorBanner.stories.tsx +132 -0
- package/src/components/ErrorBanner.tsx +122 -0
- package/src/components/ErrorBannerStack.tsx +34 -0
- package/src/components/ErrorState.render.test.ts +82 -0
- package/src/components/ErrorState.tsx +80 -0
- package/src/components/KeyboardShortcutsModal.tsx +111 -0
- package/src/components/account-service-change-dialog.render.test.ts +1 -41
- package/src/components/account-service-choice.render.test.ts +0 -26
- package/src/components/account-service-toggles.render.test.ts +0 -6
- package/src/components/address-display.render.test.ts +1 -38
- package/src/components/address-tag.render.test.ts +0 -11
- package/src/components/agenda-flow.reach.test.ts +0 -8
- package/src/components/agenda-flow.render.test.ts +0 -31
- package/src/components/agenda-panels.render.test.ts +0 -5
- package/src/components/app-shell-slotted.render.test.ts +0 -118
- package/src/components/attachment-list.render.test.ts +41 -24
- package/src/components/attachment-list.stories.tsx +67 -0
- package/src/components/attachment-list.tsx +112 -35
- package/src/components/attendee-row.render.test.ts +0 -41
- package/src/components/attention-dot.stories.tsx +46 -0
- package/src/components/attention-dot.tsx +23 -0
- package/src/components/banner.render.test.ts +0 -7
- package/src/components/bottom-sheet.render.test.ts +0 -42
- package/src/components/brief-section.render.test.ts +0 -13
- package/src/components/brief-sections.keyboard.test.ts +0 -13
- package/src/components/brief-sections.render.test.ts +0 -22
- package/src/components/calendar-clash-strip.render.test.ts +0 -19
- package/src/components/calendar-grid.render.test.ts +0 -79
- package/src/components/calendar-invite-card.render.test.ts +0 -19
- package/src/components/calendar-list.render.test.ts +0 -21
- package/src/components/calendar-slot-offers.render.test.ts +0 -24
- package/src/components/calendar-suggestion-deck.render.test.ts +0 -18
- package/src/components/calendar-toolbar.render.test.ts +1 -53
- package/src/components/category-badge.render.test.ts +1 -24
- package/src/components/compose-action-bar.render.test.ts +0 -5
- package/src/components/compose-attachments.render.test.ts +0 -38
- package/src/components/event-detail.render.test.ts +0 -27
- package/src/components/event-editor.render.test.ts +0 -4
- package/src/components/event-suggestion-card.render.test.ts +0 -61
- package/src/components/event-suggestion-card.zone-gate.test.ts +1 -7
- package/src/components/filter-clause-chip.tsx +1 -60
- package/src/components/filter-rule-editor.create.test.ts +0 -6
- package/src/components/filter-rule-editor.stories.tsx +24 -138
- package/src/components/filter-rule-editor.tsx +7 -93
- package/src/components/filter-rule.render.test.ts +9 -299
- package/src/components/filter-rule.ts +20 -85
- package/src/components/filter-sheet.render.test.ts +0 -7
- package/src/components/folder-manage-actions.render.test.ts +0 -13
- package/src/components/folder-manager.render.test.ts +0 -31
- package/src/components/folder-mutation-dialog.render.test.ts +0 -83
- package/src/components/folder-rename-dialog.render.test.ts +0 -14
- package/src/components/folder-row.render.test.ts +0 -30
- package/src/components/folder-sync-state.test.ts +0 -61
- package/src/components/folder-tree-picker.create.test.ts +0 -30
- package/src/components/folder-tree-picker.render.test.ts +0 -35
- package/src/components/intelligence-calendar-fixtures.ts +0 -2
- package/src/components/intelligence-calendar.render.test.ts +0 -4
- package/src/components/intelligence-panel.render.test.ts +1 -62
- package/src/components/intelligence-panel.stories.tsx +0 -76
- package/src/components/intelligence-panel.tab-strip.test.ts +0 -1
- package/src/components/intelligence-panel.tsx +6 -176
- package/src/components/intelligence-toggle.render.test.ts +0 -5
- package/src/components/isolated-email-frame.render.test.ts +0 -122
- package/src/components/isolated-email-frame.tsx +55 -3
- package/src/components/keyboard-hint-bar.render.test.ts +0 -7
- package/src/components/label-chip.render.test.ts +0 -28
- package/src/components/label-chip.tsx +1 -1
- package/src/components/mail-header.render.test.ts +0 -20
- package/src/components/mcp-connected-apps-page.stories.tsx +58 -0
- package/src/components/mcp-connected-apps-page.tsx +79 -0
- package/src/components/mcp-consent-page.stories.tsx +39 -0
- package/src/components/mcp-consent-page.tsx +47 -0
- package/src/components/mcp-device-page.stories.tsx +57 -0
- package/src/components/mcp-device-page.tsx +107 -0
- package/src/components/mcp-error-notice.stories.tsx +34 -0
- package/src/components/mcp-error-notice.tsx +23 -0
- package/src/components/mcp-error-page.stories.tsx +17 -0
- package/src/components/mcp-error-page.tsx +15 -0
- package/src/components/mcp-fixtures.ts +16 -0
- package/src/components/mcp-login-page.stories.tsx +37 -0
- package/src/components/mcp-login-page.tsx +58 -0
- package/src/components/mcp-page.stories.tsx +27 -0
- package/src/components/mcp-page.tsx +35 -0
- package/src/components/mcp-permission-list.stories.tsx +21 -0
- package/src/components/mcp-permission-list.tsx +22 -0
- package/src/components/message-body-view.render.test.ts +0 -21
- package/src/components/message-list-pane.brief-filter.test.ts +0 -6
- package/src/components/message-list-pane.render.test.ts +0 -54
- package/src/components/message-list-state.render.test.ts +0 -84
- package/src/components/{quarantine-bug-dialog.tsx → message-report-dialog.tsx} +9 -14
- package/src/components/message-row.render.test.ts +1 -98
- package/src/components/mobile-message-action-bar.render.test.ts +0 -59
- package/src/components/mobile-reading-pane.render.test.ts +0 -48
- package/src/components/mobile-reading-pane.stories.tsx +78 -0
- package/src/components/mobile-reading-pane.tsx +55 -41
- package/src/components/mobile-search-view.render.test.ts +0 -16
- package/src/components/mobile-search-view.stories.tsx +8 -11
- package/src/components/mobile-search-view.tsx +1 -1
- package/src/components/nav-sidebar.keyboard.test.ts +0 -8
- package/src/components/nav-sidebar.render.test.ts +2 -133
- package/src/components/new-folder-form.render.test.ts +0 -26
- package/src/components/outbox-row.render.test.ts +0 -9
- package/src/components/pane-layout.render.test.ts +0 -18
- package/src/components/plain-text-editor.mount.test.ts +0 -16
- package/src/components/popover-menu.render.test.ts +0 -11
- package/src/components/progress-bar.render.test.ts +0 -14
- package/src/components/quarantine-report.test.ts +0 -8
- package/src/components/quarantine-section.render.test.ts +16 -13
- package/src/components/quarantine-section.stories.tsx +11 -8
- package/src/components/reading-pane.render.test.ts +2 -106
- package/src/components/reading-pane.stories.tsx +3 -0
- package/src/components/refresh-button.render.test.ts +0 -9
- package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
- package/src/components/rich-text-editor.mount.test.ts +0 -19
- package/src/components/rich-text-image-node.ts +11 -9
- package/src/components/role-appointment-list.render.test.ts +0 -49
- package/src/components/role-appointment-prompt.render.test.ts +0 -79
- package/src/components/row-actions.render.test.ts +0 -34
- package/src/components/search-bar.render.test.ts +0 -44
- package/src/components/search-chip-input.render.test.ts +0 -71
- package/src/components/search-conversion-notice.stories.tsx +0 -6
- package/src/components/search-conversion-notice.tsx +3 -9
- package/src/components/search-conversion.render.test.ts +0 -52
- package/src/components/search-conversion.ts +2 -18
- package/src/components/search-result-row.tsx +5 -26
- package/src/components/search-results.render.test.ts +0 -68
- package/src/components/search-results.stories.tsx +0 -30
- package/src/components/search-results.tsx +1 -1
- package/src/components/security-select.render.test.ts +1 -14
- package/src/components/selection-top-bar.render.test.ts +0 -180
- package/src/components/selection-wizard-fixtures.ts +0 -2
- package/src/components/selection-wizard.render.test.ts +7 -212
- package/src/components/selection-wizard.stories.tsx +24 -164
- package/src/components/selection-wizard.tsx +10 -86
- package/src/components/self-update.render.test.ts +0 -113
- package/src/components/sender-trust-indicator.render.test.ts +0 -30
- package/src/components/shell-top-bar.render.test.ts +0 -31
- package/src/components/shell-top-bar.stories.tsx +7 -0
- package/src/components/shell-top-bar.tsx +11 -2
- package/src/components/slide-panel.render.test.ts +0 -18
- package/src/components/suggest-list.render.test.ts +0 -6
- package/src/components/swipeable-row.gesture.test.ts +85 -40
- package/src/components/swipeable-row.render.test.ts +0 -7
- package/src/components/swipeable-row.stories.tsx +3 -2
- package/src/components/swipeable-row.tsx +65 -144
- package/src/components/sync-warning-fixtures.ts +22 -0
- package/src/components/sync-warning-report.ts +38 -0
- package/src/components/sync-warning-row.tsx +51 -0
- package/src/components/sync-warning-section.render.test.ts +19 -0
- package/src/components/sync-warning-section.stories.tsx +94 -0
- package/src/components/sync-warning-section.tsx +56 -0
- package/src/components/touch-list-body.render.test.ts +0 -29
- package/src/components/wizard.render.test.ts +0 -22
- package/src/filter-presets.test.ts +1 -107
- package/src/index.ts +40 -34
- package/src/lib/compose-language.test.ts +0 -11
- package/src/lib/email-render-treatment.test.ts +0 -21
- package/src/lib/keymap.test.ts +0 -32
- package/src/lib/property-prefill.ts +2 -2
- package/src/lib/search-rule.test.ts +0 -4
- package/src/lib/search-rule.ts +0 -9
- package/src/lib/sender-derivation.ts +3 -5
- package/src/lib/swipe-config.ts +11 -0
- package/src/lib/use-list-cursor.test.ts +0 -7
- package/src/lib/use-list-keyboard.test.ts +0 -14
- package/src/lib/use-long-press.test.ts +53 -36
- package/src/lib/use-long-press.ts +62 -56
- package/src/lib/use-modal-focus.test.ts +0 -20
- package/src/lib/use-selection.hook.test.ts +0 -13
- package/src/lib/use-selection.test.ts +0 -101
- package/src/lib/use-swipe-navigation.test.ts +162 -0
- package/src/lib/use-swipe-navigation.ts +90 -0
- package/src/lib/wizard-steps.test.ts +18 -79
- package/src/lib/wizard-steps.ts +27 -67
- package/src/mcp-pages.ts +36 -0
- package/src/category-presentation.test.ts +0 -76
- package/src/components/account-service-status.render.test.ts +0 -82
- package/src/components/app-password-hint.render.test.ts +0 -23
- package/src/components/app-top-bar.render.test.ts +0 -59
- package/src/components/auth-card.render.test.ts +0 -24
- package/src/components/auth-footer.render.test.ts +0 -17
- package/src/components/auth-hero.render.test.ts +0 -31
- package/src/components/auto-moved-badge.render.test.ts +0 -65
- package/src/components/button.render.test.ts +0 -29
- package/src/components/calendar-event-chip.render.test.ts +0 -67
- package/src/components/calendar-parse-badge.render.test.ts +0 -40
- package/src/components/checkbox.render.test.ts +0 -65
- package/src/components/compose-form-shell.render.test.ts +0 -106
- package/src/components/dialog.render.test.ts +0 -51
- package/src/components/field-label.render.test.ts +0 -16
- package/src/components/mail-action-toolbar.render.test.ts +0 -43
- package/src/components/nav-link-surface.render.test.ts +0 -126
- package/src/components/new-folder-action.render.test.ts +0 -44
- package/src/components/pane-header.render.test.ts +0 -22
- package/src/components/pull-to-refresh.render.test.ts +0 -46
- package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
- package/src/components/rescue-banner.render.test.ts +0 -32
- package/src/components/rescue-candidate-row.render.test.ts +0 -68
- package/src/components/search-token-chip.render.test.ts +0 -42
- package/src/components/self-update-dot.tsx +0 -32
- package/src/components/settings-primitives.render.test.ts +0 -160
- package/src/lib/email-layout-clamp.test.ts +0 -139
- package/src/lib/label-color.test.ts +0 -25
- package/src/lib/semantic-off.ts +0 -20
- package/src/stories-viewport-globals.test.ts +0 -77
|
@@ -7,20 +7,6 @@ import { SearchBar } from "./search-bar.js";
|
|
|
7
7
|
const noop = () => {};
|
|
8
8
|
|
|
9
9
|
describe("SearchBar", () => {
|
|
10
|
-
it("renders the search input with an accessible label and placeholder", () => {
|
|
11
|
-
const html = renderToString(
|
|
12
|
-
createElement(SearchBar, {
|
|
13
|
-
value: "",
|
|
14
|
-
onChange: noop,
|
|
15
|
-
onClear: noop,
|
|
16
|
-
placeholder: "Search mail",
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
assert.match(html, /aria-label="Search mail"/);
|
|
20
|
-
assert.match(html, /placeholder="Search mail"/);
|
|
21
|
-
assert.match(html, /value=""/);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
10
|
it("omits the clear button while the query is empty", () => {
|
|
25
11
|
const html = renderToString(
|
|
26
12
|
createElement(SearchBar, { value: "", onChange: noop, onClear: noop }),
|
|
@@ -39,34 +25,4 @@ describe("SearchBar", () => {
|
|
|
39
25
|
assert.match(html, /aria-label="Clear search"/);
|
|
40
26
|
assert.match(html, /value="receipt"/);
|
|
41
27
|
});
|
|
42
|
-
|
|
43
|
-
it("omits the inline clear button when showClearButton is false", () => {
|
|
44
|
-
const html = renderToString(
|
|
45
|
-
createElement(SearchBar, {
|
|
46
|
-
value: "receipt",
|
|
47
|
-
onChange: noop,
|
|
48
|
-
onClear: noop,
|
|
49
|
-
showClearButton: false,
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
52
|
-
assert.doesNotMatch(html, /aria-label="Clear search"/);
|
|
53
|
-
assert.match(html, /value="receipt"/);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe("SearchBar narrowing chips", () => {
|
|
58
|
-
it("carries the chips inside the field, alongside the typed text", () => {
|
|
59
|
-
const html = renderToString(
|
|
60
|
-
createElement(SearchBar, {
|
|
61
|
-
value: "invoice",
|
|
62
|
-
onChange: noop,
|
|
63
|
-
onClear: noop,
|
|
64
|
-
chips: [{ id: "in:spam", label: "in:spam" }],
|
|
65
|
-
onRemoveChip: noop,
|
|
66
|
-
}),
|
|
67
|
-
);
|
|
68
|
-
assert.match(html, /in:spam/);
|
|
69
|
-
assert.match(html, /aria-label="Remove filter: in:spam"/);
|
|
70
|
-
assert.match(html, /value="invoice"/);
|
|
71
|
-
});
|
|
72
28
|
});
|
|
@@ -23,31 +23,6 @@ const SPAM = { id: "in:spam", label: "in:spam" };
|
|
|
23
23
|
const FROM = { id: "from:acme", label: "from:acme" };
|
|
24
24
|
|
|
25
25
|
describe("SearchChipInput", () => {
|
|
26
|
-
it("renders a real text input with an accessible label", () => {
|
|
27
|
-
const html = render({ placeholder: "Search mail" });
|
|
28
|
-
assert.match(html, /aria-label="Search mail"/);
|
|
29
|
-
assert.match(html, /placeholder="Search mail"/);
|
|
30
|
-
assert.match(html, /value=""/);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("renders one removable chip per narrowing term, in order", () => {
|
|
34
|
-
const html = render({ chips: [SPAM, FROM] });
|
|
35
|
-
assert.match(html, /in:spam/);
|
|
36
|
-
assert.match(html, /from:acme/);
|
|
37
|
-
assert.match(html, /aria-label="Remove filter: in:spam"/);
|
|
38
|
-
assert.match(html, /aria-label="Remove filter: from:acme"/);
|
|
39
|
-
assert.ok(
|
|
40
|
-
html.indexOf("in:spam") < html.indexOf("from:acme"),
|
|
41
|
-
"chips keep expression order",
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("keeps chips and free text in the same field", () => {
|
|
46
|
-
const html = render({ chips: [SPAM], value: "invoice" });
|
|
47
|
-
assert.match(html, /in:spam/);
|
|
48
|
-
assert.match(html, /value="invoice"/);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
26
|
it("drops the placeholder once the expression carries a chip", () => {
|
|
52
27
|
const html = render({ chips: [SPAM], placeholder: "Search mail" });
|
|
53
28
|
assert.doesNotMatch(html, /placeholder="Search mail"/);
|
|
@@ -64,29 +39,11 @@ describe("SearchChipInput", () => {
|
|
|
64
39
|
assert.doesNotMatch(render(), /aria-label="Clear search"/);
|
|
65
40
|
});
|
|
66
41
|
|
|
67
|
-
it("omits the inline clear when showClearButton is false", () => {
|
|
68
|
-
const html = render({ value: "receipt", showClearButton: false });
|
|
69
|
-
assert.doesNotMatch(html, /aria-label="Clear search"/);
|
|
70
|
-
assert.match(html, /value="receipt"/);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
42
|
it("carries a live region so a removal is never silent", () => {
|
|
74
43
|
const html = render({ chips: [SPAM] });
|
|
75
44
|
assert.match(html, /role="status"/);
|
|
76
45
|
assert.match(html, /aria-live="polite"/);
|
|
77
46
|
});
|
|
78
|
-
|
|
79
|
-
it("renders the same field at either size", () => {
|
|
80
|
-
for (const size of ["sm", "lg"] as const) {
|
|
81
|
-
const html = render({ size, chips: [SPAM], value: "invoice" });
|
|
82
|
-
assert.match(html, /aria-label="Search mail"/);
|
|
83
|
-
assert.match(html, /in:spam/);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("takes a caller-supplied input id so a page can host more than one field", () => {
|
|
88
|
-
assert.match(render({ inputId: "top-bar-search" }), /id="top-bar-search"/);
|
|
89
|
-
});
|
|
90
47
|
});
|
|
91
48
|
|
|
92
49
|
describe("SearchChipInput chip semantics", () => {
|
|
@@ -128,13 +85,6 @@ describe("SearchChipInput chip semantics", () => {
|
|
|
128
85
|
);
|
|
129
86
|
assert.ok((html.match(/tabindex="-1"/gi)?.length ?? 0) >= 6);
|
|
130
87
|
});
|
|
131
|
-
|
|
132
|
-
it("differentiates a scope chip from a typed filter chip", () => {
|
|
133
|
-
const scoped = render({ chips: [{ ...SPAM, tone: "scope" }] });
|
|
134
|
-
const filter = render({ chips: [SPAM] });
|
|
135
|
-
assert.notEqual(scoped, filter);
|
|
136
|
-
assert.match(scoped, /accent-2/);
|
|
137
|
-
});
|
|
138
88
|
});
|
|
139
89
|
|
|
140
90
|
describe("Two fields mounted at once stay independent", () => {
|
|
@@ -178,30 +128,9 @@ describe("Two fields mounted at once stay independent", () => {
|
|
|
178
128
|
);
|
|
179
129
|
assert.deepEqual(labelTargets, inputIds);
|
|
180
130
|
});
|
|
181
|
-
|
|
182
|
-
it("still honours an explicit id when the caller needs a stable one", () => {
|
|
183
|
-
const html = renderToString(
|
|
184
|
-
createElement(SearchChipInput, {
|
|
185
|
-
value: "",
|
|
186
|
-
onChange: noop,
|
|
187
|
-
onClear: noop,
|
|
188
|
-
inputId: "top-bar-search",
|
|
189
|
-
}),
|
|
190
|
-
);
|
|
191
|
-
assert.match(html, /<label[^>]*for="top-bar-search"/);
|
|
192
|
-
assert.match(html, /<input[^>]*id="top-bar-search"/);
|
|
193
|
-
});
|
|
194
131
|
});
|
|
195
132
|
|
|
196
133
|
describe("A read-only chip strip promises nothing it cannot do", () => {
|
|
197
|
-
it("still renders the remove control so the strip looks the same", () => {
|
|
198
|
-
// Removal is host-owned. Without a handler the chip cannot go anywhere, so
|
|
199
|
-
// the field must not announce a removal or move focus as though it had —
|
|
200
|
-
// see the guard in removeChipAt.
|
|
201
|
-
const html = render({ chips: [SPAM] });
|
|
202
|
-
assert.match(html, /aria-label="Remove filter: in:spam"/);
|
|
203
|
-
});
|
|
204
|
-
|
|
205
134
|
it("starts with an empty live region rather than a stale announcement", () => {
|
|
206
135
|
const html = render({ chips: [SPAM], onRemoveChip: noop });
|
|
207
136
|
assert.match(
|
|
@@ -24,18 +24,12 @@ export const DroppedFacets: Story = {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
/** A deployment that cannot match by meaning — literal words kept, no similarity claim. */
|
|
28
|
-
export const DroppedSemantic: Story = {
|
|
29
|
-
args: { notice: { droppedSemantic: true } },
|
|
30
|
-
};
|
|
31
|
-
|
|
32
27
|
/** Everything a rich search carried that the filter cannot. */
|
|
33
28
|
export const Everything: Story = {
|
|
34
29
|
args: {
|
|
35
30
|
notice: {
|
|
36
31
|
scopedOutFolder: "Archive",
|
|
37
32
|
droppedFacets: ["Has attachment", "Before 2026-01-01"],
|
|
38
|
-
droppedSemantic: true,
|
|
39
33
|
},
|
|
40
34
|
},
|
|
41
35
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { FolderInput, Info
|
|
1
|
+
import { FolderInput, Info } from "lucide-react";
|
|
2
2
|
import {
|
|
3
|
-
DROPPED_SEMANTIC_COPY,
|
|
4
3
|
droppedFacetsCopy,
|
|
5
4
|
hasConversionNotice,
|
|
6
5
|
type SearchConversionNotice,
|
|
@@ -31,8 +30,8 @@ function NoticeRow({
|
|
|
31
30
|
/**
|
|
32
31
|
* What converting a search to a filter left behind (RFC 038 D5). Rendered above
|
|
33
32
|
* the clause chips so the user sees, before touching the rule, every part of the
|
|
34
|
-
* search the filter cannot carry: a folder scope
|
|
35
|
-
*
|
|
33
|
+
* search the filter cannot carry: a folder scope and non-clause facets.
|
|
34
|
+
* Nothing to state renders nothing.
|
|
36
35
|
* Presentational and prop-driven.
|
|
37
36
|
*/
|
|
38
37
|
export function SearchConversionNoticeView({
|
|
@@ -56,11 +55,6 @@ export function SearchConversionNoticeView({
|
|
|
56
55
|
{droppedFacetsCopy(notice.droppedFacets)}
|
|
57
56
|
</NoticeRow>
|
|
58
57
|
)}
|
|
59
|
-
{notice.droppedSemantic && (
|
|
60
|
-
<NoticeRow icon={<Sparkles className="size-3.5" />}>
|
|
61
|
-
{DROPPED_SEMANTIC_COPY}
|
|
62
|
-
</NoticeRow>
|
|
63
|
-
)}
|
|
64
58
|
</ul>
|
|
65
59
|
</div>
|
|
66
60
|
);
|
|
@@ -3,11 +3,8 @@ import { describe, it } from "node:test";
|
|
|
3
3
|
import { createElement } from "react";
|
|
4
4
|
import { renderToString } from "react-dom/server";
|
|
5
5
|
import {
|
|
6
|
-
DROPPED_SEMANTIC_COPY,
|
|
7
6
|
droppedFacetsCopy,
|
|
8
|
-
hasConversionNotice,
|
|
9
7
|
makeFilterBlockedCopy,
|
|
10
|
-
scopedOutCopy,
|
|
11
8
|
} from "./search-conversion.js";
|
|
12
9
|
import { SearchConversionNoticeView } from "./search-conversion-notice.js";
|
|
13
10
|
|
|
@@ -16,11 +13,6 @@ const render = (element: Parameters<typeof renderToString>[0]) =>
|
|
|
16
13
|
renderToString(element).replaceAll("<!-- -->", "");
|
|
17
14
|
|
|
18
15
|
describe("search-conversion copy", () => {
|
|
19
|
-
it("names the folder a scoped search is kept out of the filter for", () => {
|
|
20
|
-
assert.match(scopedOutCopy("Archive"), /limited to Archive/);
|
|
21
|
-
assert.match(scopedOutCopy("Archive"), /any folder/i);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
16
|
it("names one dropped facet in the singular", () => {
|
|
25
17
|
const copy = droppedFacetsCopy(["Has attachment"]);
|
|
26
18
|
assert.match(copy, /Has attachment isn't a filter condition/);
|
|
@@ -32,33 +24,6 @@ describe("search-conversion copy", () => {
|
|
|
32
24
|
assert.match(copy, /Has attachment, Unread and Before 2026 aren't/);
|
|
33
25
|
});
|
|
34
26
|
|
|
35
|
-
it("states the filter is literal-only and the reach is not carried", () => {
|
|
36
|
-
assert.match(DROPPED_SEMANTIC_COPY, /matches these words literally/i);
|
|
37
|
-
// Never claims the filter itself matches by meaning.
|
|
38
|
-
assert.match(DROPPED_SEMANTIC_COPY, /a filter can't carry that/i);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("has nothing to say when nothing was dropped", () => {
|
|
42
|
-
assert.equal(hasConversionNotice({}), false);
|
|
43
|
-
assert.equal(hasConversionNotice({ droppedSemantic: false }), false);
|
|
44
|
-
assert.equal(hasConversionNotice({ droppedFacets: [] }), false);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("has something to say for any single drop", () => {
|
|
48
|
-
assert.equal(hasConversionNotice({ scopedOutFolder: "Archive" }), true);
|
|
49
|
-
assert.equal(hasConversionNotice({ droppedFacets: ["Unread"] }), true);
|
|
50
|
-
assert.equal(hasConversionNotice({ droppedSemantic: true }), true);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("names the facets a chip-composed query is made of, not just the gap", () => {
|
|
54
|
-
const copy = makeFilterBlockedCopy(["Unread", "Category: Newsletter"]);
|
|
55
|
-
assert.match(
|
|
56
|
-
copy,
|
|
57
|
-
/Unread and Category: Newsletter aren't filter conditions/,
|
|
58
|
-
);
|
|
59
|
-
assert.match(copy, /add a sender or words to filter on/);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
27
|
it("reads singular for one facet", () => {
|
|
63
28
|
assert.match(
|
|
64
29
|
makeFilterBlockedCopy(["Unread"]),
|
|
@@ -75,23 +40,6 @@ describe("search-conversion copy", () => {
|
|
|
75
40
|
});
|
|
76
41
|
|
|
77
42
|
describe("SearchConversionNoticeView", () => {
|
|
78
|
-
it("renders every drop the conversion recorded", () => {
|
|
79
|
-
const html = render(
|
|
80
|
-
createElement(SearchConversionNoticeView, {
|
|
81
|
-
notice: {
|
|
82
|
-
scopedOutFolder: "Archive",
|
|
83
|
-
droppedFacets: ["Has attachment"],
|
|
84
|
-
droppedSemantic: true,
|
|
85
|
-
},
|
|
86
|
-
}),
|
|
87
|
-
);
|
|
88
|
-
assert.match(html, /From your search/);
|
|
89
|
-
assert.match(html, /limited to Archive/);
|
|
90
|
-
assert.match(html, /Has attachment/);
|
|
91
|
-
assert.match(html, /left out/);
|
|
92
|
-
assert.match(html, /matches these words literally/i);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
43
|
it("renders nothing when there is nothing to state", () => {
|
|
96
44
|
const html = render(
|
|
97
45
|
createElement(SearchConversionNoticeView, { notice: {} }),
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* The honest copy for turning a search into a filter (RFC 038 D5).
|
|
3
3
|
*
|
|
4
4
|
* A search carries reach a filter's clauses cannot: a folder it was limited to,
|
|
5
|
-
* attribute facets that are not clauses
|
|
6
|
-
* query at request time — semantic similarity. The conversion never drops any of
|
|
5
|
+
* and attribute facets that are not clauses. The conversion never drops any of
|
|
7
6
|
* that silently. This module is the vocabulary the conversion notice renders; the
|
|
8
7
|
* web-client computes which parts apply and feeds the notice.
|
|
9
8
|
*/
|
|
@@ -13,20 +12,13 @@ export interface SearchConversionNotice {
|
|
|
13
12
|
scopedOutFolder?: string;
|
|
14
13
|
/** Facet labels with no clause equivalent (e.g. "Has attachment", "Before 2026-01-01"). */
|
|
15
14
|
droppedFacets?: string[];
|
|
16
|
-
/**
|
|
17
|
-
* Free text was kept as a literal `HasWords` clause, and the search had
|
|
18
|
-
* surfaced similar mail by meaning that the literal filter cannot reproduce
|
|
19
|
-
* (RFC 038 D5) — the "similar mail" reach is not part of the filter.
|
|
20
|
-
*/
|
|
21
|
-
droppedSemantic?: boolean;
|
|
22
15
|
}
|
|
23
16
|
|
|
24
17
|
/** True when the conversion left something behind worth stating. */
|
|
25
18
|
export function hasConversionNotice(notice: SearchConversionNotice): boolean {
|
|
26
19
|
return (
|
|
27
20
|
notice.scopedOutFolder !== undefined ||
|
|
28
|
-
(notice.droppedFacets?.length ?? 0) > 0
|
|
29
|
-
notice.droppedSemantic === true
|
|
21
|
+
(notice.droppedFacets?.length ?? 0) > 0
|
|
30
22
|
);
|
|
31
23
|
}
|
|
32
24
|
|
|
@@ -67,11 +59,3 @@ export function makeFilterBlockedCopy(droppedFacets: string[]): string {
|
|
|
67
59
|
droppedFacets.length === 1 ? "a filter condition" : "filter conditions";
|
|
68
60
|
return `${joinFacets(droppedFacets)} ${verb} ${noun} — ${NEEDS_A_CLAUSE}`;
|
|
69
61
|
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* States the filter is literal-only, so the search's similar-mail reach is not
|
|
73
|
-
* carried (RFC 038 D5). Shown only where that reach existed — a capable search
|
|
74
|
-
* that surfaced similar mail — so it never claims a reach the filter had.
|
|
75
|
-
*/
|
|
76
|
-
export const DROPPED_SEMANTIC_COPY =
|
|
77
|
-
"The filter matches these words literally. Your search also found similar mail by meaning — a filter can't carry that, so it won't catch mail that means the same thing without these words.";
|
|
@@ -16,8 +16,8 @@ export interface SearchResult {
|
|
|
16
16
|
sender: string;
|
|
17
17
|
/**
|
|
18
18
|
* Sender address. The avatar's color is keyed on it, so a message keeps the
|
|
19
|
-
* same circle in a search result as in the list it came from. Absent
|
|
20
|
-
*
|
|
19
|
+
* same circle in a search result as in the list it came from. Absent keys
|
|
20
|
+
* the avatar on the name.
|
|
21
21
|
*/
|
|
22
22
|
senderEmail?: string;
|
|
23
23
|
subject: string;
|
|
@@ -28,8 +28,7 @@ export interface SearchResult {
|
|
|
28
28
|
category?: { label: string; tone?: SearchResultTone };
|
|
29
29
|
/**
|
|
30
30
|
* The thread this result belongs to. Lets the consumer open the conversation
|
|
31
|
-
* directly
|
|
32
|
-
* the case for semantic "Related" hits surfaced from anywhere in the mailbox.
|
|
31
|
+
* directly, even when the message isn't in the currently loaded list.
|
|
33
32
|
*/
|
|
34
33
|
threadId?: string;
|
|
35
34
|
/** The mailbox the result lives in; paired with {@link threadId} to open it. */
|
|
@@ -40,15 +39,6 @@ export interface SearchResult {
|
|
|
40
39
|
* {@link provenanceFolderLabel} for which folders can be named.
|
|
41
40
|
*/
|
|
42
41
|
folder?: ResultFolder;
|
|
43
|
-
/**
|
|
44
|
-
* Why a semantic ("Related") hit matched — a plain-language label derived
|
|
45
|
-
* from `matchedChunkType` (e.g. "body", "subject", "attachment"), so the user
|
|
46
|
-
* understands why the result showed up. Absent for literal "Top matches"
|
|
47
|
-
* rows, which match by construction.
|
|
48
|
-
*/
|
|
49
|
-
matchedChunkLabel?: string;
|
|
50
|
-
/** Relevance figure (0–1) from the semantic engine; rendered beside the chip. */
|
|
51
|
-
score?: number;
|
|
52
42
|
}
|
|
53
43
|
|
|
54
44
|
export interface SearchResultRowProps {
|
|
@@ -91,9 +81,8 @@ function searchResultRowData(result: SearchResult): ThreadRowData {
|
|
|
91
81
|
* shared `ComfortableRowBody`: the sender avatar, the unread dot, the star and
|
|
92
82
|
* the sender/subject/snippet rhythm all come from one implementation, and a
|
|
93
83
|
* message looks the same whether it was found or scrolled to. Everything only a
|
|
94
|
-
* search knows — the folder a row was read from
|
|
95
|
-
* chip
|
|
96
|
-
* slot. Presentational and prop-driven; the app supplies `onClick` and the
|
|
84
|
+
* search knows — the folder a row was read from and the search's own category
|
|
85
|
+
* chip — rides in the row's badge slot. Presentational and prop-driven; the app supplies `onClick` and the
|
|
97
86
|
* optional `query` to bold literal matches.
|
|
98
87
|
*/
|
|
99
88
|
export function SearchResultRow({
|
|
@@ -130,16 +119,6 @@ export function SearchResultRow({
|
|
|
130
119
|
{result.category.label}
|
|
131
120
|
</Badge>
|
|
132
121
|
)}
|
|
133
|
-
{result.matchedChunkLabel && (
|
|
134
|
-
<Badge tone="neutral" className="shrink-0">
|
|
135
|
-
{`matched: ${result.matchedChunkLabel}`}
|
|
136
|
-
</Badge>
|
|
137
|
-
)}
|
|
138
|
-
{result.score != null && (
|
|
139
|
-
<span className="shrink-0 text-2xs text-fg-subtle tabular-nums">
|
|
140
|
-
{result.score.toFixed(2)}
|
|
141
|
-
</span>
|
|
142
|
-
)}
|
|
143
122
|
</>
|
|
144
123
|
}
|
|
145
124
|
/>
|
|
@@ -20,27 +20,6 @@ const sections: SearchResultSection[] = [
|
|
|
20
20
|
];
|
|
21
21
|
|
|
22
22
|
describe("SearchResults", () => {
|
|
23
|
-
it("renders the section header and matching rows for a query", () => {
|
|
24
|
-
const html = renderToString(
|
|
25
|
-
createElement(SearchResults, { value: "invoice", sections }),
|
|
26
|
-
);
|
|
27
|
-
assert.match(html, /Results/);
|
|
28
|
-
assert.match(html, /Stripe/);
|
|
29
|
-
assert.match(html, /for March is ready/);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("shows recent searches when the query is empty", () => {
|
|
33
|
-
const html = renderToString(
|
|
34
|
-
createElement(SearchResults, {
|
|
35
|
-
value: "",
|
|
36
|
-
recentSearches: ["invoice march"],
|
|
37
|
-
onPickRecent: noop,
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
40
|
-
assert.match(html, /Recent searches/);
|
|
41
|
-
assert.match(html, /invoice march/);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
23
|
it("shows the empty state when a query matches nothing", () => {
|
|
45
24
|
const html = renderToString(
|
|
46
25
|
createElement(SearchResults, {
|
|
@@ -51,42 +30,6 @@ describe("SearchResults", () => {
|
|
|
51
30
|
assert.match(html, /No matches for/);
|
|
52
31
|
});
|
|
53
32
|
|
|
54
|
-
it("renders the matched-chunk chip and score on a semantic hit", () => {
|
|
55
|
-
const semanticResult: SearchResult = {
|
|
56
|
-
...result,
|
|
57
|
-
matchedChunkLabel: "subject",
|
|
58
|
-
score: 0.87,
|
|
59
|
-
};
|
|
60
|
-
const html = renderToString(
|
|
61
|
-
createElement(SearchResults, {
|
|
62
|
-
value: "invoice",
|
|
63
|
-
sections: [
|
|
64
|
-
{ id: "related", label: "Related", results: [semanticResult] },
|
|
65
|
-
],
|
|
66
|
-
}),
|
|
67
|
-
);
|
|
68
|
-
assert.match(html, /matched: subject/);
|
|
69
|
-
assert.match(html, /0\.87/);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("renders removable filter-token chips above the sections", () => {
|
|
73
|
-
const html = renderToString(
|
|
74
|
-
createElement(SearchResults, {
|
|
75
|
-
value: "invoice from:stripe.com",
|
|
76
|
-
sections,
|
|
77
|
-
tokens: [{ label: "From: stripe.com", onRemove: noop }],
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
80
|
-
assert.match(html, /From: stripe\.com/);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("omits the chip row when there are no tokens", () => {
|
|
84
|
-
const html = renderToString(
|
|
85
|
-
createElement(SearchResults, { value: "invoice", sections, tokens: [] }),
|
|
86
|
-
);
|
|
87
|
-
assert.doesNotMatch(html, /Remove filter/);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
33
|
it("offers 'Make this a filter' above active results", () => {
|
|
91
34
|
const html = renderToString(
|
|
92
35
|
createElement(SearchResults, {
|
|
@@ -343,17 +286,6 @@ describe("SearchResults scoped to a collection", () => {
|
|
|
343
286
|
assert.match(html, /Archive/);
|
|
344
287
|
assert.match(html, /Spam/);
|
|
345
288
|
});
|
|
346
|
-
|
|
347
|
-
it("holds the same spam row out when the search is scoped to a folder", () => {
|
|
348
|
-
const html = renderToString(
|
|
349
|
-
createElement(SearchResults, {
|
|
350
|
-
value: "invoice",
|
|
351
|
-
sections: collectionSections,
|
|
352
|
-
scope: { kind: "folder", role: "inbox" },
|
|
353
|
-
}),
|
|
354
|
-
);
|
|
355
|
-
assert.doesNotMatch(html, /billing@unknown-vendor\.test/);
|
|
356
|
-
});
|
|
357
289
|
});
|
|
358
290
|
|
|
359
291
|
// #313: the figure used to be the junk rows in `sections` — a count of the page
|
|
@@ -50,34 +50,8 @@ const topMatches: SearchResult[] = [
|
|
|
50
50
|
},
|
|
51
51
|
];
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* Semantic hits. The index carries no sender address, so these rows have no
|
|
55
|
-
* `senderEmail` — their avatar keys on the display name instead.
|
|
56
|
-
*/
|
|
57
|
-
const related: SearchResult[] = [
|
|
58
|
-
{
|
|
59
|
-
id: "r5",
|
|
60
|
-
sender: "QuickBooks",
|
|
61
|
-
subject: "Reminder: 2 invoices awaiting payment",
|
|
62
|
-
snippet: "You have outstanding invoices totalling €430.00.",
|
|
63
|
-
date: "Feb 20",
|
|
64
|
-
matchedChunkLabel: "body",
|
|
65
|
-
score: 0.92,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: "r6",
|
|
69
|
-
sender: "noreply@vendor.io",
|
|
70
|
-
subject: "Overdue invoice notice",
|
|
71
|
-
snippet: "This invoice is now 14 days overdue. Please remit payment.",
|
|
72
|
-
date: "Feb 12",
|
|
73
|
-
matchedChunkLabel: "subject",
|
|
74
|
-
score: 0.81,
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
|
|
78
53
|
const resultSections: SearchResultSection[] = [
|
|
79
54
|
{ id: "top", label: "Top matches", results: topMatches },
|
|
80
|
-
{ id: "related", label: "Related", results: related },
|
|
81
55
|
];
|
|
82
56
|
|
|
83
57
|
/**
|
|
@@ -240,7 +214,6 @@ export const GlobalAcrossFolders: Story = {
|
|
|
240
214
|
}}
|
|
241
215
|
sections={[
|
|
242
216
|
{ id: "top", label: "Top matches", results: globalTopMatches },
|
|
243
|
-
{ id: "related", label: "Related", results: related },
|
|
244
217
|
]}
|
|
245
218
|
/>
|
|
246
219
|
),
|
|
@@ -269,7 +242,6 @@ export const GlobalWithoutSpamMatches: Story = {
|
|
|
269
242
|
(result) => result.folder?.role !== "junk",
|
|
270
243
|
),
|
|
271
244
|
},
|
|
272
|
-
{ id: "related", label: "Related", results: related },
|
|
273
245
|
]}
|
|
274
246
|
/>
|
|
275
247
|
),
|
|
@@ -324,7 +296,6 @@ export const GlobalSpamWithoutCount: Story = {
|
|
|
324
296
|
scope={{ kind: "global", onScopeToSpam: () => {} }}
|
|
325
297
|
sections={[
|
|
326
298
|
{ id: "top", label: "Top matches", results: globalTopMatches },
|
|
327
|
-
{ id: "related", label: "Related", results: related },
|
|
328
299
|
]}
|
|
329
300
|
/>
|
|
330
301
|
),
|
|
@@ -346,7 +317,6 @@ export const ScopedToInbox: Story = {
|
|
|
346
317
|
scope={{ kind: "folder", role: "inbox" }}
|
|
347
318
|
sections={[
|
|
348
319
|
{ id: "top", label: "Top matches", results: globalTopMatches },
|
|
349
|
-
{ id: "related", label: "Related", results: related },
|
|
350
320
|
]}
|
|
351
321
|
/>
|
|
352
322
|
),
|
|
@@ -79,7 +79,7 @@ export interface SearchResultsProps {
|
|
|
79
79
|
/** Recent searches shown when the query is empty. */
|
|
80
80
|
recentSearches?: string[];
|
|
81
81
|
onPickRecent?: (query: string) => void;
|
|
82
|
-
/** Grouped result sections (e.g. "Top matches"
|
|
82
|
+
/** Grouped result sections (e.g. "Top matches"). */
|
|
83
83
|
sections?: SearchResultSection[];
|
|
84
84
|
loading?: boolean;
|
|
85
85
|
onSelectResult?: (result: SearchResult) => void;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { describe, it } from "node:test";
|
|
3
|
-
import {
|
|
4
|
-
import { renderToString } from "react-dom/server";
|
|
5
|
-
import { SecuritySelect, securityToApi } from "./security-select.js";
|
|
3
|
+
import { securityToApi } from "./security-select.js";
|
|
6
4
|
|
|
7
5
|
describe("securityToApi", () => {
|
|
8
6
|
it("maps tls to { tls: true, startTls: false }", () => {
|
|
@@ -20,14 +18,3 @@ describe("securityToApi", () => {
|
|
|
20
18
|
assert.deepEqual(securityToApi("none"), { tls: false, startTls: false });
|
|
21
19
|
});
|
|
22
20
|
});
|
|
23
|
-
|
|
24
|
-
describe("SecuritySelect", () => {
|
|
25
|
-
it("renders all three security options", () => {
|
|
26
|
-
const html = renderToString(
|
|
27
|
-
createElement(SecuritySelect, { defaultValue: "tls" }),
|
|
28
|
-
);
|
|
29
|
-
assert.match(html, /TLS\/SSL/);
|
|
30
|
-
assert.match(html, /STARTTLS/);
|
|
31
|
-
assert.match(html, /None \(insecure\)/);
|
|
32
|
-
});
|
|
33
|
-
});
|