oneslash-design-system 2.28.1 → 2.29.0

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 (234) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +31 -1
  3. package/dist/cases/about-page.md +2 -0
  4. package/dist/cases/accept-invite.md +2 -0
  5. package/dist/cases/account-menu.md +2 -0
  6. package/dist/cases/activity-timeline.md +2 -0
  7. package/dist/cases/admin-inbox.md +2 -0
  8. package/dist/cases/agent-asks-before-risky-action.md +3 -1
  9. package/dist/cases/agent-cancels-when-unanswered.md +2 -0
  10. package/dist/cases/agent-changes-review/all-at-once.d.ts +1 -0
  11. package/dist/cases/agent-changes-review/all-at-once.jsx +238 -0
  12. package/dist/cases/agent-changes-review/per-change.d.ts +1 -0
  13. package/dist/cases/agent-changes-review/per-change.jsx +203 -0
  14. package/dist/cases/agent-changes-review.md +585 -0
  15. package/dist/cases/agent-handoff/to-agent.d.ts +1 -0
  16. package/dist/cases/agent-handoff/to-agent.jsx +53 -0
  17. package/dist/cases/agent-handoff/to-person.d.ts +1 -0
  18. package/dist/cases/agent-handoff/to-person.jsx +84 -0
  19. package/dist/cases/agent-handoff.md +231 -0
  20. package/dist/cases/agent-memory/list.d.ts +1 -0
  21. package/dist/cases/agent-memory/list.jsx +256 -0
  22. package/dist/cases/agent-memory.md +354 -0
  23. package/dist/cases/agent-options.md +2 -0
  24. package/dist/cases/agent-pending-reply/steps.jsx +70 -21
  25. package/dist/cases/agent-pending-reply.md +74 -27
  26. package/dist/cases/agent-permissions/levels.d.ts +3 -0
  27. package/dist/cases/agent-permissions/levels.jsx +49 -0
  28. package/dist/cases/agent-permissions/per-tool.d.ts +3 -0
  29. package/dist/cases/agent-permissions/per-tool.jsx +178 -0
  30. package/dist/cases/agent-permissions.md +314 -0
  31. package/dist/cases/agent-plan-proposal/changes.jsx +18 -11
  32. package/dist/cases/agent-plan-proposal/steps.jsx +11 -4
  33. package/dist/cases/agent-plan-proposal.md +36 -21
  34. package/dist/cases/agent-question.md +2 -0
  35. package/dist/cases/agent-refuses-clearly.md +2 -0
  36. package/dist/cases/agent-run-failure/limit-reached.d.ts +1 -0
  37. package/dist/cases/agent-run-failure/limit-reached.jsx +172 -0
  38. package/dist/cases/agent-run-failure/step-failed.d.ts +3 -0
  39. package/dist/cases/agent-run-failure/step-failed.jsx +187 -0
  40. package/dist/cases/agent-run-failure.md +500 -0
  41. package/dist/cases/agent-says-what-it-is.md +2 -0
  42. package/dist/cases/agent-says-where-it-stopped.md +27 -0
  43. package/dist/cases/agent-settings.md +2 -0
  44. package/dist/cases/agent-shows-progress.md +2 -0
  45. package/dist/cases/agent-shows-sources.md +2 -0
  46. package/dist/cases/api-keys.md +2 -0
  47. package/dist/cases/app-shell.md +2 -0
  48. package/dist/cases/artifact-card.md +2 -0
  49. package/dist/cases/ask-page.md +2 -0
  50. package/dist/cases/auth-gate-loading.md +2 -0
  51. package/dist/cases/billing-page.md +2 -0
  52. package/dist/cases/blog-index.md +2 -0
  53. package/dist/cases/breadcrumb.md +2 -0
  54. package/dist/cases/breakdown-list.md +2 -0
  55. package/dist/cases/bulk-actions/list.d.ts +1 -0
  56. package/dist/cases/bulk-actions/list.jsx +209 -0
  57. package/dist/cases/bulk-actions/paged-table.d.ts +1 -0
  58. package/dist/cases/bulk-actions/paged-table.jsx +246 -0
  59. package/dist/cases/bulk-actions.md +559 -0
  60. package/dist/cases/changelog.md +2 -0
  61. package/dist/cases/chart.md +2 -0
  62. package/dist/cases/check-your-email.md +2 -0
  63. package/dist/cases/code-sample.md +2 -0
  64. package/dist/cases/collapsible-search.md +2 -0
  65. package/dist/cases/comment-thread.md +2 -0
  66. package/dist/cases/comparison-page/table.d.ts +1 -0
  67. package/dist/cases/comparison-page/table.jsx +97 -0
  68. package/dist/cases/comparison-page.md +156 -0
  69. package/dist/cases/composer-limit.md +2 -0
  70. package/dist/cases/confirm-destructive-action.md +2 -0
  71. package/dist/cases/confirm-dialogs.md +2 -0
  72. package/dist/cases/connection-status/card.d.ts +1 -0
  73. package/dist/cases/connection-status/card.jsx +97 -0
  74. package/dist/cases/connection-status/row.d.ts +1 -0
  75. package/dist/cases/connection-status/row.jsx +120 -0
  76. package/dist/cases/connection-status.md +330 -0
  77. package/dist/cases/contact-page.md +2 -0
  78. package/dist/cases/conversation-starters.md +2 -0
  79. package/dist/cases/cookie-choice.md +2 -0
  80. package/dist/cases/create-modal.md +2 -0
  81. package/dist/cases/danger-zone.md +2 -0
  82. package/dist/cases/dashboard.md +2 -0
  83. package/dist/cases/data-table-page.md +2 -0
  84. package/dist/cases/date-field.md +2 -0
  85. package/dist/cases/device-login.md +2 -0
  86. package/dist/cases/docs-component-page.md +2 -0
  87. package/dist/cases/email-confirmed.md +2 -0
  88. package/dist/cases/empty-list.md +2 -0
  89. package/dist/cases/empty-lists.md +2 -0
  90. package/dist/cases/empty-not-set-up.md +2 -0
  91. package/dist/cases/empty-search.md +2 -0
  92. package/dist/cases/error-page.md +2 -0
  93. package/dist/cases/faq.md +2 -0
  94. package/dist/cases/feature-grid.md +2 -0
  95. package/dist/cases/feedback-form.md +2 -0
  96. package/dist/cases/file-upload.md +2 -0
  97. package/dist/cases/filter-menu.md +2 -0
  98. package/dist/cases/forgot-password.md +2 -0
  99. package/dist/cases/form-errors.md +2 -0
  100. package/dist/cases/image-viewer.md +2 -0
  101. package/dist/cases/import-checklist.md +2 -0
  102. package/dist/cases/inline-form-feedback.md +2 -0
  103. package/dist/cases/integrations-list/nested.jsx +1 -1
  104. package/dist/cases/integrations-list/rows.jsx +1 -1
  105. package/dist/cases/integrations-list.md +6 -4
  106. package/dist/cases/invite-member.md +2 -0
  107. package/dist/cases/invoice-list.md +2 -0
  108. package/dist/cases/landing-hero.md +2 -0
  109. package/dist/cases/leaderboard.md +2 -0
  110. package/dist/cases/legal-page.md +2 -0
  111. package/dist/cases/load-failure.md +2 -0
  112. package/dist/cases/log-out-confirm.md +2 -0
  113. package/dist/cases/login-page.md +2 -0
  114. package/dist/cases/long-form-page.md +2 -0
  115. package/dist/cases/master-detail.md +2 -0
  116. package/dist/cases/members-list.md +2 -0
  117. package/dist/cases/mention-list.md +2 -0
  118. package/dist/cases/message-actions.md +2 -0
  119. package/dist/cases/message-attachments.md +2 -0
  120. package/dist/cases/message-composer/with-tools.jsx +17 -7
  121. package/dist/cases/message-composer.md +28 -11
  122. package/dist/cases/message-edit.md +2 -0
  123. package/dist/cases/message-reactions.md +2 -0
  124. package/dist/cases/message-row.md +2 -0
  125. package/dist/cases/message-send-failure/needs-a-person.d.ts +1 -0
  126. package/dist/cases/message-send-failure/needs-a-person.jsx +116 -0
  127. package/dist/cases/message-send-failure/retrying.d.ts +1 -0
  128. package/dist/cases/message-send-failure/retrying.jsx +116 -0
  129. package/dist/cases/message-send-failure.md +308 -0
  130. package/dist/cases/mobile-menu.md +2 -0
  131. package/dist/cases/newsletter-signup.md +2 -0
  132. package/dist/cases/no-access/page.d.ts +1 -0
  133. package/dist/cases/no-access/page.jsx +37 -0
  134. package/dist/cases/no-access/read-only.d.ts +1 -0
  135. package/dist/cases/no-access/read-only.jsx +33 -0
  136. package/dist/cases/no-access.md +147 -0
  137. package/dist/cases/not-found-page.md +2 -0
  138. package/dist/cases/notification-menu.md +2 -0
  139. package/dist/cases/number-format.md +2 -0
  140. package/dist/cases/oauth-consent.md +2 -0
  141. package/dist/cases/on-off-settings.md +2 -0
  142. package/dist/cases/on-this-page.md +2 -0
  143. package/dist/cases/onboarding.md +2 -0
  144. package/dist/cases/one-main-action.md +2 -0
  145. package/dist/cases/overflow-menu.md +2 -0
  146. package/dist/cases/page-end.md +2 -0
  147. package/dist/cases/page-header.md +2 -0
  148. package/dist/cases/paged-card.md +2 -0
  149. package/dist/cases/password-gate.md +2 -0
  150. package/dist/cases/payment-method.md +2 -0
  151. package/dist/cases/people-row.md +2 -0
  152. package/dist/cases/phone-navigation.md +2 -0
  153. package/dist/cases/plan-change-confirm.md +2 -0
  154. package/dist/cases/plan-comparison.md +3 -1
  155. package/dist/cases/plan-picker.md +4 -1
  156. package/dist/cases/plan-sign-off.md +2 -0
  157. package/dist/cases/pricing-section.md +5 -1
  158. package/dist/cases/product-cards.md +2 -0
  159. package/dist/cases/product-demo/scripted.d.ts +3 -0
  160. package/dist/cases/product-demo/scripted.jsx +95 -0
  161. package/dist/cases/product-demo/still.d.ts +1 -0
  162. package/dist/cases/product-demo/still.jsx +20 -0
  163. package/dist/cases/product-demo.md +221 -0
  164. package/dist/cases/profile-form.md +2 -0
  165. package/dist/cases/quick-switcher.md +2 -0
  166. package/dist/cases/range-switch.md +2 -0
  167. package/dist/cases/rename.md +2 -0
  168. package/dist/cases/reply-feedback.md +2 -0
  169. package/dist/cases/reply-sources.md +2 -0
  170. package/dist/cases/route-loading.md +2 -0
  171. package/dist/cases/scope-picker.md +2 -0
  172. package/dist/cases/section-index.md +2 -0
  173. package/dist/cases/session-expired/in-place.d.ts +1 -0
  174. package/dist/cases/session-expired/in-place.jsx +63 -0
  175. package/dist/cases/session-expired/redirect.d.ts +1 -0
  176. package/dist/cases/session-expired/redirect.jsx +62 -0
  177. package/dist/cases/session-expired.md +204 -0
  178. package/dist/cases/set-new-password.md +2 -0
  179. package/dist/cases/settings-page.md +2 -0
  180. package/dist/cases/settings-save.md +2 -0
  181. package/dist/cases/side-pane.md +2 -0
  182. package/dist/cases/sidebar-nav.md +2 -0
  183. package/dist/cases/sign-up-page.md +3 -0
  184. package/dist/cases/signup-from-site/plain.d.ts +1 -0
  185. package/dist/cases/signup-from-site/plain.jsx +125 -0
  186. package/dist/cases/signup-from-site/with-plan.d.ts +4 -0
  187. package/dist/cases/signup-from-site/with-plan.jsx +151 -0
  188. package/dist/cases/signup-from-site.md +351 -0
  189. package/dist/cases/site-footer.md +2 -0
  190. package/dist/cases/site-header/links.d.ts +3 -1
  191. package/dist/cases/site-header/links.jsx +6 -2
  192. package/dist/cases/site-header.md +11 -3
  193. package/dist/cases/site-matches-app.md +32 -0
  194. package/dist/cases/site-search.md +2 -0
  195. package/dist/cases/slash-command-list.md +2 -0
  196. package/dist/cases/stat-row.md +2 -0
  197. package/dist/cases/status-label.md +3 -1
  198. package/dist/cases/success-feedback.md +2 -0
  199. package/dist/cases/tabbed-panels.md +2 -0
  200. package/dist/cases/tag-filter.md +2 -0
  201. package/dist/cases/task-header.md +2 -0
  202. package/dist/cases/theme-switcher.md +2 -0
  203. package/dist/cases/type-to-confirm.md +2 -0
  204. package/dist/cases/typing-and-status.md +2 -0
  205. package/dist/cases/unsaved-changes-guard.md +2 -0
  206. package/dist/cases/upgrade-prompt.md +2 -0
  207. package/dist/cases/usage-meters.md +2 -0
  208. package/dist/cases.json +1489 -39
  209. package/dist/components/checkBox.d.ts +5 -1
  210. package/dist/components/checkBox.jsx +23 -9
  211. package/dist/components/diff.d.ts +29 -0
  212. package/dist/components/diff.jsx +35 -0
  213. package/dist/index.d.ts +1 -0
  214. package/dist/index.js +1 -0
  215. package/dist/internal/diff.d.ts +17 -0
  216. package/dist/internal/diff.js +44 -0
  217. package/dist/native-mapping.json +9 -2
  218. package/dist/stories/AgentPermissions.probe.stories.d.ts +7 -0
  219. package/dist/stories/AgentPermissions.probe.stories.jsx +18 -0
  220. package/dist/stories/AgentRunFailure.probe.stories.d.ts +6 -0
  221. package/dist/stories/AgentRunFailure.probe.stories.jsx +12 -0
  222. package/dist/stories/Cases.generated.stories.d.ts +24 -0
  223. package/dist/stories/Cases.generated.stories.jsx +48 -0
  224. package/dist/stories/Checkbox.stories.d.ts +2 -0
  225. package/dist/stories/Checkbox.stories.jsx +18 -0
  226. package/dist/stories/Diff.stories.d.ts +9 -0
  227. package/dist/stories/Diff.stories.jsx +40 -0
  228. package/dist/stories/ProductDemo.probe.stories.d.ts +6 -0
  229. package/dist/stories/ProductDemo.probe.stories.jsx +12 -0
  230. package/dist/stories/SignupFromSite.probe.stories.d.ts +7 -0
  231. package/dist/stories/SignupFromSite.probe.stories.jsx +17 -0
  232. package/dist/stories/SiteHeader.probe.stories.d.ts +6 -0
  233. package/dist/stories/SiteHeader.probe.stories.jsx +13 -0
  234. package/package.json +1 -1
@@ -2,12 +2,14 @@
2
2
 
3
3
  A person connects the product to other tools, sees which ones are connected and disconnects them.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Show each provider in a row: its logo, its name and one line on what connecting does: 'Link pull requests to tasks and close tasks when they merge.'
8
10
  - Use `BrandIcon` for a logo it has, and a Lucide icon in `Icon` for the others. Both are decorative, because the name sits beside them.
9
11
  - Show 'Connect' on a provider that is not connected, and its account beside 'Disconnect' once it is. Name the provider in each `aria-label`: 'Connect Slack'.
10
- - Show a `Tag` with `color="warning"` that reads 'Needs attention', and a primary 'Reconnect', on a connection whose access ran out. Say in the line what is wrong.
12
+ - Show a dot `Tag` with `color="warning"` that reads 'Needs reconnect', and a primary 'Reconnect', on a connection whose access ran out. Draw it as the case 'Status in a row' says. Say in the line what is wrong.
11
13
  - Confirm 'Disconnect' in a small Modal, as the rule 'A confirm says exactly what will happen' says, because what it stops does not come back by itself. Title it with the verb and the thing: 'Disconnect Slack', or 'Disconnect acme-labs' for one account. Say what stops and that the person can connect again.
12
14
  - Show `loading` on 'Connect' and 'Reconnect' while the sign-in runs, and keep the label. Disable the other Buttons until it ends.
13
15
  - Group the accounts under their provider, with 'Add Account' on the provider's row, for a provider that holds several. Each account has its own 'Reconnect' and 'Disconnect'.
@@ -19,7 +21,7 @@ A person connects the product to other tools, sees which ones are connected and
19
21
  - Do not use an icon-only Button for Disconnect. It names no provider.
20
22
  - Do not label a running Button 'Connecting…'. It keeps its label and shows `loading`.
21
23
  - Do not disconnect on the first click.
22
- - Do not show red text as the only sign that access ran out. Add the 'Needs attention' Tag and a 'Reconnect' Button.
24
+ - Do not show red text as the only sign that access ran out. Add the 'Needs reconnect' Tag and a 'Reconnect' Button.
23
25
  - Do not give each provider its own page section with a heading and no logo. Put them in one list.
24
26
 
25
27
  ## Option: One row per provider
@@ -130,7 +132,7 @@ export default function IntegrationsListRows() {
130
132
  <Stack gap="small">
131
133
  <Cluster gap="small">
132
134
  <Heading level={2} size="subtitle1">{p.name}</Heading>
133
- {attention && <Tag variant="contained" size="small" color="warning" label="Needs attention" />}
135
+ {attention && <Tag variant="dot" size="small" color="warning" label="Needs reconnect" />}
134
136
  </Cluster>
135
137
  <Paragraph tone="secondary" size="body2" measure="none">
136
138
  {attention ? 'Access ran out. Reconnect to keep it working.' : p.does}
@@ -332,7 +334,7 @@ export default function IntegrationsListNested() {
332
334
  <Stack gap="small">
333
335
  <Cluster gap="small">
334
336
  <Heading level={3} size="subtitle1">{a.name}</Heading>
335
- {a.attention && <Tag variant="contained" size="small" color="warning" label="Needs attention" />}
337
+ {a.attention && <Tag variant="dot" size="small" color="warning" label="Needs reconnect" />}
336
338
  </Cluster>
337
339
  <Paragraph tone="secondary" size="body2" measure="none">{a.detail}</Paragraph>
338
340
  </Stack>
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person invites someone to join a workspace.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Title the Modal 'Invite Member' and label its action 'Invite', after 'Cancel'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A billing page lists what the workspace has paid, so an admin can find an invoice, check an amount and keep a copy.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'A number shows its unit and never shows 0 for unknown'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A marketing page opens by saying what the product is and asking for one thing.
4
4
 
5
+ For: a marketing site
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'A marketing page asks for one main action, in the same words everywhere'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A dashboard shows who did the most of something over its range, such as who left the most comments this week.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'A number shows its unit and never shows 0 for unknown'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person reads the terms or the privacy policy to find one answer in it, or reads all of it before they agree.
4
4
 
5
+ For: a marketing site
6
+
5
7
  ## Do
6
8
 
7
9
  - Put an info `Alert` first with the words 'Sample text. This is not a real agreement.' on any page whose text is an example. Set `autoDismiss={false}`, so it stays. A real page has no such line and uses text written for the company.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A list or a section could not load.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Say what could not load: 'Could not load projects'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person chooses Log Out.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Call it 'Log Out' everywhere: the menu item, the Modal title and the action Button. The way back in is 'Log In'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person who already has an account opens the product and is not logged in.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Show a problem with one field under that field.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person reads one long piece, such as a post, a case study or a method, from the top down, and may come back to part of it.
4
4
 
5
+ For: a marketing site
6
+
5
7
  ## Do
6
8
 
7
9
  - Use `PageHeader` with `level={1}`, a `title`, a `lede` of one or two sentences and `facts` for the date, the reading time and the author. The title is the one level 1 heading.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person opens an item from a list, such as a message or a report, and reads or acts on it.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  An admin sees who is in the workspace, changes their roles, removes people and invites more.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Show each member in a row: `UserImage` with `decorative`, the name, the email and the role. The avatar sits beside the same name, so it is hidden from a screen reader.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person types @ in the message box to name someone, or the agent.
4
4
 
5
+ For: an app, an agent
6
+
5
7
  ## Do
6
8
 
7
9
  - Open the list when the person types @ at the start of the text or after a space. A bare @ opens it, and each letter after it narrows it.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person acts on one message: reacts to it, copies it, edits or deletes it.
4
4
 
5
+ For: an app, an agent
6
+
5
7
  ## Do
6
8
 
7
9
  - Put the actions in the Message's `actions`. They show while the pointer is on the row or focus is in it.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person adds files to a message, and people open the files in a message that was sent.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Show each waiting file as a `FileChip` in the Composer's `above` slot, with `onRemove`.
@@ -81,12 +81,13 @@ export default function MessageComposerWithTools() {
81
81
  clearTimeout(cancel.current);
82
82
  clearInterval(tick.current);
83
83
  }; }, []);
84
- // The run is over: its own row, in the same place and with the same time, now holds the reply or the note.
85
- function endRun(rowId, text) {
84
+ // The run is over: its own row, in the same place and with the same time, now holds the reply, or the steps and a note.
85
+ function endRun(rowId, text, stopped) {
86
+ if (stopped === void 0) { stopped = false; }
86
87
  clearTimeout(runTimer.current);
87
88
  clearInterval(tick.current);
88
89
  setRun(null);
89
- setThread(function (rows) { return rows.map(function (m) { return (m.id === rowId ? __assign(__assign({}, m), { text: text, progress: false }) : m); }); });
90
+ setThread(function (rows) { return rows.map(function (m) { return (m.id === rowId ? __assign(__assign({}, m), { text: text, progress: false, stopped: stopped }) : m); }); });
90
91
  }
91
92
  function addRow(row) {
92
93
  setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [__assign(__assign({}, row), { id: "m".concat(rows.length + 1) })], false); });
@@ -121,8 +122,9 @@ export default function MessageComposerWithTools() {
121
122
  endRun(rowId, 'The email reads well. The pricing link in the second paragraph points to last year\'s page.');
122
123
  }, 3000);
123
124
  }
124
- // Stop asks the server to end the run, and shows loading until it has. Only then does the note that it
125
- // stopped replace the progress row, in the same row. Stop is gone, so focus goes to the message box.
125
+ // Stop asks the server to end the run, and shows loading until it has. Only then does the row say it
126
+ // stopped: it keeps its steps, the one not done is cancelled, and a line says what was done.
127
+ // Stop is gone, so focus goes to the message box.
126
128
  function stop() {
127
129
  if (!run || run.stopping)
128
130
  return;
@@ -131,7 +133,7 @@ export default function MessageComposerWithTools() {
131
133
  // Stands in for the request to the server.
132
134
  cancel.current = setTimeout(function () {
133
135
  var _a;
134
- endRun(run.rowId, 'Stopped. Nothing was changed.');
136
+ endRun(run.rowId, 'Stopped after 1 of 2 steps. Nothing was changed.', true);
135
137
  (_a = field.current) === null || _a === void 0 ? void 0 : _a.focus();
136
138
  }, 1200);
137
139
  }
@@ -160,7 +162,15 @@ export default function MessageComposerWithTools() {
160
162
  </Message>) : (<Message key={m.id} aria-label={m.agent ? "".concat(m.from, ", agent") : m.from} compact={followsOn(thread, i)} avatar={m.agent ? <UserImage userHandle={m.from} icon={Bot} decorative/> : <UserImage userHandle={m.from} decorative/>} name={m.from} meta={m.agent ? agentMeta(m.at) : <TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}
161
163
  // A sent file opens when its chip is pressed. A real app links to the stored file.
162
164
  footer={m.file ? <FileChip name={m.file.name} kind={m.file.kind} meta={m.file.size} href="/files/launch-email.pdf" openInNewTab/> : undefined}>
163
- {m.text && <Paragraph measure="none">{m.text}</Paragraph>}
165
+ {m.stopped ? (
166
+ // As in the case 'Agent at work': the steps stay, with the one not done cancelled.
167
+ <Stack gap="medium">
168
+ <StepList aria-label="Acme Agent's steps" steps={[
169
+ { label: 'Read the thread', status: 'done' },
170
+ { label: 'Checking the links in the email', status: 'cancelled' },
171
+ ]}/>
172
+ <Paragraph measure="none">{m.text}</Paragraph>
173
+ </Stack>) : (m.text && <Paragraph measure="none">{m.text}</Paragraph>)}
164
174
  </Message>);
165
175
  })}
166
176
  </Stack>
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person writes a message at the bottom of a thread.
4
4
 
5
+ For: an app, an agent
6
+
5
7
  ## Do
6
8
 
7
9
  - Use `Composer` under the thread, with an `aria-label`, since it has no visible label.
@@ -14,10 +16,10 @@ A person writes a message at the bottom of a thread.
14
16
  - Pass `onStop` in a conversation with the agent only, so Send becomes Stop.
15
17
  - Show the agent's name, its 'Agent' `Tag`, the model line, the seconds so far and a `StepList` on the progress row. The case 'Agent at work' has the full pattern.
16
18
  - Show 'Working for 12 seconds' in the progress row's body, above the steps.
17
- - Show 'Stop' as `loading` until the run has ended. Then 'Stopped. Nothing was changed.' replaces the progress row in the same place.
19
+ - Show 'Stop' as `loading` until the run has ended. Then the row keeps its steps and says what was done, as the case 'Agent at work' says.
18
20
  - Move focus to the message box when Stop goes away.
19
21
  - Announce the progress row politely to screen readers: the app wraps the changing part in a polite live region, since the row has none.
20
- - Show an inline error Alert above the message box when a message fails to send, as the rule 'A form error shows next to the problem' says. Keep the text so it can be sent again.
22
+ - Show a message that did not send in the thread with its reason under it, as the case 'Message that did not send' says. While the app is offline, a warning Alert sits above the message box.
21
23
  - Keep the draft when the person leaves the thread, and show it again when they come back.
22
24
 
23
25
  ## Don't
@@ -143,8 +145,8 @@ const me = 'Dana Lee';
143
145
  const agentName = 'Acme Agent';
144
146
 
145
147
  type Attachment = { name: string; kind: string; size: string };
146
- // `progress` marks the agent's row while its run is live. The same row later holds the note or the reply.
147
- type Row = { id: string; from: string; agent?: boolean; at: Date; text: string; file?: Attachment; progress?: boolean };
148
+ // `progress` marks the agent's row while its run is live. The same row later holds the reply, or the steps and a note.
149
+ type Row = { id: string; from: string; agent?: boolean; at: Date; text: string; file?: Attachment; progress?: boolean; stopped?: boolean };
148
150
 
149
151
  const sampleFile: Attachment = { name: 'Launch email.pdf', kind: 'PDF', size: '240 KB' };
150
152
 
@@ -202,12 +204,12 @@ export default function MessageComposerWithTools() {
202
204
  clearInterval(tick.current);
203
205
  }, []);
204
206
 
205
- // The run is over: its own row, in the same place and with the same time, now holds the reply or the note.
206
- function endRun(rowId: string, text: string) {
207
+ // The run is over: its own row, in the same place and with the same time, now holds the reply, or the steps and a note.
208
+ function endRun(rowId: string, text: string, stopped = false) {
207
209
  clearTimeout(runTimer.current);
208
210
  clearInterval(tick.current);
209
211
  setRun(null);
210
- setThread((rows) => rows.map((m) => (m.id === rowId ? { ...m, text, progress: false } : m)));
212
+ setThread((rows) => rows.map((m) => (m.id === rowId ? { ...m, text, progress: false, stopped } : m)));
211
213
  }
212
214
 
213
215
  function addRow(row: Omit<Row, 'id'>) {
@@ -245,15 +247,16 @@ export default function MessageComposerWithTools() {
245
247
  }, 3000);
246
248
  }
247
249
 
248
- // Stop asks the server to end the run, and shows loading until it has. Only then does the note that it
249
- // stopped replace the progress row, in the same row. Stop is gone, so focus goes to the message box.
250
+ // Stop asks the server to end the run, and shows loading until it has. Only then does the row say it
251
+ // stopped: it keeps its steps, the one not done is cancelled, and a line says what was done.
252
+ // Stop is gone, so focus goes to the message box.
250
253
  function stop() {
251
254
  if (!run || run.stopping) return;
252
255
  clearTimeout(runTimer.current);
253
256
  setRun({ ...run, stopping: true });
254
257
  // Stands in for the request to the server.
255
258
  cancel.current = setTimeout(() => {
256
- endRun(run.rowId, 'Stopped. Nothing was changed.');
259
+ endRun(run.rowId, 'Stopped after 1 of 2 steps. Nothing was changed.', true);
257
260
  field.current?.focus();
258
261
  }, 1200);
259
262
  }
@@ -304,7 +307,21 @@ export default function MessageComposerWithTools() {
304
307
  // A sent file opens when its chip is pressed. A real app links to the stored file.
305
308
  footer={m.file ? <FileChip name={m.file.name} kind={m.file.kind} meta={m.file.size} href="/files/launch-email.pdf" openInNewTab /> : undefined}
306
309
  >
307
- {m.text && <Paragraph measure="none">{m.text}</Paragraph>}
310
+ {m.stopped ? (
311
+ // As in the case 'Agent at work': the steps stay, with the one not done cancelled.
312
+ <Stack gap="medium">
313
+ <StepList
314
+ aria-label="Acme Agent's steps"
315
+ steps={[
316
+ { label: 'Read the thread', status: 'done' },
317
+ { label: 'Checking the links in the email', status: 'cancelled' },
318
+ ]}
319
+ />
320
+ <Paragraph measure="none">{m.text}</Paragraph>
321
+ </Stack>
322
+ ) : (
323
+ m.text && <Paragraph measure="none">{m.text}</Paragraph>
324
+ )}
308
325
  </Message>
309
326
  ),
310
327
  )}
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person changes the text of a message they sent.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Replace the row's body with a `Composer` that holds the text, and focus it with the caret after the text.
@@ -2,6 +2,8 @@
2
2
 
3
3
  People answer a message with an emoji instead of a reply.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Put the reactions in the Message's `footer`: a `Cluster` of `Tag`s, then a small 'Add reaction' `IconButton`.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A thread shows messages from people, and sometimes from an agent.
4
4
 
5
+ For: an app, an agent
6
+
5
7
  ## Do
6
8
 
7
9
  - Show each row with `Message`: the sender's `UserImage`, their name and the time. A person's avatar is their picture or their initial.
@@ -0,0 +1 @@
1
+ export default function MessageSendFailureNeedsAPerson(): import("react").JSX.Element;
@@ -0,0 +1,116 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ import { useEffect, useRef, useState } from 'react';
23
+ import Message from '../../components/message';
24
+ import UserImage from '../../components/userImage';
25
+ import TimeStamp from '../../components/timeStamp';
26
+ import Heading from '../../components/heading';
27
+ import Paragraph from '../../components/paragraph';
28
+ import Link from '../../components/link';
29
+ import Button from '../../components/button';
30
+ import Composer from '../../components/composer';
31
+ import { Center, Cluster, Stack } from '../../components/layout';
32
+ // A real app reads this from the session.
33
+ var me = 'Dana Lee';
34
+ // This thread is shared with a Figma file. Dana's access to Figma ran out, so her last reply did not send.
35
+ var firstThread = [
36
+ { id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T14:31:00'), text: 'The hero image is too dark on phones.', state: 'sent' },
37
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T14:35:00'), text: 'I can try a lighter one this afternoon.', state: 'sent' },
38
+ { id: 'm3', from: me, at: new Date('2026-11-16T14:40:00'), text: 'Yes, try the lighter one and we check it on Monday.', state: 'failed' },
39
+ ];
40
+ // Names a message by its first words, for the Buttons under it.
41
+ var firstWords = function (text) { return (text.length > 32 ? "".concat(text.slice(0, 32).trimEnd(), "\u2026") : text); };
42
+ export default function MessageSendFailureNeedsAPerson() {
43
+ var _a = useState(firstThread), thread = _a[0], setThread = _a[1];
44
+ var _b = useState(false), connected = _b[0], setConnected = _b[1];
45
+ var _c = useState(''), text = _c[0], setText = _c[1];
46
+ // Said once, in the polite status line, when a message has gone.
47
+ var _d = useState(''), status = _d[0], setStatus = _d[1];
48
+ var timer = useRef();
49
+ var composer = useRef(null);
50
+ // Each new message gets its own id, so no two rows share one after a discard.
51
+ var nextId = useRef(firstThread.length + 1);
52
+ // Where focus goes after the next render, once the element it goes to is on screen.
53
+ var focusNext = useRef();
54
+ // Stops the request if the example goes away before it ends.
55
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
56
+ useEffect(function () {
57
+ var move = focusNext.current;
58
+ focusNext.current = undefined;
59
+ move === null || move === void 0 ? void 0 : move();
60
+ });
61
+ // The Composer keeps working. Until Figma is reconnected, a new reply cannot send either, and says so.
62
+ function send() {
63
+ var id = "m".concat(nextId.current++);
64
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: id, from: me, at: new Date(), text: text.trim(), state: connected ? 'sent' : 'failed' }], false); });
65
+ setText('');
66
+ }
67
+ // Stands in for a person who reconnected Figma first, so it sends.
68
+ function tryAgain(id) {
69
+ if (thread.some(function (m) { return m.state === 'sending'; }))
70
+ return;
71
+ setThread(function (rows) { return rows.map(function (m) { return (m.id === id ? __assign(__assign({}, m), { state: 'sending' }) : m); }); });
72
+ timer.current = setTimeout(function () {
73
+ setThread(function (rows) { return rows.map(function (m) { return (m.id === id ? __assign(__assign({}, m), { state: 'sent' }) : m); }); });
74
+ setConnected(true);
75
+ setStatus('Message sent.');
76
+ // The line and its Buttons are gone, so focus goes to the message box.
77
+ focusNext.current = function () { var _a; return (_a = composer.current) === null || _a === void 0 ? void 0 : _a.focus(); };
78
+ }, 1200);
79
+ }
80
+ // Takes the message out of the thread. It was never sent, so no one else saw it.
81
+ function discard(id) {
82
+ setThread(function (rows) { return rows.filter(function (m) { return m.id !== id; }); });
83
+ focusNext.current = function () { var _a; return (_a = composer.current) === null || _a === void 0 ? void 0 : _a.focus(); };
84
+ }
85
+ return (<Center width="page">
86
+ <Stack gap="large">
87
+ <Stack gap="small">
88
+ <Heading level={1} size="h5">Homepage hero</Heading>
89
+ <Paragraph tone="secondary" size="body2" measure="none">Replies here also go to the comments on the Figma file.</Paragraph>
90
+ </Stack>
91
+ {/* A real app gives the list that holds the rows role="log". */}
92
+ <Stack gap="small">
93
+ {thread.map(function (m) {
94
+ var notSent = m.state !== 'sent';
95
+ return (<Message key={m.id} aria-label={notSent ? "".concat(m.from, ", not sent") : m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>} footer={notSent ? (<Stack gap="small">
96
+ {/* The reason and its fix. The link goes where the fix is done. */}
97
+ <Paragraph size="body2" tone="secondary" measure="none">
98
+ Not sent. <Link href="/settings/integrations" size="body2">Reconnect Figma</Link>, then send again.
99
+ </Paragraph>
100
+ <Cluster gap="small">
101
+ <Button size="small" type="secondary" state="enabled" label="Try Again" aria-label={"Try again: ".concat(firstWords(m.text))} loading={m.state === 'sending'} onClickButton={function () { return tryAgain(m.id); }}/>
102
+ <Button size="small" type="tertiary" state={m.state === 'sending' ? 'disabled' : 'enabled'} label="Discard" aria-label={"Discard: ".concat(firstWords(m.text))} onClickButton={function () { return discard(m.id); }}/>
103
+ </Cluster>
104
+ </Stack>) : undefined}>
105
+ <Paragraph measure="none">{m.text}</Paragraph>
106
+ </Message>);
107
+ })}
108
+ </Stack>
109
+ <Stack gap="small">
110
+ {/* On the page from the start, so it is heard once when the message goes. */}
111
+ <Paragraph role="status" size="body2" tone="secondary" measure="none">{status}</Paragraph>
112
+ <Composer ref={composer} id="message-send-failure-needs-a-person-message" aria-label="Message" placeholder="Message the team" value={text} onChange={setText} onSubmit={send}/>
113
+ </Stack>
114
+ </Stack>
115
+ </Center>);
116
+ }
@@ -0,0 +1 @@
1
+ export default function MessageSendFailureRetrying(): import("react").JSX.Element;
@@ -0,0 +1,116 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ import { useEffect, useRef, useState } from 'react';
23
+ import Message from '../../components/message';
24
+ import UserImage from '../../components/userImage';
25
+ import TimeStamp from '../../components/timeStamp';
26
+ import Heading from '../../components/heading';
27
+ import Paragraph from '../../components/paragraph';
28
+ import Alert from '../../components/alert';
29
+ import Button from '../../components/button';
30
+ import Composer from '../../components/composer';
31
+ import { Center, Cluster, Stack } from '../../components/layout';
32
+ // A real app reads this from the session.
33
+ var me = 'Dana Lee';
34
+ // Opens offline, with Dana's last message waiting to go.
35
+ var firstThread = [
36
+ { id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T14:31:00'), text: 'The pricing page is ready for a last look.', state: 'sent' },
37
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T14:35:00'), text: 'I fixed the plan table on phones.', state: 'sent' },
38
+ { id: 'm3', from: me, at: new Date('2026-11-16T14:40:00'), text: 'Can you check the plan table on a phone before 4:00 PM?', state: 'waiting' },
39
+ ];
40
+ // Names a message by its first words, for the Buttons under it.
41
+ var firstWords = function (text) { return (text.length > 32 ? "".concat(text.slice(0, 32).trimEnd(), "\u2026") : text); };
42
+ export default function MessageSendFailureRetrying() {
43
+ var _a = useState(firstThread), thread = _a[0], setThread = _a[1];
44
+ var _b = useState(false), online = _b[0], setOnline = _b[1];
45
+ var _c = useState(''), text = _c[0], setText = _c[1];
46
+ // Said once, in the polite status line, when the waiting messages have gone.
47
+ var _d = useState(''), status = _d[0], setStatus = _d[1];
48
+ var timer = useRef();
49
+ var composer = useRef(null);
50
+ // Each new message gets its own id, so no two rows share one after a discard.
51
+ var nextId = useRef(firstThread.length + 1);
52
+ // The thread as last drawn, for the request that ends later.
53
+ var latest = useRef(thread);
54
+ latest.current = thread;
55
+ // Where focus goes after the next render, once the element it goes to is on screen.
56
+ var focusNext = useRef();
57
+ // Stops the request if the example goes away before it ends.
58
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
59
+ useEffect(function () {
60
+ var move = focusNext.current;
61
+ focusNext.current = undefined;
62
+ move === null || move === void 0 ? void 0 : move();
63
+ });
64
+ // The Composer keeps working while a message waits. Offline, a new message waits in the thread too.
65
+ function send() {
66
+ var id = "m".concat(nextId.current++);
67
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: id, from: me, at: new Date(), text: text.trim(), state: online ? 'sent' : 'waiting' }], false); });
68
+ setText('');
69
+ }
70
+ // Sends at once. Here the connection is back, so every waiting message goes with it.
71
+ function sendNow(id) {
72
+ if (thread.some(function (m) { return m.state === 'sending'; }))
73
+ return;
74
+ setThread(function (rows) { return rows.map(function (m) { return (m.id === id ? __assign(__assign({}, m), { state: 'sending' }) : m); }); });
75
+ // Stands in for the request to the server.
76
+ timer.current = setTimeout(function () {
77
+ var waiting = latest.current.filter(function (m) { return m.state !== 'sent'; }).length;
78
+ setThread(function (rows) { return rows.map(function (m) { return (__assign(__assign({}, m), { state: 'sent' })); }); });
79
+ setOnline(true);
80
+ setStatus("Back online. ".concat(waiting, " ").concat(waiting === 1 ? 'message' : 'messages', " sent."));
81
+ // The line and its Buttons are gone, so focus goes to the message box.
82
+ focusNext.current = function () { var _a; return (_a = composer.current) === null || _a === void 0 ? void 0 : _a.focus(); };
83
+ }, 1200);
84
+ }
85
+ // Takes the message out of the thread. It was never sent, so no one else saw it.
86
+ function discard(id) {
87
+ setThread(function (rows) { return rows.filter(function (m) { return m.id !== id; }); });
88
+ focusNext.current = function () { var _a; return (_a = composer.current) === null || _a === void 0 ? void 0 : _a.focus(); };
89
+ }
90
+ return (<Center width="page">
91
+ <Stack gap="large">
92
+ <Heading level={1} size="h5">Launch plan</Heading>
93
+ {/* A real app gives the list that holds the rows role="log". */}
94
+ <Stack gap="small">
95
+ {thread.map(function (m) {
96
+ var notSent = m.state !== 'sent';
97
+ return (<Message key={m.id} aria-label={notSent ? "".concat(m.from, ", not sent yet") : m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>} footer={notSent ? (<Stack gap="small">
98
+ <Paragraph size="body2" tone="secondary" measure="none">Not sent yet. Trying again.</Paragraph>
99
+ <Cluster gap="small">
100
+ <Button size="small" type="secondary" state="enabled" label="Send Now" aria-label={"Send now: ".concat(firstWords(m.text))} loading={m.state === 'sending'} onClickButton={function () { return sendNow(m.id); }}/>
101
+ <Button size="small" type="tertiary" state={m.state === 'sending' ? 'disabled' : 'enabled'} label="Discard" aria-label={"Discard: ".concat(firstWords(m.text))} onClickButton={function () { return discard(m.id); }}/>
102
+ </Cluster>
103
+ </Stack>) : undefined}>
104
+ <Paragraph measure="none">{m.text}</Paragraph>
105
+ </Message>);
106
+ })}
107
+ </Stack>
108
+ <Stack gap="small">
109
+ {!online && <Alert type="warning" variant="inline" message="You are offline. Messages send when you are back." autoDismiss={false}/>}
110
+ {/* On the page from the start, so it is heard once when the messages go. */}
111
+ <Paragraph role="status" size="body2" tone="secondary" measure="none">{status}</Paragraph>
112
+ <Composer ref={composer} id="message-send-failure-retrying-message" aria-label="Message" placeholder="Message the team" value={text} onChange={setText} onSubmit={send}/>
113
+ </Stack>
114
+ </Stack>
115
+ </Center>);
116
+ }