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
@@ -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';
6
+ import Paragraph from '../../components/paragraph';
5
7
  import Surface from '../../components/surface';
6
8
  import LoadingScreen from '../../components/loadingScreen';
7
- import { Cluster, Stack } from '../../components/layout';
8
- // The product's mark. A real app passes its own file.
9
- 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";
10
- // A real app passes the router from its framework, such as Next's useRouter().
11
- var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
9
+ // The places, and the projects the person made. The page that failed or loads is the current one.
10
+ var places = [
11
+ { label: 'Home', icon: 'House', href: '/' },
12
+ { label: 'Settings', icon: 'Settings', href: '/settings' },
13
+ ];
14
+ var projects = [
15
+ { label: 'Website', icon: 'Globe', href: '/projects/website' },
16
+ { label: 'Mobile App', icon: 'Smartphone', href: '/projects/mobile-app' },
17
+ ];
18
+ var current = '/projects/website';
19
+ 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}
20
+ // A real app lets the link go to its page.
21
+ onClick={function (event) { return event.preventDefault(); }}/>); };
22
+ var sidebar = (<Navigation aria-label="Main">
23
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
24
+ {places.map(row)}
25
+ <NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
26
+ </Navigation>);
12
27
  export default function RouteLoadingRegion() {
13
- return (<Stack gap="large">
14
- <Cluster gap="large">
15
- <Image src={productMark} alt="Acme" width={32} height={32}/>
16
- <TabsContainer>
17
- <Tab label="Home" isSelected={false} href="/" router={router} onClickTab={function () { }}/>
18
- <Tab label="Projects" isSelected href="/projects" router={router} onClickTab={function () { }}/>
19
- <Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={function () { }}/>
20
- </TabsContainer>
21
- </Cluster>
28
+ // Below md the sidebar is a Drawer; this says whether it is open.
29
+ var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
30
+ return (<AppShell title="Website" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
22
31
  <Surface minHeight="tall" align="center">
23
32
  <LoadingScreen />
24
33
  </Surface>
25
- </Stack>);
34
+ </AppShell>);
26
35
  }
@@ -40,39 +40,60 @@ export default function RouteLoadingFullScreen() {
40
40
 
41
41
  Use when: The shell shows and one pane loads.
42
42
 
43
- Uses: `Cluster`, `Image`, `LoadingScreen`, `Stack`, `Surface`, `Tab`, `TabsContainer`
43
+ Uses: `AppShell`, `LoadingScreen`, `MenuItem`, `Navigation`, `NavigationGroup`, `Paragraph`, `Surface`
44
44
 
45
45
  ```tsx
46
46
  'use client';
47
- import Image from 'oneslash-design-system/components/image';
48
- import TabsContainer from 'oneslash-design-system/components/tabsContainer';
49
- import Tab from 'oneslash-design-system/components/tab';
47
+ import { useState } from 'react';
48
+ import AppShell from 'oneslash-design-system/components/appShell';
49
+ import Navigation, { NavigationGroup } from 'oneslash-design-system/components/navigation';
50
+ import MenuItem from 'oneslash-design-system/components/menuItem';
51
+ import Paragraph from 'oneslash-design-system/components/paragraph';
50
52
  import Surface from 'oneslash-design-system/components/surface';
51
53
  import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
52
- import { Cluster, Stack } from 'oneslash-design-system/components/layout';
53
54
 
54
- // The product's mark. A real app passes its own file.
55
- const productMark =
56
- "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";
57
-
58
- // A real app passes the router from its framework, such as Next's useRouter().
59
- const router = { push: (url: string) => console.info(`Go to ${url}`) };
55
+ // The places, and the projects the person made. The page that failed or loads is the current one.
56
+ const places = [
57
+ { label: 'Home', icon: 'House', href: '/' },
58
+ { label: 'Settings', icon: 'Settings', href: '/settings' },
59
+ ];
60
+ const projects = [
61
+ { label: 'Website', icon: 'Globe', href: '/projects/website' },
62
+ { label: 'Mobile App', icon: 'Smartphone', href: '/projects/mobile-app' },
63
+ ];
64
+ const current = '/projects/website';
65
+
66
+ const row = (p: { label: string; icon: string; href: string }) => (
67
+ <MenuItem
68
+ key={p.href}
69
+ size="small"
70
+ label={p.label}
71
+ iconName={p.icon}
72
+ href={p.href}
73
+ isSelected={p.href === current}
74
+ aria-current={p.href === current ? 'page' : undefined}
75
+ // A real app lets the link go to its page.
76
+ onClick={(event: { preventDefault: () => void }) => event.preventDefault()}
77
+ />
78
+ );
79
+
80
+ const sidebar = (
81
+ <Navigation aria-label="Main">
82
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
83
+ {places.map(row)}
84
+ <NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
85
+ </Navigation>
86
+ );
60
87
 
61
88
  export default function RouteLoadingRegion() {
89
+ // Below md the sidebar is a Drawer; this says whether it is open.
90
+ const [navOpen, setNavOpen] = useState(false);
62
91
  return (
63
- <Stack gap="large">
64
- <Cluster gap="large">
65
- <Image src={productMark} alt="Acme" width={32} height={32} />
66
- <TabsContainer>
67
- <Tab label="Home" isSelected={false} href="/" router={router} onClickTab={() => {}} />
68
- <Tab label="Projects" isSelected href="/projects" router={router} onClickTab={() => {}} />
69
- <Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={() => {}} />
70
- </TabsContainer>
71
- </Cluster>
92
+ <AppShell title="Website" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
72
93
  <Surface minHeight="tall" align="center">
73
94
  <LoadingScreen />
74
95
  </Surface>
75
- </Stack>
96
+ </AppShell>
76
97
  );
77
98
  }
78
99
  ```
@@ -22,6 +22,7 @@ import Button from '../../components/button';
22
22
  import TabsContainer from '../../components/tabsContainer';
23
23
  import Tab from '../../components/tab';
24
24
  import SettingsSection, { SettingsColumns } from '../../components/settingsSection';
25
+ import { formatMoney } from '../../components/formatNumber';
25
26
  import { Center, Cluster, Stack } from '../../components/layout';
26
27
  // Four areas or fewer, each named with one short word, so the tabs fit on a phone. Each tab is a page of its own in a real app, so it has an `href`.
27
28
  var areas = [
@@ -29,7 +30,7 @@ var areas = [
29
30
  { id: 'notifications', label: 'Notifications' },
30
31
  { id: 'billing', label: 'Billing' },
31
32
  ];
32
- var invoices = ['January 2025, $40.00', 'December 2024, $40.00', 'November 2024, $40.00'];
33
+ var invoices = ["November 2026, ".concat(formatMoney(24)), "October 2026, ".concat(formatMoney(24)), "September 2026, ".concat(formatMoney(24))];
33
34
  export default function SettingsPageTopTabs() {
34
35
  var _a = useState('profile'), area = _a[0], setArea = _a[1];
35
36
  var _b = useState('Dana Lee'), savedName = _b[0], setSavedName = _b[1];
@@ -108,8 +109,8 @@ export default function SettingsPageTopTabs() {
108
109
  </SettingsSection>
109
110
  </SettingsColumns>);
110
111
  var billing = (<SettingsColumns>
111
- <SettingsSection id="settings-page-tabs-plan" title="Plan" description="Team plan, 5 seats.">
112
- <Paragraph size="body2" measure="none">Renews on January 15. Only owners can change the plan.</Paragraph>
112
+ <SettingsSection id="settings-page-tabs-plan" title="Plan" description="Pro plan, 3 members.">
113
+ <Paragraph size="body2" measure="none">Renews on Dec 1, 2026. Only owners can change the plan.</Paragraph>
113
114
  </SettingsSection>
114
115
  <SettingsSection id="settings-page-tabs-invoices" title="Invoices" description="The last three months.">
115
116
  <List items={invoices} size="body2"/>
@@ -28,7 +28,7 @@ A person opens the settings of the product and looks for one area, such as Profi
28
28
 
29
29
  Use when: Four areas or fewer, with short names that fit on a phone.
30
30
 
31
- Uses: `Button`, `Center`, `Cluster`, `Form`, `FormField`, `Heading`, `List`, `Paragraph`, `SettingsColumns`, `SettingsSection`, `Stack`, `Switch`, `Tab`, `TabsContainer`, `TextField`
31
+ Uses: `Button`, `Center`, `Cluster`, `Form`, `FormField`, `Heading`, `List`, `Paragraph`, `SettingsColumns`, `SettingsSection`, `Stack`, `Switch`, `Tab`, `TabsContainer`, `TextField`, `formatMoney`
32
32
 
33
33
  ```tsx
34
34
  'use client';
@@ -44,6 +44,7 @@ import Button from 'oneslash-design-system/components/button';
44
44
  import TabsContainer from 'oneslash-design-system/components/tabsContainer';
45
45
  import Tab from 'oneslash-design-system/components/tab';
46
46
  import SettingsSection, { SettingsColumns } from 'oneslash-design-system/components/settingsSection';
47
+ import { formatMoney } from 'oneslash-design-system/components/formatNumber';
47
48
  import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
48
49
 
49
50
  type Area = 'profile' | 'notifications' | 'billing';
@@ -55,7 +56,7 @@ const areas: { id: Area; label: string }[] = [
55
56
  { id: 'billing', label: 'Billing' },
56
57
  ];
57
58
 
58
- const invoices = ['January 2025, $40.00', 'December 2024, $40.00', 'November 2024, $40.00'];
59
+ const invoices = [`November 2026, ${formatMoney(24)}`, `October 2026, ${formatMoney(24)}`, `September 2026, ${formatMoney(24)}`];
59
60
 
60
61
  export default function SettingsPageTopTabs() {
61
62
  const [area, setArea] = useState<Area>('profile');
@@ -136,8 +137,8 @@ export default function SettingsPageTopTabs() {
136
137
 
137
138
  const billing = (
138
139
  <SettingsColumns>
139
- <SettingsSection id="settings-page-tabs-plan" title="Plan" description="Team plan, 5 seats.">
140
- <Paragraph size="body2" measure="none">Renews on January 15. Only owners can change the plan.</Paragraph>
140
+ <SettingsSection id="settings-page-tabs-plan" title="Plan" description="Pro plan, 3 members.">
141
+ <Paragraph size="body2" measure="none">Renews on Dec 1, 2026. Only owners can change the plan.</Paragraph>
141
142
  </SettingsSection>
142
143
  <SettingsSection id="settings-page-tabs-invoices" title="Invoices" description="The last three months.">
143
144
  <List items={invoices} size="body2" />
@@ -0,0 +1 @@
1
+ export default function SidePaneBeside(): import("react").JSX.Element;
@@ -0,0 +1,79 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useRef, useState } from 'react';
12
+ import AppShell from '../../components/appShell';
13
+ import SidePane from '../../components/sidePane';
14
+ import TitleBar from '../../components/titleBar';
15
+ import Navigation, { NavigationGroup } from '../../components/navigation';
16
+ import MenuItem from '../../components/menuItem';
17
+ import IconButton from '../../components/iconButton';
18
+ import Tooltip from '../../components/tooltip';
19
+ import UserImage from '../../components/userImage';
20
+ import Paragraph from '../../components/paragraph';
21
+ import { Cluster, Stack } from '../../components/layout';
22
+ var members = [
23
+ { name: 'Dana Lee', role: 'Owner' },
24
+ { name: 'Ben Carter', role: 'Editor' },
25
+ { name: 'Omar Reyes', role: 'Editor' },
26
+ ];
27
+ var places = [
28
+ { id: 'inbox', label: 'Inbox', icon: 'Inbox' },
29
+ { id: 'tasks', label: 'Tasks', icon: 'ListChecks' },
30
+ { id: 'files', label: 'Files', icon: 'Files' },
31
+ ];
32
+ // The projects the person made
33
+ var projects = [
34
+ { id: 'website', label: 'Website', icon: 'Globe' },
35
+ { id: 'mobile-app', label: 'Mobile App', icon: 'Smartphone' },
36
+ ];
37
+ export default function SidePaneBeside() {
38
+ var _a;
39
+ var _b = useState(false), navOpen = _b[0], setNavOpen = _b[1];
40
+ var _c = useState('tasks'), placeId = _c[0], setPlaceId = _c[1];
41
+ // One pane at a time. Opening another replaces it.
42
+ var _d = useState(null), open = _d[0], setOpen = _d[1];
43
+ // Only the pane that holds a document can be resized.
44
+ var _e = useState(448), briefWidth = _e[0], setBriefWidth = _e[1];
45
+ var pane = useRef(null);
46
+ var place = (_a = __spreadArray(__spreadArray([], places, true), projects, true).find(function (p) { return p.id === placeId; })) !== null && _a !== void 0 ? _a : places[0];
47
+ // Pressed again while its pane is open, the opener brings the pane forward instead of opening a second one.
48
+ function opener(id, label, icon) {
49
+ return (<Tooltip title={label}>
50
+ <IconButton color="iconOnly" state={open === id ? 'selected' : 'enabled'} size="medium" iconName={icon} ariaLabel={label} aria-expanded={open === id} onClick={function () { var _a; return (open === id ? (_a = pane.current) === null || _a === void 0 ? void 0 : _a.focus() : setOpen(id)); }}/>
51
+ </Tooltip>);
52
+ }
53
+ var row = function (p) { return (<MenuItem key={p.id} size="small" label={p.label} iconName={p.icon} href={"/".concat(p.id)} isSelected={p.id === place.id} aria-current={p.id === place.id ? 'page' : undefined} onClick={function (event) {
54
+ // A real app lets the link go to its page. The example keeps the choice in state.
55
+ event.preventDefault();
56
+ setPlaceId(p.id);
57
+ }}/>); };
58
+ var sidebar = (<Navigation aria-label="Main">
59
+ {places.map(row)}
60
+ <NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
61
+ </Navigation>);
62
+ return (<AppShell title={place.label} navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar} pane={open && (<SidePane key={open} ref={pane} title={open === 'members' ? 'Members' : 'Brief'} onClose={function () { return setOpen(null); }} width={open === 'brief' ? briefWidth : undefined} onWidthChange={open === 'brief' ? setBriefWidth : undefined}>
63
+ {open === 'members' ? (<Stack gap="medium">
64
+ {members.map(function (m) { return (<Cluster key={m.name}>
65
+ <UserImage userHandle={m.name} decorative/>
66
+ <Paragraph size="body1" measure="none">{m.name}</Paragraph>
67
+ <Paragraph tone="secondary" size="body2" measure="none">{m.role}</Paragraph>
68
+ </Cluster>); })}
69
+ </Stack>) : (<Stack gap="medium">
70
+ <Paragraph measure="none">Acme ships the new home page on Friday. Omar Reyes owns the copy and Dana Lee the screens.</Paragraph>
71
+ <Paragraph tone="secondary" measure="none">The pane stays beside the page, so the task and the brief are read together. Drag its edge, or use the arrow keys on it, to make it wider.</Paragraph>
72
+ </Stack>)}
73
+ </SidePane>)}>
74
+ <Stack gap="large">
75
+ <TitleBar title="Launch plan" actions={<>{opener('members', 'Members', 'Users')}{opener('brief', 'Brief', 'FileText')}</>}/>
76
+ <Paragraph tone="secondary" measure="none">Ben Carter is writing the announcement. Omar Reyes is waiting for the new screens.</Paragraph>
77
+ </Stack>
78
+ </AppShell>);
79
+ }
@@ -0,0 +1 @@
1
+ export default function SidePaneOver(): import("react").JSX.Element;
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Drawer from '../../components/drawer';
4
+ import PageShell from '../../components/pageShell';
5
+ import TitleBar from '../../components/titleBar';
6
+ import RadioGroup from '../../components/radioGroup';
7
+ import Paragraph from '../../components/paragraph';
8
+ import Button from '../../components/button';
9
+ import { Cluster, Stack } from '../../components/layout';
10
+ var people = [
11
+ { label: 'Dana Lee', value: 'dana' },
12
+ { label: 'Ben Carter', value: 'ben' },
13
+ { label: 'Omar Reyes', value: 'omar' },
14
+ ];
15
+ export default function SidePaneOver() {
16
+ var _a = useState(false), open = _a[0], setOpen = _a[1];
17
+ // The person on the task, and the one picked in the sheet before Assign.
18
+ var _b = useState(''), assigned = _b[0], setAssigned = _b[1];
19
+ var _c = useState('dana'), picked = _c[0], setPicked = _c[1];
20
+ var _d = useState(false), saving = _d[0], setSaving = _d[1];
21
+ var timer = useRef();
22
+ // Stops the request if the example goes away before it ends.
23
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
24
+ // Escape, the scrim, Close and Cancel all close it, except while the request runs.
25
+ function close() {
26
+ if (saving)
27
+ return;
28
+ setOpen(false);
29
+ }
30
+ function assign() {
31
+ if (saving)
32
+ return;
33
+ setSaving(true);
34
+ // Stands in for the request to the server.
35
+ timer.current = setTimeout(function () {
36
+ var _a, _b;
37
+ setSaving(false);
38
+ setAssigned((_b = (_a = people.find(function (p) { return p.value === picked; })) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '');
39
+ setOpen(false);
40
+ }, 1200);
41
+ }
42
+ return (<PageShell>
43
+ <Stack gap="large">
44
+ <TitleBar title="Launch plan" actions={<Button size="medium" type="secondary" state="enabled" label="Assign" decoIcon="UserPlus" onClickButton={function () { return setOpen(true); }}/>}/>
45
+ {/* The result shows here, where the person is looking, so there is no toast. */}
46
+ <Paragraph tone="secondary" measure="none">{assigned ? "Assigned to ".concat(assigned, ".") : 'Nobody is assigned yet.'}</Paragraph>
47
+ </Stack>
48
+ <Drawer isOpen={open} onClose={close} side="end" size="small" title="Assign Task" initialFocus="body">
49
+ <Stack gap="large">
50
+ <RadioGroup aria-label="Person" options={people} selectedValue={picked} disabled={saving} onChange={setPicked}/>
51
+ <Cluster justify="end">
52
+ <Button size="small" type="tertiary" state={saving ? 'disabled' : 'enabled'} label="Cancel" onClickButton={close}/>
53
+ <Button size="small" type="primary" state="enabled" label="Assign" loading={saving} onClickButton={assign}/>
54
+ </Cluster>
55
+ </Stack>
56
+ </Drawer>
57
+ </PageShell>);
58
+ }
@@ -0,0 +1,238 @@
1
+ # Side pane
2
+
3
+ A person opens more about the page, such as its members, its history or a document, without leaving the page.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail': on a phone a pane takes the whole content area.
8
+ - Put the pane in the `pane` of `AppShell`, as a `SidePane` with a `title` and `onClose`. Render it only while it is open.
9
+ - Open it from an `IconButton` with a name and `aria-expanded`, and give it `state="selected"` while the pane is open.
10
+ - Show one pane at a time. Opening another replaces the first. Pressing the opener of the open pane calls `focus()` on the pane's ref instead of opening a second one.
11
+ - Let Close and Escape close the pane. Focus goes back to the opener.
12
+ - Open a pane only from the person's own action. It takes focus when it mounts.
13
+ - Make a pane resizable only when it holds a document: pass `width` and `onWidthChange`. The start edge then moves with the pointer and with the arrow keys.
14
+ - Use `Drawer side="end"` with a `title` for a short task. On a phone it is a sheet from the bottom.
15
+ - Give a Drawer `initialFocus="body"` when it holds a control, so focus lands on the control. Keep the Drawer open while its request runs.
16
+ - Show the result of a task in the page behind the Drawer, such as 'Assigned to Ben Carter.' Show no toast.
17
+ - Title a Drawer for its action in Title Case, as a Modal: 'Assign Task'. Title a pane that shows one thing with its name.
18
+ - Put 'Cancel' first and the action last, named with the title's verb: 'Assign Task' has an 'Assign' Button. If the request fails, keep the Drawer open and show an inline error Alert at its top, as the rule 'A form error shows next to the problem' says.
19
+
20
+ ## Don't
21
+
22
+ - Do not squeeze a pane beside the page on a phone.
23
+ - Do not open two panes at once.
24
+ - Do not open a pane when the page loads, or from a timer. It takes focus away from the person.
25
+ - Do not make a list of members resizable. Only a document needs room.
26
+ - Do not use a Drawer for something the person reads together with the page.
27
+
28
+ ## Option: Pane beside the page
29
+
30
+ Use when: The person reads the pane and the page together, such as members, history or a document.
31
+
32
+ Uses: `AppShell`, `Cluster`, `IconButton`, `MenuItem`, `Navigation`, `NavigationGroup`, `Paragraph`, `SidePane`, `Stack`, `TitleBar`, `Tooltip`, `UserImage`
33
+
34
+ ```tsx
35
+ 'use client';
36
+ import { useRef, useState } from 'react';
37
+ import AppShell from 'oneslash-design-system/components/appShell';
38
+ import SidePane, { type SidePaneHandle } from 'oneslash-design-system/components/sidePane';
39
+ import TitleBar from 'oneslash-design-system/components/titleBar';
40
+ import Navigation, { NavigationGroup } from 'oneslash-design-system/components/navigation';
41
+ import MenuItem from 'oneslash-design-system/components/menuItem';
42
+ import IconButton from 'oneslash-design-system/components/iconButton';
43
+ import Tooltip from 'oneslash-design-system/components/tooltip';
44
+ import UserImage from 'oneslash-design-system/components/userImage';
45
+ import Paragraph from 'oneslash-design-system/components/paragraph';
46
+ import { Cluster, Stack } from 'oneslash-design-system/components/layout';
47
+
48
+ type PaneId = 'members' | 'brief';
49
+
50
+ const members = [
51
+ { name: 'Dana Lee', role: 'Owner' },
52
+ { name: 'Ben Carter', role: 'Editor' },
53
+ { name: 'Omar Reyes', role: 'Editor' },
54
+ ];
55
+
56
+ const places = [
57
+ { id: 'inbox', label: 'Inbox', icon: 'Inbox' },
58
+ { id: 'tasks', label: 'Tasks', icon: 'ListChecks' },
59
+ { id: 'files', label: 'Files', icon: 'Files' },
60
+ ];
61
+ // The projects the person made
62
+ const projects = [
63
+ { id: 'website', label: 'Website', icon: 'Globe' },
64
+ { id: 'mobile-app', label: 'Mobile App', icon: 'Smartphone' },
65
+ ];
66
+
67
+ export default function SidePaneBeside() {
68
+ const [navOpen, setNavOpen] = useState(false);
69
+ const [placeId, setPlaceId] = useState('tasks');
70
+ // One pane at a time. Opening another replaces it.
71
+ const [open, setOpen] = useState<PaneId | null>(null);
72
+ // Only the pane that holds a document can be resized.
73
+ const [briefWidth, setBriefWidth] = useState(448);
74
+ const pane = useRef<SidePaneHandle>(null);
75
+
76
+ const place = [...places, ...projects].find((p) => p.id === placeId) ?? places[0];
77
+
78
+ // Pressed again while its pane is open, the opener brings the pane forward instead of opening a second one.
79
+ function opener(id: PaneId, label: string, icon: 'Users' | 'FileText') {
80
+ return (
81
+ <Tooltip title={label}>
82
+ <IconButton
83
+ color="iconOnly"
84
+ state={open === id ? 'selected' : 'enabled'}
85
+ size="medium"
86
+ iconName={icon}
87
+ ariaLabel={label}
88
+ aria-expanded={open === id}
89
+ onClick={() => (open === id ? pane.current?.focus() : setOpen(id))}
90
+ />
91
+ </Tooltip>
92
+ );
93
+ }
94
+
95
+ const row = (p: { id: string; label: string; icon: string }) => (
96
+ <MenuItem
97
+ key={p.id}
98
+ size="small"
99
+ label={p.label}
100
+ iconName={p.icon}
101
+ href={`/${p.id}`}
102
+ isSelected={p.id === place.id}
103
+ aria-current={p.id === place.id ? 'page' : undefined}
104
+ onClick={(event: { preventDefault: () => void }) => {
105
+ // A real app lets the link go to its page. The example keeps the choice in state.
106
+ event.preventDefault();
107
+ setPlaceId(p.id);
108
+ }}
109
+ />
110
+ );
111
+
112
+ const sidebar = (
113
+ <Navigation aria-label="Main">
114
+ {places.map(row)}
115
+ <NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
116
+ </Navigation>
117
+ );
118
+
119
+ return (
120
+ <AppShell
121
+ title={place.label}
122
+ navOpen={navOpen}
123
+ onNavOpenChange={setNavOpen}
124
+ sidebar={sidebar}
125
+ pane={
126
+ open && (
127
+ <SidePane
128
+ key={open}
129
+ ref={pane}
130
+ title={open === 'members' ? 'Members' : 'Brief'}
131
+ onClose={() => setOpen(null)}
132
+ width={open === 'brief' ? briefWidth : undefined}
133
+ onWidthChange={open === 'brief' ? setBriefWidth : undefined}
134
+ >
135
+ {open === 'members' ? (
136
+ <Stack gap="medium">
137
+ {members.map((m) => (
138
+ <Cluster key={m.name}>
139
+ <UserImage userHandle={m.name} decorative />
140
+ <Paragraph size="body1" measure="none">{m.name}</Paragraph>
141
+ <Paragraph tone="secondary" size="body2" measure="none">{m.role}</Paragraph>
142
+ </Cluster>
143
+ ))}
144
+ </Stack>
145
+ ) : (
146
+ <Stack gap="medium">
147
+ <Paragraph measure="none">Acme ships the new home page on Friday. Omar Reyes owns the copy and Dana Lee the screens.</Paragraph>
148
+ <Paragraph tone="secondary" measure="none">The pane stays beside the page, so the task and the brief are read together. Drag its edge, or use the arrow keys on it, to make it wider.</Paragraph>
149
+ </Stack>
150
+ )}
151
+ </SidePane>
152
+ )
153
+ }
154
+ >
155
+ <Stack gap="large">
156
+ <TitleBar title="Launch plan" actions={<>{opener('members', 'Members', 'Users')}{opener('brief', 'Brief', 'FileText')}</>} />
157
+ <Paragraph tone="secondary" measure="none">Ben Carter is writing the announcement. Omar Reyes is waiting for the new screens.</Paragraph>
158
+ </Stack>
159
+ </AppShell>
160
+ );
161
+ }
162
+ ```
163
+
164
+ ## Option: Drawer over the page
165
+
166
+ Use when: The task is short and the page can be hidden for a moment, such as picking a person.
167
+
168
+ Uses: `Button`, `Cluster`, `Drawer`, `PageShell`, `Paragraph`, `RadioGroup`, `Stack`, `TitleBar`
169
+
170
+ ```tsx
171
+ 'use client';
172
+ import { useEffect, useRef, useState } from 'react';
173
+ import Drawer from 'oneslash-design-system/components/drawer';
174
+ import PageShell from 'oneslash-design-system/components/pageShell';
175
+ import TitleBar from 'oneslash-design-system/components/titleBar';
176
+ import RadioGroup from 'oneslash-design-system/components/radioGroup';
177
+ import Paragraph from 'oneslash-design-system/components/paragraph';
178
+ import Button from 'oneslash-design-system/components/button';
179
+ import { Cluster, Stack } from 'oneslash-design-system/components/layout';
180
+
181
+ const people = [
182
+ { label: 'Dana Lee', value: 'dana' },
183
+ { label: 'Ben Carter', value: 'ben' },
184
+ { label: 'Omar Reyes', value: 'omar' },
185
+ ];
186
+
187
+ export default function SidePaneOver() {
188
+ const [open, setOpen] = useState(false);
189
+ // The person on the task, and the one picked in the sheet before Assign.
190
+ const [assigned, setAssigned] = useState('');
191
+ const [picked, setPicked] = useState('dana');
192
+ const [saving, setSaving] = useState(false);
193
+ const timer = useRef<ReturnType<typeof setTimeout>>();
194
+
195
+ // Stops the request if the example goes away before it ends.
196
+ useEffect(() => () => clearTimeout(timer.current), []);
197
+
198
+ // Escape, the scrim, Close and Cancel all close it, except while the request runs.
199
+ function close() {
200
+ if (saving) return;
201
+ setOpen(false);
202
+ }
203
+
204
+ function assign() {
205
+ if (saving) return;
206
+ setSaving(true);
207
+ // Stands in for the request to the server.
208
+ timer.current = setTimeout(() => {
209
+ setSaving(false);
210
+ setAssigned(people.find((p) => p.value === picked)?.label ?? '');
211
+ setOpen(false);
212
+ }, 1200);
213
+ }
214
+
215
+ return (
216
+ <PageShell>
217
+ <Stack gap="large">
218
+ <TitleBar title="Launch plan" actions={<Button size="medium" type="secondary" state="enabled" label="Assign" decoIcon="UserPlus" onClickButton={() => setOpen(true)} />} />
219
+ {/* The result shows here, where the person is looking, so there is no toast. */}
220
+ <Paragraph tone="secondary" measure="none">{assigned ? `Assigned to ${assigned}.` : 'Nobody is assigned yet.'}</Paragraph>
221
+ </Stack>
222
+ <Drawer isOpen={open} onClose={close} side="end" size="small" title="Assign Task" initialFocus="body">
223
+ <Stack gap="large">
224
+ <RadioGroup aria-label="Person" options={people} selectedValue={picked} disabled={saving} onChange={setPicked} />
225
+ <Cluster justify="end">
226
+ <Button size="small" type="tertiary" state={saving ? 'disabled' : 'enabled'} label="Cancel" onClickButton={close} />
227
+ <Button size="small" type="primary" state="enabled" label="Assign" loading={saving} onClickButton={assign} />
228
+ </Cluster>
229
+ </Stack>
230
+ </Drawer>
231
+ </PageShell>
232
+ );
233
+ }
234
+ ```
235
+
236
+ ## Native
237
+
238
+ On Apple use an inspector (`.inspector`) for a pane beside the page, and a `.sheet` with `presentationDetents` for a short task. On Android use a `ModalBottomSheet` for a short task.
@@ -0,0 +1 @@
1
+ export default function SidebarNavFlat(): import("react").JSX.Element;