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
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person types @ in the message box to name someone, or the agent.
4
4
 
5
- **Not built yet:** Scindo on the web builds its list from buttons, so a screen reader in the field does not hear which name is highlighted. It shows no 'Agent' tag on the agent's row.
6
-
7
5
  ## Do
8
6
 
9
7
  - Open the list when the person types @ at the start of the text or after a space. A bare @ opens it, and each letter after it narrows it.
@@ -248,5 +246,3 @@ export default function MentionListInComposer() {
248
246
  ## Native
249
247
 
250
248
  On Apple the list shows above the field, the agent with a sparkles icon and people with a person icon. A name is picked with a click or a tap.
251
-
252
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person acts on one message: reacts to it, copies it, edits or deletes it.
4
4
 
5
- **Not built yet:** Scindo on the web deletes a message with no confirm and has no Copy. Its row actions show only while the pointer is on the row, so a keyboard or a phone cannot reach them.
6
-
7
5
  ## Do
8
6
 
9
7
  - Put the actions in the Message's `actions`. They show while the pointer is on the row or focus is in it.
@@ -647,5 +645,3 @@ export default function MessageActionsMenu() {
647
645
  ## Native
648
646
 
649
647
  On Apple put the actions in the row's `contextMenu`: Copy, Edit, Add Reaction, Create Task and Report, with Delete last in the `.destructive` role. Delete asks in a system `confirmationDialog`, not in the row.
650
-
651
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person adds files to a message, and people open the files in a message that was sent.
4
4
 
5
- **Not built yet:** No product shows upload progress or a failed upload on the file itself. Scindo on the web shows a rejected file in an error Alert above the field, and its images use the file name as `alt` text.
6
-
7
5
  ## Do
8
6
 
9
7
  - Show each waiting file as a `FileChip` in the Composer's `above` slot, with `onRemove`.
@@ -306,5 +304,3 @@ export default function MessageAttachmentsInMessage() {
306
304
  ## Native
307
305
 
308
306
  On Apple the attach button opens a menu with Photo Library and Files on iPhone, and opens Files on a Mac. Waiting files show as chips with a remove button. Sent images open full screen.
309
-
310
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person writes a message at the bottom of a thread.
4
4
 
5
- **Not built yet:** Scindo's Apple app shows only 'Message' as its placeholder when the agent is not called, so it does not say who will read the message.
6
-
7
5
  ## Do
8
6
 
9
7
  - Use `Composer` under the thread, with an `aria-label`, since it has no visible label.
@@ -352,5 +350,3 @@ export default function MessageComposerWithTools() {
352
350
  ## Native
353
351
 
354
352
  On Apple use a `TextField` with `axis: .vertical`. On a Mac, Return sends and Shift-Return adds a line. On an iPhone, Return adds a line. While the agent works, Send becomes Stop.
355
-
356
- Seen in: Commentify, Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person changes the text of a message they sent.
4
4
 
5
- **Not built yet:** Scindo on the web saves and cancels with two icon buttons, a check and a cross, under the field. Scindo's Apple app shows 'Saving...' on its Save button while it saves.
6
-
7
5
  ## Do
8
6
 
9
7
  - Replace the row's body with a `Composer` that holds the text, and focus it with the caret after the text.
@@ -175,5 +173,3 @@ export default function MessageEditInPlace() {
175
173
  ## Native
176
174
 
177
175
  On Apple the text becomes a field in the row, with 'Cancel' and 'Save', and the row shows '(edited)' after.
178
-
179
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  People answer a message with an emoji instead of a reply.
4
4
 
5
- **Not built yet:** Commentify's reaction chips do not show which are the person's, and cannot be pressed. Commentify adds a reaction from a full emoji picker.
6
-
7
5
  ## Do
8
6
 
9
7
  - Put the reactions in the Message's `footer`: a `Cluster` of `Tag`s, then a small 'Add reaction' `IconButton`.
@@ -367,5 +365,3 @@ export default function MessageReactionsQuickPick() {
367
365
  ## Native
368
366
 
369
367
  On Apple a reaction is added from the row's `contextMenu`, with Add Reaction.
370
-
371
- Seen in: Commentify, Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A thread shows messages from people, and sometimes from an agent.
4
4
 
5
- **Not built yet:** Scindo on the web shows no 'Agent' tag on an agent's row, and its message list is not a log for screen readers. Scindo's Apple app shows no model name and does not group messages.
6
-
7
5
  ## Do
8
6
 
9
7
  - Show each row with `Message`: the sender's `UserImage`, their name and the time. A person's avatar is their picture or their initial.
@@ -185,5 +183,3 @@ export default function MessageRowGrouped() {
185
183
  ## Native
186
184
 
187
185
  On Apple a row shows the avatar, the name and the time, with an 'Agent' label next to an agent's name.
188
-
189
- Seen in: Commentify, Scindo.
@@ -0,0 +1 @@
1
+ export default function MobileMenuLinks(): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import SiteHeader from '../../components/siteHeader';
3
+ import PageShell from '../../components/pageShell';
4
+ import Button from '../../components/button';
5
+ import Heading from '../../components/heading';
6
+ import Paragraph from '../../components/paragraph';
7
+ import { Stack } from '../../components/layout';
8
+ var links = [
9
+ { label: 'Features', href: '#features', current: true },
10
+ { label: 'Pricing', href: '#pricing' },
11
+ { label: 'Docs', href: '#docs' },
12
+ ];
13
+ export default function MobileMenuLinks() {
14
+ return (<>
15
+ {/* Below md the Menu IconButton opens a Drawer: the links first, then 'Log In'. Choosing one closes it. 'Sign Up' stays in the bar. */}
16
+ <SiteHeader brand={{ href: '#top', name: 'Acme' }} links={links} actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in"/>} phoneAction={<Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up"/>} mainId="mobile-menu-links-main"/>
17
+ <PageShell id="mobile-menu-links-main" tabIndex={-1}>
18
+ <Stack gap="large">
19
+ <Heading level={1} size="h5">Features</Heading>
20
+ <Paragraph tone="secondary" measure="none">On a phone, open Menu to reach every page. It closes when you choose one.</Paragraph>
21
+ </Stack>
22
+ </PageShell>
23
+ </>);
24
+ }
@@ -0,0 +1 @@
1
+ export default function MobileMenuSections(): import("react").JSX.Element;
@@ -0,0 +1,61 @@
1
+ 'use client';
2
+ import { useState } from 'react';
3
+ import Drawer from '../../components/drawer';
4
+ import IconButton from '../../components/iconButton';
5
+ import TabsContainer from '../../components/tabsContainer';
6
+ import Tab from '../../components/tab';
7
+ import Navigation from '../../components/navigation';
8
+ import MenuItem from '../../components/menuItem';
9
+ import PageShell from '../../components/pageShell';
10
+ import Heading from '../../components/heading';
11
+ import Paragraph from '../../components/paragraph';
12
+ import { Cluster, Stack } from '../../components/layout';
13
+ // Four sections, one short word each. A real site reads these from its navigation.
14
+ var sections = [
15
+ { id: 'start', label: 'Start', pages: [{ id: 'install', label: 'Install' }, { id: 'first-steps', label: 'First steps' }] },
16
+ { id: 'guides', label: 'Guides', pages: [{ id: 'sharing', label: 'Share a folder' }, { id: 'roles', label: 'Roles and access' }, { id: 'billing', label: 'Billing' }] },
17
+ { id: 'reference', label: 'API', pages: [{ id: 'api', label: 'Endpoints' }, { id: 'limits', label: 'Limits' }] },
18
+ { id: 'updates', label: 'News', pages: [{ id: 'changelog', label: 'Changelog' }] },
19
+ ];
20
+ var drawerId = 'mobile-menu-sections-drawer';
21
+ export default function MobileMenuSections() {
22
+ var _a, _b, _c;
23
+ var _d = useState(false), open = _d[0], setOpen = _d[1];
24
+ var _e = useState('sharing'), pageId = _e[0], setPageId = _e[1];
25
+ var currentSection = (_a = sections.find(function (s) { return s.pages.some(function (p) { return p.id === pageId; }); })) !== null && _a !== void 0 ? _a : sections[0];
26
+ // The tabs show the section of the current page each time the menu opens.
27
+ var _f = useState(currentSection.id), sectionId = _f[0], setSectionId = _f[1];
28
+ var shown = (_b = sections.find(function (s) { return s.id === sectionId; })) !== null && _b !== void 0 ? _b : sections[0];
29
+ var page = (_c = currentSection.pages.find(function (p) { return p.id === pageId; })) !== null && _c !== void 0 ? _c : currentSection.pages[0];
30
+ function openMenu() {
31
+ setSectionId(currentSection.id);
32
+ setOpen(true);
33
+ }
34
+ return (<PageShell>
35
+ <Stack gap="large">
36
+ <Cluster gap="small">
37
+ {/* A real site shows this IconButton only below md, where the links are not in the bar. */}
38
+ <IconButton color="iconOnly" state="enabled" size="medium" iconName="Menu" ariaLabel="Menu" aria-expanded={open} aria-controls={drawerId} onClick={openMenu}/>
39
+ <Paragraph size="body1" measure="none">Acme Docs</Paragraph>
40
+ </Cluster>
41
+ <Heading level={1} size="h5">{page.label}</Heading>
42
+ <Paragraph tone="secondary" measure="none">This page is in {currentSection.label}. Open Menu to move to another section.</Paragraph>
43
+ </Stack>
44
+ {/* Section tabs at the top, the section's pages under them, the current page marked. A choice closes the Drawer. */}
45
+ <Drawer id={drawerId} isOpen={open} onClose={function () { return setOpen(false); }} aria-label="Menu" side="start" size="small" closeFrom="md">
46
+ <Stack gap="large">
47
+ <TabsContainer fill>
48
+ {sections.map(function (s) { return (<Tab key={s.id} label={s.label} size="small" isSelected={s.id === shown.id} onClickTab={function () { return setSectionId(s.id); }}/>); })}
49
+ </TabsContainer>
50
+ <Navigation aria-label={"".concat(shown.label, " pages")}>
51
+ {shown.pages.map(function (p) { return (<MenuItem key={p.id} size="small" label={p.label} href={"/".concat(shown.id, "/").concat(p.id)} isSelected={p.id === pageId} aria-current={p.id === pageId ? 'page' : undefined} onClick={function (event) {
52
+ // A real app lets the link go to its page. The example keeps the choice in state.
53
+ event.preventDefault();
54
+ setPageId(p.id);
55
+ setOpen(false);
56
+ }}/>); })}
57
+ </Navigation>
58
+ </Stack>
59
+ </Drawer>
60
+ </PageShell>);
61
+ }
@@ -0,0 +1,170 @@
1
+ # Menu on a phone
2
+
3
+ A site's links and actions do not fit in the bar on a phone, and the person still needs to reach every one.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail'. The menu is a `Drawer` from the start side.
8
+ - Open it from an `IconButton` named 'Menu' at the start of the bar, with `aria-expanded` and `aria-controls`.
9
+ - Use the menu that `SiteHeader` builds for a few links. The links come first, then the actions. One main action stays in the bar as `phoneAction`.
10
+ - Build the menu from a `Drawer` for sections: the pages of the open section as `MenuItem` links in a `Navigation`. Put a `TabsContainer` of section `Tab`s above them when the bar does not show the sections.
11
+ - Put the 'Menu' IconButton in a real bar with a skip link, as `SiteHeader` builds.
12
+ - Open the menu on the section of the current page, and mark the current page with `isSelected` and `aria-current="page"`.
13
+ - Close the menu when a page is chosen. A `Drawer` also closes on Close, Escape and the scrim.
14
+ - Close the menu when the window widens past `md`, so the page is never left locked. A `SiteHeader` does it; give your own `Drawer` `closeFrom="md"`.
15
+ - Give the Drawer a name with `aria-label`, the same as the button that opens it.
16
+
17
+ ## Don't
18
+
19
+ - Do not leave a link without a way to reach it on a phone.
20
+ - Do not keep the menu open after a page is chosen.
21
+ - Do not put a Button that opens a Modal in the menu. On a phone the menu closes when it is chosen, so the Modal has no Button to give focus back to. Link to a page instead.
22
+ - Do not name the button only by its icon. Name it 'Menu'.
23
+ - Do not use more than four section tabs, or long names. They will not fit on a phone.
24
+
25
+ ## Option: Links and actions in one menu
26
+
27
+ Use when: A site has a few links and its actions, such as 'Log In'.
28
+
29
+ Uses: `Button`, `Heading`, `PageShell`, `Paragraph`, `SiteHeader`, `Stack`
30
+
31
+ ```tsx
32
+ 'use client';
33
+ import SiteHeader from 'oneslash-design-system/components/siteHeader';
34
+ import PageShell from 'oneslash-design-system/components/pageShell';
35
+ import Button from 'oneslash-design-system/components/button';
36
+ import Heading from 'oneslash-design-system/components/heading';
37
+ import Paragraph from 'oneslash-design-system/components/paragraph';
38
+ import { Stack } from 'oneslash-design-system/components/layout';
39
+
40
+ const links = [
41
+ { label: 'Features', href: '#features', current: true },
42
+ { label: 'Pricing', href: '#pricing' },
43
+ { label: 'Docs', href: '#docs' },
44
+ ];
45
+
46
+ export default function MobileMenuLinks() {
47
+ return (
48
+ <>
49
+ {/* Below md the Menu IconButton opens a Drawer: the links first, then 'Log In'. Choosing one closes it. 'Sign Up' stays in the bar. */}
50
+ <SiteHeader
51
+ brand={{ href: '#top', name: 'Acme' }}
52
+ links={links}
53
+ actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in" />}
54
+ phoneAction={<Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up" />}
55
+ mainId="mobile-menu-links-main"
56
+ />
57
+ <PageShell id="mobile-menu-links-main" tabIndex={-1}>
58
+ <Stack gap="large">
59
+ <Heading level={1} size="h5">Features</Heading>
60
+ <Paragraph tone="secondary" measure="none">On a phone, open Menu to reach every page. It closes when you choose one.</Paragraph>
61
+ </Stack>
62
+ </PageShell>
63
+ </>
64
+ );
65
+ }
66
+ ```
67
+
68
+ ## Option: Sections with their pages
69
+
70
+ Use when: A site has sections that each hold many pages, and the person picks a section first.
71
+
72
+ Uses: `Cluster`, `Drawer`, `Heading`, `IconButton`, `MenuItem`, `Navigation`, `PageShell`, `Paragraph`, `Stack`, `Tab`, `TabsContainer`
73
+
74
+ ```tsx
75
+ 'use client';
76
+ import { useState } from 'react';
77
+ import Drawer from 'oneslash-design-system/components/drawer';
78
+ import IconButton from 'oneslash-design-system/components/iconButton';
79
+ import TabsContainer from 'oneslash-design-system/components/tabsContainer';
80
+ import Tab from 'oneslash-design-system/components/tab';
81
+ import Navigation from 'oneslash-design-system/components/navigation';
82
+ import MenuItem from 'oneslash-design-system/components/menuItem';
83
+ import PageShell from 'oneslash-design-system/components/pageShell';
84
+ import Heading from 'oneslash-design-system/components/heading';
85
+ import Paragraph from 'oneslash-design-system/components/paragraph';
86
+ import { Cluster, Stack } from 'oneslash-design-system/components/layout';
87
+
88
+ type Page = { id: string; label: string };
89
+ type Section = { id: string; label: string; pages: Page[] };
90
+
91
+ // Four sections, one short word each. A real site reads these from its navigation.
92
+ const sections: Section[] = [
93
+ { id: 'start', label: 'Start', pages: [{ id: 'install', label: 'Install' }, { id: 'first-steps', label: 'First steps' }] },
94
+ { id: 'guides', label: 'Guides', pages: [{ id: 'sharing', label: 'Share a folder' }, { id: 'roles', label: 'Roles and access' }, { id: 'billing', label: 'Billing' }] },
95
+ { id: 'reference', label: 'API', pages: [{ id: 'api', label: 'Endpoints' }, { id: 'limits', label: 'Limits' }] },
96
+ { id: 'updates', label: 'News', pages: [{ id: 'changelog', label: 'Changelog' }] },
97
+ ];
98
+
99
+ const drawerId = 'mobile-menu-sections-drawer';
100
+
101
+ export default function MobileMenuSections() {
102
+ const [open, setOpen] = useState(false);
103
+ const [pageId, setPageId] = useState('sharing');
104
+ const currentSection = sections.find((s) => s.pages.some((p) => p.id === pageId)) ?? sections[0];
105
+ // The tabs show the section of the current page each time the menu opens.
106
+ const [sectionId, setSectionId] = useState(currentSection.id);
107
+ const shown = sections.find((s) => s.id === sectionId) ?? sections[0];
108
+ const page = currentSection.pages.find((p) => p.id === pageId) ?? currentSection.pages[0];
109
+
110
+ function openMenu() {
111
+ setSectionId(currentSection.id);
112
+ setOpen(true);
113
+ }
114
+
115
+ return (
116
+ <PageShell>
117
+ <Stack gap="large">
118
+ <Cluster gap="small">
119
+ {/* A real site shows this IconButton only below md, where the links are not in the bar. */}
120
+ <IconButton
121
+ color="iconOnly"
122
+ state="enabled"
123
+ size="medium"
124
+ iconName="Menu"
125
+ ariaLabel="Menu"
126
+ aria-expanded={open}
127
+ aria-controls={drawerId}
128
+ onClick={openMenu}
129
+ />
130
+ <Paragraph size="body1" measure="none">Acme Docs</Paragraph>
131
+ </Cluster>
132
+ <Heading level={1} size="h5">{page.label}</Heading>
133
+ <Paragraph tone="secondary" measure="none">This page is in {currentSection.label}. Open Menu to move to another section.</Paragraph>
134
+ </Stack>
135
+ {/* Section tabs at the top, the section's pages under them, the current page marked. A choice closes the Drawer. */}
136
+ <Drawer id={drawerId} isOpen={open} onClose={() => setOpen(false)} aria-label="Menu" side="start" size="small" closeFrom="md">
137
+ <Stack gap="large">
138
+ <TabsContainer fill>
139
+ {sections.map((s) => (
140
+ <Tab key={s.id} label={s.label} size="small" isSelected={s.id === shown.id} onClickTab={() => setSectionId(s.id)} />
141
+ ))}
142
+ </TabsContainer>
143
+ <Navigation aria-label={`${shown.label} pages`}>
144
+ {shown.pages.map((p) => (
145
+ <MenuItem
146
+ key={p.id}
147
+ size="small"
148
+ label={p.label}
149
+ href={`/${shown.id}/${p.id}`}
150
+ isSelected={p.id === pageId}
151
+ aria-current={p.id === pageId ? 'page' : undefined}
152
+ onClick={(event: { preventDefault: () => void }) => {
153
+ // A real app lets the link go to its page. The example keeps the choice in state.
154
+ event.preventDefault();
155
+ setPageId(p.id);
156
+ setOpen(false);
157
+ }}
158
+ />
159
+ ))}
160
+ </Navigation>
161
+ </Stack>
162
+ </Drawer>
163
+ </PageShell>
164
+ );
165
+ }
166
+ ```
167
+
168
+ ## Native
169
+
170
+ On iPhone use a `TabView` for the main places and a `NavigationStack` for the pages in a section. On Android use a navigation drawer.
@@ -1,26 +1,35 @@
1
1
  'use client';
2
- import Image from '../../components/image';
3
- import TabsContainer from '../../components/tabsContainer';
4
- import Tab from '../../components/tab';
2
+ import { useState } from 'react';
3
+ import AppShell from '../../components/appShell';
4
+ import Navigation, { NavigationGroup } from '../../components/navigation';
5
+ import MenuItem from '../../components/menuItem';
5
6
  import Surface from '../../components/surface';
6
7
  import Heading from '../../components/heading';
7
8
  import Paragraph from '../../components/paragraph';
8
9
  import Button from '../../components/button';
9
10
  import { Cluster, Stack } from '../../components/layout';
10
- // The product's mark. A real app passes its own file.
11
- var productMark = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
12
- // A real app passes the router from its framework, such as Next's useRouter().
13
- var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
11
+ // The places, and the projects the person made. The page that failed or loads is the current one.
12
+ var places = [
13
+ { label: 'Home', icon: 'House', href: '/' },
14
+ { label: 'Settings', icon: 'Settings', href: '/settings' },
15
+ ];
16
+ var projects = [
17
+ { label: 'Website', icon: 'Globe', href: '/projects/website' },
18
+ { label: 'Mobile App', icon: 'Smartphone', href: '/projects/mobile-app' },
19
+ ];
20
+ var current = '/projects/website';
21
+ var row = function (p) { return (<MenuItem key={p.href} size="small" label={p.label} iconName={p.icon} href={p.href} isSelected={p.href === current} aria-current={p.href === current ? 'page' : undefined}
22
+ // A real app lets the link go to its page.
23
+ onClick={function (event) { return event.preventDefault(); }}/>); };
24
+ var sidebar = (<Navigation aria-label="Main">
25
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
26
+ {places.map(row)}
27
+ <NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
28
+ </Navigation>);
14
29
  export default function NotFoundPageInShell() {
15
- return (<Stack gap="large">
16
- <Cluster gap="large">
17
- <Image src={productMark} alt="Acme" width={32} height={32}/>
18
- <TabsContainer>
19
- <Tab label="Home" isSelected={false} href="/" router={router} onClickTab={function () { }}/>
20
- <Tab label="Projects" isSelected href="/projects" router={router} onClickTab={function () { }}/>
21
- <Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={function () { }}/>
22
- </TabsContainer>
23
- </Cluster>
30
+ // Below md the sidebar is a Drawer; this says whether it is open.
31
+ var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
32
+ return (<AppShell title="Website" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
24
33
  <Surface minHeight="tall" align="center">
25
34
  <Stack gap="xlarge">
26
35
  <Stack gap="medium">
@@ -32,5 +41,5 @@ export default function NotFoundPageInShell() {
32
41
  </Cluster>
33
42
  </Stack>
34
43
  </Surface>
35
- </Stack>);
44
+ </AppShell>);
36
45
  }
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person opens a link to a page that does not exist.
4
4
 
5
- **Not built yet:** Commentify's page not found is one line of bare text, 'Page not found.', with no way home. Scindo on the web shows '404' as its heading, then bare text and a text link home. jinhwankim.com has no heading: it puts '404:' at the start of its `EmptyBox` text and labels its Button 'Go to Home'.
6
-
7
5
  ## Do
8
6
 
9
7
  - Say 'Page not found' in a `Heading` with `level={1}`.
@@ -48,37 +46,58 @@ export default function NotFoundPageFullPage() {
48
46
 
49
47
  Use when: The address is inside the app and the navigation still works.
50
48
 
51
- Uses: `Button`, `Cluster`, `Heading`, `Image`, `Paragraph`, `Stack`, `Surface`, `Tab`, `TabsContainer`
49
+ Uses: `AppShell`, `Button`, `Cluster`, `Heading`, `MenuItem`, `Navigation`, `NavigationGroup`, `Paragraph`, `Stack`, `Surface`
52
50
 
53
51
  ```tsx
54
52
  'use client';
55
- import Image from 'oneslash-design-system/components/image';
56
- import TabsContainer from 'oneslash-design-system/components/tabsContainer';
57
- import Tab from 'oneslash-design-system/components/tab';
53
+ import { useState } from 'react';
54
+ import AppShell from 'oneslash-design-system/components/appShell';
55
+ import Navigation, { NavigationGroup } from 'oneslash-design-system/components/navigation';
56
+ import MenuItem from 'oneslash-design-system/components/menuItem';
58
57
  import Surface from 'oneslash-design-system/components/surface';
59
58
  import Heading from 'oneslash-design-system/components/heading';
60
59
  import Paragraph from 'oneslash-design-system/components/paragraph';
61
60
  import Button from 'oneslash-design-system/components/button';
62
61
  import { Cluster, Stack } from 'oneslash-design-system/components/layout';
63
62
 
64
- // The product's mark. A real app passes its own file.
65
- const productMark =
66
- "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
67
-
68
- // A real app passes the router from its framework, such as Next's useRouter().
69
- const router = { push: (url: string) => console.info(`Go to ${url}`) };
63
+ // The places, and the projects the person made. The page that failed or loads is the current one.
64
+ const places = [
65
+ { label: 'Home', icon: 'House', href: '/' },
66
+ { label: 'Settings', icon: 'Settings', href: '/settings' },
67
+ ];
68
+ const projects = [
69
+ { label: 'Website', icon: 'Globe', href: '/projects/website' },
70
+ { label: 'Mobile App', icon: 'Smartphone', href: '/projects/mobile-app' },
71
+ ];
72
+ const current = '/projects/website';
73
+
74
+ const row = (p: { label: string; icon: string; href: string }) => (
75
+ <MenuItem
76
+ key={p.href}
77
+ size="small"
78
+ label={p.label}
79
+ iconName={p.icon}
80
+ href={p.href}
81
+ isSelected={p.href === current}
82
+ aria-current={p.href === current ? 'page' : undefined}
83
+ // A real app lets the link go to its page.
84
+ onClick={(event: { preventDefault: () => void }) => event.preventDefault()}
85
+ />
86
+ );
87
+
88
+ const sidebar = (
89
+ <Navigation aria-label="Main">
90
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
91
+ {places.map(row)}
92
+ <NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
93
+ </Navigation>
94
+ );
70
95
 
71
96
  export default function NotFoundPageInShell() {
97
+ // Below md the sidebar is a Drawer; this says whether it is open.
98
+ const [navOpen, setNavOpen] = useState(false);
72
99
  return (
73
- <Stack gap="large">
74
- <Cluster gap="large">
75
- <Image src={productMark} alt="Acme" width={32} height={32} />
76
- <TabsContainer>
77
- <Tab label="Home" isSelected={false} href="/" router={router} onClickTab={() => {}} />
78
- <Tab label="Projects" isSelected href="/projects" router={router} onClickTab={() => {}} />
79
- <Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={() => {}} />
80
- </TabsContainer>
81
- </Cluster>
100
+ <AppShell title="Website" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
82
101
  <Surface minHeight="tall" align="center">
83
102
  <Stack gap="xlarge">
84
103
  <Stack gap="medium">
@@ -90,9 +109,7 @@ export default function NotFoundPageInShell() {
90
109
  </Cluster>
91
110
  </Stack>
92
111
  </Surface>
93
- </Stack>
112
+ </AppShell>
94
113
  );
95
114
  }
96
115
  ```
97
-
98
- Seen in: Commentify, Scindo, jinhwankim.com.
@@ -0,0 +1 @@
1
+ export default function NotificationMenuExample(): import("react").JSX.Element;
@@ -0,0 +1,74 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Toaster, { toast, dismissToast } from '../../components/toaster';
4
+ import Heading from '../../components/heading';
5
+ import Paragraph from '../../components/paragraph';
6
+ import IconButton from '../../components/iconButton';
7
+ import Tooltip from '../../components/tooltip';
8
+ import Popover from '../../components/popover';
9
+ import Menu from '../../components/menu';
10
+ import MenuItem from '../../components/menuItem';
11
+ import { Center, Cluster, Stack } from '../../components/layout';
12
+ var choices = [
13
+ { value: 'all', label: 'All Messages', line: 'Every message in this channel.', current: 'All messages' },
14
+ { value: 'mentions', label: 'Mentions Only', line: 'Only when someone mentions you.', current: 'Mentions only' },
15
+ { value: 'none', label: 'Muted', line: 'No notifications from this channel.', current: 'Muted' },
16
+ ];
17
+ export default function NotificationMenuExample() {
18
+ var _a;
19
+ var _b = useState('all'), pref = _b[0], setPref = _b[1];
20
+ var _c = useState(false), saving = _c[0], setSaving = _c[1];
21
+ var _d = useState(null), anchor = _d[0], setAnchor = _d[1];
22
+ var _e = useState(false), open = _e[0], setOpen = _e[1];
23
+ var timer = useRef();
24
+ var toastIds = useRef([]);
25
+ var current = (_a = choices.find(function (c) { return c.value === pref; })) !== null && _a !== void 0 ? _a : choices[0];
26
+ // On unmount it stops the request and closes the toast it opened.
27
+ useEffect(function () { return function () {
28
+ clearTimeout(timer.current);
29
+ toastIds.current.forEach(function (id) { return dismissToast(id); });
30
+ toastIds.current = [];
31
+ }; }, []);
32
+ function toggle(anchorEl) {
33
+ if (saving)
34
+ return;
35
+ setAnchor(anchorEl);
36
+ setOpen(function (o) { return !o; });
37
+ }
38
+ // Saves at once and shows nothing when it works: the bell already shows the new value.
39
+ // The menu is gone by now, so a failure says so in a toast, and the bell goes back.
40
+ function choose(next) {
41
+ var previous = pref;
42
+ setOpen(false);
43
+ if (next === previous)
44
+ return;
45
+ setPref(next);
46
+ setSaving(true);
47
+ // Stands in for the request to the server. 'Muted' never saves, as if the connection were down.
48
+ timer.current = setTimeout(function () {
49
+ setSaving(false);
50
+ if (next === 'none') {
51
+ setPref(previous);
52
+ toastIds.current.push(toast({ type: 'error', message: 'Could not save your notification setting. Try again.' }));
53
+ }
54
+ }, 900);
55
+ }
56
+ return (<Center width="page">
57
+ {/* A real app mounts one Toaster near its root. */}
58
+ <Toaster />
59
+ <Stack gap="large">
60
+ <Cluster justify="between">
61
+ <Heading level={1} size="h5">Design team</Heading>
62
+ <Tooltip title={current.current}>
63
+ <IconButton color={pref === 'none' ? 'secondary' : 'iconOnly'} state={open ? 'selected' : 'enabled'} size="small" iconName={pref === 'none' ? 'BellOff' : 'Bell'} ariaLabel={"Notifications: ".concat(current.current)} aria-haspopup="menu" aria-expanded={open} aria-busy={saving} onClick={function (e) { return toggle(e.currentTarget); }}/>
64
+ </Tooltip>
65
+ </Cluster>
66
+ <Paragraph tone="secondary" size="body2" measure="none">Ben Carter: The press kit is in the shared folder.</Paragraph>
67
+ </Stack>
68
+ <Popover open={open} anchorEl={anchor} onClose={function () { return setOpen(false); }} returnFocus>
69
+ <Menu navigable aria-label="Notifications" width={260}>
70
+ {choices.map(function (c) { return (<MenuItem key={c.value} size="small" label={c.label} secondLabel={c.line} isSelected={c.value === pref} role="menuitemradio" onClick={function () { return choose(c.value); }}/>); })}
71
+ </Menu>
72
+ </Popover>
73
+ </Center>);
74
+ }