oneslash-design-system 2.17.0 → 2.18.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 (185) hide show
  1. package/README.md +2 -2
  2. package/dist/DESIGN.md +30 -14
  3. package/dist/cases/accept-invite.md +1 -5
  4. package/dist/cases/account-menu/menu.d.ts +1 -0
  5. package/dist/cases/account-menu/menu.jsx +99 -0
  6. package/dist/cases/account-menu.md +164 -0
  7. package/dist/cases/agent-asks-before-risky-action.md +0 -4
  8. package/dist/cases/agent-cancels-when-unanswered.md +0 -4
  9. package/dist/cases/agent-options.md +0 -4
  10. package/dist/cases/agent-pending-reply.md +0 -4
  11. package/dist/cases/agent-plan-proposal.md +0 -4
  12. package/dist/cases/agent-question.md +0 -4
  13. package/dist/cases/agent-refuses-clearly.md +0 -4
  14. package/dist/cases/agent-says-what-it-is.md +0 -2
  15. package/dist/cases/agent-settings/form.d.ts +1 -0
  16. package/dist/cases/agent-settings/form.jsx +164 -0
  17. package/dist/cases/agent-settings.md +259 -0
  18. package/dist/cases/agent-shows-progress.md +0 -2
  19. package/dist/cases/agent-shows-sources.md +0 -2
  20. package/dist/cases/api-keys/list.d.ts +1 -0
  21. package/dist/cases/api-keys/list.jsx +162 -0
  22. package/dist/cases/api-keys.md +229 -0
  23. package/dist/cases/artifact-card.md +0 -4
  24. package/dist/cases/auth-gate-loading.md +0 -4
  25. package/dist/cases/check-your-email.md +0 -4
  26. package/dist/cases/collapsible-search/popover.d.ts +1 -0
  27. package/dist/cases/collapsible-search/popover.jsx +74 -0
  28. package/dist/cases/collapsible-search.md +143 -0
  29. package/dist/cases/composer-limit.md +0 -4
  30. package/dist/cases/confirm-destructive-action.md +0 -4
  31. package/dist/cases/confirm-dialogs.md +0 -4
  32. package/dist/cases/conversation-starters.md +0 -4
  33. package/dist/cases/create-modal.md +0 -4
  34. package/dist/cases/danger-zone/collapsed.d.ts +1 -0
  35. package/dist/cases/danger-zone/collapsed.jsx +75 -0
  36. package/dist/cases/danger-zone/shown.d.ts +1 -0
  37. package/dist/cases/danger-zone/shown.jsx +95 -0
  38. package/dist/cases/danger-zone.md +263 -0
  39. package/dist/cases/device-login.md +0 -4
  40. package/dist/cases/email-confirmed.md +0 -4
  41. package/dist/cases/empty-list.md +0 -4
  42. package/dist/cases/empty-lists.md +0 -4
  43. package/dist/cases/empty-not-set-up.md +0 -4
  44. package/dist/cases/empty-search.md +0 -4
  45. package/dist/cases/error-page.md +0 -4
  46. package/dist/cases/feedback-form.md +0 -4
  47. package/dist/cases/filter-menu/presets.d.ts +1 -0
  48. package/dist/cases/filter-menu/presets.jsx +53 -0
  49. package/dist/cases/filter-menu/with-clear.d.ts +1 -0
  50. package/dist/cases/filter-menu/with-clear.jsx +56 -0
  51. package/dist/cases/filter-menu.md +204 -0
  52. package/dist/cases/forgot-password.md +0 -4
  53. package/dist/cases/form-errors.md +0 -4
  54. package/dist/cases/import-checklist.md +0 -4
  55. package/dist/cases/inline-form-feedback.md +0 -4
  56. package/dist/cases/integrations-list/nested.d.ts +1 -0
  57. package/dist/cases/integrations-list/nested.jsx +164 -0
  58. package/dist/cases/integrations-list/rows.d.ts +1 -0
  59. package/dist/cases/integrations-list/rows.jsx +134 -0
  60. package/dist/cases/integrations-list.md +379 -0
  61. package/dist/cases/invite-member.md +0 -4
  62. package/dist/cases/load-failure.md +0 -4
  63. package/dist/cases/log-out-confirm.md +0 -4
  64. package/dist/cases/login-page.md +0 -4
  65. package/dist/cases/members-list/rows.d.ts +1 -0
  66. package/dist/cases/members-list/rows.jsx +318 -0
  67. package/dist/cases/members-list/table.d.ts +1 -0
  68. package/dist/cases/members-list/table.jsx +351 -0
  69. package/dist/cases/members-list.md +799 -0
  70. package/dist/cases/mention-list.md +0 -4
  71. package/dist/cases/message-actions.md +0 -4
  72. package/dist/cases/message-attachments.md +0 -4
  73. package/dist/cases/message-composer.md +0 -4
  74. package/dist/cases/message-edit.md +0 -4
  75. package/dist/cases/message-reactions.md +0 -4
  76. package/dist/cases/message-row.md +0 -4
  77. package/dist/cases/not-found-page.md +0 -4
  78. package/dist/cases/notification-menu/menu.d.ts +1 -0
  79. package/dist/cases/notification-menu/menu.jsx +74 -0
  80. package/dist/cases/notification-menu.md +135 -0
  81. package/dist/cases/oauth-consent.md +0 -4
  82. package/dist/cases/on-off-settings/list.d.ts +1 -0
  83. package/dist/cases/on-off-settings/list.jsx +97 -0
  84. package/dist/cases/on-off-settings.md +116 -0
  85. package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
  86. package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
  87. package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
  88. package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
  89. package/dist/cases/overflow-menu.md +410 -0
  90. package/dist/cases/profile-form/form.d.ts +1 -0
  91. package/dist/cases/profile-form/form.jsx +153 -0
  92. package/dist/cases/profile-form.md +236 -0
  93. package/dist/cases/quick-switcher/modal.d.ts +1 -0
  94. package/dist/cases/quick-switcher/modal.jsx +114 -0
  95. package/dist/cases/quick-switcher.md +205 -0
  96. package/dist/cases/range-switch/segmented.d.ts +1 -0
  97. package/dist/cases/range-switch/segmented.jsx +30 -0
  98. package/dist/cases/range-switch.md +67 -0
  99. package/dist/cases/rename.md +0 -4
  100. package/dist/cases/reply-feedback.md +0 -4
  101. package/dist/cases/reply-sources.md +0 -4
  102. package/dist/cases/route-loading.md +0 -2
  103. package/dist/cases/scope-picker/menu.d.ts +1 -0
  104. package/dist/cases/scope-picker/menu.jsx +47 -0
  105. package/dist/cases/scope-picker.md +97 -0
  106. package/dist/cases/set-new-password.md +0 -4
  107. package/dist/cases/settings-page/side-nav.d.ts +1 -0
  108. package/dist/cases/settings-page/side-nav.jsx +171 -0
  109. package/dist/cases/settings-page/top-tabs.d.ts +1 -0
  110. package/dist/cases/settings-page/top-tabs.jsx +129 -0
  111. package/dist/cases/settings-page.md +378 -0
  112. package/dist/cases/settings-save.md +35 -0
  113. package/dist/cases/sign-up-page.md +1 -5
  114. package/dist/cases/slash-command-list.md +0 -4
  115. package/dist/cases/success-feedback.md +0 -4
  116. package/dist/cases/tag-filter/tags.d.ts +1 -0
  117. package/dist/cases/tag-filter/tags.jsx +226 -0
  118. package/dist/cases/tag-filter.md +298 -0
  119. package/dist/cases/type-to-confirm.md +0 -4
  120. package/dist/cases/typing-and-status.md +0 -4
  121. package/dist/cases/unsaved-changes-guard.md +0 -4
  122. package/dist/cases/upgrade-prompt.md +0 -4
  123. package/dist/cases.json +1038 -263
  124. package/dist/components/alert.d.ts +3 -1
  125. package/dist/components/alert.jsx +2 -2
  126. package/dist/components/button.jsx +5 -2
  127. package/dist/components/checkBox.d.ts +5 -1
  128. package/dist/components/checkBox.jsx +2 -2
  129. package/dist/components/copyField.d.ts +20 -0
  130. package/dist/components/copyField.jsx +99 -0
  131. package/dist/components/formField.d.ts +34 -0
  132. package/dist/components/formField.jsx +28 -0
  133. package/dist/components/heading.d.ts +3 -1
  134. package/dist/components/heading.jsx +2 -2
  135. package/dist/components/menu.jsx +2 -2
  136. package/dist/components/menuItem.d.ts +4 -2
  137. package/dist/components/menuItem.jsx +3 -3
  138. package/dist/components/navigation.d.ts +9 -1
  139. package/dist/components/navigation.jsx +15 -3
  140. package/dist/components/radioGroup.d.ts +5 -1
  141. package/dist/components/radioGroup.jsx +2 -2
  142. package/dist/components/segmentedControl.d.ts +22 -0
  143. package/dist/components/segmentedControl.jsx +54 -0
  144. package/dist/components/select.d.ts +5 -1
  145. package/dist/components/select.jsx +2 -2
  146. package/dist/components/settingsSection.d.ts +31 -0
  147. package/dist/components/settingsSection.jsx +58 -0
  148. package/dist/components/slidingIndicator.d.ts +50 -0
  149. package/dist/components/slidingIndicator.jsx +102 -0
  150. package/dist/components/switch.d.ts +25 -0
  151. package/dist/components/switch.jsx +55 -0
  152. package/dist/components/tab.jsx +5 -11
  153. package/dist/components/tabsContainer.jsx +5 -67
  154. package/dist/components/textField.d.ts +12 -2
  155. package/dist/components/textField.jsx +11 -4
  156. package/dist/components/textarea.d.ts +5 -1
  157. package/dist/components/textarea.jsx +3 -3
  158. package/dist/components/useHotkey.d.ts +7 -0
  159. package/dist/components/useHotkey.js +24 -0
  160. package/dist/index.d.ts +6 -0
  161. package/dist/index.js +6 -0
  162. package/dist/internal/copyField.d.ts +5 -0
  163. package/dist/internal/copyField.js +61 -0
  164. package/dist/internal/hotkey.d.ts +16 -0
  165. package/dist/internal/hotkey.js +20 -0
  166. package/dist/internal/switch.d.ts +5 -0
  167. package/dist/internal/switch.js +9 -0
  168. package/dist/native-mapping.json +30 -0
  169. package/dist/stories/Cases.generated.stories.d.ts +23 -0
  170. package/dist/stories/Cases.generated.stories.jsx +46 -0
  171. package/dist/stories/CopyField.stories.d.ts +11 -0
  172. package/dist/stories/CopyField.stories.jsx +65 -0
  173. package/dist/stories/FormField.stories.d.ts +6 -0
  174. package/dist/stories/FormField.stories.jsx +44 -0
  175. package/dist/stories/Navigation.stories.d.ts +1 -0
  176. package/dist/stories/Navigation.stories.jsx +17 -1
  177. package/dist/stories/SegmentedControl.stories.d.ts +8 -0
  178. package/dist/stories/SegmentedControl.stories.jsx +33 -0
  179. package/dist/stories/SettingsSection.stories.d.ts +11 -0
  180. package/dist/stories/SettingsSection.stories.jsx +64 -0
  181. package/dist/stories/Switch.stories.d.ts +14 -0
  182. package/dist/stories/Switch.stories.jsx +87 -0
  183. package/dist/stories/TextField.stories.d.ts +1 -0
  184. package/dist/stories/TextField.stories.jsx +13 -0
  185. package/package.json +5 -1
@@ -0,0 +1,229 @@
1
+ # API keys
2
+
3
+ A person makes keys that let a script or a service use the product as them, and revokes keys they no longer use.
4
+
5
+ ## Do
6
+
7
+ - List each key with its name, the start of the key in the mono face, when it was created and when it was last used. Say 'Never used' when it was not.
8
+ - Show only a prefix of 14 characters in the list, with an ellipsis. Never show a whole key again once the Modal is closed.
9
+ - Open a Modal titled 'Create Key' from a 'Create Key' Button, with one field, 'Name', and 'Cancel' then 'Create'.
10
+ - Say under the name what to put in it: 'Say what will use it, such as CI pipeline.'
11
+ - Keep the Modal open when the key is made, change its title to 'Key Created' and show the key in a `CopyField` with `reveal="once"` and `mono`. The field says 'Copy it now. You will not see it again.'
12
+ - Give the Modal one Button, 'Done'. Ignore Escape and a click outside while the key shows, so a stray click cannot lose it.
13
+ - Confirm 'Revoke' in the row, as the case 'Delete confirm' does: the row asks 'Revoke CI pipeline?' and shows 'Cancel' and a danger 'Revoke'. Then show a toast: 'CI pipeline key revoked.'
14
+ - Give each row's 'Revoke', and the confirm's 'Cancel' and 'Revoke', an `aria-label` that names the key: 'Revoke CI pipeline' and 'Cancel revoking CI pipeline'.
15
+ - Show `EmptyBox` with 'No API keys' when the list is empty, as the rule 'An empty list says what is empty' says.
16
+ - Disable the name field while the key is made, and show `loading` on the Button without changing its label.
17
+
18
+ ## Don't
19
+
20
+ - Do not show a whole key in the list, in a toast or in a URL.
21
+ - Do not revoke a key on the first click.
22
+ - Do not label the Button 'Create' on the page. Name the thing: 'Create Key'.
23
+ - Do not close the Modal when the key is made, because the person has not copied it yet.
24
+ - Do not put the key in a plain field the person has to select by hand. Use `CopyField`.
25
+ - Do not use an icon-only Button for Revoke. It names no key.
26
+
27
+ ## Example: A list of keys with a create Modal
28
+
29
+ Uses: `Button`, `Center`, `Cluster`, `CopyField`, `EmptyBox`, `Form`, `Heading`, `Modal`, `Paragraph`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `TextField`, `Toaster`, `dismissToast`, `toast`
30
+
31
+ ```tsx
32
+ 'use client';
33
+ import { useEffect, useRef, useState } from 'react';
34
+ import Toaster, { toast, dismissToast } from 'oneslash-design-system/components/toaster';
35
+ import Modal from 'oneslash-design-system/components/modal';
36
+ import Heading from 'oneslash-design-system/components/heading';
37
+ import Paragraph from 'oneslash-design-system/components/paragraph';
38
+ import TableContainer from 'oneslash-design-system/components/tableContainer';
39
+ import TableHeader from 'oneslash-design-system/components/tableHeader';
40
+ import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
41
+ import TableRow from 'oneslash-design-system/components/tableRow';
42
+ import TableCell from 'oneslash-design-system/components/tableCell';
43
+ import Form from 'oneslash-design-system/components/form';
44
+ import TextField from 'oneslash-design-system/components/textField';
45
+ import CopyField from 'oneslash-design-system/components/copyField';
46
+ import EmptyBox from 'oneslash-design-system/components/emptyBox';
47
+ import Button from 'oneslash-design-system/components/button';
48
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
49
+
50
+ type Key = { id: string; name: string; prefix: string; created: string; lastUsed: string };
51
+
52
+ const firstKeys: Key[] = [
53
+ { id: 'k1', name: 'CI pipeline', prefix: 'acme_live_7Hd2', created: 'Oct 3, 2026', lastUsed: 'Today' },
54
+ { id: 'k2', name: 'Reporting script', prefix: 'acme_live_Qm4x', created: 'Aug 19, 2026', lastUsed: 'Nov 20, 2026' },
55
+ ];
56
+
57
+ // The key the server made. A real app gets it once, in the reply to the create request, and never again.
58
+ const madeKey = 'acme_live_4f9kQ27xLmT4vB8cRw1ZdN6yHs3P';
59
+ const prefixLength = 14;
60
+
61
+ export default function ApiKeysList() {
62
+ // Opens on the new key, as if the person just chose Create. The list already holds it, without the key.
63
+ const [keys, setKeys] = useState<Key[]>(() => [
64
+ { id: 'k3', name: 'Deploy bot', prefix: madeKey.slice(0, prefixLength), created: 'Today', lastUsed: 'Never used' },
65
+ ...firstKeys,
66
+ ]);
67
+ const [open, setOpen] = useState(true);
68
+ const [shownKey, setShownKey] = useState<string | null>(madeKey);
69
+ const [name, setName] = useState('');
70
+ const [nameError, setNameError] = useState('');
71
+ const [creating, setCreating] = useState(false);
72
+ const [confirming, setConfirming] = useState<string | null>(null);
73
+ const [revoking, setRevoking] = useState<string | null>(null);
74
+ const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
75
+ // Gives each new key its own id, so no two rows share a key.
76
+ const keyCount = useRef(0);
77
+ const toastIds = useRef<string[]>([]);
78
+
79
+ // On unmount it stops every request and closes every toast it opened.
80
+ useEffect(() => () => {
81
+ timers.current.forEach(clearTimeout);
82
+ toastIds.current.forEach((id) => dismissToast(id));
83
+ toastIds.current = [];
84
+ }, []);
85
+
86
+ // Stands in for the request to the server.
87
+ function later(callback: () => void, ms: number) {
88
+ timers.current.push(setTimeout(callback, ms));
89
+ }
90
+
91
+ function handleOpen() {
92
+ setName('');
93
+ setNameError('');
94
+ setShownKey(null);
95
+ setOpen(true);
96
+ }
97
+
98
+ // Escape, a click outside and Cancel close the first step, except while the request runs.
99
+ // Once the key shows, only 'Done' closes it, so a stray click cannot throw the key away.
100
+ function handleClose() {
101
+ if (creating || shownKey) return;
102
+ setOpen(false);
103
+ }
104
+
105
+ // 'Done' drops the key from the page. It is not kept anywhere else.
106
+ function handleDone() {
107
+ setOpen(false);
108
+ setShownKey(null);
109
+ }
110
+
111
+ function handleCreate() {
112
+ if (creating) return;
113
+ if (!name.trim()) {
114
+ setNameError('Enter a name for the key.');
115
+ return;
116
+ }
117
+ setNameError('');
118
+ setCreating(true);
119
+ later(() => {
120
+ setCreating(false);
121
+ keyCount.current += 1;
122
+ const id = `new-${keyCount.current}`;
123
+ setKeys((list) => [{ id, name: name.trim(), prefix: madeKey.slice(0, prefixLength), created: 'Today', lastUsed: 'Never used' }, ...list]);
124
+ setShownKey(madeKey);
125
+ }, 1200);
126
+ }
127
+
128
+ function handleRevoke(key: Key) {
129
+ if (revoking) return;
130
+ setRevoking(key.id);
131
+ later(() => {
132
+ setRevoking(null);
133
+ setConfirming(null);
134
+ setKeys((list) => list.filter((k) => k.id !== key.id));
135
+ toastIds.current.push(toast({ type: 'success', message: `${key.name} key revoked.` }));
136
+ }, 1200);
137
+ }
138
+
139
+ return (
140
+ <Center width="page">
141
+ {/* A real app mounts one Toaster near its root. */}
142
+ <Toaster />
143
+ <Stack gap="large">
144
+ <Stack gap="small">
145
+ <Cluster justify="between">
146
+ <Heading level={1} size="h5">API keys</Heading>
147
+ <Button size="small" type="primary" state="enabled" label="Create Key" decoIcon="Plus" onClickButton={handleOpen} />
148
+ </Cluster>
149
+ <Paragraph tone="secondary" size="body2" measure="none">Keys let a script or a service use Acme as you. The list shows the start of each key, never the whole key.</Paragraph>
150
+ </Stack>
151
+
152
+ {keys.length > 0 ? (
153
+ <TableContainer>
154
+ <TableHeader>
155
+ <TableRow>
156
+ <TableHeaderCell>Name</TableHeaderCell>
157
+ <TableHeaderCell width="150px">Key</TableHeaderCell>
158
+ <TableHeaderCell width="100px">Created</TableHeaderCell>
159
+ <TableHeaderCell width="100px">Last used</TableHeaderCell>
160
+ <TableHeaderCell width="200px">Actions</TableHeaderCell>
161
+ </TableRow>
162
+ </TableHeader>
163
+ {keys.map((k) => (
164
+ <TableRow key={k.id}>
165
+ <TableCell>{k.name}</TableCell>
166
+ <TableCell width="150px">
167
+ <Paragraph mono size="body2" measure="none">{k.prefix}…</Paragraph>
168
+ </TableCell>
169
+ <TableCell width="100px">{k.created}</TableCell>
170
+ <TableCell width="100px">{k.lastUsed}</TableCell>
171
+ {/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
172
+ <TableCell width="200px">
173
+ {confirming === k.id ? (
174
+ <Stack gap="small">
175
+ <Paragraph size="body2" measure="none">Revoke {k.name}?</Paragraph>
176
+ <Cluster gap="small">
177
+ <Button size="small" type="tertiary" state={revoking === k.id ? 'disabled' : 'enabled'} label="Cancel" aria-label={`Cancel revoking ${k.name}`} onClickButton={() => setConfirming(null)} />
178
+ <Button size="small" type="primary" color="danger" state="enabled" label="Revoke" aria-label={`Revoke ${k.name}`} loading={revoking === k.id} onClickButton={() => handleRevoke(k)} />
179
+ </Cluster>
180
+ </Stack>
181
+ ) : (
182
+ <Button size="small" type="tertiary" state={revoking ? 'disabled' : 'enabled'} label="Revoke" aria-label={`Revoke ${k.name}`} onClickButton={() => setConfirming(k.id)} />
183
+ )}
184
+ </TableCell>
185
+ </TableRow>
186
+ ))}
187
+ </TableContainer>
188
+ ) : (
189
+ <EmptyBox size="small" icon="KeyRound" text="No API keys" secondText="Keys you create appear here." />
190
+ )}
191
+ </Stack>
192
+
193
+ <Modal
194
+ isOpen={open}
195
+ size="medium"
196
+ initialFocus="body"
197
+ title={shownKey ? 'Key Created' : 'Create Key'}
198
+ onClose={handleClose}
199
+ actions={
200
+ shownKey ? (
201
+ <Button size="small" type="primary" state="enabled" label="Done" onClickButton={handleDone} />
202
+ ) : (
203
+ <>
204
+ <Button size="small" type="tertiary" state={creating ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose} />
205
+ <Button size="small" type="primary" state="enabled" label="Create" loading={creating} onClickButton={handleCreate} />
206
+ </>
207
+ )
208
+ }
209
+ >
210
+ {shownKey ? (
211
+ <Stack gap="medium">
212
+ <Paragraph measure="none">Use this key where the service asks for one. Anyone who has it can use Acme as you.</Paragraph>
213
+ {/* `reveal="once"` adds the line that says the key will not show again. */}
214
+ <CopyField id="api-keys-key" label="API key" value={shownKey} mono reveal="once" />
215
+ </Stack>
216
+ ) : (
217
+ <Form aria-label="Create key" onSubmit={handleCreate}>
218
+ <TextField id="api-keys-name" label="Name" value={name} disabled={creating} error={Boolean(nameError)} errorText={nameError} helperText="Say what will use it, such as CI pipeline." onChange={(e) => { setName(e.target.value); setNameError(''); }} />
219
+ </Form>
220
+ )}
221
+ </Modal>
222
+ </Center>
223
+ );
224
+ }
225
+ ```
226
+
227
+ ## Native
228
+
229
+ On Apple use a `Table` with a monospaced prefix, a `.destructive` Button that asks in a `confirmationDialog`, and a sheet that shows the new key once with a Copy Button.
@@ -2,8 +2,6 @@
2
2
 
3
3
  The agent made a document for the person, such as a plan or a report.
4
4
 
5
- **Not built yet:** Scindo's card shows the kind, the title and 'Open' on one line, with no icon and no length. Its reply is not short: it is cut to its first lines.
6
-
7
5
  ## Do
8
6
 
9
7
  - Keep the reply to one sentence on what the agent made. Then put the card in the reply's `footer`.
@@ -99,5 +97,3 @@ export default function ArtifactCardCard() {
99
97
  ## Native
100
98
 
101
99
  On Mac the card opens the document in the canvas beside the thread. On iPhone it opens the document in a read-only sheet.
102
-
103
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  The app is checking whether the person is logged in, or running a step such as checking an invite, before it knows what to show.
4
4
 
5
- **Not built yet:** Scindo on the web shows 'Please wait' under the step while it checks an invite, and a small spinner instead of `LoadingScreen` while onboarding checks for a workspace.
6
-
7
5
  ## Do
8
6
 
9
7
  - Show the spinner from the first render, before anything else, as `LoadingScreen` in `Center` with `fill`.
@@ -66,5 +64,3 @@ export default function AuthGateLoadingSpinnerWithLine() {
66
64
  ## Native
67
65
 
68
66
  On Apple use `ProgressView()` centered in the window, with a label only for a named step that can take longer.
69
-
70
- Seen in: Commentify admin, Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person signed up, and the product sent a link to confirm their email.
4
4
 
5
- **Not built yet:** Neither Commentify nor Scindo can send the email again from the check-your-email screen. Both show their success Alert above the login form with a close button, and it starts 'Account created.', even for an address that already had an account.
6
-
7
5
  ## Do
8
6
 
9
7
  - Name the page 'Check your email' in a `Heading` with `level={1}`, with a `Mail` icon above it.
@@ -180,5 +178,3 @@ export default function CheckYourEmailAlertOnLogin() {
180
178
  );
181
179
  }
182
180
  ```
183
-
184
- Seen in: Commentify, Scindo.
@@ -0,0 +1 @@
1
+ export default function CollapsibleSearchPopover(): import("react").JSX.Element;
@@ -0,0 +1,74 @@
1
+ 'use client';
2
+ import { useRef, useState } from 'react';
3
+ import Heading from '../../components/heading';
4
+ import Paragraph from '../../components/paragraph';
5
+ import TextField from '../../components/textField';
6
+ import IconButton from '../../components/iconButton';
7
+ import Button from '../../components/button';
8
+ import Tooltip from '../../components/tooltip';
9
+ import Popover from '../../components/popover';
10
+ import Menu from '../../components/menu';
11
+ import List from '../../components/list';
12
+ import Surface from '../../components/surface';
13
+ import EmptyBox from '../../components/emptyBox';
14
+ import { Center, Cluster, Stack } from '../../components/layout';
15
+ // A real app reads these from the server.
16
+ var invoices = ['Northwind, March', 'Harbor Studio, March', 'Lumen Labs, February', 'Northstar Dental, February', 'Pine and Co, January'];
17
+ export default function CollapsibleSearchPopover() {
18
+ // The filter belongs to the page, not to the Popover: it stays when the Popover closes.
19
+ var _a = useState('north'), query = _a[0], setQuery = _a[1];
20
+ var _b = useState(null), anchor = _b[0], setAnchor = _b[1];
21
+ var _c = useState(false), open = _c[0], setOpen = _c[1];
22
+ var trigger = useRef(null);
23
+ var words = query.trim();
24
+ var on = words !== '';
25
+ var found = invoices.filter(function (name) { return name.toLowerCase().includes(words.toLowerCase()); });
26
+ function toggle(anchorEl) {
27
+ setAnchor(anchorEl);
28
+ setOpen(function (o) { return !o; });
29
+ }
30
+ // Escape clears the search and closes. The field handles it before the Popover's own Escape, which only closes.
31
+ // Enter closes and keeps the filter. A click outside and Tab close and keep it too.
32
+ function keyDown(e) {
33
+ if (e.key === 'Escape') {
34
+ e.preventDefault();
35
+ setQuery('');
36
+ setOpen(false);
37
+ }
38
+ else if (e.key === 'Enter') {
39
+ e.preventDefault();
40
+ setOpen(false);
41
+ }
42
+ }
43
+ // The field is closed, so 'Clear Search' clears the filter and focus goes to the search button.
44
+ function clearSearch() {
45
+ var _a;
46
+ setQuery('');
47
+ (_a = trigger.current) === null || _a === void 0 ? void 0 : _a.focus();
48
+ }
49
+ return (<Center width="page">
50
+ <Stack gap="large">
51
+ <Cluster gap="small">
52
+ <Heading level={1} size="h5">Invoices</Heading>
53
+ {/* A search that is on shows in a filled button and says what it is looking for. */}
54
+ <Tooltip title={on ? "Search: ".concat(words) : 'Search'}>
55
+ <IconButton ref={trigger} color={on ? 'secondary' : 'iconOnly'} state={open ? 'selected' : 'enabled'} size="small" iconName="Search" ariaLabel={on ? "Search: ".concat(words) : 'Search'} aria-haspopup="dialog" aria-expanded={open} onClick={function (e) { return toggle(e.currentTarget); }}/>
56
+ </Tooltip>
57
+ </Cluster>
58
+ <Paragraph tone="secondary" size="body2" measure="none">
59
+ {on ? "".concat(found.length, " of ").concat(invoices.length, " invoices match \"").concat(words, "\".") : "All ".concat(invoices.length, " invoices.")}
60
+ </Paragraph>
61
+ {found.length > 0 ? (<Surface>
62
+ <List items={found} size="body1"/>
63
+ </Surface>) : (<Surface align="center" minHeight="short">
64
+ <EmptyBox size="large" icon="Search" text={"No invoices match \"".concat(words, "\"")} secondText="Check the spelling, or search for fewer words." action={<Button size="medium" type="secondary" state="enabled" label="Clear Search" onClickButton={clearSearch}/>}/>
65
+ </Surface>)}
66
+ </Stack>
67
+ <Popover open={open} anchorEl={anchor} onClose={function () { return setOpen(false); }} returnFocus>
68
+ {/* Menu gives the Popover its surface and a width. It holds a field here, not items. */}
69
+ <Menu width={288}>
70
+ <TextField id="collapsible-search-query" type="search" size="small" autoFocus aria-label="Search invoices" placeholder="Search invoices" value={query} onChange={function (e) { return setQuery(e.target.value); }} onKeyDown={keyDown}/>
71
+ </Menu>
72
+ </Popover>
73
+ </Center>);
74
+ }
@@ -0,0 +1,143 @@
1
+ # Collapsible search
2
+
3
+ A person filters a list by a word, and the list should keep its room when they are not typing.
4
+
5
+ ## Do
6
+
7
+ - Use an `IconButton` with `iconName="Search"` beside the list's heading, and open a `<Popover returnFocus>` with a search `TextField` from it.
8
+ - Keep the words in the page, not in the Popover. The list stays filtered while the Popover is closed.
9
+ - Show that a search is on: `color="secondary"` on the button, and a line such as '2 of 5 invoices match "north".'.
10
+ - Say the current search in the button's `ariaLabel`: 'Search: north'. It is plain 'Search' when no search is on.
11
+ - Set `aria-haspopup="dialog"` and `aria-expanded` on the button, and `state="selected"` while the Popover is open.
12
+ - Focus the field with `autoFocus` when the Popover opens, and name it with `aria-label`, such as `aria-label="Search invoices"`.
13
+ - Clear the search and close the Popover on Escape. Focus goes back to the button.
14
+ - Keep the search when the Popover closes any other way: Enter, a click outside, or Tab.
15
+ - Follow the case 'Empty search' when nothing matches. Its 'Clear Search' Button clears the filter. Focus goes to the search button, not the field, because the field is in the closed Popover.
16
+
17
+ ## Don't
18
+
19
+ - Do not clear the search when the Popover closes, except with Escape.
20
+ - Do not name the button 'Search' while a search is on. Its name says what is searched for.
21
+ - Do not show the filter only in color. The line under the heading says it too.
22
+ - Do not open the Popover when the page loads.
23
+
24
+ ## Example: Search button with a Popover
25
+
26
+ Uses: `Button`, `Center`, `Cluster`, `EmptyBox`, `Heading`, `IconButton`, `List`, `Menu`, `Paragraph`, `Popover`, `Stack`, `Surface`, `TextField`, `Tooltip`
27
+
28
+ ```tsx
29
+ 'use client';
30
+ import { useRef, useState } from 'react';
31
+ import Heading from 'oneslash-design-system/components/heading';
32
+ import Paragraph from 'oneslash-design-system/components/paragraph';
33
+ import TextField from 'oneslash-design-system/components/textField';
34
+ import IconButton from 'oneslash-design-system/components/iconButton';
35
+ import Button from 'oneslash-design-system/components/button';
36
+ import Tooltip from 'oneslash-design-system/components/tooltip';
37
+ import Popover from 'oneslash-design-system/components/popover';
38
+ import Menu from 'oneslash-design-system/components/menu';
39
+ import List from 'oneslash-design-system/components/list';
40
+ import Surface from 'oneslash-design-system/components/surface';
41
+ import EmptyBox from 'oneslash-design-system/components/emptyBox';
42
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
43
+
44
+ // A real app reads these from the server.
45
+ const invoices = ['Northwind, March', 'Harbor Studio, March', 'Lumen Labs, February', 'Northstar Dental, February', 'Pine and Co, January'];
46
+
47
+ export default function CollapsibleSearchPopover() {
48
+ // The filter belongs to the page, not to the Popover: it stays when the Popover closes.
49
+ const [query, setQuery] = useState('north');
50
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
51
+ const [open, setOpen] = useState(false);
52
+ const trigger = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
53
+ const words = query.trim();
54
+ const on = words !== '';
55
+ const found = invoices.filter((name) => name.toLowerCase().includes(words.toLowerCase()));
56
+
57
+ function toggle(anchorEl: HTMLElement) {
58
+ setAnchor(anchorEl);
59
+ setOpen((o) => !o);
60
+ }
61
+
62
+ // Escape clears the search and closes. The field handles it before the Popover's own Escape, which only closes.
63
+ // Enter closes and keeps the filter. A click outside and Tab close and keep it too.
64
+ function keyDown(e: { key: string; preventDefault(): void }) {
65
+ if (e.key === 'Escape') {
66
+ e.preventDefault();
67
+ setQuery('');
68
+ setOpen(false);
69
+ } else if (e.key === 'Enter') {
70
+ e.preventDefault();
71
+ setOpen(false);
72
+ }
73
+ }
74
+
75
+ // The field is closed, so 'Clear Search' clears the filter and focus goes to the search button.
76
+ function clearSearch() {
77
+ setQuery('');
78
+ trigger.current?.focus();
79
+ }
80
+
81
+ return (
82
+ <Center width="page">
83
+ <Stack gap="large">
84
+ <Cluster gap="small">
85
+ <Heading level={1} size="h5">Invoices</Heading>
86
+ {/* A search that is on shows in a filled button and says what it is looking for. */}
87
+ <Tooltip title={on ? `Search: ${words}` : 'Search'}>
88
+ <IconButton
89
+ ref={trigger}
90
+ color={on ? 'secondary' : 'iconOnly'}
91
+ state={open ? 'selected' : 'enabled'}
92
+ size="small"
93
+ iconName="Search"
94
+ ariaLabel={on ? `Search: ${words}` : 'Search'}
95
+ aria-haspopup="dialog"
96
+ aria-expanded={open}
97
+ onClick={(e: { currentTarget: HTMLElement }) => toggle(e.currentTarget)}
98
+ />
99
+ </Tooltip>
100
+ </Cluster>
101
+ <Paragraph tone="secondary" size="body2" measure="none">
102
+ {on ? `${found.length} of ${invoices.length} invoices match "${words}".` : `All ${invoices.length} invoices.`}
103
+ </Paragraph>
104
+ {found.length > 0 ? (
105
+ <Surface>
106
+ <List items={found} size="body1" />
107
+ </Surface>
108
+ ) : (
109
+ <Surface align="center" minHeight="short">
110
+ <EmptyBox
111
+ size="large"
112
+ icon="Search"
113
+ text={`No invoices match "${words}"`}
114
+ secondText="Check the spelling, or search for fewer words."
115
+ action={<Button size="medium" type="secondary" state="enabled" label="Clear Search" onClickButton={clearSearch} />}
116
+ />
117
+ </Surface>
118
+ )}
119
+ </Stack>
120
+ <Popover open={open} anchorEl={anchor} onClose={() => setOpen(false)} returnFocus>
121
+ {/* Menu gives the Popover its surface and a width. It holds a field here, not items. */}
122
+ <Menu width={288}>
123
+ <TextField
124
+ id="collapsible-search-query"
125
+ type="search"
126
+ size="small"
127
+ autoFocus
128
+ aria-label="Search invoices"
129
+ placeholder="Search invoices"
130
+ value={query}
131
+ onChange={(e) => setQuery(e.target.value)}
132
+ onKeyDown={keyDown}
133
+ />
134
+ </Menu>
135
+ </Popover>
136
+ </Center>
137
+ );
138
+ }
139
+ ```
140
+
141
+ ## Native
142
+
143
+ On Apple use `.searchable` on the list, which collapses into the toolbar and keeps its text. On Android use a `SearchBar` that expands from the app bar.
@@ -2,8 +2,6 @@
2
2
 
3
3
  The agent cannot be called from the composer because the workspace reached a limit, such as its agent replies for the month.
4
4
 
5
- **Not built yet:** Scindo on the web shows the monthly limit in an overlay over the thread, and shows its Upgrade button to everyone. Its other limits show as an error Alert that the person closes.
6
-
7
5
  ## Do
8
6
 
9
7
  - Follow the rule 'An agent refuses clearly' word for word: "You've used all 50 AI agent responses this month."
@@ -282,5 +280,3 @@ export default function ComposerLimitNoticeWithAction() {
282
280
  ## Native
283
281
 
284
282
  On Apple the notice is a row above the composer, with an Upgrade or Change Budget Cap button for admins and never a link to a web page.
285
-
286
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person asks to delete or remove something, and it cannot be undone.
4
4
 
5
- **Not built yet:** Commentify's Delete project confirm is not danger-colored and asks a question in its body. Scindo on the web confirms removing a saved card in place, but asks 'Are you sure?' and labels its Buttons 'Confirm' and 'No'.
6
-
7
5
  ## Do
8
6
 
9
7
  - Follow the rule 'A confirm says exactly what will happen' for the Modal: `size="small"`, 'Cancel' first, then the action with `color="danger"`.
@@ -207,5 +205,3 @@ export default function ConfirmDestructiveActionInline() {
207
205
  ## Native
208
206
 
209
207
  On Apple use a system `confirmationDialog` or `.alert`, with the action in the `.destructive` role and 'Cancel' in the `.cancel` role.
210
-
211
- Seen in: Commentify, Scindo.
@@ -6,8 +6,6 @@ An action a person takes themselves needs their yes before it happens. An action
6
6
 
7
7
  A confirm is a Modal with `size="small"`. Its title names the action in Title Case, such as 'Delete Project'. The body says in one or two sentences what will happen and what is kept. Two Buttons sit in the Modal's `actions`. 'Cancel' comes first, a `<Button type="tertiary" size="small">`. Then comes the action, a `<Button type="primary" size="small">` labelled in Title Case with the same verb as the title. When the action destroys or removes something, the action Button also has `color="danger"`. One case differs: 'Unsaved changes'. Its guard may have three Buttons, 'Cancel', "Don't Save" and 'Save', in that order. When it has two, its safe Button reads 'Keep Editing'. Escape and a click outside the Modal mean Cancel. While the request runs, the action Button is `loading` and keeps its label, and 'Cancel' is `state="disabled"`. The Modal stays open. It still calls `onClose` on Escape or a click outside, and the page ignores that call until the request ends. If the request fails, the Modal stays open and shows an inline error Alert at the top of its body, as the rule 'A form error shows next to the problem' says. When the action works, the Modal closes. If the thing is still on screen, the change shows where it is. If the thing is gone, a toast names it, as the rule 'Success shows where the person is looking' says.
8
8
 
9
- **Not built yet:** No Commentify confirm Modal uses `color="danger"`, and two of them label Cancel 'No'. Scindo on the web makes Cancel a secondary Button in some confirms and a tertiary one in others. It leaves its Delete Task and Remove Member confirms uncolored. Scindo on the web revokes an API key, and Commentify revokes an agent client, with no confirm.
10
-
11
9
  ## Why
12
10
 
13
11
  A confirm is the last chance to stop a mistake. It has to say exactly what will happen, and the safe choice has to be easy to find.
@@ -32,5 +30,3 @@ A confirm is the last chance to stop a mistake. It has to say exactly what will
32
30
  ## Native
33
31
 
34
32
  On Apple use a system `confirmationDialog` or `.alert`, with the action in the `.destructive` role when it destroys or removes something. Never build a sheet by hand for a confirm.
35
-
36
- Seen in: Commentify, Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A thread has no messages yet, and the person may not know what to write first.
4
4
 
5
- **Not built yet:** Scindo on the web shows its starters as `Tag`s under the `EmptyBox`, not as its `action`. It shows them in threads between people too, and puts '@Agent' before the text.
6
-
7
5
  ## Do
8
6
 
9
7
  - Show the empty thread as the rule 'An empty list says what will fill it' says. Use `EmptyBox` with `size="large"`, the `text` 'No messages yet', and a `secondText` that says what to do.
@@ -204,5 +202,3 @@ export default function ConversationStartersNone() {
204
202
  );
205
203
  }
206
204
  ```
207
-
208
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person creates something new, such as a project or a task, and it needs a name before it exists.
4
4
 
5
- **Not built yet:** Scindo on the web replaces the fields with a spinner while it creates a workspace or a task, and makes Cancel a secondary Button. Scindo's Apple app labels the Button 'Creating...' while it runs.
6
-
7
5
  ## Do
8
6
 
9
7
  - Title the Modal 'Create' and the thing, such as 'Create Project', and give its action the same verb: 'Create'.
@@ -240,5 +238,3 @@ export default function CreateModalWithSettings() {
240
238
  ## Native
241
239
 
242
240
  On Apple use a sheet with a `Form`. Put 'Cancel' in the `.cancellationAction` placement and 'Create' in `.confirmationAction`, and create on `.onSubmit` from the name field.
243
-
244
- Seen in: Scindo.
@@ -0,0 +1 @@
1
+ export default function DangerZoneCollapsed(): import("react").JSX.Element;
@@ -0,0 +1,75 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Heading from '../../components/heading';
4
+ import Paragraph from '../../components/paragraph';
5
+ import TextField from '../../components/textField';
6
+ import Button from '../../components/button';
7
+ import SettingsSection from '../../components/settingsSection';
8
+ import { Center, Cluster, Stack } from '../../components/layout';
9
+ // An account has no name to type, so the person types a fixed word.
10
+ var word = 'DELETE';
11
+ export default function DangerZoneCollapsed() {
12
+ var _a = useState(false), shown = _a[0], setShown = _a[1];
13
+ var _b = useState(false), confirming = _b[0], setConfirming = _b[1];
14
+ var _c = useState(''), typed = _c[0], setTyped = _c[1];
15
+ var _d = useState(false), deleting = _d[0], setDeleting = _d[1];
16
+ var _e = useState(false), deleted = _e[0], setDeleted = _e[1];
17
+ var timer = useRef();
18
+ // Stops the request if the example goes away before it ends.
19
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
20
+ // An exact match, with case. Pasting the word is fine.
21
+ var matches = typed === word;
22
+ function handleToggle() {
23
+ if (deleting)
24
+ return;
25
+ setShown(!shown);
26
+ setConfirming(false);
27
+ setTyped('');
28
+ }
29
+ function handleCancel() {
30
+ setConfirming(false);
31
+ setTyped('');
32
+ }
33
+ function handleDelete() {
34
+ if (deleting || !matches)
35
+ return;
36
+ setDeleting(true);
37
+ // Stands in for the request to the server.
38
+ timer.current = setTimeout(function () {
39
+ setDeleting(false);
40
+ setDeleted(true);
41
+ }, 1200);
42
+ }
43
+ // The account is gone, so the page that showed it is gone too.
44
+ if (deleted) {
45
+ return (<Center fill>
46
+ <Heading level={1} size="h5">Your account is deleted</Heading>
47
+ <Paragraph tone="secondary" measure="none">We sent a note to dana@acme.example to say so.</Paragraph>
48
+ </Center>);
49
+ }
50
+ return (<Center width="page">
51
+ <Stack gap="xlarge">
52
+ <Heading level={1} size="h5">Account</Heading>
53
+ <SettingsSection title="Profile" description="Dana Lee, dana@acme.example.">
54
+ <Paragraph size="body2" measure="none">Your name and picture are in Profile Settings.</Paragraph>
55
+ </SettingsSection>
56
+ <SettingsSection tone="danger" title="Danger zone" description="These actions cannot be undone.">
57
+ <Cluster>
58
+ <Button size="small" type="textOnly" state={deleting ? 'disabled' : 'enabled'} label={shown ? 'Hide Danger Zone' : 'Show Danger Zone'} aria-expanded={shown} onClickButton={handleToggle}/>
59
+ </Cluster>
60
+ {shown && (<Stack gap="medium">
61
+ <Paragraph size="body2" measure="none">This deletes your account and your private documents. Messages and tasks you shared stay with your team and show as &apos;Deleted user&apos;.</Paragraph>
62
+ {confirming ? (<>
63
+ <TextField id="danger-zone-collapsed-word" label={"Type ".concat(word, " to confirm")} value={typed} disabled={deleting} onChange={function (e) { return setTyped(e.target.value); }}/>
64
+ <Cluster gap="small">
65
+ <Button size="small" type="tertiary" state={deleting ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel}/>
66
+ <Button size="small" type="primary" color="danger" state={matches ? 'enabled' : 'disabled'} label="Delete Account" loading={deleting} onClickButton={handleDelete}/>
67
+ </Cluster>
68
+ </>) : (<Cluster>
69
+ <Button size="small" type="secondary" color="danger" state="enabled" label="Delete Account" onClickButton={function () { return setConfirming(true); }}/>
70
+ </Cluster>)}
71
+ </Stack>)}
72
+ </SettingsSection>
73
+ </Stack>
74
+ </Center>);
75
+ }