oneslash-design-system 2.28.0 → 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 (237) 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/list.jsx +30 -3
  47. package/dist/cases/api-keys.md +37 -3
  48. package/dist/cases/app-shell.md +2 -0
  49. package/dist/cases/artifact-card.md +2 -0
  50. package/dist/cases/ask-page.md +2 -0
  51. package/dist/cases/auth-gate-loading.md +2 -0
  52. package/dist/cases/billing-page.md +2 -0
  53. package/dist/cases/blog-index.md +2 -0
  54. package/dist/cases/breadcrumb.md +2 -0
  55. package/dist/cases/breakdown-list.md +2 -0
  56. package/dist/cases/bulk-actions/list.d.ts +1 -0
  57. package/dist/cases/bulk-actions/list.jsx +209 -0
  58. package/dist/cases/bulk-actions/paged-table.d.ts +1 -0
  59. package/dist/cases/bulk-actions/paged-table.jsx +246 -0
  60. package/dist/cases/bulk-actions.md +559 -0
  61. package/dist/cases/changelog.md +2 -0
  62. package/dist/cases/chart.md +2 -0
  63. package/dist/cases/check-your-email.md +2 -0
  64. package/dist/cases/code-sample.md +2 -0
  65. package/dist/cases/collapsible-search.md +2 -0
  66. package/dist/cases/comment-thread.md +2 -0
  67. package/dist/cases/comparison-page/table.d.ts +1 -0
  68. package/dist/cases/comparison-page/table.jsx +97 -0
  69. package/dist/cases/comparison-page.md +156 -0
  70. package/dist/cases/composer-limit.md +2 -0
  71. package/dist/cases/confirm-destructive-action.md +2 -0
  72. package/dist/cases/confirm-dialogs.md +2 -0
  73. package/dist/cases/connection-status/card.d.ts +1 -0
  74. package/dist/cases/connection-status/card.jsx +97 -0
  75. package/dist/cases/connection-status/row.d.ts +1 -0
  76. package/dist/cases/connection-status/row.jsx +120 -0
  77. package/dist/cases/connection-status.md +330 -0
  78. package/dist/cases/contact-page.md +2 -0
  79. package/dist/cases/conversation-starters.md +2 -0
  80. package/dist/cases/cookie-choice.md +2 -0
  81. package/dist/cases/create-modal.md +2 -0
  82. package/dist/cases/danger-zone.md +2 -0
  83. package/dist/cases/dashboard.md +2 -0
  84. package/dist/cases/data-table-page.md +2 -0
  85. package/dist/cases/date-field.md +2 -0
  86. package/dist/cases/device-login.md +2 -0
  87. package/dist/cases/docs-component-page.md +2 -0
  88. package/dist/cases/email-confirmed.md +2 -0
  89. package/dist/cases/empty-list.md +2 -0
  90. package/dist/cases/empty-lists.md +2 -0
  91. package/dist/cases/empty-not-set-up.md +2 -0
  92. package/dist/cases/empty-search.md +2 -0
  93. package/dist/cases/error-page.md +2 -0
  94. package/dist/cases/faq.md +2 -0
  95. package/dist/cases/feature-grid.md +2 -0
  96. package/dist/cases/feedback-form.md +2 -0
  97. package/dist/cases/file-upload.md +2 -0
  98. package/dist/cases/filter-menu.md +2 -0
  99. package/dist/cases/forgot-password.md +2 -0
  100. package/dist/cases/form-errors.md +2 -0
  101. package/dist/cases/image-viewer.md +2 -0
  102. package/dist/cases/import-checklist.md +2 -0
  103. package/dist/cases/inline-form-feedback.md +2 -0
  104. package/dist/cases/integrations-list/nested.jsx +1 -1
  105. package/dist/cases/integrations-list/rows.jsx +1 -1
  106. package/dist/cases/integrations-list.md +6 -4
  107. package/dist/cases/invite-member.md +2 -0
  108. package/dist/cases/invoice-list.md +2 -0
  109. package/dist/cases/landing-hero.md +2 -0
  110. package/dist/cases/leaderboard.md +2 -0
  111. package/dist/cases/legal-page.md +2 -0
  112. package/dist/cases/load-failure.md +2 -0
  113. package/dist/cases/log-out-confirm.md +2 -0
  114. package/dist/cases/login-page.md +2 -0
  115. package/dist/cases/long-form-page.md +2 -0
  116. package/dist/cases/master-detail.md +2 -0
  117. package/dist/cases/members-list/rows.jsx +37 -6
  118. package/dist/cases/members-list/table.jsx +37 -6
  119. package/dist/cases/members-list.md +83 -12
  120. package/dist/cases/mention-list.md +2 -0
  121. package/dist/cases/message-actions.md +2 -0
  122. package/dist/cases/message-attachments.md +2 -0
  123. package/dist/cases/message-composer/with-tools.jsx +17 -7
  124. package/dist/cases/message-composer.md +28 -11
  125. package/dist/cases/message-edit.md +2 -0
  126. package/dist/cases/message-reactions.md +2 -0
  127. package/dist/cases/message-row.md +2 -0
  128. package/dist/cases/message-send-failure/needs-a-person.d.ts +1 -0
  129. package/dist/cases/message-send-failure/needs-a-person.jsx +116 -0
  130. package/dist/cases/message-send-failure/retrying.d.ts +1 -0
  131. package/dist/cases/message-send-failure/retrying.jsx +116 -0
  132. package/dist/cases/message-send-failure.md +308 -0
  133. package/dist/cases/mobile-menu.md +2 -0
  134. package/dist/cases/newsletter-signup.md +2 -0
  135. package/dist/cases/no-access/page.d.ts +1 -0
  136. package/dist/cases/no-access/page.jsx +37 -0
  137. package/dist/cases/no-access/read-only.d.ts +1 -0
  138. package/dist/cases/no-access/read-only.jsx +33 -0
  139. package/dist/cases/no-access.md +147 -0
  140. package/dist/cases/not-found-page.md +2 -0
  141. package/dist/cases/notification-menu.md +2 -0
  142. package/dist/cases/number-format.md +2 -0
  143. package/dist/cases/oauth-consent.md +2 -0
  144. package/dist/cases/on-off-settings.md +2 -0
  145. package/dist/cases/on-this-page.md +2 -0
  146. package/dist/cases/onboarding.md +2 -0
  147. package/dist/cases/one-main-action.md +2 -0
  148. package/dist/cases/overflow-menu.md +2 -0
  149. package/dist/cases/page-end.md +2 -0
  150. package/dist/cases/page-header.md +2 -0
  151. package/dist/cases/paged-card.md +2 -0
  152. package/dist/cases/password-gate.md +2 -0
  153. package/dist/cases/payment-method.md +2 -0
  154. package/dist/cases/people-row.md +2 -0
  155. package/dist/cases/phone-navigation.md +2 -0
  156. package/dist/cases/plan-change-confirm.md +2 -0
  157. package/dist/cases/plan-comparison.md +3 -1
  158. package/dist/cases/plan-picker.md +4 -1
  159. package/dist/cases/plan-sign-off.md +2 -0
  160. package/dist/cases/pricing-section.md +5 -1
  161. package/dist/cases/product-cards.md +2 -0
  162. package/dist/cases/product-demo/scripted.d.ts +3 -0
  163. package/dist/cases/product-demo/scripted.jsx +95 -0
  164. package/dist/cases/product-demo/still.d.ts +1 -0
  165. package/dist/cases/product-demo/still.jsx +20 -0
  166. package/dist/cases/product-demo.md +221 -0
  167. package/dist/cases/profile-form.md +2 -0
  168. package/dist/cases/quick-switcher.md +2 -0
  169. package/dist/cases/range-switch.md +2 -0
  170. package/dist/cases/rename.md +2 -0
  171. package/dist/cases/reply-feedback.md +2 -0
  172. package/dist/cases/reply-sources.md +2 -0
  173. package/dist/cases/route-loading.md +2 -0
  174. package/dist/cases/scope-picker.md +2 -0
  175. package/dist/cases/section-index.md +2 -0
  176. package/dist/cases/session-expired/in-place.d.ts +1 -0
  177. package/dist/cases/session-expired/in-place.jsx +63 -0
  178. package/dist/cases/session-expired/redirect.d.ts +1 -0
  179. package/dist/cases/session-expired/redirect.jsx +62 -0
  180. package/dist/cases/session-expired.md +204 -0
  181. package/dist/cases/set-new-password.md +2 -0
  182. package/dist/cases/settings-page.md +2 -0
  183. package/dist/cases/settings-save.md +2 -0
  184. package/dist/cases/side-pane.md +2 -0
  185. package/dist/cases/sidebar-nav.md +2 -0
  186. package/dist/cases/sign-up-page.md +3 -0
  187. package/dist/cases/signup-from-site/plain.d.ts +1 -0
  188. package/dist/cases/signup-from-site/plain.jsx +125 -0
  189. package/dist/cases/signup-from-site/with-plan.d.ts +4 -0
  190. package/dist/cases/signup-from-site/with-plan.jsx +151 -0
  191. package/dist/cases/signup-from-site.md +351 -0
  192. package/dist/cases/site-footer.md +2 -0
  193. package/dist/cases/site-header/links.d.ts +3 -1
  194. package/dist/cases/site-header/links.jsx +6 -2
  195. package/dist/cases/site-header.md +11 -3
  196. package/dist/cases/site-matches-app.md +32 -0
  197. package/dist/cases/site-search.md +2 -0
  198. package/dist/cases/slash-command-list.md +2 -0
  199. package/dist/cases/stat-row.md +2 -0
  200. package/dist/cases/status-label.md +3 -1
  201. package/dist/cases/success-feedback.md +2 -0
  202. package/dist/cases/tabbed-panels.md +2 -0
  203. package/dist/cases/tag-filter.md +2 -0
  204. package/dist/cases/task-header.md +2 -0
  205. package/dist/cases/theme-switcher.md +2 -0
  206. package/dist/cases/type-to-confirm.md +2 -0
  207. package/dist/cases/typing-and-status.md +2 -0
  208. package/dist/cases/unsaved-changes-guard.md +2 -0
  209. package/dist/cases/upgrade-prompt.md +2 -0
  210. package/dist/cases/usage-meters.md +2 -0
  211. package/dist/cases.json +1494 -42
  212. package/dist/components/checkBox.d.ts +5 -1
  213. package/dist/components/checkBox.jsx +23 -9
  214. package/dist/components/diff.d.ts +29 -0
  215. package/dist/components/diff.jsx +35 -0
  216. package/dist/index.d.ts +1 -0
  217. package/dist/index.js +1 -0
  218. package/dist/internal/diff.d.ts +17 -0
  219. package/dist/internal/diff.js +44 -0
  220. package/dist/native-mapping.json +9 -2
  221. package/dist/stories/AgentPermissions.probe.stories.d.ts +7 -0
  222. package/dist/stories/AgentPermissions.probe.stories.jsx +18 -0
  223. package/dist/stories/AgentRunFailure.probe.stories.d.ts +6 -0
  224. package/dist/stories/AgentRunFailure.probe.stories.jsx +12 -0
  225. package/dist/stories/Cases.generated.stories.d.ts +24 -0
  226. package/dist/stories/Cases.generated.stories.jsx +48 -0
  227. package/dist/stories/Checkbox.stories.d.ts +2 -0
  228. package/dist/stories/Checkbox.stories.jsx +18 -0
  229. package/dist/stories/Diff.stories.d.ts +9 -0
  230. package/dist/stories/Diff.stories.jsx +40 -0
  231. package/dist/stories/ProductDemo.probe.stories.d.ts +6 -0
  232. package/dist/stories/ProductDemo.probe.stories.jsx +12 -0
  233. package/dist/stories/SignupFromSite.probe.stories.d.ts +7 -0
  234. package/dist/stories/SignupFromSite.probe.stories.jsx +17 -0
  235. package/dist/stories/SiteHeader.probe.stories.d.ts +6 -0
  236. package/dist/stories/SiteHeader.probe.stories.jsx +13 -0
  237. package/package.json +1 -1
@@ -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
+ }
@@ -0,0 +1,308 @@
1
+ # Message that did not send
2
+
3
+ A person sent a message and it did not reach the people it was for, because the app is offline or because something needs fixing first.
4
+
5
+ For: an app, an agent
6
+
7
+ ## Do
8
+
9
+ - Keep the message in the thread as a `Message`, where the person wrote it, with a line in its `footer` that says it did not send.
10
+ - Write 'Not sent yet. Trying again.' when the app will send it by itself, with 'Send Now' and 'Discard'.
11
+ - Say why it did not send and what fixes it when it needs the person: 'Not sent. Reconnect Figma, then send again.' Link the fix to the place that does it, with 'Try Again' and 'Discard'.
12
+ - Make the line's Buttons `size="small"`, with an `aria-label` that names the message: 'Send now: Can you check the plan table on…'.
13
+ - Show a warning `Alert` above the `Composer` while the app is offline: 'You are offline. Messages send when you are back.' Give it no close button and `autoDismiss={false}`.
14
+ - Keep the `Composer` working. The person can type and send more, and each new message waits in the thread too.
15
+ - Show 'Send Now' and 'Try Again' as `loading` while they send, and keep their labels.
16
+ - Move focus to the `Composer` when the message sends or is discarded, because the line and its Buttons are gone.
17
+ - Send focus to the `Composer` after 'Discard', not to the next row as the case 'Message actions' does after a delete. A failed message is usually the last one.
18
+ - Say in a polite status line, once, when waiting messages have sent: 'Back online. 2 messages sent.'
19
+
20
+ ## Don't
21
+
22
+ - Do not fade the text as the only sign that it did not send. Say it in words under the message.
23
+ - Do not show a toast for a failure that stays. The line stays with the message until it sends or is discarded.
24
+ - Do not lose the text. It stays in the thread until it sends or the person discards it.
25
+ - Do not show the error's own message, such as 'Request failed with status 401'.
26
+ - Do not block the Composer while one message waits.
27
+
28
+ ## Option: Sends again by itself
29
+
30
+ Use when: The app can send it again without help, such as when it is offline.
31
+
32
+ Uses: `Alert`, `Button`, `Center`, `Cluster`, `Composer`, `Heading`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `UserImage`
33
+
34
+ ```tsx
35
+ 'use client';
36
+ import { useEffect, useRef, useState } from 'react';
37
+ import Message from 'oneslash-design-system/components/message';
38
+ import UserImage from 'oneslash-design-system/components/userImage';
39
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
40
+ import Heading from 'oneslash-design-system/components/heading';
41
+ import Paragraph from 'oneslash-design-system/components/paragraph';
42
+ import Alert from 'oneslash-design-system/components/alert';
43
+ import Button from 'oneslash-design-system/components/button';
44
+ import Composer from 'oneslash-design-system/components/composer';
45
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
46
+
47
+ // A real app reads this from the session.
48
+ const me = 'Dana Lee';
49
+
50
+ type Row = { id: string; from: string; at: Date; text: string; state: 'sent' | 'waiting' | 'sending' };
51
+
52
+ // Opens offline, with Dana's last message waiting to go.
53
+ const firstThread: Row[] = [
54
+ { 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' },
55
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T14:35:00'), text: 'I fixed the plan table on phones.', state: 'sent' },
56
+ { 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' },
57
+ ];
58
+
59
+ // Names a message by its first words, for the Buttons under it.
60
+ const firstWords = (text: string) => (text.length > 32 ? `${text.slice(0, 32).trimEnd()}…` : text);
61
+
62
+ export default function MessageSendFailureRetrying() {
63
+ const [thread, setThread] = useState(firstThread);
64
+ const [online, setOnline] = useState(false);
65
+ const [text, setText] = useState('');
66
+ // Said once, in the polite status line, when the waiting messages have gone.
67
+ const [status, setStatus] = useState('');
68
+ const timer = useRef<ReturnType<typeof setTimeout>>();
69
+ const composer = useRef<HTMLTextAreaElement>(null);
70
+ // Each new message gets its own id, so no two rows share one after a discard.
71
+ const nextId = useRef(firstThread.length + 1);
72
+ // The thread as last drawn, for the request that ends later.
73
+ const latest = useRef(thread);
74
+ latest.current = thread;
75
+ // Where focus goes after the next render, once the element it goes to is on screen.
76
+ const focusNext = useRef<() => void>();
77
+
78
+ // Stops the request if the example goes away before it ends.
79
+ useEffect(() => () => clearTimeout(timer.current), []);
80
+
81
+ useEffect(() => {
82
+ const move = focusNext.current;
83
+ focusNext.current = undefined;
84
+ move?.();
85
+ });
86
+
87
+ // The Composer keeps working while a message waits. Offline, a new message waits in the thread too.
88
+ function send() {
89
+ const id = `m${nextId.current++}`;
90
+ setThread((rows) => [...rows, { id, from: me, at: new Date(), text: text.trim(), state: online ? 'sent' : 'waiting' }]);
91
+ setText('');
92
+ }
93
+
94
+ // Sends at once. Here the connection is back, so every waiting message goes with it.
95
+ function sendNow(id: string) {
96
+ if (thread.some((m) => m.state === 'sending')) return;
97
+ setThread((rows) => rows.map((m) => (m.id === id ? { ...m, state: 'sending' } : m)));
98
+ // Stands in for the request to the server.
99
+ timer.current = setTimeout(() => {
100
+ const waiting = latest.current.filter((m) => m.state !== 'sent').length;
101
+ setThread((rows) => rows.map((m) => ({ ...m, state: 'sent' })));
102
+ setOnline(true);
103
+ setStatus(`Back online. ${waiting} ${waiting === 1 ? 'message' : 'messages'} sent.`);
104
+ // The line and its Buttons are gone, so focus goes to the message box.
105
+ focusNext.current = () => composer.current?.focus();
106
+ }, 1200);
107
+ }
108
+
109
+ // Takes the message out of the thread. It was never sent, so no one else saw it.
110
+ function discard(id: string) {
111
+ setThread((rows) => rows.filter((m) => m.id !== id));
112
+ focusNext.current = () => composer.current?.focus();
113
+ }
114
+
115
+ return (
116
+ <Center width="page">
117
+ <Stack gap="large">
118
+ <Heading level={1} size="h5">Launch plan</Heading>
119
+ {/* A real app gives the list that holds the rows role="log". */}
120
+ <Stack gap="small">
121
+ {thread.map((m) => {
122
+ const notSent = m.state !== 'sent';
123
+ return (
124
+ <Message
125
+ key={m.id}
126
+ aria-label={notSent ? `${m.from}, not sent yet` : m.from}
127
+ avatar={<UserImage userHandle={m.from} decorative />}
128
+ name={m.from}
129
+ meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
130
+ footer={
131
+ notSent ? (
132
+ <Stack gap="small">
133
+ <Paragraph size="body2" tone="secondary" measure="none">Not sent yet. Trying again.</Paragraph>
134
+ <Cluster gap="small">
135
+ <Button size="small" type="secondary" state="enabled" label="Send Now" aria-label={`Send now: ${firstWords(m.text)}`} loading={m.state === 'sending'} onClickButton={() => sendNow(m.id)} />
136
+ <Button size="small" type="tertiary" state={m.state === 'sending' ? 'disabled' : 'enabled'} label="Discard" aria-label={`Discard: ${firstWords(m.text)}`} onClickButton={() => discard(m.id)} />
137
+ </Cluster>
138
+ </Stack>
139
+ ) : undefined
140
+ }
141
+ >
142
+ <Paragraph measure="none">{m.text}</Paragraph>
143
+ </Message>
144
+ );
145
+ })}
146
+ </Stack>
147
+ <Stack gap="small">
148
+ {!online && <Alert type="warning" variant="inline" message="You are offline. Messages send when you are back." autoDismiss={false} />}
149
+ {/* On the page from the start, so it is heard once when the messages go. */}
150
+ <Paragraph role="status" size="body2" tone="secondary" measure="none">{status}</Paragraph>
151
+ <Composer
152
+ ref={composer}
153
+ id="message-send-failure-retrying-message"
154
+ aria-label="Message"
155
+ placeholder="Message the team"
156
+ value={text}
157
+ onChange={setText}
158
+ onSubmit={send}
159
+ />
160
+ </Stack>
161
+ </Stack>
162
+ </Center>
163
+ );
164
+ }
165
+ ```
166
+
167
+ ## Option: Waits for a fix
168
+
169
+ Use when: Sending cannot work until the person does something, such as reconnect an account.
170
+
171
+ Uses: `Button`, `Center`, `Cluster`, `Composer`, `Heading`, `Link`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `UserImage`
172
+
173
+ ```tsx
174
+ 'use client';
175
+ import { useEffect, useRef, useState } from 'react';
176
+ import Message from 'oneslash-design-system/components/message';
177
+ import UserImage from 'oneslash-design-system/components/userImage';
178
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
179
+ import Heading from 'oneslash-design-system/components/heading';
180
+ import Paragraph from 'oneslash-design-system/components/paragraph';
181
+ import Link from 'oneslash-design-system/components/link';
182
+ import Button from 'oneslash-design-system/components/button';
183
+ import Composer from 'oneslash-design-system/components/composer';
184
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
185
+
186
+ // A real app reads this from the session.
187
+ const me = 'Dana Lee';
188
+
189
+ type Row = { id: string; from: string; at: Date; text: string; state: 'sent' | 'failed' | 'sending' };
190
+
191
+ // This thread is shared with a Figma file. Dana's access to Figma ran out, so her last reply did not send.
192
+ const firstThread: Row[] = [
193
+ { id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T14:31:00'), text: 'The hero image is too dark on phones.', state: 'sent' },
194
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T14:35:00'), text: 'I can try a lighter one this afternoon.', state: 'sent' },
195
+ { 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' },
196
+ ];
197
+
198
+ // Names a message by its first words, for the Buttons under it.
199
+ const firstWords = (text: string) => (text.length > 32 ? `${text.slice(0, 32).trimEnd()}…` : text);
200
+
201
+ export default function MessageSendFailureNeedsAPerson() {
202
+ const [thread, setThread] = useState(firstThread);
203
+ const [connected, setConnected] = useState(false);
204
+ const [text, setText] = useState('');
205
+ // Said once, in the polite status line, when a message has gone.
206
+ const [status, setStatus] = useState('');
207
+ const timer = useRef<ReturnType<typeof setTimeout>>();
208
+ const composer = useRef<HTMLTextAreaElement>(null);
209
+ // Each new message gets its own id, so no two rows share one after a discard.
210
+ const nextId = useRef(firstThread.length + 1);
211
+ // Where focus goes after the next render, once the element it goes to is on screen.
212
+ const focusNext = useRef<() => void>();
213
+
214
+ // Stops the request if the example goes away before it ends.
215
+ useEffect(() => () => clearTimeout(timer.current), []);
216
+
217
+ useEffect(() => {
218
+ const move = focusNext.current;
219
+ focusNext.current = undefined;
220
+ move?.();
221
+ });
222
+
223
+ // The Composer keeps working. Until Figma is reconnected, a new reply cannot send either, and says so.
224
+ function send() {
225
+ const id = `m${nextId.current++}`;
226
+ setThread((rows) => [...rows, { id, from: me, at: new Date(), text: text.trim(), state: connected ? 'sent' : 'failed' }]);
227
+ setText('');
228
+ }
229
+
230
+ // Stands in for a person who reconnected Figma first, so it sends.
231
+ function tryAgain(id: string) {
232
+ if (thread.some((m) => m.state === 'sending')) return;
233
+ setThread((rows) => rows.map((m) => (m.id === id ? { ...m, state: 'sending' } : m)));
234
+ timer.current = setTimeout(() => {
235
+ setThread((rows) => rows.map((m) => (m.id === id ? { ...m, state: 'sent' } : m)));
236
+ setConnected(true);
237
+ setStatus('Message sent.');
238
+ // The line and its Buttons are gone, so focus goes to the message box.
239
+ focusNext.current = () => composer.current?.focus();
240
+ }, 1200);
241
+ }
242
+
243
+ // Takes the message out of the thread. It was never sent, so no one else saw it.
244
+ function discard(id: string) {
245
+ setThread((rows) => rows.filter((m) => m.id !== id));
246
+ focusNext.current = () => composer.current?.focus();
247
+ }
248
+
249
+ return (
250
+ <Center width="page">
251
+ <Stack gap="large">
252
+ <Stack gap="small">
253
+ <Heading level={1} size="h5">Homepage hero</Heading>
254
+ <Paragraph tone="secondary" size="body2" measure="none">Replies here also go to the comments on the Figma file.</Paragraph>
255
+ </Stack>
256
+ {/* A real app gives the list that holds the rows role="log". */}
257
+ <Stack gap="small">
258
+ {thread.map((m) => {
259
+ const notSent = m.state !== 'sent';
260
+ return (
261
+ <Message
262
+ key={m.id}
263
+ aria-label={notSent ? `${m.from}, not sent` : m.from}
264
+ avatar={<UserImage userHandle={m.from} decorative />}
265
+ name={m.from}
266
+ meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
267
+ footer={
268
+ notSent ? (
269
+ <Stack gap="small">
270
+ {/* The reason and its fix. The link goes where the fix is done. */}
271
+ <Paragraph size="body2" tone="secondary" measure="none">
272
+ Not sent. <Link href="/settings/integrations" size="body2">Reconnect Figma</Link>, then send again.
273
+ </Paragraph>
274
+ <Cluster gap="small">
275
+ <Button size="small" type="secondary" state="enabled" label="Try Again" aria-label={`Try again: ${firstWords(m.text)}`} loading={m.state === 'sending'} onClickButton={() => tryAgain(m.id)} />
276
+ <Button size="small" type="tertiary" state={m.state === 'sending' ? 'disabled' : 'enabled'} label="Discard" aria-label={`Discard: ${firstWords(m.text)}`} onClickButton={() => discard(m.id)} />
277
+ </Cluster>
278
+ </Stack>
279
+ ) : undefined
280
+ }
281
+ >
282
+ <Paragraph measure="none">{m.text}</Paragraph>
283
+ </Message>
284
+ );
285
+ })}
286
+ </Stack>
287
+ <Stack gap="small">
288
+ {/* On the page from the start, so it is heard once when the message goes. */}
289
+ <Paragraph role="status" size="body2" tone="secondary" measure="none">{status}</Paragraph>
290
+ <Composer
291
+ ref={composer}
292
+ id="message-send-failure-needs-a-person-message"
293
+ aria-label="Message"
294
+ placeholder="Message the team"
295
+ value={text}
296
+ onChange={setText}
297
+ onSubmit={send}
298
+ />
299
+ </Stack>
300
+ </Stack>
301
+ </Center>
302
+ );
303
+ }
304
+ ```
305
+
306
+ ## Native
307
+
308
+ On Apple show the line under the message in a footnote style, with 'Send Now' and 'Discard' as Buttons and a banner above the text field while offline. On Android use the same line under the message, and a `Snackbar` only for a failure that clears itself.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A site's links and actions do not fit in the bar on a phone, and the person still needs to reach every one.
4
4
 
5
+ For: a marketing site, 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'. The menu is a `Drawer` from the start side.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A reader of the public site wants to hear about the product by email, without making an account.
4
4
 
5
+ For: a marketing site
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rules 'A form error shows next to the problem' and 'Success shows where the person is looking'.
@@ -0,0 +1 @@
1
+ export default function NoAccessPage(): import("react").JSX.Element;
@@ -0,0 +1,37 @@
1
+ 'use client';
2
+ import { useState } from 'react';
3
+ import AppShell from '../../components/appShell';
4
+ import Navigation from '../../components/navigation';
5
+ import MenuItem from '../../components/menuItem';
6
+ import TitleBar from '../../components/titleBar';
7
+ import Surface from '../../components/surface';
8
+ import EmptyBox from '../../components/emptyBox';
9
+ import Paragraph from '../../components/paragraph';
10
+ import Button from '../../components/button';
11
+ import { Stack } from '../../components/layout';
12
+ // The places a member can open. Billing is for admins, so it is not in the list:
13
+ // the person reached it by a link, and the page says why they cannot see it.
14
+ var places = [
15
+ { label: 'Home', icon: 'House', href: '/' },
16
+ { label: 'Invoices', icon: 'FileText', href: '/invoices' },
17
+ { label: 'Settings', icon: 'Settings', href: '/settings' },
18
+ ];
19
+ var sidebar = (<Navigation aria-label="Main">
20
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
21
+ {places.map(function (p) { return (<MenuItem key={p.href} size="small" label={p.label} iconName={p.icon} href={p.href} isSelected={false}
22
+ // A real app lets the link go to its page.
23
+ onClick={function (event) { return event.preventDefault(); }}/>); })}
24
+ </Navigation>);
25
+ export default function NoAccessPage() {
26
+ // Below md the sidebar is a Drawer; this says whether it is open.
27
+ var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
28
+ return (<AppShell title="Billing" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
29
+ <Stack gap="large">
30
+ {/* The page exists, so it keeps its name. It is not a 404. */}
31
+ <TitleBar title="Billing"/>
32
+ <Surface minHeight="tall" align="center">
33
+ <EmptyBox size="large" icon="Lock" text="You do not have access to Billing" secondText="Ask an admin: Dana Lee" action={<Button size="medium" type="secondary" state="enabled" label="Go Home" href="/"/>}/>
34
+ </Surface>
35
+ </Stack>
36
+ </AppShell>);
37
+ }
@@ -0,0 +1 @@
1
+ export default function NoAccessReadOnly(): import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+ import Heading from '../../components/heading';
3
+ import Alert from '../../components/alert';
4
+ import SettingsSection from '../../components/settingsSection';
5
+ import TextField from '../../components/textField';
6
+ import { Center, Stack } from '../../components/layout';
7
+ // A real app reads these from the server. Ben Carter is a member, so he can read them and not change them.
8
+ var general = [
9
+ { id: 'no-access-name', label: 'Workspace name', value: 'Acme' },
10
+ { id: 'no-access-email', label: 'Billing email', value: 'billing@acme.example' },
11
+ { id: 'no-access-time-zone', label: 'Time zone', value: 'Central Time (US and Canada)' },
12
+ ];
13
+ var members = [
14
+ { id: 'no-access-invite', label: 'Who can invite members', value: 'Admins only' },
15
+ { id: 'no-access-domain', label: 'Email domain for new members', value: 'acme.example' },
16
+ ];
17
+ // A read-only field changes nothing.
18
+ var unchanged = function () { };
19
+ export default function NoAccessReadOnly() {
20
+ return (<Center>
21
+ <Stack gap="xlarge">
22
+ <Heading level={1} size="h5">Workspace settings</Heading>
23
+ {/* One line at the top says why nothing can be changed, and who can. No Save Button, no disabled Buttons. */}
24
+ <Alert type="info" variant="inline" message="Only admins can change these settings. Your admin is Dana Lee." autoDismiss={false}/>
25
+ <SettingsSection title="General">
26
+ {general.map(function (f) { return (<TextField key={f.id} id={f.id} label={f.label} value={f.value} readOnly onChange={unchanged}/>); })}
27
+ </SettingsSection>
28
+ <SettingsSection title="Members">
29
+ {members.map(function (f) { return (<TextField key={f.id} id={f.id} label={f.label} value={f.value} readOnly onChange={unchanged}/>); })}
30
+ </SettingsSection>
31
+ </Stack>
32
+ </Center>);
33
+ }