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,204 @@
1
+ # Filter menu
2
+
3
+ A person narrows a list by one choice, such as a date range, or turns the filter off.
4
+
5
+ ## Do
6
+
7
+ - Open a navigable menu from an `IconButton`: `<Popover returnFocus>` around `<Menu navigable aria-label="Filter by date">` with `onClick` items.
8
+ - Pass `event.currentTarget` to the Popover as `anchorEl`, and set `state="selected"` on the button while the menu is open.
9
+ - Give the button `color="secondary"` while a filter is on.
10
+ - Say the current filter in the button's `ariaLabel`: 'Filter by date: Last 7 days'.
11
+ - Show the current filter in a `Tooltip` on the button, such as 'Last 7 days'.
12
+ - Give each item `role="menuitemradio"` and mark the current one with `isSelected`. It sets `aria-checked`, so a screen reader says which one is on.
13
+ - Write each choice in Title Case, such as 'Last 24 Hours', and close the menu when one is chosen.
14
+ - Add 'Clear Filter' last, after a `Line`, when the filter can be off. Show it only while a filter is on.
15
+ - Show what the list holds under the heading, such as how many comments the filter leaves.
16
+ - Use the case 'Range switch' instead when two to four ranges are the page's main view and the header has room.
17
+
18
+ ## Don't
19
+
20
+ - Do not use a Tooltip as the only place that names the current filter.
21
+ - Do not mark the current choice with color only.
22
+ - Do not keep the menu open after a choice.
23
+ - Do not add a custom date range in a menu. ODS has no date picker yet.
24
+ - Do not put a destructive item in a filter menu.
25
+
26
+ ## Option: Presets
27
+
28
+ Use when: The choices are dates or a few fixed choices, and one is always on.
29
+
30
+ Uses: `Center`, `Cluster`, `Heading`, `IconButton`, `Menu`, `MenuItem`, `Paragraph`, `Popover`, `Stack`, `Tooltip`
31
+
32
+ ```tsx
33
+ 'use client';
34
+ import { useState } from 'react';
35
+ import Heading from 'oneslash-design-system/components/heading';
36
+ import Paragraph from 'oneslash-design-system/components/paragraph';
37
+ import IconButton from 'oneslash-design-system/components/iconButton';
38
+ import Tooltip from 'oneslash-design-system/components/tooltip';
39
+ import Popover from 'oneslash-design-system/components/popover';
40
+ import Menu from 'oneslash-design-system/components/menu';
41
+ import MenuItem from 'oneslash-design-system/components/menuItem';
42
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
43
+
44
+ // A real app counts these on the server. `label` is the menu item, in Title Case. `current` names the
45
+ // choice in the button's name, its tooltip and the line, in sentence case.
46
+ const filters = [
47
+ { value: 'day', label: 'Last 24 Hours', current: 'Last 24 hours', count: 4 },
48
+ { value: 'week', label: 'Last 7 Days', current: 'Last 7 days', count: 18 },
49
+ { value: 'month', label: 'Last 30 Days', current: 'Last 30 days', count: 64 },
50
+ { value: 'quarter', label: 'Last 90 Days', current: 'Last 90 days', count: 171 },
51
+ { value: 'all', label: 'All Time', current: 'All time', count: 240 },
52
+ ];
53
+
54
+ export default function FilterMenuPresets() {
55
+ const [value, setValue] = useState('week');
56
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
57
+ const [open, setOpen] = useState(false);
58
+ const current = filters.find((f) => f.value === value) ?? filters[1];
59
+
60
+ // The trigger toggles the menu. Popover's returnFocus gives focus back to it on close.
61
+ function toggle(anchorEl: HTMLElement) {
62
+ setAnchor(anchorEl);
63
+ setOpen((o) => !o);
64
+ }
65
+
66
+ function choose(next: string) {
67
+ setValue(next);
68
+ setOpen(false);
69
+ }
70
+
71
+ return (
72
+ <Center width="page">
73
+ <Stack gap="large">
74
+ <Cluster justify="between">
75
+ <Heading level={1} size="h5">Comments</Heading>
76
+ {/* The tooltip names the current filter, and so does the button's name. A filter that is on
77
+ shows in a filled button; 'All Time' filters nothing, so the button is plain. */}
78
+ <Tooltip title={current.current}>
79
+ <IconButton
80
+ color={value === 'all' ? 'iconOnly' : 'secondary'}
81
+ state={open ? 'selected' : 'enabled'}
82
+ size="small"
83
+ iconName="ListFilter"
84
+ ariaLabel={`Filter by date: ${current.current}`}
85
+ aria-haspopup="menu"
86
+ aria-expanded={open}
87
+ onClick={(e: { currentTarget: HTMLElement }) => toggle(e.currentTarget)}
88
+ />
89
+ </Tooltip>
90
+ </Cluster>
91
+ <Paragraph tone="secondary" size="body2" measure="none">{current.count} comments, {current.current.toLowerCase()}.</Paragraph>
92
+ </Stack>
93
+ <Popover open={open} anchorEl={anchor} onClose={() => setOpen(false)} returnFocus>
94
+ <Menu navigable aria-label="Filter by date" width={200}>
95
+ {filters.map((f) => (
96
+ <MenuItem
97
+ key={f.value}
98
+ size="small"
99
+ label={f.label}
100
+ isSelected={f.value === value}
101
+ role="menuitemradio"
102
+ onClick={() => choose(f.value)}
103
+ />
104
+ ))}
105
+ </Menu>
106
+ </Popover>
107
+ </Center>
108
+ );
109
+ }
110
+ ```
111
+
112
+ ## Option: Presets with Clear Filter
113
+
114
+ Use when: The filter can be off, so the list shows everything until the person picks a choice.
115
+
116
+ Uses: `Center`, `Cluster`, `Heading`, `IconButton`, `Line`, `Menu`, `MenuItem`, `Paragraph`, `Popover`, `Stack`, `Tooltip`
117
+
118
+ ```tsx
119
+ 'use client';
120
+ import { useState } from 'react';
121
+ import Heading from 'oneslash-design-system/components/heading';
122
+ import Paragraph from 'oneslash-design-system/components/paragraph';
123
+ import IconButton from 'oneslash-design-system/components/iconButton';
124
+ import Tooltip from 'oneslash-design-system/components/tooltip';
125
+ import Popover from 'oneslash-design-system/components/popover';
126
+ import Menu from 'oneslash-design-system/components/menu';
127
+ import MenuItem from 'oneslash-design-system/components/menuItem';
128
+ import Line from 'oneslash-design-system/components/line';
129
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
130
+
131
+ // A real app reads these from the server. `label` is the menu item, in Title Case. `current` names the
132
+ // choice in the button's name, its tooltip and the line, in sentence case.
133
+ const filters = [
134
+ { value: 'mentions', label: 'Mentions', current: 'Mentions', count: 3 },
135
+ { value: 'unread', label: 'Unread', current: 'Unread', count: 5 },
136
+ { value: 'assigned', label: 'Assigned to Me', current: 'Assigned to me', count: 2 },
137
+ ];
138
+ const total = 12;
139
+
140
+ export default function FilterMenuWithClear() {
141
+ // null means the filter is off.
142
+ const [value, setValue] = useState<string | null>('unread');
143
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
144
+ const [open, setOpen] = useState(false);
145
+ const current = filters.find((f) => f.value === value);
146
+
147
+ function toggle(anchorEl: HTMLElement) {
148
+ setAnchor(anchorEl);
149
+ setOpen((o) => !o);
150
+ }
151
+
152
+ function choose(next: string | null) {
153
+ setValue(next);
154
+ setOpen(false);
155
+ }
156
+
157
+ return (
158
+ <Center width="page">
159
+ <Stack gap="large">
160
+ <Cluster justify="between">
161
+ <Heading level={1} size="h5">Inbox</Heading>
162
+ {/* A filter that is on shows in a filled button. When it is off the button is plain. */}
163
+ <Tooltip title={current ? current.current : 'Filter messages'}>
164
+ <IconButton
165
+ color={current ? 'secondary' : 'iconOnly'}
166
+ state={open ? 'selected' : 'enabled'}
167
+ size="small"
168
+ iconName="ListFilter"
169
+ ariaLabel={current ? `Filter messages: ${current.current}` : 'Filter messages'}
170
+ aria-haspopup="menu"
171
+ aria-expanded={open}
172
+ onClick={(e: { currentTarget: HTMLElement }) => toggle(e.currentTarget)}
173
+ />
174
+ </Tooltip>
175
+ </Cluster>
176
+ <Paragraph tone="secondary" size="body2" measure="none">
177
+ {current ? `${current.count} of ${total} messages, ${current.current.toLowerCase()}.` : `All ${total} messages.`}
178
+ </Paragraph>
179
+ </Stack>
180
+ <Popover open={open} anchorEl={anchor} onClose={() => setOpen(false)} returnFocus>
181
+ <Menu navigable aria-label="Filter messages" width={200}>
182
+ {filters.map((f) => (
183
+ <MenuItem
184
+ key={f.value}
185
+ size="small"
186
+ label={f.label}
187
+ isSelected={f.value === value}
188
+ role="menuitemradio"
189
+ onClick={() => choose(f.value)}
190
+ />
191
+ ))}
192
+ {/* Clear is last, and shows only while a filter is on. */}
193
+ {current && <Line />}
194
+ {current && <MenuItem size="small" iconName="X" label="Clear Filter" onClick={() => choose(null)} />}
195
+ </Menu>
196
+ </Popover>
197
+ </Center>
198
+ );
199
+ }
200
+ ```
201
+
202
+ ## Native
203
+
204
+ On Apple use a `Menu` with a `Picker` inside it, so the current choice gets a check mark. On Android use a dropdown menu with radio items.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person cannot remember their password and asks for a link to set a new one.
4
4
 
5
- **Not built yet:** Commentify and Scindo on the web replace the form with a spinner while sending the link. Both then say 'We sent a password reset link to' the address, even when it has no account.
6
-
7
5
  ## Do
8
6
 
9
7
  - Name the page 'Reset password' in a `Heading` with `level={1}`, and say in one line what happens next.
@@ -324,5 +322,3 @@ export default function ForgotPasswordOwnPage() {
324
322
  ## Native
325
323
 
326
324
  On Apple, put 'Forgot Password?' under the 'Log In' Button and open the web reset form from it.
327
-
328
- Seen in: Commentify, Scindo.
@@ -6,8 +6,6 @@ A form was submitted and something is wrong.
6
6
 
7
7
  A problem with one field shows under that field, through the field's `error` and `errorText`. A problem with the whole request shows above the fields in `<Alert type="error" variant="inline" showCloseButton>`, so it stays until the person closes it or submits again. Its `onClose` clears the message; if it does not, the Alert comes back. While the request runs, the submit Button is `loading` and keeps its label. The form keeps what the person typed. The next submit clears the old messages. Messages are in sentence case. It is never a colored caption written by hand, and never the browser's `alert()`.
8
8
 
9
- **Not built yet:** Commentify writes red captions by hand on its consent screen and in its Figma import dialog. Scindo on the web does the same in its dialogs, such as renaming a workspace or a task. Commentify uses the browser's `alert()` in three files, and Scindo on the web in one.
10
-
11
9
  ## Why
12
10
 
13
11
  A message next to the problem tells the person what to fix without searching for it. Keeping what they typed means they fix one thing instead of starting again.
@@ -28,5 +26,3 @@ A message next to the problem tells the person what to fix without searching for
28
26
  - Do not use the browser's `alert()`.
29
27
  - Do not clear the form after a failed submit.
30
28
  - Do not change the submit Button's label while it is loading, such as to 'Saving…'.
31
-
32
- Seen in: Commentify, Scindo, jinhwankim.com.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person picks which items to bring in from another place, such as pages from a wiki.
4
4
 
5
- **Not built yet:** Scindo's Notion import labels its Buttons 'Select all' and 'Import', changes the action to 'Importing… 1/2' while it runs, and shows bare text when nothing matches.
6
-
7
5
  ## Do
8
6
 
9
7
  - Put a search field at the top, then a count line, then the list of `Checkbox`es.
@@ -184,5 +182,3 @@ export default function ImportChecklistModal() {
184
182
  );
185
183
  }
186
184
  ```
187
-
188
- Seen in: Scindo.
@@ -2,8 +2,6 @@
2
2
 
3
3
  A person submits a small form, such as a settings field, and the request ends. The three options are the three outcomes of one save: it worked in place, it failed, or the result is elsewhere.
4
4
 
5
- **Not built yet:** Scindo on the web labels its save Buttons 'Saving...' while they save. Its profile settings show nothing when a save fails. Its instructions settings show the error's own message in an inline Alert with no close button.
6
-
7
5
  ## Do
8
6
 
9
7
  - Show `loading` on the submit Button while the request runs, and keep its label.
@@ -233,5 +231,3 @@ export default function InlineFormFeedbackToast() {
233
231
  ## Native
234
232
 
235
233
  On Apple there is no toast. Show the result in place.
236
-
237
- Seen in: Scindo.
@@ -0,0 +1 @@
1
+ export default function IntegrationsListNested(): import("react").JSX.Element;
@@ -0,0 +1,164 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ import { Fragment, useEffect, useRef, useState } from 'react';
23
+ import { Slack } from 'lucide-react';
24
+ import Modal from '../../components/modal';
25
+ import Heading from '../../components/heading';
26
+ import Paragraph from '../../components/paragraph';
27
+ import TableContainer from '../../components/tableContainer';
28
+ import TableRow from '../../components/tableRow';
29
+ import TableCell from '../../components/tableCell';
30
+ import BrandIcon from '../../components/brandIcon';
31
+ import Icon from '../../components/icon';
32
+ import Tag from '../../components/tag';
33
+ import Button from '../../components/button';
34
+ import { Center, Cluster, Stack } from '../../components/layout';
35
+ var firstProviders = [
36
+ {
37
+ id: 'github',
38
+ name: 'GitHub',
39
+ does: 'Link pull requests to tasks and close tasks when they merge.',
40
+ stops: 'Pull requests from it stop linking to tasks.',
41
+ brand: 'github',
42
+ accounts: [
43
+ { id: 'acme', name: 'acme', detail: 'Connected Oct 3 · 14 repositories' },
44
+ { id: 'acme-labs', name: 'acme-labs', detail: 'Access ran out. Reconnect to keep it working.', attention: true },
45
+ ],
46
+ },
47
+ {
48
+ id: 'slack',
49
+ name: 'Slack',
50
+ does: 'Post the weekly digest and link previews in your channels.',
51
+ stops: 'The digest and link previews stop in its channels.',
52
+ accounts: [],
53
+ },
54
+ ];
55
+ export default function IntegrationsListNested() {
56
+ var _a = useState(firstProviders), providers = _a[0], setProviders = _a[1];
57
+ // Which Button is working: it shows `loading`, and every other Button waits.
58
+ var _b = useState(null), working = _b[0], setWorking = _b[1];
59
+ var _c = useState(null), confirming = _c[0], setConfirming = _c[1];
60
+ var timers = useRef([]);
61
+ // Stops every request if the example goes away before they end.
62
+ useEffect(function () { return function () { return timers.current.forEach(clearTimeout); }; }, []);
63
+ // Stands in for the sign-in a provider asks for, and the request that follows.
64
+ function later(callback, ms) {
65
+ timers.current.push(setTimeout(callback, ms));
66
+ }
67
+ function update(providerId, change) {
68
+ setProviders(function (list) { return list.map(function (p) { return (p.id === providerId ? __assign(__assign({}, p), { accounts: change(p.accounts) }) : p); }); });
69
+ }
70
+ // 'Connect' and 'Add Account' both start a sign-in, and the account that comes back joins its provider.
71
+ function handleAdd(p) {
72
+ if (working)
73
+ return;
74
+ setWorking("add-".concat(p.id));
75
+ later(function () {
76
+ setWorking(null);
77
+ var next = p.id === 'github'
78
+ ? { id: 'acme-design', name: 'acme-design', detail: 'Connected today · 3 repositories' }
79
+ : { id: 'acme-slack', name: 'Acme', detail: 'Connected today · 6 channels' };
80
+ update(p.id, function (accounts) { return __spreadArray(__spreadArray([], accounts, true), [next], false); });
81
+ }, 1200);
82
+ }
83
+ function handleReconnect(p, a) {
84
+ if (working)
85
+ return;
86
+ setWorking("reconnect-".concat(a.id));
87
+ later(function () {
88
+ setWorking(null);
89
+ update(p.id, function (accounts) { return accounts.map(function (x) { return (x.id === a.id ? __assign(__assign({}, x), { detail: 'Connected today · 5 repositories', attention: false }) : x); }); });
90
+ }, 1200);
91
+ }
92
+ // Escape, a click outside and Cancel all close it, except while the request runs.
93
+ function handleClose() {
94
+ if (working)
95
+ return;
96
+ setConfirming(null);
97
+ }
98
+ function handleDisconnect(p, a) {
99
+ if (working)
100
+ return;
101
+ setWorking("remove-".concat(a.id));
102
+ later(function () {
103
+ setWorking(null);
104
+ setConfirming(null);
105
+ update(p.id, function (accounts) { return accounts.filter(function (x) { return x.id !== a.id; }); });
106
+ }, 1200);
107
+ }
108
+ return (<Center width="page">
109
+ <Stack gap="large">
110
+ <Stack gap="small">
111
+ <Heading level={1} size="h5">Integrations</Heading>
112
+ <Paragraph tone="secondary" size="body2" measure="none">A tool can hold several accounts. Each one connects and disconnects on its own.</Paragraph>
113
+ </Stack>
114
+ <TableContainer>
115
+ {providers.map(function (p) { return (<Fragment key={p.id}>
116
+ <TableRow>
117
+ <TableCell width="56px">
118
+ {p.brand ? <BrandIcon name={p.brand} size={24}/> : <Icon icon={Slack} size="medium" color="secondary"/>}
119
+ </TableCell>
120
+ <TableCell>
121
+ <Stack gap="small">
122
+ <Heading level={2} size="subtitle1">{p.name}</Heading>
123
+ <Paragraph tone="secondary" size="body2" measure="none">{p.does}</Paragraph>
124
+ </Stack>
125
+ </TableCell>
126
+ {/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
127
+ <TableCell width="240px">
128
+ <Cluster justify="end">
129
+ <Button size="small" type="secondary" state={working && working !== "add-".concat(p.id) ? 'disabled' : 'enabled'} label={p.accounts.length === 0 ? 'Connect' : 'Add Account'} aria-label={p.accounts.length === 0 ? "Connect ".concat(p.name) : "Add Account to ".concat(p.name)} loading={working === "add-".concat(p.id)} onClickButton={function () { return handleAdd(p); }}/>
130
+ </Cluster>
131
+ </TableCell>
132
+ </TableRow>
133
+ {/* The accounts sit under their provider, indented by an empty first cell. */}
134
+ {p.accounts.map(function (a) { return (<TableRow key={a.id}>
135
+ <TableCell width="56px">{''}</TableCell>
136
+ <TableCell>
137
+ <Stack gap="small">
138
+ <Cluster gap="small">
139
+ <Heading level={3} size="subtitle1">{a.name}</Heading>
140
+ {a.attention && <Tag variant="contained" size="small" color="warning" label="Needs attention"/>}
141
+ </Cluster>
142
+ <Paragraph tone="secondary" size="body2" measure="none">{a.detail}</Paragraph>
143
+ </Stack>
144
+ </TableCell>
145
+ <TableCell width="240px">
146
+ <Cluster gap="small" justify="end">
147
+ {a.attention && (<Button size="small" type="primary" state={working && working !== "reconnect-".concat(a.id) ? 'disabled' : 'enabled'} label="Reconnect" aria-label={"Reconnect ".concat(a.name)} loading={working === "reconnect-".concat(a.id)} onClickButton={function () { return handleReconnect(p, a); }}/>)}
148
+ <Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Disconnect" aria-label={"Disconnect ".concat(a.name)} onClickButton={function () { return setConfirming({ provider: p, account: a }); }}/>
149
+ </Cluster>
150
+ </TableCell>
151
+ </TableRow>); })}
152
+ </Fragment>); })}
153
+ </TableContainer>
154
+ </Stack>
155
+ <Modal isOpen={confirming !== null} size="small" title={confirming ? "Disconnect ".concat(confirming.account.name) : 'Disconnect'} onClose={handleClose} actions={<>
156
+ <Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
157
+ <Button size="small" type="primary" color="danger" state="enabled" label="Disconnect" loading={Boolean(working)} onClickButton={function () { return confirming && handleDisconnect(confirming.provider, confirming.account); }}/>
158
+ </>}>
159
+ {confirming && (<Paragraph measure="none">
160
+ {confirming.provider.stops} You can connect {confirming.account.name} again any time.
161
+ </Paragraph>)}
162
+ </Modal>
163
+ </Center>);
164
+ }
@@ -0,0 +1 @@
1
+ export default function IntegrationsListRows(): import("react").JSX.Element;
@@ -0,0 +1,134 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ import { useEffect, useRef, useState } from 'react';
14
+ import { Figma, Slack } from 'lucide-react';
15
+ import Modal from '../../components/modal';
16
+ import Heading from '../../components/heading';
17
+ import Paragraph from '../../components/paragraph';
18
+ import TableContainer from '../../components/tableContainer';
19
+ import TableRow from '../../components/tableRow';
20
+ import TableCell from '../../components/tableCell';
21
+ import BrandIcon from '../../components/brandIcon';
22
+ import Icon from '../../components/icon';
23
+ import Tag from '../../components/tag';
24
+ import Button from '../../components/button';
25
+ import { Center, Cluster, Stack } from '../../components/layout';
26
+ var providers = [
27
+ { id: 'slack', name: 'Slack', does: 'Post the weekly digest and link previews in your channels.', stops: 'The weekly digest and link previews stop.', account: 'Acme workspace' },
28
+ { id: 'github', name: 'GitHub', does: 'Link pull requests to tasks and close tasks when they merge.', stops: 'Pull requests stop linking to tasks.', account: 'acme', brand: 'github' },
29
+ { id: 'google', name: 'Google Calendar', does: 'Show your calendar events beside your tasks.', stops: 'Calendar events stop showing beside tasks.', account: 'dana@acme.example', brand: 'google' },
30
+ { id: 'figma', name: 'Figma', does: 'Show a preview when someone pastes a Figma link.', stops: 'Figma links stop showing a preview.', account: 'Acme team' },
31
+ ];
32
+ function renderLogo(p) {
33
+ if (p.brand)
34
+ return <BrandIcon name={p.brand} size={24}/>;
35
+ return <Icon icon={p.id === 'slack' ? Slack : Figma} size="medium" color="secondary"/>;
36
+ }
37
+ export default function IntegrationsListRows() {
38
+ // Opens with GitHub needing attention, as if its access ran out.
39
+ var _a = useState({ github: true, google: true }), connected = _a[0], setConnected = _a[1];
40
+ var _b = useState({ github: true }), needsAttention = _b[0], setNeedsAttention = _b[1];
41
+ var _c = useState(null), working = _c[0], setWorking = _c[1];
42
+ var _d = useState(null), confirming = _d[0], setConfirming = _d[1];
43
+ var timers = useRef([]);
44
+ // Stops every request if the example goes away before they end.
45
+ useEffect(function () { return function () { return timers.current.forEach(clearTimeout); }; }, []);
46
+ // Stands in for the sign-in a provider asks for, and the request that follows.
47
+ function later(callback, ms) {
48
+ timers.current.push(setTimeout(callback, ms));
49
+ }
50
+ function handleConnect(p) {
51
+ if (working)
52
+ return;
53
+ setWorking(p.id);
54
+ later(function () {
55
+ setWorking(null);
56
+ setConnected(function (current) {
57
+ var _a;
58
+ return (__assign(__assign({}, current), (_a = {}, _a[p.id] = true, _a)));
59
+ });
60
+ setNeedsAttention(function (current) {
61
+ var _a;
62
+ return (__assign(__assign({}, current), (_a = {}, _a[p.id] = false, _a)));
63
+ });
64
+ }, 1200);
65
+ }
66
+ // Escape, a click outside and Cancel all close it, except while the request runs.
67
+ function handleClose() {
68
+ if (working)
69
+ return;
70
+ setConfirming(null);
71
+ }
72
+ function handleDisconnect(p) {
73
+ if (working)
74
+ return;
75
+ setWorking(p.id);
76
+ later(function () {
77
+ setWorking(null);
78
+ setConfirming(null);
79
+ setConnected(function (current) {
80
+ var _a;
81
+ return (__assign(__assign({}, current), (_a = {}, _a[p.id] = false, _a)));
82
+ });
83
+ setNeedsAttention(function (current) {
84
+ var _a;
85
+ return (__assign(__assign({}, current), (_a = {}, _a[p.id] = false, _a)));
86
+ });
87
+ }, 1200);
88
+ }
89
+ return (<Center width="page">
90
+ <Stack gap="large">
91
+ <Stack gap="small">
92
+ <Heading level={1} size="h5">Integrations</Heading>
93
+ <Paragraph tone="secondary" size="body2" measure="none">Connect the tools your team already uses.</Paragraph>
94
+ </Stack>
95
+ <TableContainer>
96
+ {providers.map(function (p) {
97
+ var isConnected = Boolean(connected[p.id]);
98
+ var attention = isConnected && Boolean(needsAttention[p.id]);
99
+ var busy = working === p.id;
100
+ return (<TableRow key={p.id}>
101
+ <TableCell width="56px">{renderLogo(p)}</TableCell>
102
+ <TableCell>
103
+ <Stack gap="small">
104
+ <Cluster gap="small">
105
+ <Heading level={2} size="subtitle1">{p.name}</Heading>
106
+ {attention && <Tag variant="contained" size="small" color="warning" label="Needs attention"/>}
107
+ </Cluster>
108
+ <Paragraph tone="secondary" size="body2" measure="none">
109
+ {attention ? 'Access ran out. Reconnect to keep it working.' : p.does}
110
+ </Paragraph>
111
+ </Stack>
112
+ </TableCell>
113
+ {/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
114
+ <TableCell width="340px">
115
+ {isConnected ? (<Cluster gap="small" justify="end">
116
+ <Paragraph size="body2" measure="none">{p.account}</Paragraph>
117
+ {attention && <Button size="small" type="primary" state={working && !busy ? 'disabled' : 'enabled'} label="Reconnect" aria-label={"Reconnect ".concat(p.name)} loading={busy} onClickButton={function () { return handleConnect(p); }}/>}
118
+ <Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Disconnect" aria-label={"Disconnect ".concat(p.name)} onClickButton={function () { return setConfirming(p); }}/>
119
+ </Cluster>) : (<Cluster gap="small" justify="end">
120
+ <Button size="small" type="secondary" state={working && !busy ? 'disabled' : 'enabled'} label="Connect" aria-label={"Connect ".concat(p.name)} loading={busy} onClickButton={function () { return handleConnect(p); }}/>
121
+ </Cluster>)}
122
+ </TableCell>
123
+ </TableRow>);
124
+ })}
125
+ </TableContainer>
126
+ </Stack>
127
+ <Modal isOpen={confirming !== null} size="small" title={confirming ? "Disconnect ".concat(confirming.name) : 'Disconnect'} onClose={handleClose} actions={<>
128
+ <Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
129
+ <Button size="small" type="primary" color="danger" state="enabled" label="Disconnect" loading={Boolean(working)} onClickButton={function () { return confirming && handleDisconnect(confirming); }}/>
130
+ </>}>
131
+ {confirming && (<Paragraph measure="none">{confirming.stops} You can connect {confirming.name} again any time.</Paragraph>)}
132
+ </Modal>
133
+ </Center>);
134
+ }