oneslash-design-system 2.23.1 → 2.25.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 (147) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +20 -5
  3. package/dist/cases/activity-timeline/activity.d.ts +1 -0
  4. package/dist/cases/activity-timeline/activity.jsx +43 -0
  5. package/dist/cases/activity-timeline/versions.d.ts +1 -0
  6. package/dist/cases/activity-timeline/versions.jsx +130 -0
  7. package/dist/cases/activity-timeline.md +315 -0
  8. package/dist/cases/agent-plan-proposal.md +1 -0
  9. package/dist/cases/ask-page/answered.d.ts +1 -0
  10. package/dist/cases/ask-page/answered.jsx +248 -0
  11. package/dist/cases/ask-page/first-visit.d.ts +1 -0
  12. package/dist/cases/ask-page/first-visit.jsx +118 -0
  13. package/dist/cases/ask-page.md +551 -0
  14. package/dist/cases/billing-page/self-serve.jsx +4 -4
  15. package/dist/cases/billing-page/trial.d.ts +1 -0
  16. package/dist/cases/billing-page/trial.jsx +115 -0
  17. package/dist/cases/billing-page.md +166 -5
  18. package/dist/cases/chart/bars.d.ts +1 -0
  19. package/dist/cases/chart/bars.jsx +83 -0
  20. package/dist/cases/chart/lines.d.ts +1 -0
  21. package/dist/cases/chart/lines.jsx +71 -0
  22. package/dist/cases/chart.md +258 -0
  23. package/dist/cases/collapsible-search/popover.jsx +1 -1
  24. package/dist/cases/collapsible-search.md +2 -2
  25. package/dist/cases/comment-thread/card.d.ts +1 -0
  26. package/dist/cases/comment-thread/card.jsx +141 -0
  27. package/dist/cases/comment-thread/thread.d.ts +1 -0
  28. package/dist/cases/comment-thread/thread.jsx +87 -0
  29. package/dist/cases/comment-thread.md +349 -0
  30. package/dist/cases/cookie-choice/banner.d.ts +1 -0
  31. package/dist/cases/cookie-choice/banner.jsx +82 -0
  32. package/dist/cases/cookie-choice/settings.d.ts +1 -0
  33. package/dist/cases/cookie-choice/settings.jsx +75 -0
  34. package/dist/cases/cookie-choice.md +234 -0
  35. package/dist/cases/dashboard/numbers-first.jsx +63 -2
  36. package/dist/cases/dashboard/work-first.jsx +1 -1
  37. package/dist/cases/dashboard.md +77 -5
  38. package/dist/cases/data-table-page/all-rows.jsx +1 -1
  39. package/dist/cases/data-table-page/paged.jsx +1 -1
  40. package/dist/cases/data-table-page.md +2 -2
  41. package/dist/cases/invoice-list/table.jsx +21 -9
  42. package/dist/cases/invoice-list.md +27 -12
  43. package/dist/cases/leaderboard/ranked.d.ts +1 -0
  44. package/dist/cases/leaderboard/ranked.jsx +44 -0
  45. package/dist/cases/leaderboard/table.d.ts +1 -0
  46. package/dist/cases/leaderboard/table.jsx +87 -0
  47. package/dist/cases/leaderboard.md +177 -0
  48. package/dist/cases/message-reactions/picker.jsx +1 -1
  49. package/dist/cases/message-reactions.md +2 -2
  50. package/dist/cases/message-row.md +2 -1
  51. package/dist/cases/newsletter-signup/inline.d.ts +1 -0
  52. package/dist/cases/newsletter-signup/inline.jsx +72 -0
  53. package/dist/cases/newsletter-signup/section.d.ts +1 -0
  54. package/dist/cases/newsletter-signup/section.jsx +72 -0
  55. package/dist/cases/newsletter-signup.md +234 -0
  56. package/dist/cases/number-format.md +9 -3
  57. package/dist/cases/onboarding/checklist.d.ts +1 -0
  58. package/dist/cases/onboarding/checklist.jsx +92 -0
  59. package/dist/cases/onboarding/steps.d.ts +3 -0
  60. package/dist/cases/onboarding/steps.jsx +177 -0
  61. package/dist/cases/onboarding.md +368 -0
  62. package/dist/cases/people-row/stack.jsx +1 -1
  63. package/dist/cases/people-row.md +2 -2
  64. package/dist/cases/plan-comparison/table.d.ts +1 -0
  65. package/dist/cases/plan-comparison/table.jsx +47 -0
  66. package/dist/cases/plan-comparison.md +94 -0
  67. package/dist/cases/plan-picker.md +1 -0
  68. package/dist/cases/plan-sign-off/one-approver.d.ts +1 -0
  69. package/dist/cases/plan-sign-off/one-approver.jsx +129 -0
  70. package/dist/cases/plan-sign-off/team.d.ts +1 -0
  71. package/dist/cases/plan-sign-off/team.jsx +213 -0
  72. package/dist/cases/plan-sign-off.md +541 -0
  73. package/dist/cases/pricing-section.md +1 -1
  74. package/dist/cases/site-footer/columns.jsx +2 -1
  75. package/dist/cases/site-footer.md +3 -1
  76. package/dist/cases/stat-row/tiles.jsx +2 -1
  77. package/dist/cases/stat-row.md +5 -2
  78. package/dist/cases/task-header/agent-sets-status.d.ts +1 -0
  79. package/dist/cases/task-header/agent-sets-status.jsx +164 -0
  80. package/dist/cases/task-header/people-change-status.d.ts +1 -0
  81. package/dist/cases/task-header/people-change-status.jsx +175 -0
  82. package/dist/cases/task-header.md +576 -0
  83. package/dist/cases.json +883 -30
  84. package/dist/components/alert.d.ts +3 -1
  85. package/dist/components/alert.jsx +5 -5
  86. package/dist/components/barChart.d.ts +35 -0
  87. package/dist/components/barChart.jsx +92 -0
  88. package/dist/components/dateField.jsx +1 -1
  89. package/dist/components/formatNumber.d.ts +10 -2
  90. package/dist/components/formatNumber.js +44 -9
  91. package/dist/components/heading.d.ts +2 -2
  92. package/dist/components/heading.jsx +5 -3
  93. package/dist/components/layout.d.ts +4 -2
  94. package/dist/components/layout.jsx +13 -2
  95. package/dist/components/lineChart.d.ts +39 -0
  96. package/dist/components/lineChart.jsx +128 -0
  97. package/dist/components/markdown.d.ts +24 -0
  98. package/dist/components/markdown.jsx +81 -0
  99. package/dist/components/pageShell.d.ts +3 -3
  100. package/dist/components/pageShell.jsx +6 -5
  101. package/dist/components/popover.d.ts +5 -1
  102. package/dist/components/popover.jsx +3 -2
  103. package/dist/components/progress.jsx +1 -1
  104. package/dist/components/select.jsx +5 -2
  105. package/dist/components/statTile.d.ts +1 -1
  106. package/dist/components/statTile.jsx +7 -2
  107. package/dist/components/tableCell.d.ts +4 -3
  108. package/dist/components/tableCell.jsx +2 -2
  109. package/dist/components/timeline.d.ts +32 -0
  110. package/dist/components/timeline.jsx +54 -0
  111. package/dist/components/titleBar.d.ts +3 -1
  112. package/dist/components/titleBar.jsx +9 -4
  113. package/dist/components/toaster.jsx +81 -11
  114. package/dist/index.d.ts +1 -0
  115. package/dist/index.js +1 -0
  116. package/dist/internal/chart.d.ts +39 -0
  117. package/dist/internal/chart.js +110 -0
  118. package/dist/internal/chartFrame.d.ts +29 -0
  119. package/dist/internal/chartFrame.jsx +57 -0
  120. package/dist/internal/markdown.d.ts +40 -0
  121. package/dist/internal/markdown.js +577 -0
  122. package/dist/internal/toaster.d.ts +2 -0
  123. package/dist/internal/toaster.js +8 -0
  124. package/dist/native-mapping.json +28 -4
  125. package/dist/stories/BarChart.stories.d.ts +10 -0
  126. package/dist/stories/BarChart.stories.jsx +104 -0
  127. package/dist/stories/Cases.generated.stories.d.ts +22 -0
  128. package/dist/stories/Cases.generated.stories.jsx +44 -0
  129. package/dist/stories/Heading.stories.d.ts +1 -0
  130. package/dist/stories/Heading.stories.jsx +17 -0
  131. package/dist/stories/LineChart.stories.d.ts +9 -0
  132. package/dist/stories/LineChart.stories.jsx +34 -0
  133. package/dist/stories/Markdown.stories.d.ts +9 -0
  134. package/dist/stories/Markdown.stories.jsx +66 -0
  135. package/dist/stories/Onboarding.probe.stories.d.ts +6 -0
  136. package/dist/stories/Onboarding.probe.stories.jsx +12 -0
  137. package/dist/stories/Popover.stories.d.ts +2 -0
  138. package/dist/stories/Popover.stories.jsx +33 -0
  139. package/dist/stories/StatTile.stories.d.ts +4 -0
  140. package/dist/stories/StatTile.stories.jsx +47 -2
  141. package/dist/stories/Timeline.stories.d.ts +8 -0
  142. package/dist/stories/Timeline.stories.jsx +49 -0
  143. package/dist/stories/TitleBar.stories.d.ts +1 -0
  144. package/dist/stories/TitleBar.stories.jsx +13 -0
  145. package/dist/stories/Toaster.stories.d.ts +4 -0
  146. package/dist/stories/Toaster.stories.jsx +30 -0
  147. package/package.json +1 -1
@@ -0,0 +1,368 @@
1
+ # First-run setup
2
+
3
+ A person has just signed up, and the app needs a few things from them before it works or before it is fully set up.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'A form error shows next to the problem'.
8
+ - Ask only for what the app cannot work without. Everything else goes in the checklist or in Settings.
9
+ - Say the count of steps up front, in words above the heading: 'Step 2 of 3'.
10
+ - Center each step in `<Center width="form">`, and title it with a `Heading level={1}` that names the step: 'Name your workspace'.
11
+ - Give the heading a `ref` and `tabIndex={-1}`, and move focus to it on every step change, so a screen reader hears where the person is.
12
+ - Put each step in its own `Form`. 'Continue' is the primary Button and submits it. Give the last step 'Go to Workspace'.
13
+ - Give every step after the first a tertiary 'Back'. Keep what the person typed in state, so Back shows it again.
14
+ - Save each step when the person continues. A person who leaves comes back to the first step not done, with what they entered.
15
+ - Make Back and Continue again change what was saved, never make it twice: the same workspace name goes on at once, and only new addresses are invited.
16
+ - Give an optional step a tertiary 'Skip for Now'. It sends nothing and goes on at once. The last step says what was sent, counting invites sent before Back.
17
+ - Make the pressed Button `loading` while the request runs, and keep the step, its fields and its label on screen.
18
+ - Keep the step and what was typed when a request fails. Show an inline error `Alert` at the top of the form, above the fields and the Buttons.
19
+ - Show a field's error on submit, under the field: 'Enter a name for your workspace.'
20
+ - Show what can wait as a `SettingsSection` on the home page: a `Progress kind="share"` with `valueText` such as '2 of 4 done', then a `StepList` of done and waiting steps.
21
+ - Link each waiting step to the place where it is done, such as 'Connect Calendar'.
22
+ - Say 'Acme is set up.' in an inline success `Alert` once every step is done, and offer a tertiary 'Hide Checklist'. Move focus to the page's heading when it hides.
23
+
24
+ ## Don't
25
+
26
+ - Do not show progress as a bar of colored segments with no words.
27
+ - Do not disable Continue until a field is filled. Show the error on submit.
28
+ - Do not swap the step for a spinner while a request runs.
29
+ - Do not make a tour of the interface a step. Show help where the person needs it.
30
+ - Do not lose what the person typed when they go Back or a request fails.
31
+ - Do not make a second workspace or send an invite twice when the person goes Back and on again.
32
+ - Do not put a step the app can work without before the app. Put it in the checklist.
33
+
34
+ ## Option: Steps before the app
35
+
36
+ Use when: Two to four steps a new person must pass before the app works, such as naming a workspace.
37
+
38
+ Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Paragraph`, `Stack`, `TextField`
39
+
40
+ ```tsx
41
+ 'use client';
42
+ import { useEffect, useRef, useState } from 'react';
43
+ import Heading from 'oneslash-design-system/components/heading';
44
+ import Paragraph from 'oneslash-design-system/components/paragraph';
45
+ import Form from 'oneslash-design-system/components/form';
46
+ import TextField from 'oneslash-design-system/components/textField';
47
+ import Alert from 'oneslash-design-system/components/alert';
48
+ import Button from 'oneslash-design-system/components/button';
49
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
50
+
51
+ const titles = ['Name your workspace', 'Invite your team', 'You are set'];
52
+
53
+ // A small check: some text, an @, then some text.
54
+ function looksLikeEmail(value: string) {
55
+ return /^[^@\s]+@[^@\s]+$/.test(value);
56
+ }
57
+
58
+ function addresses(text: string) {
59
+ return text.split(',').map((a) => a.trim()).filter(Boolean);
60
+ }
61
+
62
+ // `failOn` makes the workspace request fail once, so a test can see the error. A real app leaves it out.
63
+ // A real app saves each step on Continue. A person who leaves comes back to the first step not done,
64
+ // with what they entered, and the steps before it show what was saved.
65
+ export default function OnboardingSteps({ failOn }: { failOn?: 'workspace' } = {}) {
66
+ const [step, setStep] = useState(0);
67
+ // What the person typed stays in state, so Back shows it again.
68
+ const [name, setName] = useState('');
69
+ const [emails, setEmails] = useState('');
70
+ const [nameError, setNameError] = useState('');
71
+ const [emailError, setEmailError] = useState('');
72
+ const [error, setError] = useState('');
73
+ const [loading, setLoading] = useState(false);
74
+ // What was saved: the workspace's name once it exists, and the addresses already invited.
75
+ // Back and Continue again never make the workspace twice or send an invite twice.
76
+ const [created, setCreated] = useState<string | null>(null);
77
+ const [sent, setSent] = useState<string[]>([]);
78
+ const heading = useRef<HTMLHeadingElement>(null);
79
+ const failed = useRef(false);
80
+ const timer = useRef<ReturnType<typeof setTimeout>>();
81
+ // Set on a step change; run after the next render, once the new heading is on screen.
82
+ const focusNext = useRef<() => void>();
83
+
84
+ // Stops the request if the example goes away before it ends.
85
+ useEffect(() => () => clearTimeout(timer.current), []);
86
+
87
+ useEffect(() => {
88
+ const move = focusNext.current;
89
+ focusNext.current = undefined;
90
+ move?.();
91
+ });
92
+
93
+ // Each step change moves focus to the step's heading, so a screen reader reads where the person is.
94
+ // The first step keeps focus where the page put it.
95
+ function go(next: number) {
96
+ setError('');
97
+ setNameError('');
98
+ setEmailError('');
99
+ setStep(next);
100
+ focusNext.current = () => heading.current?.focus({ preventScroll: true });
101
+ }
102
+
103
+ function back() {
104
+ if (loading) return;
105
+ go(step - 1);
106
+ }
107
+
108
+ function createWorkspace() {
109
+ if (loading) return;
110
+ setError('');
111
+ setNameError('');
112
+ const wanted = name.trim();
113
+ if (!wanted) {
114
+ setNameError('Enter a name for your workspace.');
115
+ return;
116
+ }
117
+ // Already saved with this name: go on with no request.
118
+ if (wanted === created) {
119
+ go(1);
120
+ return;
121
+ }
122
+ setLoading(true);
123
+ // Stands in for the request to the server: it creates the workspace, or renames it when it exists.
124
+ // The step and its Buttons stay while it runs.
125
+ timer.current = setTimeout(() => {
126
+ setLoading(false);
127
+ if (failOn === 'workspace' && !failed.current) {
128
+ failed.current = true;
129
+ setError(created === null ? 'The workspace was not created. Try again.' : 'The workspace was not renamed. Try again.');
130
+ return;
131
+ }
132
+ setCreated(wanted);
133
+ go(1);
134
+ }, 1200);
135
+ }
136
+
137
+ function sendInvites() {
138
+ if (loading) return;
139
+ setError('');
140
+ setEmailError('');
141
+ const list = addresses(emails);
142
+ if (list.length === 0 && sent.length === 0) {
143
+ setEmailError('Enter an email address, or choose Skip for Now.');
144
+ return;
145
+ }
146
+ const wrong = list.find((a) => !looksLikeEmail(a));
147
+ if (wrong) {
148
+ setEmailError(`Check ${wrong}. Enter an address like name@example.com.`);
149
+ return;
150
+ }
151
+ // Only addresses not yet invited are sent. With none, the step goes on at once.
152
+ const fresh = list.filter((a) => !sent.includes(a));
153
+ if (fresh.length === 0) {
154
+ go(2);
155
+ return;
156
+ }
157
+ setLoading(true);
158
+ // Stands in for the request to the server. A failed request shows an inline error Alert, as on the first step.
159
+ timer.current = setTimeout(() => {
160
+ setLoading(false);
161
+ setSent((s) => [...s, ...fresh]);
162
+ go(2);
163
+ }, 1200);
164
+ }
165
+
166
+ // Skip sends nothing and goes on at once. Invites already sent stay sent.
167
+ function skip() {
168
+ if (loading) return;
169
+ go(2);
170
+ }
171
+
172
+ const workspace = created ?? name.trim();
173
+
174
+ return (
175
+ <Center width="form">
176
+ <Stack gap="small">
177
+ {/* The count of steps is said up front, in words. */}
178
+ <Paragraph size="body2" tone="secondary" measure="none">{`Step ${step + 1} of ${titles.length}`}</Paragraph>
179
+ <Heading ref={heading} tabIndex={-1} level={1} size="h5">{titles[step]}</Heading>
180
+ </Stack>
181
+
182
+ {step === 0 && (
183
+ <Form aria-label={titles[0]} onSubmit={createWorkspace}>
184
+ {/* A failed request keeps the step and what was typed, and says so above the fields and the Buttons. */}
185
+ {error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
186
+ <TextField
187
+ id="onboarding-steps-workspace"
188
+ label="Workspace name"
189
+ value={name}
190
+ disabled={loading}
191
+ error={Boolean(nameError)}
192
+ errorText={nameError}
193
+ helperText="Your team works here. You can change the name later."
194
+ onChange={(e) => { setName(e.target.value); setNameError(''); }}
195
+ />
196
+ <Cluster gap="small">
197
+ <Button size="medium" type="primary" state="enabled" label="Continue" htmlType="submit" loading={loading} />
198
+ </Cluster>
199
+ </Form>
200
+ )}
201
+
202
+ {step === 1 && (
203
+ <Form aria-label={titles[1]} onSubmit={sendInvites}>
204
+ {error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
205
+ <Paragraph measure="none">{`Invite the people you work with to ${workspace}. You can skip this and invite them later.`}</Paragraph>
206
+ <TextField
207
+ id="onboarding-steps-emails"
208
+ label="Email addresses"
209
+ type="email"
210
+ value={emails}
211
+ disabled={loading}
212
+ error={Boolean(emailError)}
213
+ errorText={emailError}
214
+ helperText="Separate addresses with commas."
215
+ onChange={(e) => { setEmails(e.target.value); setEmailError(''); }}
216
+ />
217
+ <Cluster gap="small" justify="between">
218
+ <Button size="medium" type="tertiary" state="enabled" label="Back" decoIcon="ChevronLeft" onClickButton={back} />
219
+ <Cluster gap="small">
220
+ <Button size="medium" type="tertiary" state="enabled" label="Skip for Now" onClickButton={skip} />
221
+ <Button size="medium" type="primary" state="enabled" label="Continue" htmlType="submit" loading={loading} />
222
+ </Cluster>
223
+ </Cluster>
224
+ </Form>
225
+ )}
226
+
227
+ {step === 2 && (
228
+ <Stack gap="large">
229
+ <Paragraph measure="none">
230
+ {sent.length === 0
231
+ ? `${workspace} is ready. No invites were sent. You can invite your team later in Settings, under Members.`
232
+ : `${workspace} is ready. Invites went to ${sent.length} ${sent.length === 1 ? 'person' : 'people'}.`}
233
+ </Paragraph>
234
+ <Cluster gap="small" justify="between">
235
+ <Button size="medium" type="tertiary" state="enabled" label="Back" decoIcon="ChevronLeft" onClickButton={back} />
236
+ {/* A real app goes to the new workspace. */}
237
+ <Button size="medium" type="primary" state="enabled" label="Go to Workspace" href="/workspace" />
238
+ </Cluster>
239
+ </Stack>
240
+ )}
241
+ </Center>
242
+ );
243
+ }
244
+ ```
245
+
246
+ ## Option: Checklist on the home page
247
+
248
+ Use when: Things to set up that can wait, shown on the home page until they are done.
249
+
250
+ Uses: `Alert`, `Button`, `Center`, `Cluster`, `Heading`, `Paragraph`, `Progress`, `SettingsSection`, `Stack`, `StepList`, `Toaster`, `dismissToast`, `toast`
251
+
252
+ ```tsx
253
+ 'use client';
254
+ import { useEffect, useRef, useState } from 'react';
255
+ import Toaster, { toast, dismissToast } from 'oneslash-design-system/components/toaster';
256
+ import Heading from 'oneslash-design-system/components/heading';
257
+ import Paragraph from 'oneslash-design-system/components/paragraph';
258
+ import SettingsSection from 'oneslash-design-system/components/settingsSection';
259
+ import StepList from 'oneslash-design-system/components/stepList';
260
+ import Progress from 'oneslash-design-system/components/progress';
261
+ import Alert from 'oneslash-design-system/components/alert';
262
+ import Button from 'oneslash-design-system/components/button';
263
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
264
+
265
+ type Task = { id: string; label: string; detail: string; action: string; href: string; done: boolean };
266
+
267
+ // Things to set up that can wait. The app works without them. A real app reads them from the server.
268
+ const first: Task[] = [
269
+ { id: 'workspace', label: 'Name your workspace', detail: 'Done Nov 14, 2026', action: 'Rename Workspace', href: '/settings/workspace', done: true },
270
+ { id: 'invite', label: 'Invite your team', detail: 'Done Nov 14, 2026', action: 'Invite People', href: '/settings/members', done: true },
271
+ { id: 'calendar', label: 'Connect a calendar', detail: 'In Settings, under Integrations', action: 'Connect Calendar', href: '/settings/integrations', done: false },
272
+ { id: 'project', label: 'Create your first project', detail: 'On the Projects page', action: 'Create Project', href: '/projects/new', done: false },
273
+ ];
274
+
275
+ type Focusable = HTMLButtonElement | HTMLAnchorElement | null;
276
+
277
+ export default function OnboardingChecklist() {
278
+ const [tasks, setTasks] = useState(first);
279
+ const [hidden, setHidden] = useState(false);
280
+ const page = useRef<HTMLHeadingElement>(null);
281
+ const hideButton = useRef<Focusable>(null);
282
+ const firstAction = useRef<Focusable>(null);
283
+ const toastIds = useRef<string[]>([]);
284
+ // Where focus goes after the next render, once the element it goes to is on screen.
285
+ const focusNext = useRef<() => void>();
286
+
287
+ // On unmount it closes every toast it opened.
288
+ useEffect(() => () => {
289
+ toastIds.current.forEach((id) => dismissToast(id));
290
+ toastIds.current = [];
291
+ }, []);
292
+
293
+ useEffect(() => {
294
+ const move = focusNext.current;
295
+ focusNext.current = undefined;
296
+ move?.();
297
+ });
298
+
299
+ const done = tasks.filter((t) => t.done).length;
300
+ const waiting = tasks.filter((t) => !t.done);
301
+ const allDone = waiting.length === 0;
302
+
303
+ // A real app lets the link go to its page, and the step is done when the person comes back.
304
+ // The example marks it done here, so the end of the checklist shows.
305
+ function finish(event: { preventDefault: () => void }, id: string) {
306
+ event.preventDefault();
307
+ const next = tasks.map((t) => (t.id === id ? { ...t, done: true, detail: 'Done Nov 16, 2026' } : t));
308
+ setTasks(next);
309
+ // The pressed link goes away. Focus goes to the next link, or to 'Hide Checklist' after the last one.
310
+ focusNext.current = next.every((t) => t.done)
311
+ ? () => hideButton.current?.focus({ preventScroll: true })
312
+ : () => firstAction.current?.focus({ preventScroll: true });
313
+ }
314
+
315
+ // The checklist leaves the home page for good. Its Button goes with it, so focus goes to the page's heading.
316
+ function hide() {
317
+ setHidden(true);
318
+ toastIds.current.push(toast({ type: 'success', message: 'Setup checklist hidden.' }));
319
+ focusNext.current = () => page.current?.focus({ preventScroll: true });
320
+ }
321
+
322
+ return (
323
+ <Center width="page">
324
+ <Stack gap="xlarge">
325
+ <Heading ref={page} tabIndex={-1} level={1} size="h5">Home</Heading>
326
+ {!hidden && (
327
+ <SettingsSection title="Set up Acme" description="The app works without these. Finish them when you are ready." id="onboarding-checklist-setup">
328
+ <Stack gap="large">
329
+ <Progress kind="share" label="Set up" value={done} max={tasks.length} valueText={`${done} of ${tasks.length} done`} />
330
+ <StepList aria-label="Setup steps" steps={tasks.map((t) => ({ label: t.label, detail: t.detail, status: t.done ? 'done' : 'waiting' }))} />
331
+ {allDone ? (
332
+ <Stack gap="medium" align="start">
333
+ {/* An inline Alert is a polite status, so a screen reader hears it. */}
334
+ <Alert variant="inline" type="success" autoDismiss={false} message="Acme is set up." />
335
+ <Button ref={hideButton} size="small" type="tertiary" state="enabled" label="Hide Checklist" onClickButton={hide} />
336
+ </Stack>
337
+ ) : (
338
+ // Each waiting step links to the place where it is done.
339
+ <Cluster gap="small">
340
+ {waiting.map((t, i) => (
341
+ <Button
342
+ key={t.id}
343
+ ref={i === 0 ? firstAction : undefined}
344
+ size="small"
345
+ type="secondary"
346
+ state="enabled"
347
+ label={t.action}
348
+ href={t.href}
349
+ onClickButton={(event: { preventDefault: () => void }) => finish(event, t.id)}
350
+ />
351
+ ))}
352
+ </Cluster>
353
+ )}
354
+ </Stack>
355
+ </SettingsSection>
356
+ )}
357
+ <Paragraph tone="secondary" measure="none">Your projects and comments show here.</Paragraph>
358
+ </Stack>
359
+ {/* A real app mounts one Toaster near its root. */}
360
+ <Toaster />
361
+ </Center>
362
+ );
363
+ }
364
+ ```
365
+
366
+ ## Native
367
+
368
+ On Apple show the steps as a `NavigationStack` that pushes one `Form` per step, with Back in the navigation bar and Continue in a bottom bar, and post a screen-changed accessibility notification on each step. On Android use one screen per step with a `TopAppBar` back arrow, and the checklist as a card on the home screen.
@@ -26,7 +26,7 @@ export default function PeopleRowStack() {
26
26
  </Stack>
27
27
  <AvatarStack people={people} aria-label={"Show the ".concat(people.length, " people in this thread")} aria-haspopup="dialog" aria-expanded={anchor !== null} onClick={function (event) { return setAnchor(anchor ? null : event.currentTarget); }}/>
28
28
  </Cluster>
29
- <Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={function () { return setAnchor(null); }} returnFocus>
29
+ <Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={function () { return setAnchor(null); }} returnFocus aria-label="People in this thread">
30
30
  <List items={people.map(function (p) { return "".concat(p.name, ", ").concat(p.role); })}/>
31
31
  </Popover>
32
32
  </Stack>);
@@ -6,7 +6,7 @@ A thread or a task shows who is on it, and the person can find out who they all
6
6
 
7
7
  - Use `AvatarStack` for four or more people. Past `max` its last circle counts the rest, such as '+3'.
8
8
  - Make the stack one button with `onClick`, and name it for what it opens: 'Show the 6 people in this thread'.
9
- - Open a `<Popover returnFocus>` from the stack with a `List` of every name and role, such as 'Ben Carter, Admin'. Escape or a click outside closes it, and Escape puts focus back on the stack.
9
+ - Open a `<Popover returnFocus aria-label="People in this thread">` from the stack with a `List` of every name and role, such as 'Ben Carter, Admin'. Escape or a click outside closes it, and Escape puts focus back on the stack.
10
10
  - Show one to three people as faces and their names: 'Dana Lee, Ben Carter and Omar Reyes'. Make each face `UserImage decorative`, because the names say who is there.
11
11
  - Keep the same order everywhere, the person who started the item first.
12
12
  - Use the person's name as `userHandle`, so a person with no picture shows their initial.
@@ -62,7 +62,7 @@ export default function PeopleRowStack() {
62
62
  onClick={(event) => setAnchor(anchor ? null : event.currentTarget)}
63
63
  />
64
64
  </Cluster>
65
- <Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={() => setAnchor(null)} returnFocus>
65
+ <Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={() => setAnchor(null)} returnFocus aria-label="People in this thread">
66
66
  <List items={people.map((p) => `${p.name}, ${p.role}`)} />
67
67
  </Popover>
68
68
  </Stack>
@@ -0,0 +1 @@
1
+ export default function PlanComparisonTable(): import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+ import PageShell from '../../components/pageShell';
3
+ import SectionIntro from '../../components/sectionIntro';
4
+ import TableContainer from '../../components/tableContainer';
5
+ import TableHeader from '../../components/tableHeader';
6
+ import TableHeaderCell from '../../components/tableHeaderCell';
7
+ import TableRow from '../../components/tableRow';
8
+ import TableCell from '../../components/tableCell';
9
+ import { formatMoney } from '../../components/formatNumber';
10
+ import { PageSection } from '../../components/layout';
11
+ // The same plans as the cases 'Plan picker' and 'Pricing section': names, prices and what each includes. A real site reads them from one place.
12
+ var plans = [
13
+ { id: 'free', name: 'Free', price: "".concat(formatMoney(0), " per month"), includes: ['3 members', '50 AI agent responses a month', '1 GB of storage'] },
14
+ { id: 'pro', name: 'Pro', price: "".concat(formatMoney(8), " per member per month"), includes: ['Unlimited members', '1,000 AI agent responses a month', '50 GB of storage', 'Export to PDF'] },
15
+ { id: 'business', name: 'Business', price: "".concat(formatMoney(16), " per member per month"), includes: ['Unlimited members', '10,000 AI agent responses a month', '500 GB of storage', 'Export to PDF', 'Priority support'] },
16
+ ];
17
+ // One row per limit. A cell is the plan's own words for it, 'Included' when the plan has the feature, or 'Not included'.
18
+ var rows = [
19
+ { feature: 'Price', cells: { free: "".concat(formatMoney(0), " per month"), pro: "".concat(formatMoney(8), " per member per month"), business: "".concat(formatMoney(16), " per member per month") } },
20
+ { feature: 'Members', cells: { free: '3 members', pro: 'Unlimited members', business: 'Unlimited members' } },
21
+ { feature: 'AI agent responses', cells: { free: '50 AI agent responses a month', pro: '1,000 AI agent responses a month', business: '10,000 AI agent responses a month' } },
22
+ { feature: 'Storage', cells: { free: '1 GB of storage', pro: '50 GB of storage', business: '500 GB of storage' } },
23
+ { feature: 'Export to PDF', cells: { free: 'Not included', pro: 'Included', business: 'Included' } },
24
+ { feature: 'Priority support', cells: { free: 'Not included', pro: 'Not included', business: 'Included' } },
25
+ ];
26
+ export default function PlanComparisonTable() {
27
+ return (<PageShell>
28
+ <PageSection gap="xxlarge">
29
+ <SectionIntro name="Compare plans"/>
30
+ {/* A named region that scrolls sideways on a phone, so the page never does. The header row stays at every width. */}
31
+ {/* No Buttons here: the plan cards above the table hold the one action for each plan. */}
32
+ <TableContainer aria-label="Compare plans" minWidth="40rem">
33
+ <TableHeader>
34
+ <TableRow>
35
+ <TableHeaderCell>Feature</TableHeaderCell>
36
+ {plans.map(function (p) { return (<TableHeaderCell key={p.id}>{p.name}</TableHeaderCell>); })}
37
+ </TableRow>
38
+ </TableHeader>
39
+ {rows.map(function (row) { return (<TableRow key={row.feature}>
40
+ {/* The feature names its row, so a screen reader says it with each cell. */}
41
+ <TableCell rowHeader>{row.feature}</TableCell>
42
+ {plans.map(function (p) { return (<TableCell key={p.id}>{row.cells[p.id]}</TableCell>); })}
43
+ </TableRow>); })}
44
+ </TableContainer>
45
+ </PageSection>
46
+ </PageShell>);
47
+ }
@@ -0,0 +1,94 @@
1
+ # Plan comparison
2
+
3
+ A visitor to the public site wants to see every limit of every plan side by side before signing up.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'A number shows its unit and never shows 0 for unknown'.
8
+ - Show the same plans as the case 'Plan picker', word for word: the names, the prices and what each includes.
9
+ - Open the section with `SectionIntro` 'Compare plans', under the plan cards of the case 'Pricing section'.
10
+ - Put the table in `TableContainer aria-label="Compare plans" minWidth="40rem"`. It is a named region that scrolls sideways on a phone, as in the case 'Data table page', so the page never does.
11
+ - Put the plan names in the header row, after 'Feature', with one `TableHeaderCell` for each plan.
12
+ - Put the features in the first column, each in `TableCell rowHeader`, so a screen reader says the feature with each cell: Price, Members, AI agent responses, Storage, Export to PDF and Priority support.
13
+ - Write each cell in the plan's own words, such as 'Unlimited members'. Say what a plan has as 'Included' and what is missing as 'Not included'.
14
+ - Leave Buttons out of the table. The plan cards above it hold the one action for each plan, as the rule 'A marketing page asks for one main action, in the same words everywhere' says.
15
+
16
+ ## Don't
17
+
18
+ - Do not show a check mark or a cross with no words.
19
+ - Do not build the table from a grid of boxes. A screen reader cannot read it as a table.
20
+ - Do not hide the header row on a phone. Let the table scroll sideways in its region.
21
+ - Do not put a Button in every column.
22
+ - Do not change a price or a limit here without changing it in the cases 'Plan picker' and 'Pricing section' too.
23
+ - Do not dim the other columns with tabs. Every plan stays in view.
24
+
25
+ ## Example: Table under the plan cards
26
+
27
+ Uses: `PageSection`, `PageShell`, `SectionIntro`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `formatMoney`
28
+
29
+ ```tsx
30
+ 'use client';
31
+ import PageShell from 'oneslash-design-system/components/pageShell';
32
+ import SectionIntro from 'oneslash-design-system/components/sectionIntro';
33
+ import TableContainer from 'oneslash-design-system/components/tableContainer';
34
+ import TableHeader from 'oneslash-design-system/components/tableHeader';
35
+ import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
36
+ import TableRow from 'oneslash-design-system/components/tableRow';
37
+ import TableCell from 'oneslash-design-system/components/tableCell';
38
+ import { formatMoney } from 'oneslash-design-system/components/formatNumber';
39
+ import { PageSection } from 'oneslash-design-system/components/layout';
40
+
41
+ type PlanId = 'free' | 'pro' | 'business';
42
+
43
+ // The same plans as the cases 'Plan picker' and 'Pricing section': names, prices and what each includes. A real site reads them from one place.
44
+ const plans: { id: PlanId; name: string; price: string; includes: string[] }[] = [
45
+ { id: 'free', name: 'Free', price: `${formatMoney(0)} per month`, includes: ['3 members', '50 AI agent responses a month', '1 GB of storage'] },
46
+ { id: 'pro', name: 'Pro', price: `${formatMoney(8)} per member per month`, includes: ['Unlimited members', '1,000 AI agent responses a month', '50 GB of storage', 'Export to PDF'] },
47
+ { id: 'business', name: 'Business', price: `${formatMoney(16)} per member per month`, includes: ['Unlimited members', '10,000 AI agent responses a month', '500 GB of storage', 'Export to PDF', 'Priority support'] },
48
+ ];
49
+
50
+ // One row per limit. A cell is the plan's own words for it, 'Included' when the plan has the feature, or 'Not included'.
51
+ const rows: { feature: string; cells: Record<PlanId, string> }[] = [
52
+ { feature: 'Price', cells: { free: `${formatMoney(0)} per month`, pro: `${formatMoney(8)} per member per month`, business: `${formatMoney(16)} per member per month` } },
53
+ { feature: 'Members', cells: { free: '3 members', pro: 'Unlimited members', business: 'Unlimited members' } },
54
+ { feature: 'AI agent responses', cells: { free: '50 AI agent responses a month', pro: '1,000 AI agent responses a month', business: '10,000 AI agent responses a month' } },
55
+ { feature: 'Storage', cells: { free: '1 GB of storage', pro: '50 GB of storage', business: '500 GB of storage' } },
56
+ { feature: 'Export to PDF', cells: { free: 'Not included', pro: 'Included', business: 'Included' } },
57
+ { feature: 'Priority support', cells: { free: 'Not included', pro: 'Not included', business: 'Included' } },
58
+ ];
59
+
60
+ export default function PlanComparisonTable() {
61
+ return (
62
+ <PageShell>
63
+ <PageSection gap="xxlarge">
64
+ <SectionIntro name="Compare plans" />
65
+ {/* A named region that scrolls sideways on a phone, so the page never does. The header row stays at every width. */}
66
+ {/* No Buttons here: the plan cards above the table hold the one action for each plan. */}
67
+ <TableContainer aria-label="Compare plans" minWidth="40rem">
68
+ <TableHeader>
69
+ <TableRow>
70
+ <TableHeaderCell>Feature</TableHeaderCell>
71
+ {plans.map((p) => (
72
+ <TableHeaderCell key={p.id}>{p.name}</TableHeaderCell>
73
+ ))}
74
+ </TableRow>
75
+ </TableHeader>
76
+ {rows.map((row) => (
77
+ <TableRow key={row.feature}>
78
+ {/* The feature names its row, so a screen reader says it with each cell. */}
79
+ <TableCell rowHeader>{row.feature}</TableCell>
80
+ {plans.map((p) => (
81
+ <TableCell key={p.id}>{row.cells[p.id]}</TableCell>
82
+ ))}
83
+ </TableRow>
84
+ ))}
85
+ </TableContainer>
86
+ </PageSection>
87
+ </PageShell>
88
+ );
89
+ }
90
+ ```
91
+
92
+ ## Native
93
+
94
+ On Apple an app has no pricing page. The plans are in the app as a `List` with the system purchase sheet, as the case 'Plan picker' says. On iPad or Mac, a `Table` with the plans as columns works too.
@@ -21,6 +21,7 @@ An admin compares the plans a workspace can be on and chooses one.
21
21
  - Do not add a monthly and yearly switch when no plan bills yearly.
22
22
  - Do not change a Button label to show it is busy, such as to 'Checking...'.
23
23
  - Do not charge or change the plan from this page. The confirm does that.
24
+ - Do not change a price or a limit here without changing it in the cases 'Pricing section' and 'Plan comparison' too.
24
25
 
25
26
  ## Option: Cards side by side
26
27
 
@@ -0,0 +1 @@
1
+ export default function PlanSignOffOneApprover(): import("react").JSX.Element;