@remit/ui 0.0.222 → 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 +12 -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 +1 -1
- 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-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 +0 -15
- package/src/components/swipeable-row.render.test.ts +0 -7
- 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 -30
- 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/use-list-cursor.test.ts +0 -7
- package/src/lib/use-list-keyboard.test.ts +0 -14
- 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/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
|
@@ -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
|
-
});
|
|
@@ -31,11 +31,6 @@ const row = (html: string, name: "actions" | "select-all"): string => {
|
|
|
31
31
|
return next === -1 ? rest : rest.slice(0, next);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const hasRow = (html: string, name: "actions" | "select-all"): boolean =>
|
|
35
|
-
html.includes(`data-selection-bar-row="${name}"`);
|
|
36
|
-
|
|
37
|
-
const INLINE_SELECT_ALL = /hidden shrink-0 pr-2 md:flex/;
|
|
38
|
-
|
|
39
34
|
const selectAll = { checked: false, onChange: () => undefined };
|
|
40
35
|
|
|
41
36
|
describe("SelectionTopBar", () => {
|
|
@@ -47,21 +42,6 @@ describe("SelectionTopBar", () => {
|
|
|
47
42
|
assert.doesNotMatch(text(html), /messages selected/);
|
|
48
43
|
});
|
|
49
44
|
|
|
50
|
-
it("carries the list header's own chrome while nothing is ticked", () => {
|
|
51
|
-
const html = renderToString(
|
|
52
|
-
createElement(SelectionTopBar, {
|
|
53
|
-
...handlers,
|
|
54
|
-
count: 0,
|
|
55
|
-
navSlot: createElement("button", { type: "button" }, "Menu"),
|
|
56
|
-
titleMeta: createElement("span", null, "12 unread"),
|
|
57
|
-
searchSlot: createElement("button", { type: "button" }, "Search"),
|
|
58
|
-
}),
|
|
59
|
-
);
|
|
60
|
-
assert.match(text(html), /Menu/);
|
|
61
|
-
assert.match(text(html), /12 unread/);
|
|
62
|
-
assert.match(text(html), /Search/);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
45
|
it("hands the row to the count and the verbs from the first ticked row", () => {
|
|
66
46
|
const html = renderToString(
|
|
67
47
|
createElement(SelectionTopBar, {
|
|
@@ -77,18 +57,6 @@ describe("SelectionTopBar", () => {
|
|
|
77
57
|
assert.doesNotMatch(text(html), /Search/);
|
|
78
58
|
});
|
|
79
59
|
|
|
80
|
-
it("lets the expanded search field take the title's place while idle", () => {
|
|
81
|
-
const html = renderToString(
|
|
82
|
-
createElement(SelectionTopBar, {
|
|
83
|
-
...handlers,
|
|
84
|
-
count: 0,
|
|
85
|
-
searchField: createElement("input", { "aria-label": "Search mail" }),
|
|
86
|
-
}),
|
|
87
|
-
);
|
|
88
|
-
assert.match(html, /aria-label="Search mail"/);
|
|
89
|
-
assert.doesNotMatch(text(html), /Inbox/);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
60
|
it("carries the make-filter row while nothing is ticked, and drops it once something is", () => {
|
|
93
61
|
const idleSlot = createElement("button", { type: "button" }, "Make filter");
|
|
94
62
|
assert.match(
|
|
@@ -109,28 +77,6 @@ describe("SelectionTopBar", () => {
|
|
|
109
77
|
);
|
|
110
78
|
});
|
|
111
79
|
|
|
112
|
-
it("keeps Junk and Mark read in the overflow menu, never as glyphs", () => {
|
|
113
|
-
const html = renderToString(
|
|
114
|
-
createElement(SelectionTopBar, {
|
|
115
|
-
...handlers,
|
|
116
|
-
count: 2,
|
|
117
|
-
onJunk: () => undefined,
|
|
118
|
-
onMarkRead: () => undefined,
|
|
119
|
-
}),
|
|
120
|
-
);
|
|
121
|
-
assert.match(html, /aria-label="More actions"/);
|
|
122
|
-
assert.doesNotMatch(row(html, "actions"), /aria-label="Junk"/);
|
|
123
|
-
assert.doesNotMatch(row(html, "actions"), /aria-label="Mark read"/);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it("replaces the title with the count from the first ticked row", () => {
|
|
127
|
-
const html = renderToString(
|
|
128
|
-
createElement(SelectionTopBar, { ...handlers, count: 1 }),
|
|
129
|
-
);
|
|
130
|
-
assert.match(text(html), /1 message selected/);
|
|
131
|
-
assert.doesNotMatch(text(html), /Inbox/);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
80
|
it("renders plural copy for many messages", () => {
|
|
135
81
|
const html = renderToString(
|
|
136
82
|
createElement(SelectionTopBar, { ...handlers, count: 3 }),
|
|
@@ -164,48 +110,11 @@ describe("SelectionTopBar", () => {
|
|
|
164
110
|
assert.match(actions, /aria-label="Organize selected messages"/);
|
|
165
111
|
});
|
|
166
112
|
|
|
167
|
-
it("puts select-all on a second row, out of the way of the verbs", () => {
|
|
168
|
-
assert.ok(hasRow(html, "select-all"));
|
|
169
|
-
const secondRow = row(html, "select-all");
|
|
170
|
-
assert.match(secondRow, /Select all/);
|
|
171
|
-
assert.match(
|
|
172
|
-
secondRow,
|
|
173
|
-
/md:hidden/,
|
|
174
|
-
"the second row exists only below 768px",
|
|
175
|
-
);
|
|
176
|
-
assert.match(
|
|
177
|
-
row(html, "actions"),
|
|
178
|
-
INLINE_SELECT_ALL,
|
|
179
|
-
"the inline copy is the one that stands down below 768px",
|
|
180
|
-
);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
113
|
it("offers a back arrow to leave selection", () => {
|
|
184
114
|
assert.match(row(html, "actions"), /aria-label="Cancel selection"/);
|
|
185
115
|
});
|
|
186
116
|
});
|
|
187
117
|
|
|
188
|
-
describe("at 1024px", () => {
|
|
189
|
-
it("keeps select-all inline in the bar with zero rows ticked", () => {
|
|
190
|
-
const html = renderToString(
|
|
191
|
-
createElement(SelectionTopBar, { ...handlers, count: 0, selectAll }),
|
|
192
|
-
);
|
|
193
|
-
const actions = row(html, "actions");
|
|
194
|
-
assert.match(actions, /Select all/);
|
|
195
|
-
assert.match(actions, INLINE_SELECT_ALL, "inline from 768px up");
|
|
196
|
-
assert.doesNotMatch(
|
|
197
|
-
actions,
|
|
198
|
-
/aria-label="Cancel selection"/,
|
|
199
|
-
"nothing to leave with nothing ticked",
|
|
200
|
-
);
|
|
201
|
-
assert.equal(
|
|
202
|
-
hasRow(html, "select-all"),
|
|
203
|
-
false,
|
|
204
|
-
"no second row when nothing is ticked",
|
|
205
|
-
);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
118
|
it("renders Junk and Mark read in the overflow menu, not the verb row", () => {
|
|
210
119
|
const html = renderToString(
|
|
211
120
|
createElement(SelectionTopBar, {
|
|
@@ -263,18 +172,6 @@ describe("SelectionTopBar", () => {
|
|
|
263
172
|
assert.doesNotMatch(html, /aria-label="More actions"/);
|
|
264
173
|
});
|
|
265
174
|
|
|
266
|
-
it("renders the verbs at the 44px touch size", () => {
|
|
267
|
-
const html = renderToString(
|
|
268
|
-
createElement(SelectionTopBar, {
|
|
269
|
-
...handlers,
|
|
270
|
-
count: 2,
|
|
271
|
-
onOrganize: () => undefined,
|
|
272
|
-
}),
|
|
273
|
-
);
|
|
274
|
-
const buttonCount = (html.match(/h-11 w-11/g) ?? []).length;
|
|
275
|
-
assert.equal(buttonCount, 3, "back, delete and organize are all 44px");
|
|
276
|
-
});
|
|
277
|
-
|
|
278
175
|
it("hides the verbs while counting", () => {
|
|
279
176
|
const html = renderToString(
|
|
280
177
|
createElement(SelectionTopBar, {
|
|
@@ -288,18 +185,6 @@ describe("SelectionTopBar", () => {
|
|
|
288
185
|
assert.doesNotMatch(html, /aria-label="Organize selected messages"/);
|
|
289
186
|
});
|
|
290
187
|
|
|
291
|
-
it("renders statusLabel in place of the count copy when provided", () => {
|
|
292
|
-
const html = renderToString(
|
|
293
|
-
createElement(SelectionTopBar, {
|
|
294
|
-
...handlers,
|
|
295
|
-
count: 3412,
|
|
296
|
-
statusLabel: "Deleting 1,200 of 3,412…",
|
|
297
|
-
}),
|
|
298
|
-
);
|
|
299
|
-
assert.match(text(html), /Deleting 1,200 of 3,412…/);
|
|
300
|
-
assert.doesNotMatch(text(html), /3,412 messages selected/);
|
|
301
|
-
});
|
|
302
|
-
|
|
303
188
|
it("marks the count/status line as a polite live region", () => {
|
|
304
189
|
const html = renderToString(
|
|
305
190
|
createElement(SelectionTopBar, { ...handlers, count: 2 }),
|
|
@@ -310,13 +195,6 @@ describe("SelectionTopBar", () => {
|
|
|
310
195
|
);
|
|
311
196
|
});
|
|
312
197
|
|
|
313
|
-
it("omits the select-all control when selectAll is absent", () => {
|
|
314
|
-
const html = renderToString(
|
|
315
|
-
createElement(SelectionTopBar, { ...handlers, count: 2 }),
|
|
316
|
-
);
|
|
317
|
-
assert.doesNotMatch(text(html), /Select all/);
|
|
318
|
-
});
|
|
319
|
-
|
|
320
198
|
it("renders select-all unchecked in the some-selected state", () => {
|
|
321
199
|
const html = renderToString(
|
|
322
200
|
createElement(SelectionTopBar, {
|
|
@@ -364,33 +242,6 @@ describe("SelectionTopBar", () => {
|
|
|
364
242
|
assert.match(text(html), /All 47 loaded selected/);
|
|
365
243
|
});
|
|
366
244
|
|
|
367
|
-
it("lets statusLabel override the scoped default for an escalated selection", () => {
|
|
368
|
-
const html = renderToString(
|
|
369
|
-
createElement(SelectionTopBar, {
|
|
370
|
-
...handlers,
|
|
371
|
-
count: 3412,
|
|
372
|
-
selectAll: { checked: true, onChange: () => undefined },
|
|
373
|
-
statusLabel: 'All 3,412 matching "npm" selected',
|
|
374
|
-
}),
|
|
375
|
-
);
|
|
376
|
-
assert.match(text(html), /All 3,412 matching "npm" selected/);
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
it("renders the notice text and tone", () => {
|
|
380
|
-
const html = renderToString(
|
|
381
|
-
createElement(SelectionTopBar, {
|
|
382
|
-
...handlers,
|
|
383
|
-
count: 2,
|
|
384
|
-
notice: {
|
|
385
|
-
tone: "warning",
|
|
386
|
-
text: "Move only works within one account",
|
|
387
|
-
},
|
|
388
|
-
}),
|
|
389
|
-
);
|
|
390
|
-
assert.match(text(html), /Move only works within one account/);
|
|
391
|
-
assert.match(html, /role="status"/);
|
|
392
|
-
});
|
|
393
|
-
|
|
394
245
|
it("renders the notice's action as a real button, not prose", () => {
|
|
395
246
|
const html = renderToString(
|
|
396
247
|
createElement(SelectionTopBar, {
|
|
@@ -405,35 +256,4 @@ describe("SelectionTopBar", () => {
|
|
|
405
256
|
);
|
|
406
257
|
assert.match(html, /<button[^>]*>Retry 340<\/button>/);
|
|
407
258
|
});
|
|
408
|
-
|
|
409
|
-
it("omits the notice when absent", () => {
|
|
410
|
-
const html = renderToString(
|
|
411
|
-
createElement(SelectionTopBar, { ...handlers, count: 2 }),
|
|
412
|
-
);
|
|
413
|
-
// Only the count/status line carries role="status" — no second one for
|
|
414
|
-
// an absent notice.
|
|
415
|
-
const statusRoles = (html.match(/role="status"/g) ?? []).length;
|
|
416
|
-
assert.equal(statusRoles, 1);
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
it("renders a determinate progress bar when progress is provided", () => {
|
|
420
|
-
const html = renderToString(
|
|
421
|
-
createElement(SelectionTopBar, {
|
|
422
|
-
...handlers,
|
|
423
|
-
count: 3412,
|
|
424
|
-
statusLabel: "Deleting 1,200 of 3,412…",
|
|
425
|
-
isBusy: true,
|
|
426
|
-
progress: { value: 1200, max: 3412 },
|
|
427
|
-
}),
|
|
428
|
-
);
|
|
429
|
-
assert.match(html, /role="progressbar"/);
|
|
430
|
-
assert.match(html, /aria-valuenow="1200"/);
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
it("omits the progress bar when progress is absent", () => {
|
|
434
|
-
const html = renderToString(
|
|
435
|
-
createElement(SelectionTopBar, { ...handlers, count: 2 }),
|
|
436
|
-
);
|
|
437
|
-
assert.doesNotMatch(html, /role="progressbar"/);
|
|
438
|
-
});
|
|
439
259
|
});
|
|
@@ -323,7 +323,6 @@ export const RICH_CONVERSION: SearchConversion = {
|
|
|
323
323
|
{ type: "before", label: "Before 2026-01-01" },
|
|
324
324
|
],
|
|
325
325
|
keptTerms: true,
|
|
326
|
-
droppedSemantic: true,
|
|
327
326
|
};
|
|
328
327
|
|
|
329
328
|
export const PLAIN_CONVERSION: SearchConversion = {
|
|
@@ -331,5 +330,4 @@ export const PLAIN_CONVERSION: SearchConversion = {
|
|
|
331
330
|
matchOperator: "all",
|
|
332
331
|
droppedFacets: [],
|
|
333
332
|
keptTerms: true,
|
|
334
|
-
droppedSemantic: false,
|
|
335
333
|
};
|