@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.
Files changed (209) hide show
  1. package/package.json +14 -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 +55 -3
  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-reading-pane.stories.tsx +78 -0
  99. package/src/components/mobile-reading-pane.tsx +55 -41
  100. package/src/components/mobile-search-view.render.test.ts +0 -16
  101. package/src/components/mobile-search-view.stories.tsx +8 -11
  102. package/src/components/mobile-search-view.tsx +1 -1
  103. package/src/components/nav-sidebar.keyboard.test.ts +0 -8
  104. package/src/components/nav-sidebar.render.test.ts +2 -133
  105. package/src/components/new-folder-form.render.test.ts +0 -26
  106. package/src/components/outbox-row.render.test.ts +0 -9
  107. package/src/components/pane-layout.render.test.ts +0 -18
  108. package/src/components/plain-text-editor.mount.test.ts +0 -16
  109. package/src/components/popover-menu.render.test.ts +0 -11
  110. package/src/components/progress-bar.render.test.ts +0 -14
  111. package/src/components/quarantine-report.test.ts +0 -8
  112. package/src/components/quarantine-section.render.test.ts +16 -13
  113. package/src/components/quarantine-section.stories.tsx +11 -8
  114. package/src/components/reading-pane.render.test.ts +2 -106
  115. package/src/components/reading-pane.stories.tsx +3 -0
  116. package/src/components/refresh-button.render.test.ts +0 -9
  117. package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
  118. package/src/components/rich-text-editor.mount.test.ts +0 -19
  119. package/src/components/rich-text-image-node.ts +11 -9
  120. package/src/components/role-appointment-list.render.test.ts +0 -49
  121. package/src/components/role-appointment-prompt.render.test.ts +0 -79
  122. package/src/components/row-actions.render.test.ts +0 -34
  123. package/src/components/search-bar.render.test.ts +0 -44
  124. package/src/components/search-chip-input.render.test.ts +0 -71
  125. package/src/components/search-conversion-notice.stories.tsx +0 -6
  126. package/src/components/search-conversion-notice.tsx +3 -9
  127. package/src/components/search-conversion.render.test.ts +0 -52
  128. package/src/components/search-conversion.ts +2 -18
  129. package/src/components/search-result-row.tsx +5 -26
  130. package/src/components/search-results.render.test.ts +0 -68
  131. package/src/components/search-results.stories.tsx +0 -30
  132. package/src/components/search-results.tsx +1 -1
  133. package/src/components/security-select.render.test.ts +1 -14
  134. package/src/components/selection-top-bar.render.test.ts +0 -180
  135. package/src/components/selection-wizard-fixtures.ts +0 -2
  136. package/src/components/selection-wizard.render.test.ts +7 -212
  137. package/src/components/selection-wizard.stories.tsx +24 -164
  138. package/src/components/selection-wizard.tsx +10 -86
  139. package/src/components/self-update.render.test.ts +0 -113
  140. package/src/components/sender-trust-indicator.render.test.ts +0 -30
  141. package/src/components/shell-top-bar.render.test.ts +0 -31
  142. package/src/components/shell-top-bar.stories.tsx +7 -0
  143. package/src/components/shell-top-bar.tsx +11 -2
  144. package/src/components/slide-panel.render.test.ts +0 -18
  145. package/src/components/suggest-list.render.test.ts +0 -6
  146. package/src/components/swipeable-row.gesture.test.ts +85 -40
  147. package/src/components/swipeable-row.render.test.ts +0 -7
  148. package/src/components/swipeable-row.stories.tsx +3 -2
  149. package/src/components/swipeable-row.tsx +65 -144
  150. package/src/components/sync-warning-fixtures.ts +22 -0
  151. package/src/components/sync-warning-report.ts +38 -0
  152. package/src/components/sync-warning-row.tsx +51 -0
  153. package/src/components/sync-warning-section.render.test.ts +19 -0
  154. package/src/components/sync-warning-section.stories.tsx +94 -0
  155. package/src/components/sync-warning-section.tsx +56 -0
  156. package/src/components/touch-list-body.render.test.ts +0 -29
  157. package/src/components/wizard.render.test.ts +0 -22
  158. package/src/filter-presets.test.ts +1 -107
  159. package/src/index.ts +40 -34
  160. package/src/lib/compose-language.test.ts +0 -11
  161. package/src/lib/email-render-treatment.test.ts +0 -21
  162. package/src/lib/keymap.test.ts +0 -32
  163. package/src/lib/property-prefill.ts +2 -2
  164. package/src/lib/search-rule.test.ts +0 -4
  165. package/src/lib/search-rule.ts +0 -9
  166. package/src/lib/sender-derivation.ts +3 -5
  167. package/src/lib/swipe-config.ts +11 -0
  168. package/src/lib/use-list-cursor.test.ts +0 -7
  169. package/src/lib/use-list-keyboard.test.ts +0 -14
  170. package/src/lib/use-long-press.test.ts +53 -36
  171. package/src/lib/use-long-press.ts +62 -56
  172. package/src/lib/use-modal-focus.test.ts +0 -20
  173. package/src/lib/use-selection.hook.test.ts +0 -13
  174. package/src/lib/use-selection.test.ts +0 -101
  175. package/src/lib/use-swipe-navigation.test.ts +162 -0
  176. package/src/lib/use-swipe-navigation.ts +90 -0
  177. package/src/lib/wizard-steps.test.ts +18 -79
  178. package/src/lib/wizard-steps.ts +27 -67
  179. package/src/mcp-pages.ts +36 -0
  180. package/src/category-presentation.test.ts +0 -76
  181. package/src/components/account-service-status.render.test.ts +0 -82
  182. package/src/components/app-password-hint.render.test.ts +0 -23
  183. package/src/components/app-top-bar.render.test.ts +0 -59
  184. package/src/components/auth-card.render.test.ts +0 -24
  185. package/src/components/auth-footer.render.test.ts +0 -17
  186. package/src/components/auth-hero.render.test.ts +0 -31
  187. package/src/components/auto-moved-badge.render.test.ts +0 -65
  188. package/src/components/button.render.test.ts +0 -29
  189. package/src/components/calendar-event-chip.render.test.ts +0 -67
  190. package/src/components/calendar-parse-badge.render.test.ts +0 -40
  191. package/src/components/checkbox.render.test.ts +0 -65
  192. package/src/components/compose-form-shell.render.test.ts +0 -106
  193. package/src/components/dialog.render.test.ts +0 -51
  194. package/src/components/field-label.render.test.ts +0 -16
  195. package/src/components/mail-action-toolbar.render.test.ts +0 -43
  196. package/src/components/nav-link-surface.render.test.ts +0 -126
  197. package/src/components/new-folder-action.render.test.ts +0 -44
  198. package/src/components/pane-header.render.test.ts +0 -22
  199. package/src/components/pull-to-refresh.render.test.ts +0 -46
  200. package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
  201. package/src/components/rescue-banner.render.test.ts +0 -32
  202. package/src/components/rescue-candidate-row.render.test.ts +0 -68
  203. package/src/components/search-token-chip.render.test.ts +0 -42
  204. package/src/components/self-update-dot.tsx +0 -32
  205. package/src/components/settings-primitives.render.test.ts +0 -160
  206. package/src/lib/email-layout-clamp.test.ts +0 -139
  207. package/src/lib/label-color.test.ts +0 -25
  208. package/src/lib/semantic-off.ts +0 -20
  209. package/src/stories-viewport-globals.test.ts +0 -77
@@ -0,0 +1,78 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { useState } from "react";
3
+ import { expect, waitFor, within } from "storybook/test";
4
+ import { MobileReadingPane } from "./mobile-reading-pane.js";
5
+
6
+ const subjects = ["First message", "Second message", "Third message"];
7
+
8
+ const meta: Meta<typeof MobileReadingPane> = {
9
+ title: "Design System/Primitives/MobileReadingPane",
10
+ component: MobileReadingPane,
11
+ parameters: { layout: "fullscreen" },
12
+ };
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof MobileReadingPane>;
16
+
17
+ const SwipeBetweenMessages = () => {
18
+ const [index, setIndex] = useState(1);
19
+ return (
20
+ <div className="h-96 max-w-md">
21
+ <MobileReadingPane
22
+ thread={{ subject: subjects[index] ?? "", messages: [] }}
23
+ onBack={() => undefined}
24
+ onSwipeNext={
25
+ index < subjects.length - 1 ? () => setIndex(index + 1) : undefined
26
+ }
27
+ onSwipePrevious={index > 0 ? () => setIndex(index - 1) : undefined}
28
+ >
29
+ <p className="p-4">Swipe the body left or right.</p>
30
+ </MobileReadingPane>
31
+ </div>
32
+ );
33
+ };
34
+
35
+ const swipe = (area: Element, fromX: number, toX: number) => {
36
+ const touch = (type: string, x: number) =>
37
+ area.dispatchEvent(
38
+ new PointerEvent(type, {
39
+ bubbles: true,
40
+ buttons: type === "pointerup" ? 0 : 1,
41
+ pointerType: "touch",
42
+ pointerId: 1,
43
+ clientX: x,
44
+ clientY: 200,
45
+ }),
46
+ );
47
+ touch("pointerdown", fromX);
48
+ touch("pointermove", (fromX + toX) / 2);
49
+ touch("pointermove", toX);
50
+ touch("pointerup", toX);
51
+ };
52
+
53
+ export const SwipeToOpenNextAndPrevious: Story = {
54
+ name: "Swipe to open next and previous (interactive)",
55
+ render: () => <SwipeBetweenMessages />,
56
+ play: async ({ canvasElement }) => {
57
+ const canvas = within(canvasElement);
58
+ const area = canvasElement.querySelector("article > div.overflow-y-auto");
59
+ if (!area) throw new Error("reading area did not render");
60
+ await expect(canvas.getByRole("heading")).toHaveTextContent(
61
+ "Second message",
62
+ );
63
+
64
+ swipe(area, 300, 100);
65
+ await waitFor(() =>
66
+ expect(canvas.getByRole("heading")).toHaveTextContent("Third message"),
67
+ );
68
+
69
+ swipe(area, 100, 300);
70
+ await waitFor(() =>
71
+ expect(canvas.getByRole("heading")).toHaveTextContent("Second message"),
72
+ );
73
+ swipe(area, 100, 300);
74
+ await waitFor(() =>
75
+ expect(canvas.getByRole("heading")).toHaveTextContent("First message"),
76
+ );
77
+ },
78
+ };
@@ -1,6 +1,10 @@
1
1
  import { ArrowLeft, Info } from "lucide-react";
2
- import { type HTMLAttributes, type ReactNode, useState } from "react";
2
+ import { type ReactNode, useState } from "react";
3
3
  import { cn } from "../lib/cn.js";
4
+ import {
5
+ SwipeSurface,
6
+ useSwipeNavigation,
7
+ } from "../lib/use-swipe-navigation.js";
4
8
  import type { ThreadData } from "./app-shell-types.js";
5
9
  import { Button } from "./button.js";
6
10
  import { Dialog } from "./dialog.js";
@@ -49,8 +53,10 @@ export interface MobileReadingPaneProps {
49
53
  * still drives the top bar.
50
54
  */
51
55
  children?: ReactNode;
52
- /** Touch handlers attached to the scroll area (swipe-between-messages). */
53
- touchHandlers?: HTMLAttributes<HTMLDivElement>;
56
+ /** Swipe left on the reading area: open the next message. */
57
+ onSwipeNext?: () => void;
58
+ /** Swipe right on the reading area: open the previous message. */
59
+ onSwipePrevious?: () => void;
54
60
  }
55
61
 
56
62
  /**
@@ -71,8 +77,13 @@ export function MobileReadingPane({
71
77
  onToggleIntelligence,
72
78
  actions,
73
79
  children,
74
- touchHandlers,
80
+ onSwipeNext,
81
+ onSwipePrevious,
75
82
  }: MobileReadingPaneProps) {
83
+ const swipe = useSwipeNavigation({
84
+ onSwipeLeft: onSwipeNext,
85
+ onSwipeRight: onSwipePrevious,
86
+ });
76
87
  const [localIntelligenceOpen, setLocalIntelligenceOpen] = useState(false);
77
88
  const controlled = onToggleIntelligence !== undefined;
78
89
  const isOpen = controlled
@@ -129,49 +140,52 @@ export function MobileReadingPane({
129
140
  )}
130
141
  </header>
131
142
 
132
- <div
133
- className="flex-1 overflow-y-auto"
134
- style={touchHandlers ? { touchAction: "pan-y pinch-zoom" } : undefined}
135
- {...touchHandlers}
136
- >
137
- {/* Newest first, as on the wide pane. */}
138
- {children ??
139
- [...thread.messages].reverse().map((message) => {
140
- const bind = (handler?: (id: string) => void) =>
141
- handler ? () => handler(message.id) : undefined;
143
+ <SwipeSurface.Provider value={swipe.enabled}>
144
+ <div
145
+ ref={swipe.ref}
146
+ className="flex-1 overflow-y-auto"
147
+ style={{ touchAction: swipe.touchAction }}
148
+ {...swipe.bind()}
149
+ >
150
+ {/* Newest first, as on the wide pane. */}
151
+ {children ??
152
+ [...thread.messages].reverse().map((message) => {
153
+ const bind = (handler?: (id: string) => void) =>
154
+ handler ? () => handler(message.id) : undefined;
155
+
156
+ if (!message.expanded) {
157
+ return (
158
+ <CollapsedMessage
159
+ key={message.id}
160
+ message={message}
161
+ onClick={bind(actions?.onToggleExpand)}
162
+ />
163
+ );
164
+ }
142
165
 
143
- if (!message.expanded) {
144
166
  return (
145
- <CollapsedMessage
167
+ <ExpandedMessage
146
168
  key={message.id}
147
169
  message={message}
148
- onClick={bind(actions?.onToggleExpand)}
170
+ warning={thread.warning}
171
+ onHeaderClick={bind(actions?.onToggleExpand)}
172
+ actionBar={
173
+ <MobileMessageActionBar
174
+ hasThread
175
+ onReply={bind(actions?.onReply)}
176
+ onReplyAll={bind(actions?.onReplyAll)}
177
+ onForward={bind(actions?.onForward)}
178
+ onToggleStar={bind(actions?.onToggleStar)}
179
+ onDelete={bind(actions?.onDelete)}
180
+ onToggleRead={bind(actions?.onToggleRead)}
181
+ moveSlot={actions?.moveSlot?.(message.id)}
182
+ />
183
+ }
149
184
  />
150
185
  );
151
- }
152
-
153
- return (
154
- <ExpandedMessage
155
- key={message.id}
156
- message={message}
157
- warning={thread.warning}
158
- onHeaderClick={bind(actions?.onToggleExpand)}
159
- actionBar={
160
- <MobileMessageActionBar
161
- hasThread
162
- onReply={bind(actions?.onReply)}
163
- onReplyAll={bind(actions?.onReplyAll)}
164
- onForward={bind(actions?.onForward)}
165
- onToggleStar={bind(actions?.onToggleStar)}
166
- onDelete={bind(actions?.onDelete)}
167
- onToggleRead={bind(actions?.onToggleRead)}
168
- moveSlot={actions?.moveSlot?.(message.id)}
169
- />
170
- }
171
- />
172
- );
173
- })}
174
- </div>
186
+ })}
187
+ </div>
188
+ </SwipeSurface.Provider>
175
189
 
176
190
  {intelligence && !controlled && (
177
191
  <Dialog
@@ -117,20 +117,4 @@ describe("MobileSearchView search scope", () => {
117
117
  assert.doesNotMatch(html, /from Spam/);
118
118
  assert.doesNotMatch(html, /Archive/);
119
119
  });
120
-
121
- it("carries the server's spam count to the phone tier too", () => {
122
- const html = renderToString(
123
- createElement(MobileSearchView, {
124
- ...base,
125
- scope: {
126
- kind: "global" as const,
127
- onScopeToSpam: noop,
128
- spamCount: { kind: "exact" as const, value: 17 },
129
- },
130
- }),
131
- );
132
- assert.match(html, />17</);
133
- assert.match(html, /results from Spam/);
134
- assert.match(html, /Go to Spam/);
135
- });
136
120
  });
@@ -68,9 +68,9 @@ const topMatches: SearchResult[] = [
68
68
  },
69
69
  ];
70
70
 
71
- // Semantic "Related" hits carry their own thread + mailbox so they open directly
72
- // — the matching message often lives outside the loaded list.
73
- const related: SearchResult[] = [
71
+ // Results that carry their own thread + mailbox open directly — the matching
72
+ // message can live outside the loaded list.
73
+ const unloaded: SearchResult[] = [
74
74
  {
75
75
  id: "r5",
76
76
  sender: "QuickBooks",
@@ -95,12 +95,10 @@ const related: SearchResult[] = [
95
95
 
96
96
  const resultSections: SearchResultSection[] = [
97
97
  { id: "top", label: "Top matches", results: topMatches },
98
- { id: "related", label: "Related", results: related },
99
98
  ];
100
99
 
101
100
  const emptySections: SearchResultSection[] = [
102
101
  { id: "top", label: "Top matches", results: [] },
103
- { id: "related", label: "Related", results: [] },
104
102
  ];
105
103
 
106
104
  /** Matches spread across ordinary folders, each carrying where it was read from. */
@@ -398,17 +396,16 @@ export const Loading: Story = {
398
396
  };
399
397
 
400
398
  /**
401
- * Selecting a "Related" (semantic) hit. These rows carry their own thread +
402
- * mailbox, so tapping one opens the conversation directly — even though the
403
- * matching message lives outside the loaded list. Tap a row under "Related" to
399
+ * Selecting a hit from outside the loaded list. These rows carry their own
400
+ * thread + mailbox, so tapping one opens the conversation directly. Tap a row to
404
401
  * see the thread + mailbox the result hands the app to open. Regression cover for
405
- * the brief bug where a tapped related result selected nothing.
402
+ * the brief bug where a tapped result selected nothing.
406
403
  */
407
- export const RelatedSelectable: Story = {
404
+ export const UnloadedSelectable: Story = {
408
405
  render: () => (
409
406
  <Harness
410
407
  initialValue="invoice"
411
- sections={[{ id: "related", label: "Related", results: related }]}
408
+ sections={[{ id: "top", label: "Top matches", results: unloaded }]}
412
409
  preset="brief"
413
410
  />
414
411
  ),
@@ -37,7 +37,7 @@ export interface MobileSearchViewProps {
37
37
  /** Recent searches shown when the query is empty. */
38
38
  recentSearches?: string[];
39
39
  onPickRecent?: (query: string) => void;
40
- /** Grouped result sections (e.g. "Top matches", "Related"). */
40
+ /** Grouped result sections (e.g. "Top matches"). */
41
41
  sections?: SearchResultSection[];
42
42
  loading?: boolean;
43
43
  onSelectResult?: (result: SearchResult) => void;
@@ -95,14 +95,6 @@ describe("NavSidebar arrow-key traversal", () => {
95
95
  assert.equal(document.activeElement, items[0]);
96
96
  });
97
97
 
98
- it("traverses the drawer variant too", () => {
99
- mount("drawer");
100
- const items = navItems();
101
- act(() => items[0]?.focus());
102
- act(() => pressKey(items[0] as Element, "ArrowDown"));
103
- assert.equal(document.activeElement, items[1]);
104
- });
105
-
106
98
  it("leaves Left/Right to the browser", () => {
107
99
  mount();
108
100
  const items = navItems();
@@ -1,15 +1,9 @@
1
1
  import assert from "node:assert/strict";
2
- import { afterEach, describe, it } from "node:test";
2
+ import { describe, it } from "node:test";
3
3
  import { createElement } from "react";
4
4
  import { renderToString } from "react-dom/server";
5
5
  import type { NavAccount, NavLinkComponent } from "./app-shell-types.js";
6
- import {
7
- NAV_ACCOUNT_OPEN_KEY,
8
- NAV_FOLDER_OPEN_KEY,
9
- NavSidebar,
10
- readOpen,
11
- writeOpen,
12
- } from "./nav-sidebar.js";
6
+ import { NAV_FOLDER_OPEN_KEY, NavSidebar, readOpen } from "./nav-sidebar.js";
13
7
 
14
8
  const accounts: NavAccount[] = [
15
9
  {
@@ -25,23 +19,6 @@ const accounts: NavAccount[] = [
25
19
  },
26
20
  ];
27
21
 
28
- /** Minimal in-memory localStorage stub for the persistence contract tests. */
29
- class MemoryStorage {
30
- private store = new Map<string, string>();
31
- getItem(key: string): string | null {
32
- return this.store.has(key) ? (this.store.get(key) ?? null) : null;
33
- }
34
- setItem(key: string, value: string): void {
35
- this.store.set(key, value);
36
- }
37
- removeItem(key: string): void {
38
- this.store.delete(key);
39
- }
40
- clear(): void {
41
- this.store.clear();
42
- }
43
- }
44
-
45
22
  /** An anchor-rendering linkComponent so we can assert real <a href> output. */
46
23
  const hrefLink: NavLinkComponent = ({
47
24
  navId,
@@ -57,18 +34,6 @@ const hrefLink: NavLinkComponent = ({
57
34
  );
58
35
 
59
36
  describe("NavSidebar", () => {
60
- it("renders the daily brief item", () => {
61
- const html = renderToString(
62
- createElement(NavSidebar, {
63
- accounts,
64
- selectedNavId: "personal-inbox",
65
- briefUnseen: 7,
66
- onSelectNav: () => undefined,
67
- }),
68
- );
69
- assert.match(html, /Daily brief/);
70
- });
71
-
72
37
  it("labels the \\Flagged virtual mailbox 'Starred'", () => {
73
38
  const html = renderToString(
74
39
  createElement(NavSidebar, {
@@ -81,20 +46,6 @@ describe("NavSidebar", () => {
81
46
  assert.doesNotMatch(html, /Flagged/);
82
47
  });
83
48
 
84
- it("renders system and custom mailbox names", () => {
85
- const html = renderToString(
86
- createElement(NavSidebar, {
87
- accounts,
88
- selectedNavId: "personal-inbox",
89
- onSelectNav: () => undefined,
90
- }),
91
- );
92
- assert.match(html, /Inbox/);
93
- assert.match(html, /Sent/);
94
- assert.match(html, /Trash/);
95
- assert.match(html, /Travel/);
96
- });
97
-
98
49
  it("marks a folder whose last change failed and names the reason", () => {
99
50
  const html = renderToString(
100
51
  createElement(NavSidebar, {
@@ -119,18 +70,6 @@ describe("NavSidebar", () => {
119
70
  assert.match(html, /title="Locked — Permission denied"/);
120
71
  });
121
72
 
122
- it("gives the selected item its active accent styling", () => {
123
- const html = renderToString(
124
- createElement(NavSidebar, {
125
- accounts,
126
- selectedNavId: "personal-inbox",
127
- onSelectNav: () => undefined,
128
- }),
129
- );
130
- assert.match(html, /bg-accent-2-soft/);
131
- assert.match(html, /text-accent-2/);
132
- });
133
-
134
73
  it("carries no Settings entry — it lives in the top bar, by the avatar", () => {
135
74
  for (const variant of [undefined, "drawer" as const]) {
136
75
  const html = renderToString(
@@ -161,19 +100,6 @@ describe("NavSidebar", () => {
161
100
  assert.match(html, /<a href="\/mail\/personal-travel"/);
162
101
  });
163
102
 
164
- it("carries aria-label and the fullPath title on a mailbox link", () => {
165
- const html = renderToString(
166
- createElement(NavSidebar, {
167
- accounts,
168
- selectedNavId: "personal-inbox",
169
- onSelectNav: () => undefined,
170
- linkComponent: hrefLink,
171
- }),
172
- );
173
- assert.match(html, /aria-label="Inbox"/);
174
- assert.match(html, /title="Personal\/Travel"/);
175
- });
176
-
177
103
  it("renders an Outbox entry with its pending count when set", () => {
178
104
  const html = renderToString(
179
105
  createElement(NavSidebar, {
@@ -188,17 +114,6 @@ describe("NavSidebar", () => {
188
114
  assert.match(html, /3/);
189
115
  });
190
116
 
191
- it("omits the Outbox entry when outboxPending is undefined", () => {
192
- const html = renderToString(
193
- createElement(NavSidebar, {
194
- accounts,
195
- selectedNavId: "personal-inbox",
196
- onSelectNav: () => undefined,
197
- }),
198
- );
199
- assert.doesNotMatch(html, /Outbox/);
200
- });
201
-
202
117
  it("shows the empty state when no accounts are configured", () => {
203
118
  const html = renderToString(
204
119
  createElement(NavSidebar, {
@@ -290,25 +205,6 @@ describe("NavSidebar", () => {
290
205
  ],
291
206
  };
292
207
 
293
- it("pins Hostnet system folders with their role icons", () => {
294
- const html = renderToString(
295
- createElement(NavSidebar, {
296
- accounts: [hostnet],
297
- selectedNavId: "hn-inbox",
298
- onSelectNav: () => undefined,
299
- }),
300
- );
301
- assert.match(html, /lucide-inbox/);
302
- assert.match(html, /lucide-file-text/);
303
- assert.match(html, /lucide-send/);
304
- assert.match(html, /lucide-archive/);
305
- assert.match(html, /lucide-octagon-alert/);
306
- assert.match(html, /lucide-trash2/);
307
- // The real user folder lands in the collapsible Folders section.
308
- assert.match(html, /Nieuwsbrieven/);
309
- assert.match(html, /Folders/);
310
- });
311
-
312
208
  it("orders Hostnet system folders canonically and before custom folders", () => {
313
209
  const html = renderToString(
314
210
  createElement(NavSidebar, {
@@ -355,13 +251,6 @@ describe("NavSidebar with mail sync off", () => {
355
251
  }),
356
252
  );
357
253
 
358
- it("keeps the account and every mailbox it already synced", () => {
359
- const html = render(mailOff);
360
- assert.match(html, /Personal/);
361
- assert.match(html, /Inbox/);
362
- assert.match(html, /Travel/);
363
- });
364
-
365
254
  it("labels the account rather than leaving it to be guessed at", () => {
366
255
  assert.match(render(mailOff), /mail sync off/);
367
256
  });
@@ -373,26 +262,6 @@ describe("NavSidebar with mail sync off", () => {
373
262
  });
374
263
 
375
264
  describe("NavSidebar collapse persistence", () => {
376
- afterEach(() => {
377
- Reflect.deleteProperty(globalThis, "localStorage");
378
- });
379
-
380
- it("defaults to open when nothing is stored", () => {
381
- (globalThis as { localStorage?: Storage }).localStorage =
382
- new MemoryStorage() as unknown as Storage;
383
- assert.equal(readOpen(NAV_FOLDER_OPEN_KEY, "acct-1", true), true);
384
- assert.equal(readOpen(NAV_ACCOUNT_OPEN_KEY, "acct-1", true), true);
385
- });
386
-
387
- it("round-trips a stored collapsed flag per id", () => {
388
- (globalThis as { localStorage?: Storage }).localStorage =
389
- new MemoryStorage() as unknown as Storage;
390
- writeOpen(NAV_ACCOUNT_OPEN_KEY, "acct-1", false);
391
- assert.equal(readOpen(NAV_ACCOUNT_OPEN_KEY, "acct-1", true), false);
392
- // A different id is unaffected — collapse is keyed per account.
393
- assert.equal(readOpen(NAV_ACCOUNT_OPEN_KEY, "acct-2", true), true);
394
- });
395
-
396
265
  it("honours the supplied fallback with no storage available", () => {
397
266
  // No localStorage on globalThis → return fallback verbatim.
398
267
  assert.equal(readOpen(NAV_FOLDER_OPEN_KEY, "acct-1", false), false);
@@ -17,15 +17,6 @@ const render = (props: Partial<NewFolderFormProps>) =>
17
17
  );
18
18
 
19
19
  describe("NewFolderForm", () => {
20
- it("asks for a name and states where the folder goes", () => {
21
- const html = render({ name: "Car hire" });
22
- assert.match(html, /Folder name/);
23
- assert.match(html, /value="Car hire"/);
24
- assert.match(html, /placeholder="Hotels"/);
25
- assert.match(html, /Inside/);
26
- assert.match(html, />Travel</);
27
- });
28
-
29
20
  it("ties the label to the field it names", () => {
30
21
  const html = render({});
31
22
  const forId = html.match(/<label[^>]*for="([^"]+)"/)?.[1];
@@ -33,10 +24,6 @@ describe("NewFolderForm", () => {
33
24
  assert.match(html, new RegExp(`<input[^>]*id="${forId}"`));
34
25
  });
35
26
 
36
- it("states the parent as text rather than a second choice", () => {
37
- assert.doesNotMatch(render({}), /<select/);
38
- });
39
-
40
27
  it("holds the wait and refuses a second submit while it runs", () => {
41
28
  const html = render({ pending: true });
42
29
  assert.match(html, /Creating folder…/);
@@ -48,17 +35,4 @@ describe("NewFolderForm", () => {
48
35
  const html = render({ error: "The mail server refused that name." });
49
36
  assert.match(html, /role="alert"[^>]*>The mail server refused that name\./);
50
37
  });
51
-
52
- it("says nothing about a failure that has not happened", () => {
53
- assert.doesNotMatch(render({}), /role="alert"/);
54
- });
55
-
56
- it("applies caller-supplied labels", () => {
57
- const html = render({
58
- labels: { create: "Map maken", cancel: "Annuleren", insideLabel: "In" },
59
- });
60
- assert.match(html, />Map maken</);
61
- assert.match(html, />Annuleren</);
62
- assert.doesNotMatch(html, /Inside/);
63
- });
64
38
  });
@@ -14,15 +14,6 @@ const baseProps = {
14
14
  };
15
15
 
16
16
  describe("OutboxRow", () => {
17
- it("renders recipients, subject and the status label", () => {
18
- const html = renderToString(
19
- createElement(OutboxRow, { ...baseProps, status: "queued" }),
20
- );
21
- assert.match(html, /alex@example\.com/);
22
- assert.match(html, /Hello/);
23
- assert.match(html, /Queued/);
24
- });
25
-
26
17
  it("hides the action cluster for in-flight statuses", () => {
27
18
  const html = renderToString(
28
19
  createElement(OutboxRow, { ...baseProps, status: "sending" }),
@@ -27,12 +27,6 @@ describe("resolvePaneLayout — pane count by width", () => {
27
27
  assert.equal(paneCount(l), 1);
28
28
  });
29
29
 
30
- it("tablet portrait (834, iPad): still list alone", () => {
31
- const l = resolvePaneLayout(834);
32
- assert.equal(l.reading, false);
33
- assert.equal(paneCount(l), 1);
34
- });
35
-
36
30
  it("just below the reading boundary (1023): still list alone", () => {
37
31
  assert.equal(resolvePaneLayout(1023).reading, false);
38
32
  });
@@ -45,12 +39,6 @@ describe("resolvePaneLayout — pane count by width", () => {
45
39
  assert.equal(paneCount(l), 3);
46
40
  });
47
41
 
48
- it("iPad landscape (1112): two content panes, no rail", () => {
49
- const l = resolvePaneLayout(1112);
50
- assert.equal(l.reading, true);
51
- assert.equal(l.intelligence, false);
52
- });
53
-
54
42
  it("just below the rail boundary (1279): no rail", () => {
55
43
  assert.equal(resolvePaneLayout(1279).intelligence, false);
56
44
  });
@@ -96,10 +84,4 @@ describe("resolvePaneLayout — configurable thresholds (#900/#901)", () => {
96
84
  "at the custom intelligence boundary",
97
85
  );
98
86
  });
99
-
100
- it("defaults still match the module constants when no overrides given", () => {
101
- const withDefaults = resolvePaneLayout(1024);
102
- const withExplicit = resolvePaneLayout(1024, 1024, 1280);
103
- assert.deepEqual(withDefaults, withExplicit, "defaults are identical");
104
- });
105
87
  });
@@ -98,13 +98,6 @@ const mount = async (
98
98
  };
99
99
 
100
100
  describe("PlainTextEditor", () => {
101
- it("offers no formatting buttons, and says Markdown is read here", async () => {
102
- await mount();
103
-
104
- assert.equal(container.querySelectorAll("button").length, 0);
105
- assert.match(container.textContent ?? "", /Markdown/);
106
- });
107
-
108
101
  it("inserts a pasted web page as Markdown", async () => {
109
102
  const editor = await mount();
110
103
 
@@ -126,15 +119,6 @@ describe("PlainTextEditor", () => {
126
119
  assert.equal(editor.latest(), "| not | a | table |");
127
120
  });
128
121
 
129
- it("carries the mode toggle at the right of its toolbar", async () => {
130
- await mount("", { trailing: true });
131
-
132
- const toggle = container.querySelector("[data-testid=compose-mode-toggle]");
133
- assert.ok(toggle, "the toggle rides in the toolbar");
134
- assert.equal(toggle.getAttribute("aria-pressed"), "true");
135
- assert.equal(toggle.textContent, "Plain text");
136
- });
137
-
138
122
  it("takes focus with the caret at the end when it arrives on a switch", async () => {
139
123
  await mount("Everything written so far.", { initialCaret: "end" });
140
124
 
@@ -52,15 +52,4 @@ describe("PopoverMenu", () => {
52
52
  assert.match(html, /aria-label="Apply label[^>]*role="menuitem"/);
53
53
  assert.match(html, /role="none"/);
54
54
  });
55
-
56
- it("renders the trigger text beside its glyph", () => {
57
- const html = renderToString(
58
- createElement(PopoverMenu, {
59
- triggerLabel: "Apply label to selected messages",
60
- triggerText: "Apply label",
61
- items: [item],
62
- }),
63
- );
64
- assert.match(html, /Apply label</);
65
- });
66
55
  });
@@ -15,13 +15,6 @@ describe("ProgressBar", () => {
15
15
  assert.match(html, /aria-valuemax="3412"/);
16
16
  });
17
17
 
18
- it("computes the fill width as a percentage of value/max", () => {
19
- const html = renderToString(
20
- createElement(ProgressBar, { value: 25, max: 100 }),
21
- );
22
- assert.match(html, /width:25%/);
23
- });
24
-
25
18
  it("clamps the fill at 100% when value exceeds max", () => {
26
19
  const html = renderToString(
27
20
  createElement(ProgressBar, { value: 500, max: 100 }),
@@ -36,11 +29,4 @@ describe("ProgressBar", () => {
36
29
  assert.doesNotMatch(html, /aria-valuenow/);
37
30
  assert.doesNotMatch(html, /aria-valuemax/);
38
31
  });
39
-
40
- it("applies the tone's fill color", () => {
41
- const html = renderToString(
42
- createElement(ProgressBar, { value: 1, max: 2, tone: "danger" }),
43
- );
44
- assert.match(html, /bg-danger/);
45
- });
46
32
  });