oneslash-design-system 2.18.0 → 2.20.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 (227) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +54 -5
  3. package/dist/cases/app-shell/sidebar.d.ts +1 -0
  4. package/dist/cases/app-shell/sidebar.jsx +124 -0
  5. package/dist/cases/app-shell/top-tabs.d.ts +1 -0
  6. package/dist/cases/app-shell/top-tabs.jsx +106 -0
  7. package/dist/cases/app-shell.md +364 -0
  8. package/dist/cases/artifact-card/card.jsx +32 -6
  9. package/dist/cases/artifact-card.md +55 -7
  10. package/dist/cases/billing-page/billed-elsewhere.d.ts +1 -0
  11. package/dist/cases/billing-page/billed-elsewhere.jsx +28 -0
  12. package/dist/cases/billing-page/self-serve.d.ts +1 -0
  13. package/dist/cases/billing-page/self-serve.jsx +134 -0
  14. package/dist/cases/billing-page.md +247 -0
  15. package/dist/cases/breakdown-list/bars.d.ts +1 -0
  16. package/dist/cases/breakdown-list/bars.jsx +47 -0
  17. package/dist/cases/breakdown-list/table.d.ts +1 -0
  18. package/dist/cases/breakdown-list/table.jsx +69 -0
  19. package/dist/cases/breakdown-list.md +158 -0
  20. package/dist/cases/composer-limit/notice-with-action.jsx +3 -3
  21. package/dist/cases/composer-limit/notice.jsx +3 -3
  22. package/dist/cases/composer-limit.md +8 -8
  23. package/dist/cases/dashboard/numbers-first.d.ts +1 -0
  24. package/dist/cases/dashboard/numbers-first.jsx +165 -0
  25. package/dist/cases/dashboard/work-first.d.ts +1 -0
  26. package/dist/cases/dashboard/work-first.jsx +165 -0
  27. package/dist/cases/dashboard.md +507 -0
  28. package/dist/cases/data-table-page/all-rows.d.ts +1 -0
  29. package/dist/cases/data-table-page/all-rows.jsx +226 -0
  30. package/dist/cases/data-table-page/paged.d.ts +1 -0
  31. package/dist/cases/data-table-page/paged.jsx +284 -0
  32. package/dist/cases/data-table-page.md +771 -0
  33. package/dist/cases/error-page/in-shell.jsx +26 -17
  34. package/dist/cases/error-page.md +42 -21
  35. package/dist/cases/invoice-list/table.d.ts +1 -0
  36. package/dist/cases/invoice-list/table.jsx +64 -0
  37. package/dist/cases/invoice-list/with-upcoming.d.ts +1 -0
  38. package/dist/cases/invoice-list/with-upcoming.jsx +75 -0
  39. package/dist/cases/invoice-list.md +237 -0
  40. package/dist/cases/load-failure/inline.jsx +2 -2
  41. package/dist/cases/load-failure.md +2 -2
  42. package/dist/cases/master-detail/list-then-page.d.ts +1 -0
  43. package/dist/cases/master-detail/list-then-page.jsx +65 -0
  44. package/dist/cases/master-detail/split.d.ts +1 -0
  45. package/dist/cases/master-detail/split.jsx +49 -0
  46. package/dist/cases/master-detail.md +213 -0
  47. package/dist/cases/members-list/rows.jsx +2 -1
  48. package/dist/cases/members-list/table.jsx +8 -9
  49. package/dist/cases/members-list.md +12 -13
  50. package/dist/cases/mobile-menu/links.d.ts +1 -0
  51. package/dist/cases/mobile-menu/links.jsx +24 -0
  52. package/dist/cases/mobile-menu/sections.d.ts +1 -0
  53. package/dist/cases/mobile-menu/sections.jsx +61 -0
  54. package/dist/cases/mobile-menu.md +170 -0
  55. package/dist/cases/not-found-page/in-shell.jsx +26 -17
  56. package/dist/cases/not-found-page.md +41 -20
  57. package/dist/cases/number-format.md +36 -0
  58. package/dist/cases/on-this-page/aside.d.ts +1 -0
  59. package/dist/cases/on-this-page/aside.jsx +39 -0
  60. package/dist/cases/on-this-page.md +80 -0
  61. package/dist/cases/page-header/actions.d.ts +1 -0
  62. package/dist/cases/page-header/actions.jsx +65 -0
  63. package/dist/cases/page-header/sub-page.d.ts +1 -0
  64. package/dist/cases/page-header/sub-page.jsx +37 -0
  65. package/dist/cases/page-header.md +195 -0
  66. package/dist/cases/paged-card/pager.d.ts +1 -0
  67. package/dist/cases/paged-card/pager.jsx +41 -0
  68. package/dist/cases/paged-card/see-all.d.ts +1 -0
  69. package/dist/cases/paged-card/see-all.jsx +34 -0
  70. package/dist/cases/paged-card.md +147 -0
  71. package/dist/cases/payment-method/none.d.ts +1 -0
  72. package/dist/cases/payment-method/none.jsx +17 -0
  73. package/dist/cases/payment-method/on-file.d.ts +1 -0
  74. package/dist/cases/payment-method/on-file.jsx +92 -0
  75. package/dist/cases/payment-method.md +182 -0
  76. package/dist/cases/phone-navigation.md +32 -0
  77. package/dist/cases/plan-change-confirm/blocked.d.ts +1 -0
  78. package/dist/cases/plan-change-confirm/blocked.jsx +48 -0
  79. package/dist/cases/plan-change-confirm/downgrade.d.ts +1 -0
  80. package/dist/cases/plan-change-confirm/downgrade.jsx +52 -0
  81. package/dist/cases/plan-change-confirm/upgrade.d.ts +1 -0
  82. package/dist/cases/plan-change-confirm/upgrade.jsx +51 -0
  83. package/dist/cases/plan-change-confirm.md +261 -0
  84. package/dist/cases/plan-picker/cards.d.ts +1 -0
  85. package/dist/cases/plan-picker/cards.jsx +97 -0
  86. package/dist/cases/plan-picker/list.d.ts +1 -0
  87. package/dist/cases/plan-picker/list.jsx +103 -0
  88. package/dist/cases/plan-picker.md +297 -0
  89. package/dist/cases/range-switch/segmented.jsx +11 -7
  90. package/dist/cases/range-switch.md +16 -11
  91. package/dist/cases/route-loading/region.jsx +27 -18
  92. package/dist/cases/route-loading.md +42 -21
  93. package/dist/cases/settings-page/top-tabs.jsx +4 -3
  94. package/dist/cases/settings-page.md +5 -4
  95. package/dist/cases/side-pane/beside.d.ts +1 -0
  96. package/dist/cases/side-pane/beside.jsx +79 -0
  97. package/dist/cases/side-pane/over.d.ts +1 -0
  98. package/dist/cases/side-pane/over.jsx +58 -0
  99. package/dist/cases/side-pane.md +238 -0
  100. package/dist/cases/sidebar-nav/flat.d.ts +1 -0
  101. package/dist/cases/sidebar-nav/flat.jsx +81 -0
  102. package/dist/cases/sidebar-nav/nested.d.ts +1 -0
  103. package/dist/cases/sidebar-nav/nested.jsx +122 -0
  104. package/dist/cases/sidebar-nav.md +261 -0
  105. package/dist/cases/site-footer/columns.d.ts +1 -0
  106. package/dist/cases/site-footer/columns.jsx +51 -0
  107. package/dist/cases/site-footer/simple.d.ts +1 -0
  108. package/dist/cases/site-footer/simple.jsx +24 -0
  109. package/dist/cases/site-footer.md +133 -0
  110. package/dist/cases/site-header/links.d.ts +1 -0
  111. package/dist/cases/site-header/links.jsx +26 -0
  112. package/dist/cases/site-header/sections.d.ts +1 -0
  113. package/dist/cases/site-header/sections.jsx +64 -0
  114. package/dist/cases/site-header.md +183 -0
  115. package/dist/cases/stat-row/featured.d.ts +1 -0
  116. package/dist/cases/stat-row/featured.jsx +17 -0
  117. package/dist/cases/stat-row/tiles.d.ts +1 -0
  118. package/dist/cases/stat-row/tiles.jsx +34 -0
  119. package/dist/cases/stat-row.md +104 -0
  120. package/dist/cases/status-label/dot.d.ts +1 -0
  121. package/dist/cases/status-label/dot.jsx +39 -0
  122. package/dist/cases/status-label/text.d.ts +1 -0
  123. package/dist/cases/status-label/text.jsx +44 -0
  124. package/dist/cases/status-label.md +143 -0
  125. package/dist/cases/theme-switcher/menu.d.ts +1 -0
  126. package/dist/cases/theme-switcher/menu.jsx +47 -0
  127. package/dist/cases/theme-switcher/segmented.d.ts +1 -0
  128. package/dist/cases/theme-switcher/segmented.jsx +26 -0
  129. package/dist/cases/theme-switcher.md +149 -0
  130. package/dist/cases/upgrade-prompt/inline.jsx +4 -2
  131. package/dist/cases/upgrade-prompt/modal.jsx +2 -1
  132. package/dist/cases/upgrade-prompt.md +10 -6
  133. package/dist/cases/usage-meters/by-person.d.ts +1 -0
  134. package/dist/cases/usage-meters/by-person.jsx +72 -0
  135. package/dist/cases/usage-meters/meters.d.ts +1 -0
  136. package/dist/cases/usage-meters/meters.jsx +49 -0
  137. package/dist/cases/usage-meters/with-cap.d.ts +1 -0
  138. package/dist/cases/usage-meters/with-cap.jsx +73 -0
  139. package/dist/cases/usage-meters.md +303 -0
  140. package/dist/cases.json +1756 -172
  141. package/dist/components/appShell.d.ts +44 -0
  142. package/dist/components/appShell.jsx +121 -0
  143. package/dist/components/button.d.ts +1 -1
  144. package/dist/components/button.jsx +11 -5
  145. package/dist/components/drawer.d.ts +31 -0
  146. package/dist/components/drawer.jsx +121 -0
  147. package/dist/components/formatNumber.d.ts +25 -0
  148. package/dist/components/formatNumber.js +125 -0
  149. package/dist/components/heading.d.ts +3 -1
  150. package/dist/components/heading.jsx +2 -2
  151. package/dist/components/iconButton.jsx +12 -7
  152. package/dist/components/link.d.ts +6 -1
  153. package/dist/components/link.jsx +11 -3
  154. package/dist/components/menuItem.d.ts +7 -1
  155. package/dist/components/menuItem.jsx +4 -3
  156. package/dist/components/modal.jsx +12 -23
  157. package/dist/components/onThisPage.d.ts +29 -0
  158. package/dist/components/onThisPage.jsx +151 -0
  159. package/dist/components/pageShell.d.ts +7 -1
  160. package/dist/components/pageShell.jsx +14 -1
  161. package/dist/components/pagination.d.ts +28 -0
  162. package/dist/components/pagination.jsx +89 -0
  163. package/dist/components/popover.jsx +4 -0
  164. package/dist/components/progress.d.ts +33 -0
  165. package/dist/components/progress.jsx +50 -0
  166. package/dist/components/settingsSection.d.ts +6 -1
  167. package/dist/components/settingsSection.jsx +10 -3
  168. package/dist/components/sidePane.d.ts +32 -0
  169. package/dist/components/sidePane.jsx +128 -0
  170. package/dist/components/siteFooter.d.ts +24 -0
  171. package/dist/components/siteFooter.jsx +48 -0
  172. package/dist/components/siteHeader.d.ts +55 -0
  173. package/dist/components/siteHeader.jsx +125 -0
  174. package/dist/components/skeleton.d.ts +21 -0
  175. package/dist/components/skeleton.jsx +41 -0
  176. package/dist/components/statTile.d.ts +32 -0
  177. package/dist/components/statTile.jsx +61 -0
  178. package/dist/components/tableContainer.d.ts +5 -1
  179. package/dist/components/tableContainer.jsx +9 -1
  180. package/dist/components/tableHeaderCell.d.ts +3 -1
  181. package/dist/components/tableHeaderCell.jsx +2 -2
  182. package/dist/components/titleBar.d.ts +19 -0
  183. package/dist/components/titleBar.jsx +18 -0
  184. package/dist/index.d.ts +12 -0
  185. package/dist/index.js +12 -0
  186. package/dist/internal/overlayStack.d.ts +24 -0
  187. package/dist/internal/overlayStack.js +71 -0
  188. package/dist/internal/resize.d.ts +9 -0
  189. package/dist/internal/resize.js +31 -0
  190. package/dist/internal/scrollSpy.d.ts +24 -0
  191. package/dist/internal/scrollSpy.js +53 -0
  192. package/dist/internal/siteBrand.d.ts +6 -0
  193. package/dist/internal/siteBrand.jsx +11 -0
  194. package/dist/native-mapping.json +69 -3
  195. package/dist/stories/AppShell.stories.d.ts +15 -0
  196. package/dist/stories/AppShell.stories.jsx +137 -0
  197. package/dist/stories/Button.stories.d.ts +1 -0
  198. package/dist/stories/Button.stories.jsx +19 -1
  199. package/dist/stories/Cases.generated.stories.d.ts +45 -0
  200. package/dist/stories/Cases.generated.stories.jsx +90 -0
  201. package/dist/stories/Drawer.stories.d.ts +10 -0
  202. package/dist/stories/Drawer.stories.jsx +123 -0
  203. package/dist/stories/Link.stories.d.ts +1 -0
  204. package/dist/stories/Link.stories.jsx +8 -0
  205. package/dist/stories/OnThisPage.stories.d.ts +10 -0
  206. package/dist/stories/OnThisPage.stories.jsx +105 -0
  207. package/dist/stories/Pagination.stories.d.ts +9 -0
  208. package/dist/stories/Pagination.stories.jsx +75 -0
  209. package/dist/stories/Progress.stories.d.ts +9 -0
  210. package/dist/stories/Progress.stories.jsx +43 -0
  211. package/dist/stories/SettingsSection.stories.d.ts +1 -0
  212. package/dist/stories/SettingsSection.stories.jsx +27 -0
  213. package/dist/stories/SidePane.stories.d.ts +6 -0
  214. package/dist/stories/SidePane.stories.jsx +37 -0
  215. package/dist/stories/SiteFooter.stories.d.ts +7 -0
  216. package/dist/stories/SiteFooter.stories.jsx +63 -0
  217. package/dist/stories/SiteHeader.stories.d.ts +10 -0
  218. package/dist/stories/SiteHeader.stories.jsx +94 -0
  219. package/dist/stories/Skeleton.stories.d.ts +7 -0
  220. package/dist/stories/Skeleton.stories.jsx +27 -0
  221. package/dist/stories/StatTile.stories.d.ts +10 -0
  222. package/dist/stories/StatTile.stories.jsx +55 -0
  223. package/dist/stories/Table.stories.d.ts +1 -0
  224. package/dist/stories/Table.stories.jsx +49 -1
  225. package/dist/stories/TitleBar.stories.d.ts +7 -0
  226. package/dist/stories/TitleBar.stories.jsx +41 -0
  227. package/package.json +5 -1
@@ -0,0 +1,364 @@
1
+ # App shell
2
+
3
+ A person opens the product and moves between its places, such as Inbox, Tasks and Settings, from every page.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail'.
8
+ - Build the sidebar frame with `AppShell`. Its places are a `Navigation` of `NavigationGroup`s.
9
+ - Make each place a `MenuItem` with an `href`, and mark the open one with `isSelected` and `aria-current="page"`.
10
+ - Put the account menu last in the sidebar, built as the case 'Account menu' says.
11
+ - Give the page's `TitleBar` the page's name as the level 1 heading, and give `AppShell` the place's name as `title`. When the page is the place, the two are the same.
12
+ - Pass `onSidebarHiddenChange` to `AppShell` so a person can hide the sidebar from `md` up. It adds a 'Hide sidebar' IconButton at the top of the column and a 'Show sidebar' IconButton when it is hidden, and moves focus between them. The phone menu has neither.
13
+ - Add Cmd+B, or Ctrl+B, with `useHotkey('b', …)`, and have it change the same state. It does nothing while the person types in a field. Ignore it while a Modal, such as the 'Log Out' confirm, is open.
14
+ - Close the phone menu in the `onClick` of an item in a Popover, such as Settings in the account menu. A choice in a Popover does not close the Drawer by itself.
15
+ - Render a Modal that the sidebar opens, such as the 'Log Out' confirm, inside the sidebar node, so it is mounted once: in the column or in the Drawer.
16
+ - Use `TabsContainer fill` with a `Tab` for each place, each with an `href` and the app's `router`, when there are four places or fewer. Name each with one short word.
17
+ - With tabs across the top, put the name of the app at the start of the bar and the account menu at the end.
18
+
19
+ ## Don't
20
+
21
+ - Do not use tabs for more than four places, or for places the person makes.
22
+ - Do not show the sidebar beside the page on a phone.
23
+ - Do not hide the sidebar with the shortcut alone. Give a person a visible 'Hide sidebar' button as well.
24
+ - Do not let the tabs scroll sideways. When they do not fit at 375px, use the sidebar.
25
+ - Do not mount the sidebar twice, once for the column and once for the menu.
26
+
27
+ ## Option: Sidebar in groups
28
+
29
+ Use when: There are more than four places, or the person makes some of them, such as projects or channels.
30
+
31
+ Uses: `AppShell`, `Button`, `Center`, `Cluster`, `Heading`, `Line`, `Menu`, `MenuItem`, `Modal`, `Navigation`, `NavigationGroup`, `Paragraph`, `Popover`, `Stack`, `TitleBar`, `UserImage`, `useHotkey`
32
+
33
+ ```tsx
34
+ 'use client';
35
+ import { useEffect, useRef, useState } from 'react';
36
+ import AppShell from 'oneslash-design-system/components/appShell';
37
+ import TitleBar from 'oneslash-design-system/components/titleBar';
38
+ import Navigation, { NavigationGroup } from 'oneslash-design-system/components/navigation';
39
+ import MenuItem from 'oneslash-design-system/components/menuItem';
40
+ import Modal from 'oneslash-design-system/components/modal';
41
+ import Heading from 'oneslash-design-system/components/heading';
42
+ import Paragraph from 'oneslash-design-system/components/paragraph';
43
+ import Button from 'oneslash-design-system/components/button';
44
+ import UserImage from 'oneslash-design-system/components/userImage';
45
+ import Popover from 'oneslash-design-system/components/popover';
46
+ import Menu from 'oneslash-design-system/components/menu';
47
+ import Line from 'oneslash-design-system/components/line';
48
+ import useHotkey from 'oneslash-design-system/components/useHotkey';
49
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
50
+
51
+ type Place = { id: string; label: string; icon: string; group: string; page: string; text: string };
52
+
53
+ // The places. The top bar on a phone names the place; the page's own title is the level 1 heading, so a phone never shows the same words twice.
54
+ const places: Place[] = [
55
+ { id: 'inbox', label: 'Inbox', icon: 'Inbox', group: 'Mail', page: 'Unread messages', text: 'Ben Carter shared the launch plan. Omar Reyes asked for the new screens by Friday.' },
56
+ { id: 'sent', label: 'Sent', icon: 'Send', group: 'Mail', page: 'Sent this week', text: 'You sent 4 messages this week.' },
57
+ { id: 'website', label: 'Website', icon: 'Globe', group: 'Projects', page: 'Home page redesign', text: '12 tasks are open. The next review is on Thursday.' },
58
+ { id: 'mobile', label: 'Mobile App', icon: 'Smartphone', group: 'Projects', page: 'Version 2 release', text: '5 tasks are open. Dana Lee owns the release.' },
59
+ ];
60
+
61
+ const groups = ['Mail', 'Projects'];
62
+
63
+ // A real app reads this from the session.
64
+ const me = 'Dana Lee';
65
+
66
+ export default function AppShellSidebar() {
67
+ const [placeId, setPlaceId] = useState('inbox');
68
+ // Below md the sidebar is a Drawer; this says whether it is open.
69
+ const [navOpen, setNavOpen] = useState(false);
70
+ // From md up the person can hide the column for room. The phone menu still has it.
71
+ const [hidden, setHidden] = useState(false);
72
+ const [accountAnchor, setAccountAnchor] = useState<HTMLElement | null>(null);
73
+ const [accountOpen, setAccountOpen] = useState(false);
74
+ const [confirming, setConfirming] = useState(false);
75
+ const [loggingOut, setLoggingOut] = useState(false);
76
+ const [loggedOut, setLoggedOut] = useState(false);
77
+ const timer = useRef<ReturnType<typeof setTimeout>>();
78
+ const accountButton = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
79
+ // Where focus goes after the next render, once the element it goes to is on screen.
80
+ const focusNext = useRef<() => void>();
81
+
82
+ // Stops the request if the example goes away before it ends.
83
+ useEffect(() => () => clearTimeout(timer.current), []);
84
+
85
+ useEffect(() => {
86
+ const move = focusNext.current;
87
+ focusNext.current = undefined;
88
+ move?.();
89
+ });
90
+
91
+ // Cmd+B, or Ctrl+B. It does nothing while the person types in a field, and nothing while the Log Out confirm is open.
92
+ useHotkey('b', () => {
93
+ if (!confirming) setHidden((h) => !h);
94
+ });
95
+
96
+ const place = places.find((p) => p.id === placeId) ?? places[0];
97
+
98
+ // Cancel, Escape and a click outside. 'Cancel' puts focus back on the account Button, inside the Drawer on a phone.
99
+ function cancelLogOut() {
100
+ if (loggingOut) return;
101
+ setConfirming(false);
102
+ focusNext.current = () => accountButton.current?.focus();
103
+ }
104
+
105
+ function logOut() {
106
+ if (loggingOut) return;
107
+ setLoggingOut(true);
108
+ // Stands in for the request to the server.
109
+ timer.current = setTimeout(() => {
110
+ setLoggingOut(false);
111
+ setConfirming(false);
112
+ setLoggedOut(true);
113
+ }, 1200);
114
+ }
115
+
116
+ // A real app goes to its login page here. The example shows a short logged-out page instead.
117
+ if (loggedOut) {
118
+ return (
119
+ <Center fill>
120
+ <Heading level={1} size="h5">You are logged out</Heading>
121
+ <Cluster>
122
+ <Button size="medium" type="primary" state="enabled" label="Log In" onClickButton={() => { setLoggedOut(false); setPlaceId('inbox'); }} />
123
+ </Cluster>
124
+ </Center>
125
+ );
126
+ }
127
+
128
+ // The sidebar is mounted once: in the column from md up, in the Drawer below it. Its Modal lives inside it.
129
+ const sidebar = (
130
+ <Navigation aria-label="Main">
131
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
132
+ {groups.map((group) => (
133
+ <NavigationGroup key={group} label={group}>
134
+ {places.filter((p) => p.group === group).map((p) => (
135
+ <MenuItem
136
+ key={p.id}
137
+ size="small"
138
+ label={p.label}
139
+ iconName={p.icon}
140
+ href={`/${p.id}`}
141
+ isSelected={p.id === place.id}
142
+ aria-current={p.id === place.id ? 'page' : undefined}
143
+ onClick={(event: { preventDefault: () => void }) => {
144
+ // A real app lets the link go to its page. The example keeps the choice in state.
145
+ event.preventDefault();
146
+ setPlaceId(p.id);
147
+ }}
148
+ />
149
+ ))}
150
+ </NavigationGroup>
151
+ ))}
152
+ <Line />
153
+ {/* The account menu is last. */}
154
+ <Cluster>
155
+ <Button
156
+ ref={accountButton}
157
+ size="small"
158
+ type="tertiary"
159
+ state={accountOpen ? 'selected' : 'enabled'}
160
+ label={me}
161
+ decoIcon={<UserImage userHandle={me} size={20} decorative />}
162
+ aria-label={`${me}, account menu`}
163
+ aria-haspopup="menu"
164
+ aria-expanded={accountOpen}
165
+ onClickButton={(e: { currentTarget: HTMLElement }) => {
166
+ setAccountAnchor(e.currentTarget);
167
+ setAccountOpen((o) => !o);
168
+ }}
169
+ />
170
+ </Cluster>
171
+ <Popover open={accountOpen} anchorEl={accountAnchor} onClose={() => setAccountOpen(false)} returnFocus>
172
+ <Menu navigable aria-label="Account" width={200}>
173
+ {/* A choice in a Popover does not close the phone menu: close it here. */}
174
+ <MenuItem size="small" iconName="Settings" label="Settings" onClick={() => { setAccountOpen(false); setNavOpen(false); }} />
175
+ <MenuItem size="small" iconName="CircleHelp" label="Help" onClick={() => { setAccountOpen(false); setNavOpen(false); }} />
176
+ <Line />
177
+ <MenuItem size="small" iconName="LogOut" label="Log Out" onClick={() => { setAccountOpen(false); setConfirming(true); }} />
178
+ </Menu>
179
+ </Popover>
180
+ <Modal
181
+ isOpen={confirming}
182
+ size="small"
183
+ title="Log Out"
184
+ onClose={cancelLogOut}
185
+ actions={
186
+ <>
187
+ <Button size="small" type="tertiary" state={loggingOut ? 'disabled' : 'enabled'} label="Cancel" onClickButton={cancelLogOut} />
188
+ <Button size="small" type="primary" state="enabled" label="Log Out" loading={loggingOut} onClickButton={logOut} />
189
+ </>
190
+ }
191
+ >
192
+ <Paragraph measure="none">You will need to log in again to use Acme on this device.</Paragraph>
193
+ </Modal>
194
+ </Navigation>
195
+ );
196
+
197
+ const newMessage = <Button size="medium" type="primary" state="enabled" label="New Message" decoIcon="Plus" />;
198
+
199
+ return (
200
+ <AppShell title={place.label} navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar} sidebarHidden={hidden} onSidebarHiddenChange={setHidden}>
201
+ <Stack gap="large">
202
+ <TitleBar
203
+ title={place.page}
204
+ actions={newMessage}
205
+ />
206
+ <Paragraph tone="secondary" measure="none">{place.text}</Paragraph>
207
+ </Stack>
208
+ </AppShell>
209
+ );
210
+ }
211
+ ```
212
+
213
+ ## Option: Tabs across the top
214
+
215
+ Use when: There are four places or fewer, all fixed, each with a short name that fits on a phone.
216
+
217
+ Uses: `Button`, `Center`, `Cluster`, `Heading`, `Line`, `Menu`, `MenuItem`, `Modal`, `PageShell`, `Paragraph`, `Popover`, `Stack`, `Tab`, `TabsContainer`, `TitleBar`, `UserImage`
218
+
219
+ ```tsx
220
+ 'use client';
221
+ import { useEffect, useRef, useState } from 'react';
222
+ import TitleBar from 'oneslash-design-system/components/titleBar';
223
+ import TabsContainer from 'oneslash-design-system/components/tabsContainer';
224
+ import Tab from 'oneslash-design-system/components/tab';
225
+ import Modal from 'oneslash-design-system/components/modal';
226
+ import Heading from 'oneslash-design-system/components/heading';
227
+ import Paragraph from 'oneslash-design-system/components/paragraph';
228
+ import Button from 'oneslash-design-system/components/button';
229
+ import UserImage from 'oneslash-design-system/components/userImage';
230
+ import Popover from 'oneslash-design-system/components/popover';
231
+ import Menu from 'oneslash-design-system/components/menu';
232
+ import MenuItem from 'oneslash-design-system/components/menuItem';
233
+ import Line from 'oneslash-design-system/components/line';
234
+ import PageShell from 'oneslash-design-system/components/pageShell';
235
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
236
+
237
+ type Place = { id: string; label: string; page: string; text: string };
238
+
239
+ // Four fixed places, one short word each, so the tabs fit on a phone.
240
+ const places: Place[] = [
241
+ { id: 'inbox', label: 'Inbox', page: 'Unread messages', text: 'Ben Carter shared the launch plan. Omar Reyes asked for the new screens by Friday.' },
242
+ { id: 'tasks', label: 'Tasks', page: 'My tasks', text: '7 tasks are open. 2 are due this week.' },
243
+ { id: 'files', label: 'Files', page: 'Recent files', text: 'Omar Reyes added the new screens an hour ago.' },
244
+ { id: 'team', label: 'Team', page: 'People and roles', text: 'Dana Lee, Ben Carter and Omar Reyes are in Acme.' },
245
+ ];
246
+
247
+ // A real app reads this from the session.
248
+ const me = 'Dana Lee';
249
+
250
+ export default function AppShellTopTabs() {
251
+ const [placeId, setPlaceId] = useState('inbox');
252
+ const [accountAnchor, setAccountAnchor] = useState<HTMLElement | null>(null);
253
+ const [accountOpen, setAccountOpen] = useState(false);
254
+ const [confirming, setConfirming] = useState(false);
255
+ const [loggingOut, setLoggingOut] = useState(false);
256
+ const [loggedOut, setLoggedOut] = useState(false);
257
+ const timer = useRef<ReturnType<typeof setTimeout>>();
258
+ const accountButton = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
259
+ // Where focus goes after the next render, once the element it goes to is on screen.
260
+ const focusNext = useRef<() => void>();
261
+
262
+ // Stops the request if the example goes away before it ends.
263
+ useEffect(() => () => clearTimeout(timer.current), []);
264
+
265
+ useEffect(() => {
266
+ const move = focusNext.current;
267
+ focusNext.current = undefined;
268
+ move?.();
269
+ });
270
+
271
+ const place = places.find((p) => p.id === placeId) ?? places[0];
272
+ // A real app passes the router from its framework, such as Next's useRouter(). Here it sets the open place.
273
+ const router = { push: (url: string) => setPlaceId(url.split('/').pop() ?? 'inbox') };
274
+
275
+ // 'Cancel' puts focus back on the account Button.
276
+ function cancelLogOut() {
277
+ if (loggingOut) return;
278
+ setConfirming(false);
279
+ focusNext.current = () => accountButton.current?.focus();
280
+ }
281
+
282
+ function logOut() {
283
+ if (loggingOut) return;
284
+ setLoggingOut(true);
285
+ // Stands in for the request to the server.
286
+ timer.current = setTimeout(() => {
287
+ setLoggingOut(false);
288
+ setConfirming(false);
289
+ setLoggedOut(true);
290
+ }, 1200);
291
+ }
292
+
293
+ // A real app goes to its login page here. The example shows a short logged-out page instead.
294
+ if (loggedOut) {
295
+ return (
296
+ <Center fill>
297
+ <Heading level={1} size="h5">You are logged out</Heading>
298
+ <Cluster>
299
+ <Button size="medium" type="primary" state="enabled" label="Log In" onClickButton={() => { setLoggedOut(false); setPlaceId('inbox'); }} />
300
+ </Cluster>
301
+ </Center>
302
+ );
303
+ }
304
+
305
+ return (
306
+ <PageShell>
307
+ <Stack gap="large">
308
+ {/* The app's name at the start, the account menu at the end. */}
309
+ <Cluster justify="between">
310
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
311
+ <Button
312
+ ref={accountButton}
313
+ size="small"
314
+ type="tertiary"
315
+ state={accountOpen ? 'selected' : 'enabled'}
316
+ label={me}
317
+ decoIcon={<UserImage userHandle={me} size={20} decorative />}
318
+ aria-label={`${me}, account menu`}
319
+ aria-haspopup="menu"
320
+ aria-expanded={accountOpen}
321
+ onClickButton={(e: { currentTarget: HTMLElement }) => {
322
+ setAccountAnchor(e.currentTarget);
323
+ setAccountOpen((o) => !o);
324
+ }}
325
+ />
326
+ </Cluster>
327
+ <TabsContainer fill>
328
+ {places.map((p) => (
329
+ <Tab key={p.id} label={p.label} href={`/${p.id}`} router={router} isSelected={p.id === place.id} onClickTab={() => setPlaceId(p.id)} />
330
+ ))}
331
+ </TabsContainer>
332
+ <TitleBar title={place.page} actions={<Button size="medium" type="primary" state="enabled" label="New Message" decoIcon="Plus" />} />
333
+ <Paragraph tone="secondary" measure="none">{place.text}</Paragraph>
334
+ </Stack>
335
+ <Popover open={accountOpen} anchorEl={accountAnchor} onClose={() => setAccountOpen(false)} returnFocus>
336
+ <Menu navigable aria-label="Account" width={200}>
337
+ <MenuItem size="small" iconName="Settings" label="Settings" onClick={() => setAccountOpen(false)} />
338
+ <MenuItem size="small" iconName="CircleHelp" label="Help" onClick={() => setAccountOpen(false)} />
339
+ <Line />
340
+ <MenuItem size="small" iconName="LogOut" label="Log Out" onClick={() => { setAccountOpen(false); setConfirming(true); }} />
341
+ </Menu>
342
+ </Popover>
343
+ <Modal
344
+ isOpen={confirming}
345
+ size="small"
346
+ title="Log Out"
347
+ onClose={cancelLogOut}
348
+ actions={
349
+ <>
350
+ <Button size="small" type="tertiary" state={loggingOut ? 'disabled' : 'enabled'} label="Cancel" onClickButton={cancelLogOut} />
351
+ <Button size="small" type="primary" state="enabled" label="Log Out" loading={loggingOut} onClickButton={logOut} />
352
+ </>
353
+ }
354
+ >
355
+ <Paragraph measure="none">You will need to log in again to use Acme on this device.</Paragraph>
356
+ </Modal>
357
+ </PageShell>
358
+ );
359
+ }
360
+ ```
361
+
362
+ ## Native
363
+
364
+ On macOS and iPad use a `NavigationSplitView` with a sidebar `List` in `Section`s. The system adds the hide button and its shortcut. On iPhone use a `TabView` for five places or fewer. On Android use a navigation drawer.
@@ -1,5 +1,10 @@
1
1
  'use client';
2
+ import { useRef, useState } from 'react';
2
3
  import { Bot, FileText } from 'lucide-react';
4
+ import AppShell from '../../components/appShell';
5
+ import SidePane from '../../components/sidePane';
6
+ import Navigation from '../../components/navigation';
7
+ import MenuItem from '../../components/menuItem';
3
8
  import Message from '../../components/message';
4
9
  import UserImage from '../../components/userImage';
5
10
  import Tag from '../../components/tag';
@@ -7,7 +12,7 @@ import TimeStamp from '../../components/timeStamp';
7
12
  import Heading from '../../components/heading';
8
13
  import Paragraph from '../../components/paragraph';
9
14
  import SourceCard from '../../components/sourceCard';
10
- import { Center, Grid, Stack } from '../../components/layout';
15
+ import { Grid, Stack } from '../../components/layout';
11
16
  var agentName = 'Acme Agent';
12
17
  var request = { from: 'Dana Lee', at: new Date('2025-01-15T11:40:00Z'), text: 'Can you write up the launch plan as a document?' };
13
18
  var repliedAt = new Date('2025-01-15T11:41:00Z');
@@ -22,11 +27,32 @@ function agentMeta(at) {
22
27
  <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
23
28
  </>);
24
29
  }
25
- // A real app opens the document in a pane beside the thread and moves focus into it.
26
- // ODS has no side pane part yet, so this example shows the card only.
27
- function openDocument() { }
30
+ var docParagraphs = [
31
+ 'Acme ships the new home page on March 3. Omar Reyes owns the copy and Dana Lee the screens.',
32
+ 'Ben Carter writes the announcement once the screens are approved.',
33
+ ];
34
+ // The threads. A real app lets each link go to its page.
35
+ var sidebar = (<Navigation aria-label="Main">
36
+ <MenuItem size="small" label="Launch plan" iconName="MessageSquare" href="/launch-plan" isSelected aria-current="page" onClick={function (event) { return event.preventDefault(); }}/>
37
+ </Navigation>);
28
38
  export default function ArtifactCardCard() {
29
- return (<Center width="page">
39
+ var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
40
+ // The pane opens from the card, so focus moves into it and goes back to the card on close.
41
+ var _b = useState(false), open = _b[0], setOpen = _b[1];
42
+ var pane = useRef(null);
43
+ // Pressed again while the pane is open, the card brings the pane forward instead of opening a second one.
44
+ function openDocument() {
45
+ var _a;
46
+ if (open)
47
+ (_a = pane.current) === null || _a === void 0 ? void 0 : _a.focus();
48
+ else
49
+ setOpen(true);
50
+ }
51
+ return (<AppShell title="Launch plan" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar} pane={open && (<SidePane ref={pane} title={doc.title} onClose={function () { return setOpen(false); }}>
52
+ <Stack gap="medium">
53
+ {docParagraphs.map(function (text) { return (<Paragraph key={text} measure="none">{text}</Paragraph>); })}
54
+ </Stack>
55
+ </SidePane>)}>
30
56
  <Stack gap="large">
31
57
  <Heading level={1} size="h5">Launch plan</Heading>
32
58
  {/* A real app gives the list that holds the rows role="log". */}
@@ -41,5 +67,5 @@ export default function ArtifactCardCard() {
41
67
  </Message>
42
68
  </Stack>
43
69
  </Stack>
44
- </Center>);
70
+ </AppShell>);
45
71
  }
@@ -21,11 +21,16 @@ The agent made a document for the person, such as a plan or a report.
21
21
 
22
22
  ## Example: In the thread
23
23
 
24
- Uses: `Center`, `Grid`, `Heading`, `Message`, `Paragraph`, `SourceCard`, `Stack`, `Tag`, `TimeStamp`, `UserImage`
24
+ Uses: `AppShell`, `Grid`, `Heading`, `MenuItem`, `Message`, `Navigation`, `Paragraph`, `SidePane`, `SourceCard`, `Stack`, `Tag`, `TimeStamp`, `UserImage`
25
25
 
26
26
  ```tsx
27
27
  'use client';
28
+ import { useRef, useState } from 'react';
28
29
  import { Bot, FileText } from 'lucide-react';
30
+ import AppShell from 'oneslash-design-system/components/appShell';
31
+ import SidePane, { type SidePaneHandle } from 'oneslash-design-system/components/sidePane';
32
+ import Navigation from 'oneslash-design-system/components/navigation';
33
+ import MenuItem from 'oneslash-design-system/components/menuItem';
29
34
  import Message from 'oneslash-design-system/components/message';
30
35
  import UserImage from 'oneslash-design-system/components/userImage';
31
36
  import Tag from 'oneslash-design-system/components/tag';
@@ -33,7 +38,7 @@ import TimeStamp from 'oneslash-design-system/components/timeStamp';
33
38
  import Heading from 'oneslash-design-system/components/heading';
34
39
  import Paragraph from 'oneslash-design-system/components/paragraph';
35
40
  import SourceCard from 'oneslash-design-system/components/sourceCard';
36
- import { Center, Grid, Stack } from 'oneslash-design-system/components/layout';
41
+ import { Grid, Stack } from 'oneslash-design-system/components/layout';
37
42
 
38
43
  const agentName = 'Acme Agent';
39
44
 
@@ -55,13 +60,56 @@ function agentMeta(at: Date) {
55
60
  );
56
61
  }
57
62
 
58
- // A real app opens the document in a pane beside the thread and moves focus into it.
59
- // ODS has no side pane part yet, so this example shows the card only.
60
- function openDocument() {}
63
+ const docParagraphs = [
64
+ 'Acme ships the new home page on March 3. Omar Reyes owns the copy and Dana Lee the screens.',
65
+ 'Ben Carter writes the announcement once the screens are approved.',
66
+ ];
67
+
68
+ // The threads. A real app lets each link go to its page.
69
+ const sidebar = (
70
+ <Navigation aria-label="Main">
71
+ <MenuItem
72
+ size="small"
73
+ label="Launch plan"
74
+ iconName="MessageSquare"
75
+ href="/launch-plan"
76
+ isSelected
77
+ aria-current="page"
78
+ onClick={(event: { preventDefault: () => void }) => event.preventDefault()}
79
+ />
80
+ </Navigation>
81
+ );
61
82
 
62
83
  export default function ArtifactCardCard() {
84
+ const [navOpen, setNavOpen] = useState(false);
85
+ // The pane opens from the card, so focus moves into it and goes back to the card on close.
86
+ const [open, setOpen] = useState(false);
87
+ const pane = useRef<SidePaneHandle>(null);
88
+
89
+ // Pressed again while the pane is open, the card brings the pane forward instead of opening a second one.
90
+ function openDocument() {
91
+ if (open) pane.current?.focus();
92
+ else setOpen(true);
93
+ }
94
+
63
95
  return (
64
- <Center width="page">
96
+ <AppShell
97
+ title="Launch plan"
98
+ navOpen={navOpen}
99
+ onNavOpenChange={setNavOpen}
100
+ sidebar={sidebar}
101
+ pane={
102
+ open && (
103
+ <SidePane ref={pane} title={doc.title} onClose={() => setOpen(false)}>
104
+ <Stack gap="medium">
105
+ {docParagraphs.map((text) => (
106
+ <Paragraph key={text} measure="none">{text}</Paragraph>
107
+ ))}
108
+ </Stack>
109
+ </SidePane>
110
+ )
111
+ }
112
+ >
65
113
  <Stack gap="large">
66
114
  <Heading level={1} size="h5">Launch plan</Heading>
67
115
  {/* A real app gives the list that holds the rows role="log". */}
@@ -89,7 +137,7 @@ export default function ArtifactCardCard() {
89
137
  </Message>
90
138
  </Stack>
91
139
  </Stack>
92
- </Center>
140
+ </AppShell>
93
141
  );
94
142
  }
95
143
  ```
@@ -0,0 +1 @@
1
+ export default function BillingPageBilledElsewhere(): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import Heading from '../../components/heading';
3
+ import Paragraph from '../../components/paragraph';
4
+ import Progress from '../../components/progress';
5
+ import SettingsSection from '../../components/settingsSection';
6
+ import TitleBar from '../../components/titleBar';
7
+ import { Center, Stack } from '../../components/layout';
8
+ export default function BillingPageBilledElsewhere() {
9
+ return (<Center width="page">
10
+ <Stack gap="xlarge">
11
+ <TitleBar title="Billing"/>
12
+ <SettingsSection id="billing-elsewhere-plan" title="Plan" description="What Acme pays for.">
13
+ <Stack gap="small">
14
+ <Heading level={3} size="h6">Pro</Heading>
15
+ <Paragraph tone="secondary" size="body2" measure="none">Renews on Dec 1, 2026.</Paragraph>
16
+ </Stack>
17
+ {/* No price, card or invoice: the app store that bills this plan keeps them. The page says who pays, where, and who can change it. */}
18
+ <Paragraph size="body2" measure="none">Ben Carter pays for this plan through an app store. Only Ben Carter can change or cancel it, in the app store settings on the device that bought it.</Paragraph>
19
+ </SettingsSection>
20
+ <SettingsSection id="billing-elsewhere-usage" title="Usage" description="This month.">
21
+ <Stack gap="medium">
22
+ <Progress label="AI agent responses" value={312} max={1000} unit="responses"/>
23
+ <Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
24
+ </Stack>
25
+ </SettingsSection>
26
+ </Stack>
27
+ </Center>);
28
+ }
@@ -0,0 +1 @@
1
+ export default function BillingPageSelfServe(): import("react").JSX.Element;