@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.
Files changed (200) hide show
  1. package/package.json +12 -3
  2. package/src/components/DropdownMenu.tsx +100 -0
  3. package/src/components/EmptyState.tsx +11 -0
  4. package/src/components/ErrorBanner.render.test.ts +107 -0
  5. package/src/components/ErrorBanner.stories.tsx +132 -0
  6. package/src/components/ErrorBanner.tsx +122 -0
  7. package/src/components/ErrorBannerStack.tsx +34 -0
  8. package/src/components/ErrorState.render.test.ts +82 -0
  9. package/src/components/ErrorState.tsx +80 -0
  10. package/src/components/KeyboardShortcutsModal.tsx +111 -0
  11. package/src/components/account-service-change-dialog.render.test.ts +1 -41
  12. package/src/components/account-service-choice.render.test.ts +0 -26
  13. package/src/components/account-service-toggles.render.test.ts +0 -6
  14. package/src/components/address-display.render.test.ts +1 -38
  15. package/src/components/address-tag.render.test.ts +0 -11
  16. package/src/components/agenda-flow.reach.test.ts +0 -8
  17. package/src/components/agenda-flow.render.test.ts +0 -31
  18. package/src/components/agenda-panels.render.test.ts +0 -5
  19. package/src/components/app-shell-slotted.render.test.ts +0 -118
  20. package/src/components/attachment-list.render.test.ts +41 -24
  21. package/src/components/attachment-list.stories.tsx +67 -0
  22. package/src/components/attachment-list.tsx +112 -35
  23. package/src/components/attendee-row.render.test.ts +0 -41
  24. package/src/components/attention-dot.stories.tsx +46 -0
  25. package/src/components/attention-dot.tsx +23 -0
  26. package/src/components/banner.render.test.ts +0 -7
  27. package/src/components/bottom-sheet.render.test.ts +0 -42
  28. package/src/components/brief-section.render.test.ts +0 -13
  29. package/src/components/brief-sections.keyboard.test.ts +0 -13
  30. package/src/components/brief-sections.render.test.ts +0 -22
  31. package/src/components/calendar-clash-strip.render.test.ts +0 -19
  32. package/src/components/calendar-grid.render.test.ts +0 -79
  33. package/src/components/calendar-invite-card.render.test.ts +0 -19
  34. package/src/components/calendar-list.render.test.ts +0 -21
  35. package/src/components/calendar-slot-offers.render.test.ts +0 -24
  36. package/src/components/calendar-suggestion-deck.render.test.ts +0 -18
  37. package/src/components/calendar-toolbar.render.test.ts +1 -53
  38. package/src/components/category-badge.render.test.ts +1 -24
  39. package/src/components/compose-action-bar.render.test.ts +0 -5
  40. package/src/components/compose-attachments.render.test.ts +0 -38
  41. package/src/components/event-detail.render.test.ts +0 -27
  42. package/src/components/event-editor.render.test.ts +0 -4
  43. package/src/components/event-suggestion-card.render.test.ts +0 -61
  44. package/src/components/event-suggestion-card.zone-gate.test.ts +1 -7
  45. package/src/components/filter-clause-chip.tsx +1 -60
  46. package/src/components/filter-rule-editor.create.test.ts +0 -6
  47. package/src/components/filter-rule-editor.stories.tsx +24 -138
  48. package/src/components/filter-rule-editor.tsx +7 -93
  49. package/src/components/filter-rule.render.test.ts +9 -299
  50. package/src/components/filter-rule.ts +20 -85
  51. package/src/components/filter-sheet.render.test.ts +0 -7
  52. package/src/components/folder-manage-actions.render.test.ts +0 -13
  53. package/src/components/folder-manager.render.test.ts +0 -31
  54. package/src/components/folder-mutation-dialog.render.test.ts +0 -83
  55. package/src/components/folder-rename-dialog.render.test.ts +0 -14
  56. package/src/components/folder-row.render.test.ts +0 -30
  57. package/src/components/folder-sync-state.test.ts +0 -61
  58. package/src/components/folder-tree-picker.create.test.ts +0 -30
  59. package/src/components/folder-tree-picker.render.test.ts +0 -35
  60. package/src/components/intelligence-calendar-fixtures.ts +0 -2
  61. package/src/components/intelligence-calendar.render.test.ts +0 -4
  62. package/src/components/intelligence-panel.render.test.ts +1 -62
  63. package/src/components/intelligence-panel.stories.tsx +0 -76
  64. package/src/components/intelligence-panel.tab-strip.test.ts +0 -1
  65. package/src/components/intelligence-panel.tsx +6 -176
  66. package/src/components/intelligence-toggle.render.test.ts +0 -5
  67. package/src/components/isolated-email-frame.render.test.ts +0 -122
  68. package/src/components/isolated-email-frame.tsx +1 -1
  69. package/src/components/keyboard-hint-bar.render.test.ts +0 -7
  70. package/src/components/label-chip.render.test.ts +0 -28
  71. package/src/components/label-chip.tsx +1 -1
  72. package/src/components/mail-header.render.test.ts +0 -20
  73. package/src/components/mcp-connected-apps-page.stories.tsx +58 -0
  74. package/src/components/mcp-connected-apps-page.tsx +79 -0
  75. package/src/components/mcp-consent-page.stories.tsx +39 -0
  76. package/src/components/mcp-consent-page.tsx +47 -0
  77. package/src/components/mcp-device-page.stories.tsx +57 -0
  78. package/src/components/mcp-device-page.tsx +107 -0
  79. package/src/components/mcp-error-notice.stories.tsx +34 -0
  80. package/src/components/mcp-error-notice.tsx +23 -0
  81. package/src/components/mcp-error-page.stories.tsx +17 -0
  82. package/src/components/mcp-error-page.tsx +15 -0
  83. package/src/components/mcp-fixtures.ts +16 -0
  84. package/src/components/mcp-login-page.stories.tsx +37 -0
  85. package/src/components/mcp-login-page.tsx +58 -0
  86. package/src/components/mcp-page.stories.tsx +27 -0
  87. package/src/components/mcp-page.tsx +35 -0
  88. package/src/components/mcp-permission-list.stories.tsx +21 -0
  89. package/src/components/mcp-permission-list.tsx +22 -0
  90. package/src/components/message-body-view.render.test.ts +0 -21
  91. package/src/components/message-list-pane.brief-filter.test.ts +0 -6
  92. package/src/components/message-list-pane.render.test.ts +0 -54
  93. package/src/components/message-list-state.render.test.ts +0 -84
  94. package/src/components/{quarantine-bug-dialog.tsx → message-report-dialog.tsx} +9 -14
  95. package/src/components/message-row.render.test.ts +1 -98
  96. package/src/components/mobile-message-action-bar.render.test.ts +0 -59
  97. package/src/components/mobile-reading-pane.render.test.ts +0 -48
  98. package/src/components/mobile-search-view.render.test.ts +0 -16
  99. package/src/components/mobile-search-view.stories.tsx +8 -11
  100. package/src/components/mobile-search-view.tsx +1 -1
  101. package/src/components/nav-sidebar.keyboard.test.ts +0 -8
  102. package/src/components/nav-sidebar.render.test.ts +2 -133
  103. package/src/components/new-folder-form.render.test.ts +0 -26
  104. package/src/components/outbox-row.render.test.ts +0 -9
  105. package/src/components/pane-layout.render.test.ts +0 -18
  106. package/src/components/plain-text-editor.mount.test.ts +0 -16
  107. package/src/components/popover-menu.render.test.ts +0 -11
  108. package/src/components/progress-bar.render.test.ts +0 -14
  109. package/src/components/quarantine-report.test.ts +0 -8
  110. package/src/components/quarantine-section.render.test.ts +16 -13
  111. package/src/components/quarantine-section.stories.tsx +11 -8
  112. package/src/components/reading-pane.render.test.ts +2 -106
  113. package/src/components/reading-pane.stories.tsx +3 -0
  114. package/src/components/refresh-button.render.test.ts +0 -9
  115. package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
  116. package/src/components/rich-text-editor.mount.test.ts +0 -19
  117. package/src/components/rich-text-image-node.ts +11 -9
  118. package/src/components/role-appointment-list.render.test.ts +0 -49
  119. package/src/components/role-appointment-prompt.render.test.ts +0 -79
  120. package/src/components/row-actions.render.test.ts +0 -34
  121. package/src/components/search-bar.render.test.ts +0 -44
  122. package/src/components/search-chip-input.render.test.ts +0 -71
  123. package/src/components/search-conversion-notice.stories.tsx +0 -6
  124. package/src/components/search-conversion-notice.tsx +3 -9
  125. package/src/components/search-conversion.render.test.ts +0 -52
  126. package/src/components/search-conversion.ts +2 -18
  127. package/src/components/search-result-row.tsx +5 -26
  128. package/src/components/search-results.render.test.ts +0 -68
  129. package/src/components/search-results.stories.tsx +0 -30
  130. package/src/components/search-results.tsx +1 -1
  131. package/src/components/security-select.render.test.ts +1 -14
  132. package/src/components/selection-top-bar.render.test.ts +0 -180
  133. package/src/components/selection-wizard-fixtures.ts +0 -2
  134. package/src/components/selection-wizard.render.test.ts +7 -212
  135. package/src/components/selection-wizard.stories.tsx +24 -164
  136. package/src/components/selection-wizard.tsx +10 -86
  137. package/src/components/self-update.render.test.ts +0 -113
  138. package/src/components/sender-trust-indicator.render.test.ts +0 -30
  139. package/src/components/shell-top-bar.render.test.ts +0 -31
  140. package/src/components/shell-top-bar.stories.tsx +7 -0
  141. package/src/components/shell-top-bar.tsx +11 -2
  142. package/src/components/slide-panel.render.test.ts +0 -18
  143. package/src/components/suggest-list.render.test.ts +0 -6
  144. package/src/components/swipeable-row.gesture.test.ts +0 -15
  145. package/src/components/swipeable-row.render.test.ts +0 -7
  146. package/src/components/sync-warning-fixtures.ts +22 -0
  147. package/src/components/sync-warning-report.ts +38 -0
  148. package/src/components/sync-warning-row.tsx +51 -0
  149. package/src/components/sync-warning-section.render.test.ts +19 -0
  150. package/src/components/sync-warning-section.stories.tsx +94 -0
  151. package/src/components/sync-warning-section.tsx +56 -0
  152. package/src/components/touch-list-body.render.test.ts +0 -29
  153. package/src/components/wizard.render.test.ts +0 -22
  154. package/src/filter-presets.test.ts +1 -107
  155. package/src/index.ts +40 -30
  156. package/src/lib/compose-language.test.ts +0 -11
  157. package/src/lib/email-render-treatment.test.ts +0 -21
  158. package/src/lib/keymap.test.ts +0 -32
  159. package/src/lib/property-prefill.ts +2 -2
  160. package/src/lib/search-rule.test.ts +0 -4
  161. package/src/lib/search-rule.ts +0 -9
  162. package/src/lib/sender-derivation.ts +3 -5
  163. package/src/lib/use-list-cursor.test.ts +0 -7
  164. package/src/lib/use-list-keyboard.test.ts +0 -14
  165. package/src/lib/use-modal-focus.test.ts +0 -20
  166. package/src/lib/use-selection.hook.test.ts +0 -13
  167. package/src/lib/use-selection.test.ts +0 -101
  168. package/src/lib/wizard-steps.test.ts +18 -79
  169. package/src/lib/wizard-steps.ts +27 -67
  170. package/src/mcp-pages.ts +36 -0
  171. package/src/category-presentation.test.ts +0 -76
  172. package/src/components/account-service-status.render.test.ts +0 -82
  173. package/src/components/app-password-hint.render.test.ts +0 -23
  174. package/src/components/app-top-bar.render.test.ts +0 -59
  175. package/src/components/auth-card.render.test.ts +0 -24
  176. package/src/components/auth-footer.render.test.ts +0 -17
  177. package/src/components/auth-hero.render.test.ts +0 -31
  178. package/src/components/auto-moved-badge.render.test.ts +0 -65
  179. package/src/components/button.render.test.ts +0 -29
  180. package/src/components/calendar-event-chip.render.test.ts +0 -67
  181. package/src/components/calendar-parse-badge.render.test.ts +0 -40
  182. package/src/components/checkbox.render.test.ts +0 -65
  183. package/src/components/compose-form-shell.render.test.ts +0 -106
  184. package/src/components/dialog.render.test.ts +0 -51
  185. package/src/components/field-label.render.test.ts +0 -16
  186. package/src/components/mail-action-toolbar.render.test.ts +0 -43
  187. package/src/components/nav-link-surface.render.test.ts +0 -126
  188. package/src/components/new-folder-action.render.test.ts +0 -44
  189. package/src/components/pane-header.render.test.ts +0 -22
  190. package/src/components/pull-to-refresh.render.test.ts +0 -46
  191. package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
  192. package/src/components/rescue-banner.render.test.ts +0 -32
  193. package/src/components/rescue-candidate-row.render.test.ts +0 -68
  194. package/src/components/search-token-chip.render.test.ts +0 -42
  195. package/src/components/self-update-dot.tsx +0 -32
  196. package/src/components/settings-primitives.render.test.ts +0 -160
  197. package/src/lib/email-layout-clamp.test.ts +0 -139
  198. package/src/lib/label-color.test.ts +0 -25
  199. package/src/lib/semantic-off.ts +0 -20
  200. package/src/stories-viewport-globals.test.ts +0 -77
@@ -9,18 +9,13 @@ import {
9
9
  Star,
10
10
  X,
11
11
  } from "lucide-react";
12
- import { type ReactElement, type ReactNode, useId, useState } from "react";
12
+ import { type ReactNode, useId, useState } from "react";
13
13
  import {
14
14
  categoryLabels,
15
15
  categoryTone,
16
16
  type ThreadCategory,
17
17
  } from "../category-presentation.js";
18
18
  import { cn } from "../lib/cn.js";
19
- import {
20
- SEMANTIC_OFF_BUYS,
21
- SEMANTIC_OFF_COMMAND,
22
- SEMANTIC_OFF_TITLE,
23
- } from "../lib/semantic-off.js";
24
19
  import { Avatar } from "./avatar.js";
25
20
  import { Badge } from "./badge.js";
26
21
  import { Button } from "./button.js";
@@ -34,8 +29,8 @@ import { SegmentedControl } from "./segmented-control.js";
34
29
 
35
30
  /* ------------------------------------------------------------------ */
36
31
  /* The fourth pane: mail intelligence. Driven by real backend signals */
37
- /* (Address engagement counters, DKIM-mismatch category heuristics, */
38
- /* semantic search) with reserved slots for local-LLM and Bedrock */
32
+ /* (Address engagement counters, DKIM-mismatch category heuristics) */
33
+ /* with reserved slots for local-LLM and Bedrock */
39
34
  /* features. Silent when there is nothing to say; loudest element on */
40
35
  /* the screen when authenticity fails. */
41
36
  /* ------------------------------------------------------------------ */
@@ -84,49 +79,8 @@ export interface AuthenticityIntel {
84
79
  * domain-comparison line (there is no valid domain to show).
85
80
  */
86
81
  addressUnreadable?: boolean;
87
- /** Count of semantically similar messages (the campaign, not the instance). */
88
- similarCount?: number;
89
- }
90
-
91
- export type MatchedChunk =
92
- | "sender"
93
- | "recipient"
94
- | "subject"
95
- | "attachment"
96
- | "body"
97
- | "entities";
98
-
99
- export interface SimilarMessageIntel {
100
- id: string;
101
- /** Mailbox the message lives in — the route param for opening it. */
102
- mailboxId: string;
103
- /** Conversation the message belongs to, which is what the reading pane opens. */
104
- threadId: string;
105
- fromName: string;
106
- subject: string;
107
- timeLabel: string;
108
- matched: MatchedChunk;
109
- }
110
-
111
- /**
112
- * Renders a similar-message row as a real anchor so middle-click /
113
- * open-in-new-tab / deep-linking / screen-reader link semantics all work. The
114
- * web-client passes a router `<Link>` builder; when omitted the row falls back
115
- * to a non-navigating element that preserves the visual (static stories).
116
- */
117
- export interface SimilarMessageLinkProps {
118
- mailboxId: string;
119
- threadId: string;
120
- messageId: string;
121
- className: string;
122
- ariaLabel?: string;
123
- children: ReactNode;
124
82
  }
125
83
 
126
- export type SimilarMessageLinkComponent = (
127
- props: SimilarMessageLinkProps,
128
- ) => ReactElement;
129
-
130
84
  export interface SenderFlagsIntel {
131
85
  vip?: boolean;
132
86
  muted?: boolean;
@@ -148,7 +102,6 @@ export interface IntelligenceData {
148
102
  authenticity: AuthenticityIntel;
149
103
  category: { value: ThreadCategory; overridden?: boolean };
150
104
  flags?: SenderFlagsIntel;
151
- similar: SimilarMessageIntel[];
152
105
  }
153
106
 
154
107
  export interface IntelligenceQuickActions {
@@ -170,18 +123,6 @@ export interface IntelligenceQuickActions {
170
123
  onReportSpam?: () => void;
171
124
  }
172
125
 
173
- /**
174
- * State of the similar-messages section. The host computes these from the
175
- * semantic-search query so the panel can show a skeleton while in flight and
176
- * "similarity search unavailable" on failure (the rest of the sidebar still
177
- * renders). Defaults to "ready" when omitted.
178
- *
179
- * "off" is not a failure and not a slow query: this instance stores no message
180
- * vectors, and it says so with the command that changes it. Without it the
181
- * section renders nothing at all, which reads as a sender nothing resembles.
182
- */
183
- export type SimilarState = "loading" | "error" | "off" | "ready";
184
-
185
126
  /**
186
127
  * The two halves of the panel. Sender is what this message is; Calendar is what
187
128
  * it would cost. They are tabs rather than one long column because the second
@@ -211,17 +152,8 @@ export interface IntelligenceCalendarSurface {
211
152
  export interface IntelligencePanelProps {
212
153
  data: IntelligenceData;
213
154
  onClose?: () => void;
214
- onShowSimilar?: () => void;
215
155
  /** Quick-action callbacks. When omitted the buttons are visual-only. */
216
156
  actions?: IntelligenceQuickActions;
217
- /** Loading/error state for the similar-messages section. */
218
- similarState?: SimilarState;
219
- /**
220
- * Render-prop that wraps each similar-message row in a real router anchor so
221
- * it opens that email (deep-link / middle-click / link a11y). When omitted the
222
- * rows render as static, non-navigating elements (stories / SSR previews).
223
- */
224
- similarLinkComponent?: SimilarMessageLinkComponent;
225
157
  /** Layout overrides (e.g. when hosted inside a resizable panel). */
226
158
  className?: string;
227
159
  /**
@@ -306,13 +238,7 @@ function SenderCard({ sender }: { sender: SenderIntel }) {
306
238
  );
307
239
  }
308
240
 
309
- function Authenticity({
310
- auth,
311
- onShowSimilar,
312
- }: {
313
- auth: AuthenticityIntel;
314
- onShowSimilar?: () => void;
315
- }) {
241
+ function Authenticity({ auth }: { auth: AuthenticityIntel }) {
316
242
  if (auth.verdict === "aligned") {
317
243
  return (
318
244
  <div className="flex items-start gap-2 text-xs text-fg-muted">
@@ -353,16 +279,6 @@ function Authenticity({
353
279
  )}
354
280
  </div>
355
281
  </div>
356
- {auth.similarCount != null && auth.similarCount > 0 && (
357
- <Button
358
- variant="secondary"
359
- size="sm"
360
- className="mt-2 w-full border-danger/30 text-danger hover:bg-danger-soft"
361
- onClick={onShowSimilar}
362
- >
363
- {auth.similarCount} similar messages
364
- </Button>
365
- )}
366
282
  </div>
367
283
  );
368
284
  }
@@ -408,22 +324,10 @@ function QuickAction({
408
324
  );
409
325
  }
410
326
 
411
- const matchTone: Record<MatchedChunk, string> = {
412
- sender: "matched: sender",
413
- recipient: "matched: recipient",
414
- subject: "matched: subject",
415
- attachment: "matched: attachment",
416
- body: "matched: body",
417
- entities: "matched: entities",
418
- };
419
-
420
327
  export function IntelligencePanel({
421
328
  data,
422
329
  onClose,
423
- onShowSimilar,
424
330
  actions,
425
- similarState = "ready",
426
- similarLinkComponent,
427
331
  className,
428
332
  hideCloseButton = false,
429
333
  reportSpamPending = false,
@@ -434,7 +338,7 @@ export function IntelligencePanel({
434
338
  defaultTab = "sender",
435
339
  touch,
436
340
  }: IntelligencePanelProps) {
437
- const { sender, authenticity, category, flags = {}, similar } = data;
341
+ const { sender, authenticity, category, flags = {} } = data;
438
342
  const [ownTab, setOwnTab] = useState<IntelligenceTabId>(defaultTab);
439
343
  const tabStripName = useId();
440
344
  const activeTab = tab ?? ownTab;
@@ -496,7 +400,7 @@ export function IntelligencePanel({
496
400
  </IntelligenceSection>
497
401
 
498
402
  <IntelligenceSection label="Authenticity">
499
- <Authenticity auth={authenticity} onShowSimilar={onShowSimilar} />
403
+ <Authenticity auth={authenticity} />
500
404
  </IntelligenceSection>
501
405
 
502
406
  <IntelligenceSection label="Category">
@@ -562,80 +466,6 @@ export function IntelligencePanel({
562
466
  )}
563
467
  </IntelligenceSection>
564
468
 
565
- {(similarState !== "ready" || similar.length > 0) && (
566
- <IntelligenceSection label="Similar messages">
567
- {similarState === "loading" ? (
568
- <div className="animate-pulse space-y-2">
569
- {Array.from({ length: 3 }).map((_, i) => (
570
- // biome-ignore lint/suspicious/noArrayIndexKey: list is static, no stable id
571
- <div key={i} className="space-y-1">
572
- <div className="h-3 w-3/4 rounded bg-surface-sunken" />
573
- <div className="h-2.5 w-1/2 rounded bg-surface-sunken" />
574
- </div>
575
- ))}
576
- </div>
577
- ) : similarState === "error" ? (
578
- <p className="text-xs text-fg-subtle">
579
- Similarity search unavailable
580
- </p>
581
- ) : similarState === "off" ? (
582
- <div className="space-y-1.5 text-xs text-fg-subtle">
583
- <p className="text-fg-muted">{SEMANTIC_OFF_TITLE}</p>
584
- <p>{SEMANTIC_OFF_BUYS}</p>
585
- <p>
586
- Run{" "}
587
- <code className="rounded bg-surface-sunken px-1 py-px text-2xs text-fg-muted">
588
- {SEMANTIC_OFF_COMMAND}
589
- </code>{" "}
590
- on the server.
591
- </p>
592
- </div>
593
- ) : (
594
- <ul className="-mx-1 space-y-1">
595
- {similar.map((s) => {
596
- const rowClass =
597
- "block w-full rounded-md px-1 py-1 text-left hover:bg-surface-sunken";
598
- const ariaLabel = `Open message from ${s.fromName || "unknown sender"}: ${s.subject}`;
599
- const inner = (
600
- <>
601
- <div className="flex items-baseline justify-between gap-2">
602
- <span className="truncate text-xs font-medium text-fg">
603
- {s.fromName}
604
- </span>
605
- <span className="shrink-0 text-2xs text-fg-subtle tabular-nums">
606
- {s.timeLabel}
607
- </span>
608
- </div>
609
- <div className="truncate text-xs text-fg-muted">
610
- {s.subject}
611
- </div>
612
- <span className="mt-1 inline-block rounded-full bg-surface-sunken px-1.5 py-px text-2xs text-fg-subtle">
613
- {matchTone[s.matched]}
614
- </span>
615
- </>
616
- );
617
- return (
618
- <li key={s.id}>
619
- {similarLinkComponent ? (
620
- similarLinkComponent({
621
- mailboxId: s.mailboxId,
622
- threadId: s.threadId,
623
- messageId: s.id,
624
- className: rowClass,
625
- ariaLabel,
626
- children: inner,
627
- })
628
- ) : (
629
- <div className={rowClass}>{inner}</div>
630
- )}
631
- </li>
632
- );
633
- })}
634
- </ul>
635
- )}
636
- </IntelligenceSection>
637
- )}
638
-
639
469
  <IntelligenceSection
640
470
  label="Coming soon"
641
471
  className="border-b-0 opacity-70"
@@ -14,11 +14,6 @@ const render = (props: Parameters<typeof IntelligenceToggle>[0]): string =>
14
14
  renderToString(createElement(IntelligenceToggle, props));
15
15
 
16
16
  describe("IntelligenceToggle", () => {
17
- it("renders the button when it cannot act", () => {
18
- const html = render({ enabled: false });
19
- assert.match(html, /aria-label="Show intelligence sidebar"/);
20
- });
21
-
22
17
  it("disables rather than hides the button when it cannot act", () => {
23
18
  const html = render({ enabled: false });
24
19
  assert.match(html, /\sdisabled(=""|\s|>)/);
@@ -6,8 +6,6 @@ import {
6
6
  buildEmailSrcDoc,
7
7
  DARK_OPT_IN_RE,
8
8
  generateContentInsetCSS,
9
- generateFramedEmailBaseCSS,
10
- generatePlainEmailBaseCSS,
11
9
  generateScrollportCSS,
12
10
  VIEWPORT_META,
13
11
  } from "./email-frame-css.js";
@@ -47,10 +45,6 @@ const frameStyle = (html: string): string => {
47
45
  };
48
46
 
49
47
  describe("the frame's box is the app's layout, never the mail's", () => {
50
- it("takes the width of the box holding it", () => {
51
- assert.match(frameStyle(SHORT_MAIL), /width:100%/);
52
- });
53
-
54
48
  it("gives mail that cannot fit the same box as mail that can", () => {
55
49
  // The whole width policy in one assertion: nothing about the email
56
50
  // reaches the element the app has laid out, so no mail can move a box
@@ -127,117 +121,6 @@ describe("fitScale (a wide mail shrinks to the frame, never grows)", () => {
127
121
  });
128
122
  });
129
123
 
130
- describe("generateScrollportCSS (the document holds its own overflow)", () => {
131
- it("makes the body the scrollport rather than the frame", () => {
132
- assert.match(generateScrollportCSS(), /body\{overflow-x:auto\}/);
133
- });
134
-
135
- it("stops the body's overflow propagating to the frame's viewport", () => {
136
- // Overflow on the body becomes the viewport's unless the root claims it
137
- // first, and a scrolling viewport is the app holding the email's width
138
- // again.
139
- assert.match(generateScrollportCSS(), /html\{overflow:hidden\}/);
140
- });
141
- });
142
-
143
- describe("generatePlainEmailBaseCSS (theme tokens pinned)", () => {
144
- it("injects the light-theme resolved tokens", () => {
145
- const css = generatePlainEmailBaseCSS(false);
146
- assert.match(css, /oklch\(0\.3 0\.025 235\)/);
147
- assert.match(css, /oklch\(0\.55 0\.14 150\)/);
148
- });
149
-
150
- it("injects the dark-theme resolved tokens", () => {
151
- const css = generatePlainEmailBaseCSS(true);
152
- assert.match(css, /oklch\(0\.88 0\.02 90\)/);
153
- assert.match(css, /oklch\(0\.78 0\.16 150\)/);
154
- });
155
-
156
- it("grounds the email on the reading pane's own canvas, not a lighter surface", () => {
157
- // --surface (0.975 / 0.25) would render the mail as a lighter rectangle
158
- // inside the pane, seam and all. --canvas is the pane itself.
159
- assert.match(generatePlainEmailBaseCSS(false), /oklch\(0\.96 0\.015 90\)/);
160
- assert.doesNotMatch(
161
- generatePlainEmailBaseCSS(false),
162
- /oklch\(0\.975 0\.012 90\)/,
163
- );
164
- assert.match(generatePlainEmailBaseCSS(true), /oklch\(0\.22 0\.025 220\)/);
165
- assert.doesNotMatch(
166
- generatePlainEmailBaseCSS(true),
167
- /oklch\(0\.25 0\.025 220\)/,
168
- );
169
- });
170
-
171
- it("strips author colors and backgrounds from body descendants only", () => {
172
- const css = generatePlainEmailBaseCSS(false);
173
- assert.match(css, /body \*\s*\{[^}]*color:\s*inherit\s*!important/);
174
- assert.match(
175
- css,
176
- /body \*\s*\{[^}]*background-color:\s*transparent\s*!important/,
177
- );
178
- });
179
- });
180
-
181
- describe("generateFramedEmailBaseCSS (K-9 dark strategy)", () => {
182
- it("light theme renders an author background as authored on white, no invert", () => {
183
- const css = generateFramedEmailBaseCSS(false, false, true);
184
- assert.match(css, /background-color:#ffffff/);
185
- assert.match(css, /color-scheme:light/);
186
- assert.doesNotMatch(css, /invert/);
187
- });
188
-
189
- it("dark theme without opt-in smart-inverts an author background into the pane", () => {
190
- const css = generateFramedEmailBaseCSS(true, false, true);
191
- assert.match(css, /html\{[^}]*filter:invert\(0\.92\) hue-rotate\(180deg\)/);
192
- // Media re-inverted back to natural color.
193
- assert.match(css, /img,picture,video[^{]*\{filter:invert/);
194
- });
195
-
196
- it("dark theme WITH opt-in preserves the author's own dark design (no invert)", () => {
197
- const css = generateFramedEmailBaseCSS(true, true, true);
198
- assert.match(css, /color-scheme:dark light/);
199
- assert.doesNotMatch(css, /invert/);
200
- });
201
- });
202
-
203
- describe("generateFramedEmailBaseCSS (mail that brings no ground of its own)", () => {
204
- it("grounds a light-theme email on the pane's canvas instead of white", () => {
205
- const css = generateFramedEmailBaseCSS(false, false, false);
206
- assert.match(css, /background-color:oklch\(0\.96 0\.015 90\)/);
207
- assert.doesNotMatch(css, /#ffffff/);
208
- });
209
-
210
- it("grounds a dark-theme email on the pane's canvas and never inverts it", () => {
211
- // The invert moves off `html` onto `body`: the author's colours still
212
- // darken, but a white canvas is never painted for it to turn into a
213
- // charcoal slab sitting inside the pane.
214
- const css = generateFramedEmailBaseCSS(true, false, false);
215
- assert.match(
216
- css,
217
- /html\{margin:0;background-color:oklch\(0\.22 0\.025 220\)\}/,
218
- );
219
- assert.match(css, /body\{margin:0;filter:invert\(0\.92\)/);
220
- assert.doesNotMatch(css, /#ffffff/);
221
- });
222
-
223
- it("grounds a dark opt-in email on the pane's canvas", () => {
224
- const css = generateFramedEmailBaseCSS(true, true, false);
225
- assert.match(css, /background-color:oklch\(0\.22 0\.025 220\)/);
226
- assert.doesNotMatch(css, /invert/);
227
- });
228
- });
229
-
230
- describe("generateContentInsetCSS (breathing room inside the background)", () => {
231
- it("pads the element that carries the background, in its border box", () => {
232
- const css = generateContentInsetCSS();
233
- assert.match(css, /body\{padding:16px;box-sizing:border-box\}/);
234
- });
235
-
236
- it("leaves the document itself unpadded so the ground reaches the frame edge", () => {
237
- assert.match(generateContentInsetCSS(), /html\{padding:0\}/);
238
- });
239
- });
240
-
241
124
  describe("DARK_OPT_IN_RE", () => {
242
125
  it("detects color-scheme: dark and prefers-color-scheme: dark", () => {
243
126
  assert.ok(DARK_OPT_IN_RE.test(":root{color-scheme: dark}"));
@@ -276,11 +159,6 @@ describe("buildEmailSrcDoc", () => {
276
159
  }
277
160
  });
278
161
 
279
- it("uses the plain base CSS for the plain variant", () => {
280
- const doc = buildEmailSrcDoc("<p>x</p>", "plain", false);
281
- assert.match(doc, /Plain-email base/);
282
- });
283
-
284
162
  it("uses the framed smart-invert in dark mode for a non-opt-in framed email", () => {
285
163
  const doc = buildEmailSrcDoc("<p>x</p>", "framed", true, {
286
164
  background: true,
@@ -165,7 +165,7 @@ export const isForwardableKey = (key: string): boolean => {
165
165
  };
166
166
 
167
167
  /**
168
- * Keydown events raised inside an iframe never reach the embedding window, so
168
+ * Keydown events raised inside an iframe never reach the parent window, so
169
169
  * once the reader clicks into the message body every app shortcut goes dead —
170
170
  * j/k, arrows, Esc, the lot (#43). Replay the allowlisted keystrokes on the host
171
171
  * window so the app's one keyboard layer keeps hearing them. The replay is a
@@ -6,13 +6,6 @@ import { keyboardHintsFor } from "../lib/keymap.js";
6
6
  import { KeyboardHintBar } from "./keyboard-hint-bar.js";
7
7
 
8
8
  describe("KeyboardHintBar", () => {
9
- it("offers the app's own set by default", () => {
10
- const html = renderToString(createElement(KeyboardHintBar));
11
- assert.match(html, /<span>navigate<\/span>/);
12
- assert.match(html, /<span>mute<\/span>/);
13
- assert.match(html, /<span>all shortcuts<\/span>/);
14
- });
15
-
16
9
  it("offers only what the host's handlers answer", () => {
17
10
  const hints = keyboardHintsFor({ focusNext: () => undefined });
18
11
  const html = renderToString(createElement(KeyboardHintBar, { hints }));
@@ -5,34 +5,6 @@ import { renderToString } from "react-dom/server";
5
5
  import { LabelChip } from "./label-chip.js";
6
6
 
7
7
  describe("LabelChip", () => {
8
- it("renders the label's name and a dot in its color", () => {
9
- const html = renderToString(
10
- createElement(LabelChip, {
11
- label: { labelId: "l1", name: "Receipts", color: "Blue" },
12
- }),
13
- );
14
- assert.match(html, /Receipts/);
15
- assert.match(html, /bg-blue-500/);
16
- });
17
-
18
- it("falls back to the neutral dot for an unrecognized color", () => {
19
- const html = renderToString(
20
- createElement(LabelChip, {
21
- label: { labelId: "l1", name: "Mystery", color: "Chartreuse" },
22
- }),
23
- );
24
- assert.match(html, /bg-fg-subtle/);
25
- });
26
-
27
- it("renders no remove affordance without onRemove", () => {
28
- const html = renderToString(
29
- createElement(LabelChip, {
30
- label: { labelId: "l1", name: "Receipts", color: "Blue" },
31
- }),
32
- );
33
- assert.doesNotMatch(html, /Remove label/);
34
- });
35
-
36
8
  it("renders a remove button naming the label when onRemove is wired", () => {
37
9
  const html = renderToString(
38
10
  createElement(LabelChip, {
@@ -16,7 +16,7 @@ export interface LabelChipProps {
16
16
 
17
17
  /**
18
18
  * A label applied to a message (issue #26) — a colored dot plus its name, the
19
- * same shape a category badge or the widen chip takes. `color` renders from
19
+ * same shape a category badge takes. `color` renders from
20
20
  * the literal palette (never a semantic tone): a label's color is a user
21
21
  * choice, not a status the design system assigns meaning to.
22
22
  */
@@ -39,15 +39,6 @@ describe("MailHeader", () => {
39
39
  assert.doesNotMatch(render({ isDesktop: true }), /aria-label="Menu"/);
40
40
  });
41
41
 
42
- it("sits on the pane-header datum once the top bar carries search", () => {
43
- assert.match(render({ showSearch: false }), /h-pane-header/);
44
- assert.match(render(), /h-section-row/);
45
- });
46
-
47
- it("does not render an account chip row (accounts live in the filter / nav)", () => {
48
- assert.doesNotMatch(render(), /aria-label="Filters"/);
49
- });
50
-
51
42
  it("shows the search magnifier and hides the input when collapsed", () => {
52
43
  const html = render({ searchOpen: false });
53
44
  assert.match(html, /aria-label="Search"/);
@@ -112,12 +103,6 @@ describe("MailHeader search ownership", () => {
112
103
  assert.doesNotMatch(html, /aria-label="Search"/);
113
104
  });
114
105
 
115
- it("keeps the title and unread count when search lives elsewhere", () => {
116
- const html = render({ isDesktop: true, showSearch: false });
117
- assert.match(html, /Daily brief/);
118
- assert.match(html, /15,338 unread/);
119
- });
120
-
121
106
  it("suppresses the field below desktop too, where the takeover owns search", () => {
122
107
  assert.equal(
123
108
  countSearchInputs(render({ isDesktop: false, showSearch: false })),
@@ -129,9 +114,4 @@ describe("MailHeader search ownership", () => {
129
114
  const combined = topBar() + render({ isDesktop: true, showSearch: false });
130
115
  assert.equal(countSearchInputs(combined), 1);
131
116
  });
132
-
133
- it("would be two fields if the header kept its own — the premise being guarded", () => {
134
- const combined = topBar() + render({ isDesktop: true });
135
- assert.equal(countSearchInputs(combined), 2);
136
- });
137
117
  });
@@ -0,0 +1,58 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, within } from "storybook/test";
3
+ import { McpConnectedAppsPage } from "./mcp-connected-apps-page.js";
4
+ import { mcpErrorFixture, mcpPermissionsFixture } from "./mcp-fixtures.js";
5
+
6
+ const meta: Meta<typeof McpConnectedAppsPage> = {
7
+ title: "Playground/Proposed/MCP/McpConnectedAppsPage",
8
+ tags: ["proposed"],
9
+ component: McpConnectedAppsPage,
10
+ parameters: { layout: "fullscreen" },
11
+ };
12
+ export default meta;
13
+
14
+ type Story = StoryObj<typeof McpConnectedAppsPage>;
15
+
16
+ const apps = [
17
+ {
18
+ clientId: "client-claude-ai",
19
+ name: "Claude",
20
+ permissions: mcpPermissionsFixture,
21
+ connectedOn: "12 October 2026",
22
+ },
23
+ {
24
+ clientId: "client-claude-code",
25
+ name: "Claude Code",
26
+ permissions: mcpPermissionsFixture.slice(0, 1),
27
+ connectedOn: "20 October 2026",
28
+ },
29
+ ];
30
+
31
+ export const TwoApps: Story = {
32
+ args: { apps },
33
+ play: async ({ canvasElement }) => {
34
+ const canvas = within(canvasElement);
35
+ await expect(
36
+ canvas.getByRole("button", { name: "Disconnect Claude Code" }),
37
+ ).toBeVisible();
38
+ },
39
+ };
40
+
41
+ export const JustDisconnected: Story = {
42
+ args: { apps: apps.slice(1), disconnected: "Claude" },
43
+ };
44
+
45
+ export const NoApps: Story = {
46
+ args: { apps: [] },
47
+ };
48
+
49
+ export const DisconnectFailed: Story = {
50
+ args: {
51
+ apps,
52
+ error: {
53
+ message: "Disconnecting Claude failed.",
54
+ fix: "Reload the page and try again.",
55
+ reportUrl: mcpErrorFixture.reportUrl,
56
+ },
57
+ },
58
+ };
@@ -0,0 +1,79 @@
1
+ import { Unplug } from "lucide-react";
2
+ import { Banner } from "./banner.js";
3
+ import { Button } from "./button.js";
4
+ import { McpErrorNotice } from "./mcp-error-notice.js";
5
+ import { McpPage, type McpPageError, type McpPermission } from "./mcp-page.js";
6
+ import { McpPermissionList } from "./mcp-permission-list.js";
7
+
8
+ export interface McpConnectedApp {
9
+ clientId: string;
10
+ name: string;
11
+ permissions: readonly McpPermission[];
12
+ connectedOn: string;
13
+ }
14
+
15
+ export interface McpConnectedAppsPageProps {
16
+ apps: readonly McpConnectedApp[];
17
+ disconnected?: string;
18
+ error?: McpPageError;
19
+ }
20
+
21
+ function AppRow({ app }: { app: McpConnectedApp }) {
22
+ return (
23
+ <li className="flex flex-col gap-3 py-4 first:pt-0 last:pb-0">
24
+ <div className="flex items-start justify-between gap-3">
25
+ <div className="min-w-0">
26
+ <p className="truncate font-medium text-fg">{app.name}</p>
27
+ <p className="text-xs text-fg-muted">
28
+ Connected on {app.connectedOn}
29
+ </p>
30
+ </div>
31
+ <form method="post">
32
+ <input type="hidden" name="client_id" value={app.clientId} />
33
+ <Button
34
+ type="submit"
35
+ variant="danger"
36
+ size="sm"
37
+ icon={<Unplug className="size-3.5" aria-hidden="true" />}
38
+ aria-label={`Disconnect ${app.name}`}
39
+ >
40
+ Disconnect
41
+ </Button>
42
+ </form>
43
+ </div>
44
+ <McpPermissionList permissions={app.permissions} />
45
+ </li>
46
+ );
47
+ }
48
+
49
+ export function McpConnectedAppsPage({
50
+ apps,
51
+ disconnected,
52
+ error,
53
+ }: McpConnectedAppsPageProps) {
54
+ return (
55
+ <McpPage
56
+ heading="Connected apps"
57
+ intro="These apps can use your mail. Disconnecting one signs it out at once."
58
+ >
59
+ {error && <McpErrorNotice error={error} />}
60
+ {disconnected && (
61
+ <Banner tone="success" variant="soft">
62
+ Disconnected {disconnected}. It can no longer use your mail.
63
+ </Banner>
64
+ )}
65
+ {apps.length === 0 ? (
66
+ <p className="text-sm text-fg-muted">
67
+ No apps are connected. Add remit as a connector in Claude to connect
68
+ one.
69
+ </p>
70
+ ) : (
71
+ <ul className="flex flex-col divide-y divide-line">
72
+ {apps.map((app) => (
73
+ <AppRow key={app.clientId} app={app} />
74
+ ))}
75
+ </ul>
76
+ )}
77
+ </McpPage>
78
+ );
79
+ }