@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
@@ -10,7 +10,6 @@ import {
10
10
  updateWaitNote,
11
11
  } from "./self-update.js";
12
12
  import { SelfUpdateConfirmDialog } from "./self-update-confirm-dialog.js";
13
- import { UpdateAvailableDot } from "./self-update-dot.js";
14
13
  import {
15
14
  SelfUpdateProgressOverlay,
16
15
  SelfUpdateUnreachableScreen,
@@ -58,15 +57,6 @@ describe("SelfUpdateSection", () => {
58
57
  assert.doesNotMatch(html, /role="alert"/);
59
58
  });
60
59
 
61
- it("names the automatic rollback before the user commits", () => {
62
- const html = section({
63
- status: "available",
64
- version: CURRENT,
65
- release: demoRelease,
66
- });
67
- assert.match(html, /restored on its own/);
68
- });
69
-
70
60
  it("keeps a failed check separate from a failed update", () => {
71
61
  const html = section({
72
62
  status: "checkFailed",
@@ -93,18 +83,6 @@ describe("SelfUpdateSection", () => {
93
83
  assert.match(html, /remit logs --since 10m/);
94
84
  });
95
85
 
96
- it("attributes the rollback to the server rather than asserting it", () => {
97
- const html = section({
98
- status: "rolledBack",
99
- runId: demoRunId,
100
- version: CURRENT,
101
- attemptedVersion: "0.9.4",
102
- reason: "migration 0042 failed",
103
- logsCommand: demoLogsCommand,
104
- });
105
- assert.match(html, /Remit reports that it put 0\.9\.3 back/);
106
- });
107
-
108
86
  it("never claims data survived a failed update", () => {
109
87
  const html = section({
110
88
  status: "rolledBack",
@@ -146,19 +124,6 @@ describe("SelfUpdateSection", () => {
146
124
  );
147
125
  });
148
126
 
149
- it("offers a way forward from every failure", () => {
150
- const rolledBack = section({
151
- status: "rolledBack",
152
- runId: demoRunId,
153
- version: CURRENT,
154
- attemptedVersion: "0.9.4",
155
- reason: "boom",
156
- logsCommand: demoLogsCommand,
157
- });
158
- assert.match(rolledBack, /Try 0\.9\.4 again/);
159
- assert.match(rolledBack, /Stay on 0\.9\.3/);
160
- });
161
-
162
127
  it("keeps the check control pressable while a check is running", () => {
163
128
  const html = section({ status: "checking", version: CURRENT });
164
129
  assert.match(html, /Check again/);
@@ -175,15 +140,6 @@ describe("SelfUpdateSection", () => {
175
140
  assert.doesNotMatch(html, /role="alert"/);
176
141
  });
177
142
 
178
- it("shows the last-checked time on a never-checked state when one is known", () => {
179
- const html = section({
180
- status: "neverChecked",
181
- version: "unknown",
182
- lastCheckedAt: NOW - 3_600_000,
183
- });
184
- assert.match(html, /Last checked/);
185
- });
186
-
187
143
  it("renders a failed rollback verbatim and never claims a version is running", () => {
188
144
  const html = section({
189
145
  status: "rollbackFailed",
@@ -251,29 +207,6 @@ describe("SelfUpdateConfirmDialog", () => {
251
207
  assert.match(html, /restored automatically/);
252
208
  });
253
209
 
254
- it("always offers the way back", () => {
255
- assert.match(html, /Not now/);
256
- });
257
-
258
- it("renders nothing when closed", () => {
259
- assert.equal(
260
- renderToString(
261
- createElement(SelfUpdateConfirmDialog, {
262
- open: false,
263
- currentVersion: CURRENT,
264
- release: demoRelease,
265
- onClose: noop,
266
- onConfirm: noop,
267
- }),
268
- ),
269
- "",
270
- );
271
- });
272
-
273
- it("says nothing about a migration by default", () => {
274
- assert.doesNotMatch(html, /updates the database/);
275
- });
276
-
277
210
  it("warns about a migration only when the release carries one", () => {
278
211
  const withMigration = render(
279
212
  createElement(SelfUpdateConfirmDialog, {
@@ -291,18 +224,6 @@ describe("SelfUpdateConfirmDialog", () => {
291
224
  });
292
225
 
293
226
  describe("SelfUpdateProgressOverlay", () => {
294
- it("tells the user the disconnection is expected", () => {
295
- const html = render(
296
- createElement(SelfUpdateProgressOverlay, {
297
- target: "0.9.4",
298
- phase: "restarting",
299
- elapsedSeconds: 20,
300
- }),
301
- );
302
- assert.match(html, /no server to talk to/);
303
- assert.match(html, /Waiting for Remit to answer again/);
304
- });
305
-
306
227
  it("stops promising a minute once a minute has passed", () => {
307
228
  assert.match(updateWaitNote(30), /about a minute/);
308
229
  assert.doesNotMatch(updateWaitNote(200), /about a minute/);
@@ -316,19 +237,6 @@ describe("SelfUpdateProgressOverlay", () => {
316
237
  }
317
238
  });
318
239
 
319
- it("blocks the window rather than its nearest positioned ancestor", () => {
320
- const html = render(
321
- createElement(SelfUpdateProgressOverlay, {
322
- target: "0.9.4",
323
- phase: "restarting",
324
- elapsedSeconds: 20,
325
- }),
326
- );
327
- assert.match(html, /fixed inset-0/);
328
- assert.doesNotMatch(html, /absolute inset-0/);
329
- assert.match(html, /aria-modal="true"/);
330
- });
331
-
332
240
  it("scopes the live region to the line that changes", () => {
333
241
  const html = render(
334
242
  createElement(SelfUpdateProgressOverlay, {
@@ -357,25 +265,4 @@ describe("SelfUpdateUnreachableScreen", () => {
357
265
  assert.match(html, /aria-modal="true"/);
358
266
  assert.match(html, /cannot confirm that from here/);
359
267
  });
360
-
361
- it("points at the machine that can answer", () => {
362
- assert.match(html, /remit logs --since 10m/);
363
- assert.match(html, /Try connecting again/);
364
- });
365
- });
366
-
367
- describe("UpdateAvailableDot", () => {
368
- it("carries a label for assistive tech when shown", () => {
369
- const html = renderToString(
370
- createElement(UpdateAvailableDot, { show: true }, null),
371
- );
372
- assert.match(html, /Update available/);
373
- });
374
-
375
- it("adds nothing when there is no update", () => {
376
- const html = renderToString(
377
- createElement(UpdateAvailableDot, { show: false }, null),
378
- );
379
- assert.doesNotMatch(html, /Update available/);
380
- });
381
268
  });
@@ -34,34 +34,4 @@ describe("SenderTrustIndicator", () => {
34
34
  );
35
35
  assert.match(html, /aria-label="VIP sender"/);
36
36
  });
37
-
38
- it("renders the new-sender pill only at md", () => {
39
- assert.match(
40
- renderToString(
41
- createElement(SenderTrustIndicator, {
42
- senderTrust: "unknown",
43
- size: "md",
44
- }),
45
- ),
46
- /First message from this sender/,
47
- );
48
- assert.equal(
49
- renderToString(
50
- createElement(SenderTrustIndicator, {
51
- senderTrust: "unknown",
52
- size: "sm",
53
- }),
54
- ),
55
- "",
56
- );
57
- });
58
-
59
- it("renders nothing for wellknown", () => {
60
- assert.equal(
61
- renderToString(
62
- createElement(SenderTrustIndicator, { senderTrust: "wellknown" }),
63
- ),
64
- "",
65
- );
66
- });
67
37
  });
@@ -37,37 +37,6 @@ const render = (overrides: Partial<ShellTopBarProps> = {}): string =>
37
37
  );
38
38
 
39
39
  describe("ShellTopBar", () => {
40
- it("carries compose, bug report, settings, refresh and the account, in that order", () => {
41
- const html = render();
42
- const compose = html.indexOf('aria-label="Compose"');
43
- const bug = html.indexOf('aria-label="Report a bug"');
44
- const settings = html.indexOf('aria-label="Settings"');
45
- const refresh = html.indexOf('data-testid="refresh"');
46
- const account = html.indexOf('data-testid="account"');
47
- assert.ok(
48
- compose > -1 && bug > -1 && settings > -1 && refresh > -1 && account > -1,
49
- );
50
- assert.ok(
51
- compose < bug &&
52
- bug < settings &&
53
- settings < refresh &&
54
- refresh < account,
55
- "actions render in reading order",
56
- );
57
- });
58
-
59
- it("carries exactly these aria-labelled elements and nothing else — the refresh control and account slot are opaque children, named by whatever the caller passes in", () => {
60
- const labels = [...render().matchAll(/aria-label="([^"]+)"/g)].map(
61
- (match) => match[1],
62
- );
63
- assert.deepEqual(labels, [
64
- "Search mail",
65
- "Compose",
66
- "Report a bug",
67
- "Settings",
68
- ]);
69
- });
70
-
71
40
  it("words the compose tooltip around the host's bare key", () => {
72
41
  assert.match(render({ composeShortcut: "c" }), /title="Compose \(c\)"/);
73
42
  });
@@ -37,10 +37,12 @@ const Bar = ({
37
37
  initialChips,
38
38
  scope = "global",
39
39
  refreshState = "idle",
40
+ settingsAttention,
40
41
  }: {
41
42
  initialChips?: SearchChip[];
42
43
  scope?: ShellSearchScope;
43
44
  refreshState?: RefreshControlState;
45
+ settingsAttention?: string;
44
46
  }) => {
45
47
  const [chips, setChips] = useState<SearchChip[] | undefined>(initialChips);
46
48
  const [value, setValue] = useState("");
@@ -61,6 +63,7 @@ const Bar = ({
61
63
  onCompose={() => undefined}
62
64
  onReportBug={() => undefined}
63
65
  onOpenSettings={() => undefined}
66
+ settingsAttention={settingsAttention}
64
67
  composeShortcut="c"
65
68
  refreshControl={<GlobalRefresh state={refreshState} />}
66
69
  account={<Account />}
@@ -143,6 +146,10 @@ export const RefreshFailed: Story = {
143
146
  render: () => <Bar refreshState="error" />,
144
147
  };
145
148
 
149
+ export const SettingsAttention: Story = {
150
+ render: () => <Bar settingsAttention="Sync warnings" />,
151
+ };
152
+
146
153
  /** The arrangement: one bar across the top of the shell, over every pane. */
147
154
  export const OverTheLayout: Story = {
148
155
  render: () => (
@@ -25,6 +25,7 @@
25
25
  import { Bug, Settings, SquarePen } from "lucide-react";
26
26
  import type { ReactNode } from "react";
27
27
  import { AppTopBar } from "./app-top-bar.js";
28
+ import { AttentionDot } from "./attention-dot.js";
28
29
  import { Button } from "./button.js";
29
30
  import { NavToggleButton } from "./nav-toggle-button.js";
30
31
  import { SearchBar } from "./search-bar.js";
@@ -59,6 +60,7 @@ export interface ShellTopBarProps {
59
60
  onCompose: () => void;
60
61
  onReportBug: () => void;
61
62
  onOpenSettings: () => void;
63
+ settingsAttention?: string;
62
64
  /**
63
65
  * The key that composes, as the host's keymap reads it — `c`, `⌘N`,
64
66
  * `g then b`. The tooltip's wording around it is this component's.
@@ -82,6 +84,7 @@ export function ShellTopBar({
82
84
  onCompose,
83
85
  onReportBug,
84
86
  onOpenSettings,
87
+ settingsAttention,
85
88
  composeShortcut,
86
89
  refreshControl,
87
90
  account,
@@ -121,9 +124,15 @@ export function ShellTopBar({
121
124
  <Button
122
125
  variant="ghost"
123
126
  size="sm"
124
- icon={<Settings className="size-4" />}
127
+ icon={
128
+ <AttentionDot label={settingsAttention}>
129
+ <Settings className="size-4" />
130
+ </AttentionDot>
131
+ }
125
132
  title="Settings"
126
- aria-label="Settings"
133
+ aria-label={
134
+ settingsAttention ? `Settings — ${settingsAttention}` : "Settings"
135
+ }
127
136
  onClick={onOpenSettings}
128
137
  />
129
138
  {refreshControl}
@@ -34,19 +34,6 @@ const scrim = (html: string): string => {
34
34
  };
35
35
 
36
36
  describe("SlidePanel (#57)", () => {
37
- it("is a fixed right-edge column, never a full-viewport takeover above sm", () => {
38
- const html = render(true);
39
- assert.match(html, /fixed top-0 right-0/);
40
- assert.match(html, /sm:w-\[400px\]/);
41
- assert.match(html, /translate-x-0/);
42
- });
43
-
44
- it("a closed panel is off-canvas and takes no pointer events", () => {
45
- const html = render(false);
46
- assert.match(html, /translate-x-full/);
47
- assert.match(html, /pointer-events-none/);
48
- });
49
-
50
37
  it("a closed panel is inert and hidden from assistive tech", () => {
51
38
  const tag = dialog(render(false));
52
39
  assert.match(tag, /inert=""/);
@@ -60,11 +47,6 @@ describe("SlidePanel (#57)", () => {
60
47
  assert.match(tag, /role="dialog"/);
61
48
  });
62
49
 
63
- it("scrolls its body rather than the page", () => {
64
- const html = render(true);
65
- assert.match(html, /overflow-auto/);
66
- });
67
-
68
50
  /**
69
51
  * The scrim is a pointer shortcut for the header's Close button, not a
70
52
  * control of its own: posing as a focusable button while answering only
@@ -45,12 +45,6 @@ describe("SuggestList", () => {
45
45
  assert.match(render(), /rides@lyft\.com/);
46
46
  });
47
47
 
48
- it("shows the hint and where a suggestion came from", () => {
49
- const html = render();
50
- assert.match(html, /Stripe/);
51
- assert.match(html, /selected/);
52
- });
53
-
54
48
  it("marks only the highlighted option as selected", () => {
55
49
  const html = render({ activeIndex: 1 });
56
50
  assert.equal(html.match(/aria-selected="true"/g)?.length, 1);
@@ -1,23 +1,3 @@
1
- /**
2
- * SwipeableRow — jsdom gesture tests against the real react-aria long-press
3
- * wiring interacting with axis arbitration.
4
- *
5
- * The one this guards against: react-aria's `useLongPress` dispatches its
6
- * own synthetic `pointercancel` right before calling `onLongPress` (to
7
- * preempt other pointer consumers). SwipeableRow's `onPointerCancel` was
8
- * originally aliased straight to `onPointerUp`, whose "no axis claimed"
9
- * branch reads as a tap and calls `onOpen`/`onToggleCheck` — so a clean long
10
- * press would fire onLongPress AND a spurious onOpen in the same gesture.
11
- * The fix tags SwipeableRow's own axis-abort cancel so it can tell the two
12
- * apart; these tests exercise both paths against the real hook, not a
13
- * description of the fix.
14
- *
15
- * The second: a finger held on glass drifts, and it drifts past the distance
16
- * at which the drag starts tracking. Cancelling the press there meant a real
17
- * hold on a phone never entered selection mode — the row followed the drift
18
- * and snapped back, and nothing else happened.
19
- */
20
-
21
1
  import "@remit/test-dom";
22
2
  import assert from "node:assert/strict";
23
3
  import { afterEach, beforeEach, describe, it } from "node:test";
@@ -26,7 +6,7 @@ import { createRoot, type Root } from "react-dom/client";
26
6
  import type { ThreadRowData } from "./app-shell-types.js";
27
7
  import { SwipeableRow, type SwipePeek } from "./swipeable-row.js";
28
8
 
29
- const THRESHOLD_WAIT = 560; // default react-aria threshold (500ms) + margin
9
+ const THRESHOLD_WAIT = 560;
30
10
 
31
11
  const thread: ThreadRowData = {
32
12
  id: "thread-1",
@@ -58,6 +38,8 @@ interface Handlers {
58
38
  onLongPress: () => void;
59
39
  onOpen: () => void;
60
40
  onPeek: (next: SwipePeek) => void;
41
+ onToggleCheck?: () => void;
42
+ selectionMode?: boolean;
61
43
  }
62
44
 
63
45
  function mount(handlers: Handlers) {
@@ -65,12 +47,12 @@ function mount(handlers: Handlers) {
65
47
  root.render(
66
48
  createElement(SwipeableRow, {
67
49
  thread,
68
- selectionMode: false,
50
+ selectionMode: handlers.selectionMode ?? false,
69
51
  checked: false,
70
52
  active: false,
71
53
  peek: "none",
72
54
  onPeek: handlers.onPeek,
73
- onToggleCheck: () => undefined,
55
+ onToggleCheck: handlers.onToggleCheck ?? (() => undefined),
74
56
  onLongPress: handlers.onLongPress,
75
57
  onOpen: handlers.onOpen,
76
58
  onAct: () => undefined,
@@ -107,6 +89,7 @@ function pointerDown(row: Element, x = 10, y = 10) {
107
89
  row.dispatchEvent(
108
90
  new PointerEvent("pointerdown", {
109
91
  bubbles: true,
92
+ buttons: 1,
110
93
  pointerType: "touch",
111
94
  pointerId: 1,
112
95
  clientX: x,
@@ -121,6 +104,7 @@ function pointerMove(row: Element, x: number, y: number) {
121
104
  row.dispatchEvent(
122
105
  new PointerEvent("pointermove", {
123
106
  bubbles: true,
107
+ buttons: 1,
124
108
  pointerType: "touch",
125
109
  pointerId: 1,
126
110
  clientX: x,
@@ -130,6 +114,18 @@ function pointerMove(row: Element, x: number, y: number) {
130
114
  });
131
115
  }
132
116
 
117
+ function pointerCancel(row: Element) {
118
+ act(() => {
119
+ row.dispatchEvent(
120
+ new PointerEvent("pointercancel", {
121
+ bubbles: true,
122
+ pointerType: "touch",
123
+ pointerId: 1,
124
+ }),
125
+ );
126
+ });
127
+ }
128
+
133
129
  function pointerUp(row: Element) {
134
130
  // Dispatched on the row, not document: SwipeableRow's own onPointerUp is a
135
131
  // React prop on the row element, delegated via React's root-container
@@ -153,8 +149,8 @@ function wait(ms: number) {
153
149
  return act(() => new Promise((resolve) => setTimeout(resolve, ms)));
154
150
  }
155
151
 
156
- describe("SwipeableRow gesture wiring (react-aria long press + axis arbitration)", () => {
157
- it("fires onLongPress on an unmoved press, with no spurious onOpen", async () => {
152
+ describe("SwipeableRow gesture wiring", () => {
153
+ it("fires onLongPress on an unmoved press, with no tap action on release", async () => {
158
154
  let longPressed = 0;
159
155
  let opened = 0;
160
156
  const row = mount({
@@ -168,11 +164,7 @@ describe("SwipeableRow gesture wiring (react-aria long press + axis arbitration)
168
164
  pointerUp(row);
169
165
 
170
166
  assert.equal(longPressed, 1);
171
- assert.equal(
172
- opened,
173
- 0,
174
- "react-aria's own pointercancel (dispatched right before onLongPress) must not be read as a tap-to-open",
175
- );
167
+ assert.equal(opened, 0, "a release after the hold is not a tap");
176
168
  });
177
169
 
178
170
  it("a horizontal drag past the escape distance cancels the long press and commits a swipe peek, not onOpen", async () => {
@@ -282,23 +274,76 @@ describe("SwipeableRow gesture wiring (react-aria long press + axis arbitration)
282
274
  });
283
275
 
284
276
  it("an aborted short drag opens nothing on release", async () => {
285
- // The drag claimed the axis but never reached the escape distance, so the
286
- // press was still live, and react-aria synthesizes a click for an
287
- // unresolved press.
288
- let clicks = 0;
277
+ let opened = 0;
278
+ const peeks: SwipePeek[] = [];
289
279
  const row = mount({
290
280
  onLongPress: () => undefined,
291
- onOpen: () => undefined,
292
- onPeek: () => undefined,
281
+ onOpen: () => opened++,
282
+ onPeek: (next) => peeks.push(next),
293
283
  });
294
- row.addEventListener("click", () => clicks++);
295
284
 
296
285
  pointerDown(row, 100, 200);
297
- pointerMove(row, 120, 201); // dx=20 — past the axis threshold, under the escape
286
+ pointerMove(row, 120, 201);
298
287
  pointerUp(row);
299
- await wait(200); // react-aria synthesizes its click 80ms after release
288
+ await wait(200);
300
289
 
301
- assert.equal(clicks, 0);
290
+ assert.equal(opened, 0);
291
+ assert.deepEqual(peeks, []);
292
+ });
293
+
294
+ it("a short press opens the message", async () => {
295
+ let opened = 0;
296
+ let longPressed = 0;
297
+ const row = mount({
298
+ onLongPress: () => longPressed++,
299
+ onOpen: () => opened++,
300
+ onPeek: () => undefined,
301
+ });
302
+
303
+ pointerDown(row);
304
+ pointerUp(row);
305
+ await wait(THRESHOLD_WAIT);
306
+
307
+ assert.equal(opened, 1);
308
+ assert.equal(longPressed, 0);
309
+ });
310
+
311
+ it("a short press in selection mode toggles the row and opens nothing", async () => {
312
+ let opened = 0;
313
+ let toggled = 0;
314
+ const row = mount({
315
+ selectionMode: true,
316
+ onLongPress: () => undefined,
317
+ onOpen: () => opened++,
318
+ onToggleCheck: () => toggled++,
319
+ onPeek: () => undefined,
320
+ });
321
+
322
+ pointerDown(row);
323
+ pointerUp(row);
324
+
325
+ assert.equal(toggled, 1);
326
+ assert.equal(opened, 0);
327
+ });
328
+
329
+ it("a browser pointercancel resets the gesture and fires nothing", async () => {
330
+ let longPressed = 0;
331
+ let opened = 0;
332
+ const peeks: SwipePeek[] = [];
333
+ const row = mount({
334
+ onLongPress: () => longPressed++,
335
+ onOpen: () => opened++,
336
+ onPeek: (next) => peeks.push(next),
337
+ });
338
+
339
+ pointerDown(row);
340
+ pointerMove(row, 50, 10);
341
+ pointerCancel(row);
342
+ await wait(THRESHOLD_WAIT);
343
+
344
+ assert.equal(longPressed, 0);
345
+ assert.equal(opened, 0);
346
+ assert.deepEqual(peeks, []);
302
347
  });
303
348
 
304
349
  it("suppresses the native context menu raised over a drifting hold", async () => {
@@ -35,13 +35,6 @@ function render(peek: SwipePeek, override?: Partial<typeof baseProps>) {
35
35
  }
36
36
 
37
37
  describe("SwipeableRow", () => {
38
- it("renders no action background at rest", () => {
39
- const html = render("none");
40
- assert.doesNotMatch(html, /bg-danger/);
41
- assert.doesNotMatch(html, /bg-accent-2(?!-soft)/);
42
- assert.doesNotMatch(html, /aria-label="Delete message"/);
43
- });
44
-
45
38
  it("reveals the delete action when peeked trailing", () => {
46
39
  const html = render("trailing");
47
40
  assert.match(html, /aria-label="Delete message"/);
@@ -132,7 +132,7 @@ const rowElement = (canvasElement: HTMLElement) =>
132
132
 
133
133
  /**
134
134
  * The long press is the way into multi-select on touch. Press and hold the row
135
- * (mouse hold works too — react-aria fires the long press for both) and it
135
+ * (a mouse hold works too) and it
136
136
  * flips into the selection state the `SelectionChecked` story shows: the
137
137
  * leading avatar becomes a filled, ticked checkbox and a tap toggles the row
138
138
  * instead of opening it.
@@ -162,7 +162,7 @@ export const LongPressToSelect: Story = {
162
162
  * The same gesture with a real finger's drift. A hand holding still on glass
163
163
  * wanders several pixels over the 500ms hold — further than the distance at
164
164
  * which the drag starts tracking the row, which is why a hold used to nudge
165
- * the row and then do nothing. The swipe only takes the gesture once it has
165
+ * the row and then do nothing. The drag only claims the gesture once it has
166
166
  * travelled far enough to commit a peek, so the drifting hold below still ends
167
167
  * in selection mode. The play step drives the press, the drift and the hold.
168
168
  */
@@ -192,6 +192,7 @@ export const LongPressWithDrift: Story = {
192
192
  row.dispatchEvent(
193
193
  new PointerEvent(type, {
194
194
  bubbles: true,
195
+ buttons: type === "pointerup" ? 0 : 1,
195
196
  pointerType: "touch",
196
197
  pointerId: 1,
197
198
  clientX,