oneslash-design-system 2.17.0 → 2.19.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 (282) hide show
  1. package/README.md +2 -2
  2. package/dist/DESIGN.md +55 -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/app-shell/sidebar.d.ts +1 -0
  24. package/dist/cases/app-shell/sidebar.jsx +124 -0
  25. package/dist/cases/app-shell/top-tabs.d.ts +1 -0
  26. package/dist/cases/app-shell/top-tabs.jsx +106 -0
  27. package/dist/cases/app-shell.md +364 -0
  28. package/dist/cases/artifact-card/card.jsx +32 -6
  29. package/dist/cases/artifact-card.md +55 -11
  30. package/dist/cases/auth-gate-loading.md +0 -4
  31. package/dist/cases/check-your-email.md +0 -4
  32. package/dist/cases/collapsible-search/popover.d.ts +1 -0
  33. package/dist/cases/collapsible-search/popover.jsx +74 -0
  34. package/dist/cases/collapsible-search.md +143 -0
  35. package/dist/cases/composer-limit.md +0 -4
  36. package/dist/cases/confirm-destructive-action.md +0 -4
  37. package/dist/cases/confirm-dialogs.md +0 -4
  38. package/dist/cases/conversation-starters.md +0 -4
  39. package/dist/cases/create-modal.md +0 -4
  40. package/dist/cases/danger-zone/collapsed.d.ts +1 -0
  41. package/dist/cases/danger-zone/collapsed.jsx +75 -0
  42. package/dist/cases/danger-zone/shown.d.ts +1 -0
  43. package/dist/cases/danger-zone/shown.jsx +95 -0
  44. package/dist/cases/danger-zone.md +263 -0
  45. package/dist/cases/device-login.md +0 -4
  46. package/dist/cases/email-confirmed.md +0 -4
  47. package/dist/cases/empty-list.md +0 -4
  48. package/dist/cases/empty-lists.md +0 -4
  49. package/dist/cases/empty-not-set-up.md +0 -4
  50. package/dist/cases/empty-search.md +0 -4
  51. package/dist/cases/error-page/in-shell.jsx +26 -17
  52. package/dist/cases/error-page.md +42 -25
  53. package/dist/cases/feedback-form.md +0 -4
  54. package/dist/cases/filter-menu/presets.d.ts +1 -0
  55. package/dist/cases/filter-menu/presets.jsx +53 -0
  56. package/dist/cases/filter-menu/with-clear.d.ts +1 -0
  57. package/dist/cases/filter-menu/with-clear.jsx +56 -0
  58. package/dist/cases/filter-menu.md +204 -0
  59. package/dist/cases/forgot-password.md +0 -4
  60. package/dist/cases/form-errors.md +0 -4
  61. package/dist/cases/import-checklist.md +0 -4
  62. package/dist/cases/inline-form-feedback.md +0 -4
  63. package/dist/cases/integrations-list/nested.d.ts +1 -0
  64. package/dist/cases/integrations-list/nested.jsx +164 -0
  65. package/dist/cases/integrations-list/rows.d.ts +1 -0
  66. package/dist/cases/integrations-list/rows.jsx +134 -0
  67. package/dist/cases/integrations-list.md +379 -0
  68. package/dist/cases/invite-member.md +0 -4
  69. package/dist/cases/load-failure.md +0 -4
  70. package/dist/cases/log-out-confirm.md +0 -4
  71. package/dist/cases/login-page.md +0 -4
  72. package/dist/cases/master-detail/list-then-page.d.ts +1 -0
  73. package/dist/cases/master-detail/list-then-page.jsx +65 -0
  74. package/dist/cases/master-detail/split.d.ts +1 -0
  75. package/dist/cases/master-detail/split.jsx +49 -0
  76. package/dist/cases/master-detail.md +213 -0
  77. package/dist/cases/members-list/rows.d.ts +1 -0
  78. package/dist/cases/members-list/rows.jsx +318 -0
  79. package/dist/cases/members-list/table.d.ts +1 -0
  80. package/dist/cases/members-list/table.jsx +351 -0
  81. package/dist/cases/members-list.md +799 -0
  82. package/dist/cases/mention-list.md +0 -4
  83. package/dist/cases/message-actions.md +0 -4
  84. package/dist/cases/message-attachments.md +0 -4
  85. package/dist/cases/message-composer.md +0 -4
  86. package/dist/cases/message-edit.md +0 -4
  87. package/dist/cases/message-reactions.md +0 -4
  88. package/dist/cases/message-row.md +0 -4
  89. package/dist/cases/mobile-menu/links.d.ts +1 -0
  90. package/dist/cases/mobile-menu/links.jsx +24 -0
  91. package/dist/cases/mobile-menu/sections.d.ts +1 -0
  92. package/dist/cases/mobile-menu/sections.jsx +61 -0
  93. package/dist/cases/mobile-menu.md +170 -0
  94. package/dist/cases/not-found-page/in-shell.jsx +26 -17
  95. package/dist/cases/not-found-page.md +41 -24
  96. package/dist/cases/notification-menu/menu.d.ts +1 -0
  97. package/dist/cases/notification-menu/menu.jsx +74 -0
  98. package/dist/cases/notification-menu.md +135 -0
  99. package/dist/cases/oauth-consent.md +0 -4
  100. package/dist/cases/on-off-settings/list.d.ts +1 -0
  101. package/dist/cases/on-off-settings/list.jsx +97 -0
  102. package/dist/cases/on-off-settings.md +116 -0
  103. package/dist/cases/on-this-page/aside.d.ts +1 -0
  104. package/dist/cases/on-this-page/aside.jsx +39 -0
  105. package/dist/cases/on-this-page.md +80 -0
  106. package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
  107. package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
  108. package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
  109. package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
  110. package/dist/cases/overflow-menu.md +410 -0
  111. package/dist/cases/page-header/actions.d.ts +1 -0
  112. package/dist/cases/page-header/actions.jsx +65 -0
  113. package/dist/cases/page-header/sub-page.d.ts +1 -0
  114. package/dist/cases/page-header/sub-page.jsx +37 -0
  115. package/dist/cases/page-header.md +195 -0
  116. package/dist/cases/phone-navigation.md +32 -0
  117. package/dist/cases/profile-form/form.d.ts +1 -0
  118. package/dist/cases/profile-form/form.jsx +153 -0
  119. package/dist/cases/profile-form.md +236 -0
  120. package/dist/cases/quick-switcher/modal.d.ts +1 -0
  121. package/dist/cases/quick-switcher/modal.jsx +114 -0
  122. package/dist/cases/quick-switcher.md +205 -0
  123. package/dist/cases/range-switch/segmented.d.ts +1 -0
  124. package/dist/cases/range-switch/segmented.jsx +30 -0
  125. package/dist/cases/range-switch.md +67 -0
  126. package/dist/cases/rename.md +0 -4
  127. package/dist/cases/reply-feedback.md +0 -4
  128. package/dist/cases/reply-sources.md +0 -4
  129. package/dist/cases/route-loading/region.jsx +27 -18
  130. package/dist/cases/route-loading.md +42 -23
  131. package/dist/cases/scope-picker/menu.d.ts +1 -0
  132. package/dist/cases/scope-picker/menu.jsx +47 -0
  133. package/dist/cases/scope-picker.md +97 -0
  134. package/dist/cases/set-new-password.md +0 -4
  135. package/dist/cases/settings-page/side-nav.d.ts +1 -0
  136. package/dist/cases/settings-page/side-nav.jsx +171 -0
  137. package/dist/cases/settings-page/top-tabs.d.ts +1 -0
  138. package/dist/cases/settings-page/top-tabs.jsx +129 -0
  139. package/dist/cases/settings-page.md +378 -0
  140. package/dist/cases/settings-save.md +35 -0
  141. package/dist/cases/side-pane/beside.d.ts +1 -0
  142. package/dist/cases/side-pane/beside.jsx +79 -0
  143. package/dist/cases/side-pane/over.d.ts +1 -0
  144. package/dist/cases/side-pane/over.jsx +58 -0
  145. package/dist/cases/side-pane.md +238 -0
  146. package/dist/cases/sidebar-nav/flat.d.ts +1 -0
  147. package/dist/cases/sidebar-nav/flat.jsx +81 -0
  148. package/dist/cases/sidebar-nav/nested.d.ts +1 -0
  149. package/dist/cases/sidebar-nav/nested.jsx +122 -0
  150. package/dist/cases/sidebar-nav.md +261 -0
  151. package/dist/cases/sign-up-page.md +1 -5
  152. package/dist/cases/site-footer/columns.d.ts +1 -0
  153. package/dist/cases/site-footer/columns.jsx +51 -0
  154. package/dist/cases/site-footer/simple.d.ts +1 -0
  155. package/dist/cases/site-footer/simple.jsx +24 -0
  156. package/dist/cases/site-footer.md +133 -0
  157. package/dist/cases/site-header/links.d.ts +1 -0
  158. package/dist/cases/site-header/links.jsx +26 -0
  159. package/dist/cases/site-header/sections.d.ts +1 -0
  160. package/dist/cases/site-header/sections.jsx +64 -0
  161. package/dist/cases/site-header.md +183 -0
  162. package/dist/cases/slash-command-list.md +0 -4
  163. package/dist/cases/success-feedback.md +0 -4
  164. package/dist/cases/tag-filter/tags.d.ts +1 -0
  165. package/dist/cases/tag-filter/tags.jsx +226 -0
  166. package/dist/cases/tag-filter.md +298 -0
  167. package/dist/cases/theme-switcher/menu.d.ts +1 -0
  168. package/dist/cases/theme-switcher/menu.jsx +47 -0
  169. package/dist/cases/theme-switcher/segmented.d.ts +1 -0
  170. package/dist/cases/theme-switcher/segmented.jsx +26 -0
  171. package/dist/cases/theme-switcher.md +149 -0
  172. package/dist/cases/type-to-confirm.md +0 -4
  173. package/dist/cases/typing-and-status.md +0 -4
  174. package/dist/cases/unsaved-changes-guard.md +0 -4
  175. package/dist/cases/upgrade-prompt.md +0 -4
  176. package/dist/cases.json +1737 -315
  177. package/dist/components/alert.d.ts +3 -1
  178. package/dist/components/alert.jsx +2 -2
  179. package/dist/components/appShell.d.ts +44 -0
  180. package/dist/components/appShell.jsx +121 -0
  181. package/dist/components/button.jsx +5 -2
  182. package/dist/components/checkBox.d.ts +5 -1
  183. package/dist/components/checkBox.jsx +2 -2
  184. package/dist/components/copyField.d.ts +20 -0
  185. package/dist/components/copyField.jsx +99 -0
  186. package/dist/components/drawer.d.ts +31 -0
  187. package/dist/components/drawer.jsx +121 -0
  188. package/dist/components/formField.d.ts +34 -0
  189. package/dist/components/formField.jsx +28 -0
  190. package/dist/components/heading.d.ts +5 -1
  191. package/dist/components/heading.jsx +2 -2
  192. package/dist/components/link.d.ts +6 -1
  193. package/dist/components/link.jsx +11 -3
  194. package/dist/components/menu.jsx +2 -2
  195. package/dist/components/menuItem.d.ts +10 -2
  196. package/dist/components/menuItem.jsx +4 -3
  197. package/dist/components/modal.jsx +12 -23
  198. package/dist/components/navigation.d.ts +9 -1
  199. package/dist/components/navigation.jsx +15 -3
  200. package/dist/components/onThisPage.d.ts +29 -0
  201. package/dist/components/onThisPage.jsx +151 -0
  202. package/dist/components/pageShell.d.ts +7 -1
  203. package/dist/components/pageShell.jsx +14 -1
  204. package/dist/components/popover.jsx +4 -0
  205. package/dist/components/radioGroup.d.ts +5 -1
  206. package/dist/components/radioGroup.jsx +2 -2
  207. package/dist/components/segmentedControl.d.ts +22 -0
  208. package/dist/components/segmentedControl.jsx +54 -0
  209. package/dist/components/select.d.ts +5 -1
  210. package/dist/components/select.jsx +2 -2
  211. package/dist/components/settingsSection.d.ts +36 -0
  212. package/dist/components/settingsSection.jsx +65 -0
  213. package/dist/components/sidePane.d.ts +32 -0
  214. package/dist/components/sidePane.jsx +128 -0
  215. package/dist/components/siteFooter.d.ts +24 -0
  216. package/dist/components/siteFooter.jsx +48 -0
  217. package/dist/components/siteHeader.d.ts +55 -0
  218. package/dist/components/siteHeader.jsx +125 -0
  219. package/dist/components/slidingIndicator.d.ts +50 -0
  220. package/dist/components/slidingIndicator.jsx +102 -0
  221. package/dist/components/switch.d.ts +25 -0
  222. package/dist/components/switch.jsx +55 -0
  223. package/dist/components/tab.jsx +5 -11
  224. package/dist/components/tabsContainer.jsx +5 -67
  225. package/dist/components/textField.d.ts +12 -2
  226. package/dist/components/textField.jsx +11 -4
  227. package/dist/components/textarea.d.ts +5 -1
  228. package/dist/components/textarea.jsx +3 -3
  229. package/dist/components/titleBar.d.ts +17 -0
  230. package/dist/components/titleBar.jsx +17 -0
  231. package/dist/components/useHotkey.d.ts +7 -0
  232. package/dist/components/useHotkey.js +24 -0
  233. package/dist/index.d.ts +13 -0
  234. package/dist/index.js +13 -0
  235. package/dist/internal/copyField.d.ts +5 -0
  236. package/dist/internal/copyField.js +61 -0
  237. package/dist/internal/hotkey.d.ts +16 -0
  238. package/dist/internal/hotkey.js +20 -0
  239. package/dist/internal/overlayStack.d.ts +24 -0
  240. package/dist/internal/overlayStack.js +71 -0
  241. package/dist/internal/resize.d.ts +9 -0
  242. package/dist/internal/resize.js +31 -0
  243. package/dist/internal/scrollSpy.d.ts +24 -0
  244. package/dist/internal/scrollSpy.js +53 -0
  245. package/dist/internal/siteBrand.d.ts +6 -0
  246. package/dist/internal/siteBrand.jsx +11 -0
  247. package/dist/internal/switch.d.ts +5 -0
  248. package/dist/internal/switch.js +9 -0
  249. package/dist/native-mapping.json +72 -0
  250. package/dist/stories/AppShell.stories.d.ts +15 -0
  251. package/dist/stories/AppShell.stories.jsx +137 -0
  252. package/dist/stories/Cases.generated.stories.d.ts +42 -0
  253. package/dist/stories/Cases.generated.stories.jsx +84 -0
  254. package/dist/stories/CopyField.stories.d.ts +11 -0
  255. package/dist/stories/CopyField.stories.jsx +65 -0
  256. package/dist/stories/Drawer.stories.d.ts +10 -0
  257. package/dist/stories/Drawer.stories.jsx +123 -0
  258. package/dist/stories/FormField.stories.d.ts +6 -0
  259. package/dist/stories/FormField.stories.jsx +44 -0
  260. package/dist/stories/Link.stories.d.ts +1 -0
  261. package/dist/stories/Link.stories.jsx +8 -0
  262. package/dist/stories/Navigation.stories.d.ts +1 -0
  263. package/dist/stories/Navigation.stories.jsx +17 -1
  264. package/dist/stories/OnThisPage.stories.d.ts +10 -0
  265. package/dist/stories/OnThisPage.stories.jsx +105 -0
  266. package/dist/stories/SegmentedControl.stories.d.ts +8 -0
  267. package/dist/stories/SegmentedControl.stories.jsx +33 -0
  268. package/dist/stories/SettingsSection.stories.d.ts +12 -0
  269. package/dist/stories/SettingsSection.stories.jsx +91 -0
  270. package/dist/stories/SidePane.stories.d.ts +6 -0
  271. package/dist/stories/SidePane.stories.jsx +37 -0
  272. package/dist/stories/SiteFooter.stories.d.ts +7 -0
  273. package/dist/stories/SiteFooter.stories.jsx +63 -0
  274. package/dist/stories/SiteHeader.stories.d.ts +10 -0
  275. package/dist/stories/SiteHeader.stories.jsx +94 -0
  276. package/dist/stories/Switch.stories.d.ts +14 -0
  277. package/dist/stories/Switch.stories.jsx +87 -0
  278. package/dist/stories/TextField.stories.d.ts +1 -0
  279. package/dist/stories/TextField.stories.jsx +13 -0
  280. package/dist/stories/TitleBar.stories.d.ts +6 -0
  281. package/dist/stories/TitleBar.stories.jsx +34 -0
  282. package/package.json +5 -1
@@ -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
+ }
@@ -0,0 +1 @@
1
+ export default function DangerZoneShown(): import("react").JSX.Element;
@@ -0,0 +1,95 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Modal from '../../components/modal';
4
+ import Heading from '../../components/heading';
5
+ import Paragraph from '../../components/paragraph';
6
+ import TextField from '../../components/textField';
7
+ import Button from '../../components/button';
8
+ import SettingsSection from '../../components/settingsSection';
9
+ import { Center, Cluster, Stack } from '../../components/layout';
10
+ // A workspace has a name, so the person types it.
11
+ var workspaceName = 'Acme';
12
+ export default function DangerZoneShown() {
13
+ var _a = useState(false), leaving = _a[0], setLeaving = _a[1];
14
+ var _b = useState(false), leaveOpen = _b[0], setLeaveOpen = _b[1];
15
+ var _c = useState(false), left = _c[0], setLeft = _c[1];
16
+ var _d = useState(false), confirming = _d[0], setConfirming = _d[1];
17
+ var _e = useState(''), typed = _e[0], setTyped = _e[1];
18
+ var _f = useState(false), deleting = _f[0], setDeleting = _f[1];
19
+ var _g = useState(false), deleted = _g[0], setDeleted = _g[1];
20
+ var timer = useRef();
21
+ // Stops the request if the example goes away before it ends.
22
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
23
+ // An exact match, with case. Pasting the name is fine.
24
+ var matches = typed === workspaceName;
25
+ // Escape, a click outside and Cancel all close it, except while the request runs.
26
+ function handleLeaveClose() {
27
+ if (leaving)
28
+ return;
29
+ setLeaveOpen(false);
30
+ }
31
+ function handleLeave() {
32
+ if (leaving)
33
+ return;
34
+ setLeaving(true);
35
+ // Stands in for the request to the server.
36
+ timer.current = setTimeout(function () {
37
+ setLeaving(false);
38
+ setLeaveOpen(false);
39
+ setLeft(true);
40
+ }, 1200);
41
+ }
42
+ function handleCancelDelete() {
43
+ setConfirming(false);
44
+ setTyped('');
45
+ }
46
+ function handleDelete() {
47
+ if (deleting || !matches)
48
+ return;
49
+ setDeleting(true);
50
+ timer.current = setTimeout(function () {
51
+ setDeleting(false);
52
+ setDeleted(true);
53
+ }, 1200);
54
+ }
55
+ // The workspace is gone, or the person is out of it, so the page that showed it is gone too.
56
+ if (left || deleted) {
57
+ return (<Center fill>
58
+ <Heading level={1} size="h5">{deleted ? "".concat(workspaceName, " is deleted") : "You left ".concat(workspaceName)}</Heading>
59
+ <Paragraph tone="secondary" measure="none">{deleted ? 'Everyone in it was told.' : 'An owner can invite you again.'}</Paragraph>
60
+ </Center>);
61
+ }
62
+ return (<Center width="page">
63
+ <Stack gap="xlarge">
64
+ <Stack gap="small">
65
+ <Heading level={1} size="h5">Danger zone</Heading>
66
+ <Paragraph tone="secondary" size="body2" measure="none">Leave or delete the Acme workspace.</Paragraph>
67
+ </Stack>
68
+ <SettingsSection tone="danger" title="Leave workspace" description="You lose access to Acme.">
69
+ <Paragraph size="body2" measure="none">Your messages and tasks stay in Acme. An owner can invite you again.</Paragraph>
70
+ <Cluster>
71
+ <Button size="small" type="secondary" state="enabled" label="Leave Workspace" onClickButton={function () { return setLeaveOpen(true); }}/>
72
+ </Cluster>
73
+ </SettingsSection>
74
+ <SettingsSection tone="danger" title="Delete workspace" description="This cannot be undone.">
75
+ <Paragraph size="body2" measure="none">This deletes Acme, its 128 messages, 42 tasks and 9 documents. Every member keeps their own account, and files exported earlier stay where they are.</Paragraph>
76
+ {confirming ? (<>
77
+ <TextField id="danger-zone-shown-name" label={"Type ".concat(workspaceName, " to confirm")} value={typed} disabled={deleting} onChange={function (e) { return setTyped(e.target.value); }}/>
78
+ <Cluster gap="small">
79
+ <Button size="small" type="tertiary" state={deleting ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancelDelete}/>
80
+ <Button size="small" type="primary" color="danger" state={matches ? 'enabled' : 'disabled'} label="Delete Workspace" loading={deleting} onClickButton={handleDelete}/>
81
+ </Cluster>
82
+ </>) : (<Cluster>
83
+ <Button size="small" type="secondary" color="danger" state="enabled" label="Delete Workspace" onClickButton={function () { return setConfirming(true); }}/>
84
+ </Cluster>)}
85
+ </SettingsSection>
86
+ </Stack>
87
+ <Modal isOpen={leaveOpen} size="small" title="Leave Workspace" onClose={handleLeaveClose} actions={<>
88
+ <Button size="small" type="tertiary" state={leaving ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleLeaveClose}/>
89
+ <Button size="small" type="primary" state="enabled" label="Leave" loading={leaving} onClickButton={handleLeave}/>
90
+ </>}>
91
+ <Paragraph measure="none">You will lose access to Acme.</Paragraph>
92
+ <Paragraph tone="secondary" size="body2" measure="none">Your messages and tasks stay in Acme. An owner can invite you again.</Paragraph>
93
+ </Modal>
94
+ </Center>);
95
+ }