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,133 @@
1
+ # Site footer
2
+
3
+ A person reaches the end of a site's page and looks for the pages that are not in the header, and who runs the site.
4
+
5
+ ## Do
6
+
7
+ - Use `SiteFooter` at the end of the page, after `PageShell`. It is a `<footer>` with a `<nav aria-label="Footer">`.
8
+ - Pass the brand, so the person can go home, and the links. Use `links` for a few and `columns` for many.
9
+ - Give each column a short `title`, such as 'Product', 'Company' and 'Legal'. A phone shows two columns across and a wide window up to four.
10
+ - Put the legal line last, in `legal`: the year and the name, and the license if there is one, such as '© 2026 Acme. Released under the MIT License.'
11
+ - Mark a link to another site with `external`. It opens in a new tab and the icon and the hidden words '(opens in a new tab)' say so.
12
+ - Keep the footer to links and the legal line. It holds every page the header leaves out, in plain words.
13
+
14
+ ## Don't
15
+
16
+ - Do not put a sales pitch, a heading or a Button in the footer. Use a call to action band above it.
17
+ - Do not open an external link in a new tab without saying so.
18
+ - Do not repeat a long sentence of the page in the footer.
19
+ - Do not hide a link on a phone. The columns sit two across.
20
+ - Do not put the legal line before the links.
21
+
22
+ ## Option: A row of links
23
+
24
+ Use when: The site has a few links to show.
25
+
26
+ Uses: `Center`, `Heading`, `Paragraph`, `SiteFooter`, `Stack`
27
+
28
+ ```tsx
29
+ 'use client';
30
+ import SiteFooter from 'oneslash-design-system/components/siteFooter';
31
+ import Heading from 'oneslash-design-system/components/heading';
32
+ import Paragraph from 'oneslash-design-system/components/paragraph';
33
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
34
+
35
+ const links = [
36
+ { label: 'Pricing', href: '#pricing' },
37
+ { label: 'Changelog', href: '#changelog' },
38
+ { label: 'Privacy', href: '#privacy' },
39
+ { label: 'GitHub', href: 'https://github.com/acme/acme', external: true },
40
+ ];
41
+
42
+ export default function SiteFooterSimple() {
43
+ return (
44
+ <>
45
+ {/* A real page puts its content in PageShell, then SiteFooter. Center keeps the footer in view here. */}
46
+ <Center width="page">
47
+ <Stack gap="large">
48
+ <Heading level={1} size="h5">Changelog</Heading>
49
+ <Paragraph tone="secondary" measure="none">Version 2.4 adds shared folders. Ben Carter wrote the notes.</Paragraph>
50
+ </Stack>
51
+ </Center>
52
+ {/* A few links in one row that wraps, then the legal line last. */}
53
+ <SiteFooter
54
+ brand={{ href: '#top', name: 'Acme' }}
55
+ links={links}
56
+ legal="© 2026 Acme. Released under the MIT License."
57
+ />
58
+ </>
59
+ );
60
+ }
61
+ ```
62
+
63
+ ## Option: Links in groups
64
+
65
+ Use when: The site has many links that fall into groups, such as product, company and legal.
66
+
67
+ Uses: `Center`, `Heading`, `Paragraph`, `SiteFooter`, `Stack`
68
+
69
+ ```tsx
70
+ 'use client';
71
+ import SiteFooter from 'oneslash-design-system/components/siteFooter';
72
+ import Heading from 'oneslash-design-system/components/heading';
73
+ import Paragraph from 'oneslash-design-system/components/paragraph';
74
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
75
+
76
+ const columns = [
77
+ {
78
+ title: 'Product',
79
+ links: [
80
+ { label: 'Features', href: '#features' },
81
+ { label: 'Pricing', href: '#pricing' },
82
+ { label: 'Changelog', href: '#changelog' },
83
+ { label: 'Docs', href: '#docs' },
84
+ ],
85
+ },
86
+ {
87
+ title: 'Company',
88
+ links: [
89
+ { label: 'About', href: '#about' },
90
+ { label: 'Blog', href: '#blog' },
91
+ { label: 'Contact', href: '#contact' },
92
+ ],
93
+ },
94
+ {
95
+ title: 'Follow',
96
+ links: [
97
+ { label: 'GitHub', href: 'https://github.com/acme/acme', external: true },
98
+ { label: 'Newsletter', href: 'https://acme.example/newsletter', external: true },
99
+ ],
100
+ },
101
+ {
102
+ title: 'Legal',
103
+ links: [
104
+ { label: 'Terms', href: '#terms' },
105
+ { label: 'Privacy', href: '#privacy' },
106
+ ],
107
+ },
108
+ ];
109
+
110
+ export default function SiteFooterColumns() {
111
+ return (
112
+ <>
113
+ {/* A real page puts its content in PageShell, then SiteFooter. Center keeps the footer in view here. */}
114
+ <Center width="page">
115
+ <Stack gap="large">
116
+ <Heading level={1} size="h5">About Acme</Heading>
117
+ <Paragraph tone="secondary" measure="none">Acme helps small teams share files and decide together.</Paragraph>
118
+ </Stack>
119
+ </Center>
120
+ {/* Groups of links, two across on a phone and four across from md. The legal line is last. */}
121
+ <SiteFooter
122
+ brand={{ href: '#top', name: 'Acme' }}
123
+ columns={columns}
124
+ legal="© 2026 Acme. All rights reserved."
125
+ />
126
+ </>
127
+ );
128
+ }
129
+ ```
130
+
131
+ ## Native
132
+
133
+ On Apple and Android an app has no footer. Put the links in a settings or an About screen, as a `List` of rows.
@@ -0,0 +1 @@
1
+ export default function SiteHeaderLinks(): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+ import SiteHeader from '../../components/siteHeader';
3
+ import PageShell from '../../components/pageShell';
4
+ import Button from '../../components/button';
5
+ import Heading from '../../components/heading';
6
+ import Paragraph from '../../components/paragraph';
7
+ import { Stack } from '../../components/layout';
8
+ var links = [
9
+ { label: 'Features', href: '#features' },
10
+ { label: 'Pricing', href: '#pricing', current: true },
11
+ { label: 'Changelog', href: '#changelog' },
12
+ { label: 'Docs', href: '#docs' },
13
+ ];
14
+ export default function SiteHeaderLinks() {
15
+ return (<>
16
+ {/* From md the links are a row in the bar. Below md they and 'Log In' are in the Menu; Sign Up stays beside it. */}
17
+ <SiteHeader brand={{ href: '#top', name: 'Acme' }} links={links} actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in"/>} phoneAction={<Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up"/>} mainId="site-header-main"/>
18
+ {/* The skip link goes here: the id matches mainId, and tabIndex -1 lets focus move in. */}
19
+ <PageShell id="site-header-main" tabIndex={-1}>
20
+ <Stack gap="large">
21
+ <Heading level={1} size="h5">Pricing</Heading>
22
+ <Paragraph tone="secondary" measure="none">Acme is free for up to three people. Add more people when your team grows.</Paragraph>
23
+ </Stack>
24
+ </PageShell>
25
+ </>);
26
+ }
@@ -0,0 +1 @@
1
+ export default function SiteHeaderSections(): import("react").JSX.Element;
@@ -0,0 +1,64 @@
1
+ 'use client';
2
+ import { useState } from 'react';
3
+ import SiteHeader from '../../components/siteHeader';
4
+ import TabsContainer from '../../components/tabsContainer';
5
+ import Tab from '../../components/tab';
6
+ import IconButton from '../../components/iconButton';
7
+ import Tooltip from '../../components/tooltip';
8
+ import Popover from '../../components/popover';
9
+ import Menu from '../../components/menu';
10
+ import MenuItem from '../../components/menuItem';
11
+ import PageShell from '../../components/pageShell';
12
+ import Heading from '../../components/heading';
13
+ import Paragraph from '../../components/paragraph';
14
+ import { Stack } from '../../components/layout';
15
+ // Four sections, one short word each. Each holds many pages.
16
+ var sections = [
17
+ { id: 'start', label: 'Start', page: 'Start here' },
18
+ { id: 'guides', label: 'Guides', page: 'Guides' },
19
+ { id: 'reference', label: 'API', page: 'API reference' },
20
+ { id: 'updates', label: 'News', page: 'News' },
21
+ ];
22
+ var modes = [
23
+ { value: 'light', label: 'Light', icon: 'Sun' },
24
+ { value: 'dark', label: 'Dark', icon: 'Moon' },
25
+ { value: 'system', label: 'System', icon: 'Monitor' },
26
+ ];
27
+ export default function SiteHeaderSections() {
28
+ var _a, _b;
29
+ var _c = useState('guides'), sectionId = _c[0], setSectionId = _c[1];
30
+ var _d = useState('system'), mode = _d[0], setMode = _d[1];
31
+ var _e = useState(null), anchor = _e[0], setAnchor = _e[1];
32
+ var _f = useState(false), open = _f[0], setOpen = _f[1];
33
+ var section = (_a = sections.find(function (s) { return s.id === sectionId; })) !== null && _a !== void 0 ? _a : sections[0];
34
+ var current = (_b = modes.find(function (m) { return m.value === mode; })) !== null && _b !== void 0 ? _b : modes[2];
35
+ // A real app passes the router from its framework, such as Next's useRouter(). Here it sets the open section.
36
+ var router = { push: function (url) { var _a; return setSectionId((_a = url.split('/').pop()) !== null && _a !== void 0 ? _a : 'start'); } };
37
+ return (<>
38
+ {/* The brand, then search and the theme menu as `phoneAction`, so they stay in the bar at every width. The section Tabs are `nav`, a second row of the bar. */}
39
+ <SiteHeader brand={{ href: '#top', name: 'Acme Docs' }} links={[]} phoneAction={<>
40
+ <Tooltip title="Search">
41
+ <IconButton color="iconOnly" state="enabled" size="medium" iconName="Search" ariaLabel="Search"/>
42
+ </Tooltip>
43
+ <Tooltip title={"Theme: ".concat(current.label)}>
44
+ <IconButton color="iconOnly" state={open ? 'selected' : 'enabled'} size="medium" iconName={current.icon} ariaLabel={"Theme: ".concat(current.label)} aria-haspopup="menu" aria-expanded={open} onClick={function (e) {
45
+ setAnchor(e.currentTarget);
46
+ setOpen(function (o) { return !o; });
47
+ }}/>
48
+ </Tooltip>
49
+ </>} nav={<TabsContainer fill>
50
+ {sections.map(function (s) { return (<Tab key={s.id} label={s.label} href={"/".concat(s.id)} router={router} isSelected={s.id === section.id} onClickTab={function () { return setSectionId(s.id); }}/>); })}
51
+ </TabsContainer>} mainId="site-header-sections-main"/>
52
+ <PageShell id="site-header-sections-main" tabIndex={-1}>
53
+ <Stack gap="large">
54
+ <Heading level={1} size="h5">{section.page}</Heading>
55
+ <Paragraph tone="secondary" measure="none">The pages in {section.label} are listed beside this page on a wide screen, and in the menu on a phone.</Paragraph>
56
+ </Stack>
57
+ </PageShell>
58
+ <Popover open={open} anchorEl={anchor} onClose={function () { return setOpen(false); }} returnFocus>
59
+ <Menu navigable aria-label="Theme" width={180}>
60
+ {modes.map(function (m) { return (<MenuItem key={m.value} size="small" iconName={m.icon} label={m.label} isSelected={m.value === mode} role="menuitemradio" onClick={function () { setMode(m.value); setOpen(false); }}/>); })}
61
+ </Menu>
62
+ </Popover>
63
+ </>);
64
+ }
@@ -0,0 +1,183 @@
1
+ # Site header
2
+
3
+ A site's pages name the site at the top and show the person where to go and what to do next.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail': below `md` the links go into a menu and one main action stays in the bar.
8
+ - Use `SiteHeader` for a few pages. Pass the brand, at most five `links`, and mark the page the person is on with `current`.
9
+ - Pass what must stay in the bar on a phone as `phoneAction`. On a product site that is the main action, named 'Open App' or 'Sign Up'. It is last at every width. Do not repeat it in `actions`.
10
+ - Pass the secondary Buttons, such as 'Log In', as `actions`. They go into the menu on a phone.
11
+ - Give `PageShell` `id` and `tabIndex={-1}` to match `mainId`, so the 'Skip to content' link moves focus into the page.
12
+ - Give a site with sections one `TabsContainer` of `Tab`s with `href`, four sections or fewer and one short word each. Pass it as `nav` to `SiteHeader` with `links` empty: it is a second row of the bar at every width.
13
+ - Pass search and the theme menu as `phoneAction`, so they stay at the end of the bar on a phone. With no `links` and no `actions` there is no menu.
14
+ - Keep the section tabs in the bar, so no section is hidden. On a phone, put the pages of the open section in a menu, as the case 'Menu on a phone' shows in 'Sections with their pages'.
15
+ - Open the theme menu as the case 'Theme switcher' says, and name the search `IconButton` 'Search'.
16
+
17
+ ## Don't
18
+
19
+ - Do not show more than five links in the bar.
20
+ - Do not show two primary Buttons in the bar.
21
+ - Do not hide a link on a phone without a menu that holds it.
22
+ - Do not put a Button that opens a Modal in `actions`. On a phone the menu closes when it is chosen, so the Modal has no Button to give focus back to. Link to a page instead.
23
+ - Do not turn a product site's few pages into tabs. Use `links`. Tabs are for sections that each hold many pages.
24
+
25
+ ## Option: Links and one main action
26
+
27
+ Use when: A product site has a few pages and one main action, such as 'Sign Up'.
28
+
29
+ Uses: `Button`, `Heading`, `PageShell`, `Paragraph`, `SiteHeader`, `Stack`
30
+
31
+ ```tsx
32
+ 'use client';
33
+ import SiteHeader from 'oneslash-design-system/components/siteHeader';
34
+ import PageShell from 'oneslash-design-system/components/pageShell';
35
+ import Button from 'oneslash-design-system/components/button';
36
+ import Heading from 'oneslash-design-system/components/heading';
37
+ import Paragraph from 'oneslash-design-system/components/paragraph';
38
+ import { Stack } from 'oneslash-design-system/components/layout';
39
+
40
+ const links = [
41
+ { label: 'Features', href: '#features' },
42
+ { label: 'Pricing', href: '#pricing', current: true },
43
+ { label: 'Changelog', href: '#changelog' },
44
+ { label: 'Docs', href: '#docs' },
45
+ ];
46
+
47
+ export default function SiteHeaderLinks() {
48
+ return (
49
+ <>
50
+ {/* From md the links are a row in the bar. Below md they and 'Log In' are in the Menu; Sign Up stays beside it. */}
51
+ <SiteHeader
52
+ brand={{ href: '#top', name: 'Acme' }}
53
+ links={links}
54
+ actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in" />}
55
+ phoneAction={<Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up" />}
56
+ mainId="site-header-main"
57
+ />
58
+ {/* The skip link goes here: the id matches mainId, and tabIndex -1 lets focus move in. */}
59
+ <PageShell id="site-header-main" tabIndex={-1}>
60
+ <Stack gap="large">
61
+ <Heading level={1} size="h5">Pricing</Heading>
62
+ <Paragraph tone="secondary" measure="none">Acme is free for up to three people. Add more people when your team grows.</Paragraph>
63
+ </Stack>
64
+ </PageShell>
65
+ </>
66
+ );
67
+ }
68
+ ```
69
+
70
+ ## Option: Sections with their own tabs
71
+
72
+ Use when: A docs site has sections that each hold many pages.
73
+
74
+ Uses: `Heading`, `IconButton`, `Menu`, `MenuItem`, `PageShell`, `Paragraph`, `Popover`, `SiteHeader`, `Stack`, `Tab`, `TabsContainer`, `Tooltip`
75
+
76
+ ```tsx
77
+ 'use client';
78
+ import { useState } from 'react';
79
+ import SiteHeader from 'oneslash-design-system/components/siteHeader';
80
+ import TabsContainer from 'oneslash-design-system/components/tabsContainer';
81
+ import Tab from 'oneslash-design-system/components/tab';
82
+ import IconButton from 'oneslash-design-system/components/iconButton';
83
+ import Tooltip from 'oneslash-design-system/components/tooltip';
84
+ import Popover from 'oneslash-design-system/components/popover';
85
+ import Menu from 'oneslash-design-system/components/menu';
86
+ import MenuItem from 'oneslash-design-system/components/menuItem';
87
+ import PageShell from 'oneslash-design-system/components/pageShell';
88
+ import Heading from 'oneslash-design-system/components/heading';
89
+ import Paragraph from 'oneslash-design-system/components/paragraph';
90
+ import { Stack } from 'oneslash-design-system/components/layout';
91
+
92
+ type Mode = 'light' | 'dark' | 'system';
93
+
94
+ // Four sections, one short word each. Each holds many pages.
95
+ const sections = [
96
+ { id: 'start', label: 'Start', page: 'Start here' },
97
+ { id: 'guides', label: 'Guides', page: 'Guides' },
98
+ { id: 'reference', label: 'API', page: 'API reference' },
99
+ { id: 'updates', label: 'News', page: 'News' },
100
+ ];
101
+
102
+ const modes: { value: Mode; label: string; icon: 'Sun' | 'Moon' | 'Monitor' }[] = [
103
+ { value: 'light', label: 'Light', icon: 'Sun' },
104
+ { value: 'dark', label: 'Dark', icon: 'Moon' },
105
+ { value: 'system', label: 'System', icon: 'Monitor' },
106
+ ];
107
+
108
+ export default function SiteHeaderSections() {
109
+ const [sectionId, setSectionId] = useState('guides');
110
+ const [mode, setMode] = useState<Mode>('system');
111
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
112
+ const [open, setOpen] = useState(false);
113
+ const section = sections.find((s) => s.id === sectionId) ?? sections[0];
114
+ const current = modes.find((m) => m.value === mode) ?? modes[2];
115
+ // A real app passes the router from its framework, such as Next's useRouter(). Here it sets the open section.
116
+ const router = { push: (url: string) => setSectionId(url.split('/').pop() ?? 'start') };
117
+
118
+ return (
119
+ <>
120
+ {/* The brand, then search and the theme menu as `phoneAction`, so they stay in the bar at every width. The section Tabs are `nav`, a second row of the bar. */}
121
+ <SiteHeader
122
+ brand={{ href: '#top', name: 'Acme Docs' }}
123
+ links={[]}
124
+ phoneAction={
125
+ <>
126
+ <Tooltip title="Search">
127
+ <IconButton color="iconOnly" state="enabled" size="medium" iconName="Search" ariaLabel="Search" />
128
+ </Tooltip>
129
+ <Tooltip title={`Theme: ${current.label}`}>
130
+ <IconButton
131
+ color="iconOnly"
132
+ state={open ? 'selected' : 'enabled'}
133
+ size="medium"
134
+ iconName={current.icon}
135
+ ariaLabel={`Theme: ${current.label}`}
136
+ aria-haspopup="menu"
137
+ aria-expanded={open}
138
+ onClick={(e: { currentTarget: HTMLElement }) => {
139
+ setAnchor(e.currentTarget);
140
+ setOpen((o) => !o);
141
+ }}
142
+ />
143
+ </Tooltip>
144
+ </>
145
+ }
146
+ nav={
147
+ <TabsContainer fill>
148
+ {sections.map((s) => (
149
+ <Tab key={s.id} label={s.label} href={`/${s.id}`} router={router} isSelected={s.id === section.id} onClickTab={() => setSectionId(s.id)} />
150
+ ))}
151
+ </TabsContainer>
152
+ }
153
+ mainId="site-header-sections-main"
154
+ />
155
+ <PageShell id="site-header-sections-main" tabIndex={-1}>
156
+ <Stack gap="large">
157
+ <Heading level={1} size="h5">{section.page}</Heading>
158
+ <Paragraph tone="secondary" measure="none">The pages in {section.label} are listed beside this page on a wide screen, and in the menu on a phone.</Paragraph>
159
+ </Stack>
160
+ </PageShell>
161
+ <Popover open={open} anchorEl={anchor} onClose={() => setOpen(false)} returnFocus>
162
+ <Menu navigable aria-label="Theme" width={180}>
163
+ {modes.map((m) => (
164
+ <MenuItem
165
+ key={m.value}
166
+ size="small"
167
+ iconName={m.icon}
168
+ label={m.label}
169
+ isSelected={m.value === mode}
170
+ role="menuitemradio"
171
+ onClick={() => { setMode(m.value); setOpen(false); }}
172
+ />
173
+ ))}
174
+ </Menu>
175
+ </Popover>
176
+ </>
177
+ );
178
+ }
179
+ ```
180
+
181
+ ## Native
182
+
183
+ On Apple a site header has no counterpart: an app uses a `NavigationStack` with a navigation bar. On Android use a top app bar.
@@ -0,0 +1 @@
1
+ export default function StatRowFeatured(): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ import Heading from '../../components/heading';
3
+ import StatTile from '../../components/statTile';
4
+ import { Center, Grid, Stack } from '../../components/layout';
5
+ export default function StatRowFeatured() {
6
+ return (<Center width="page">
7
+ <Stack gap="large">
8
+ <Heading level={2} size="h6">This month</Heading>
9
+ {/* The number that matters most is one step larger and has the row to itself. */}
10
+ <StatTile label="Responses" value={48210} previous={41980} period="month" size="large"/>
11
+ <Grid compact columns={2}>
12
+ <StatTile label="Estimated cost" value={96.4} format="money" previous={88.2} period="month"/>
13
+ <StatTile label="Data stored" value={1288490188} format="bytes" previous={1073741824} period="month"/>
14
+ </Grid>
15
+ </Stack>
16
+ </Center>);
17
+ }
@@ -0,0 +1 @@
1
+ export default function StatRowTiles(): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Heading from '../../components/heading';
4
+ import StatTile from '../../components/statTile';
5
+ import Button from '../../components/button';
6
+ import { Center, Cluster, Grid, Stack } from '../../components/layout';
7
+ export default function StatRowTiles() {
8
+ var _a = useState(false), loading = _a[0], setLoading = _a[1];
9
+ var timer = useRef();
10
+ // Stops the request if the example goes away before it ends.
11
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
12
+ function reload() {
13
+ if (loading)
14
+ return;
15
+ setLoading(true);
16
+ // Stands in for the request to the server.
17
+ timer.current = setTimeout(function () { return setLoading(false); }, 1200);
18
+ }
19
+ return (<Center width="page">
20
+ <Stack gap="large">
21
+ <Cluster justify="between">
22
+ <Heading level={2} size="h6">This week</Heading>
23
+ <Button size="small" type="tertiary" state="enabled" label="Reload" decoIcon="RefreshCw" onClickButton={reload}/>
24
+ </Cluster>
25
+ {/* Four tiles at most. Two across on a phone, four from md up. Each counts one thing over the same range. */}
26
+ <Grid compact columns={4}>
27
+ <StatTile label="New comments" value={1240} previous={1106} loading={loading}/>
28
+ <StatTile label="Marked done" value={312} previous={280} loading={loading}/>
29
+ <StatTile label="People engaged" value={18} previous={18} loading={loading}/>
30
+ <StatTile label="Average reply time" value={8640000} format="duration" previous={9200000} loading={loading}/>
31
+ </Grid>
32
+ </Stack>
33
+ </Center>);
34
+ }
@@ -0,0 +1,104 @@
1
+ # Stat row
2
+
3
+ A page opens with the few numbers that say how things are going, counted over one range.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'A number shows its unit and never shows 0 for unknown'. Use `StatTile`, which does.
8
+ - Put the tiles in `<Grid compact columns={4}>`: two across on a phone, up to four from md up.
9
+ - Use four tiles at most. A fifth number goes in a table.
10
+ - Make each tile count one thing, with its unit in the label or the `unit` prop: 'New comments', 'Responses'.
11
+ - Count every tile over the same range, and say the range in the heading above the row: 'This week'.
12
+ - Pass `previous` and `period` to get the change line, such as 'Up 12% from last week'. Leave `previous` out when there is nothing to compare with.
13
+ - Pass `loading` while the numbers load, so a `Skeleton` holds each place. Pass `value={null}` when there is no data: the tile says 'No data yet'.
14
+ - Pass `format` for money, a percent, a size or a time, such as `format="money"`. Do not format a number by hand.
15
+ - Give the one number that matters most `size="large"` and a row of its own, with the others under it.
16
+
17
+ ## Don't
18
+
19
+ - Do not show 0 while a number loads or when it is missing.
20
+ - Do not color a change green or red. More is not good or bad by itself.
21
+ - Do not put more than four tiles in a row, or two things in one tile.
22
+ - Do not draw a chart or a sparkline in a tile. A trend is the change line.
23
+ - Do not box each tile in a card. The row sits on the page.
24
+
25
+ ## Option: Tiles of equal weight
26
+
27
+ Use when: Two to four numbers matter about the same, over one range.
28
+
29
+ Uses: `Button`, `Center`, `Cluster`, `Grid`, `Heading`, `Stack`, `StatTile`
30
+
31
+ ```tsx
32
+ 'use client';
33
+ import { useEffect, useRef, useState } from 'react';
34
+ import Heading from 'oneslash-design-system/components/heading';
35
+ import StatTile from 'oneslash-design-system/components/statTile';
36
+ import Button from 'oneslash-design-system/components/button';
37
+ import { Center, Cluster, Grid, Stack } from 'oneslash-design-system/components/layout';
38
+
39
+ export default function StatRowTiles() {
40
+ const [loading, setLoading] = useState(false);
41
+ const timer = useRef<ReturnType<typeof setTimeout>>();
42
+
43
+ // Stops the request if the example goes away before it ends.
44
+ useEffect(() => () => clearTimeout(timer.current), []);
45
+
46
+ function reload() {
47
+ if (loading) return;
48
+ setLoading(true);
49
+ // Stands in for the request to the server.
50
+ timer.current = setTimeout(() => setLoading(false), 1200);
51
+ }
52
+
53
+ return (
54
+ <Center width="page">
55
+ <Stack gap="large">
56
+ <Cluster justify="between">
57
+ <Heading level={2} size="h6">This week</Heading>
58
+ <Button size="small" type="tertiary" state="enabled" label="Reload" decoIcon="RefreshCw" onClickButton={reload} />
59
+ </Cluster>
60
+ {/* Four tiles at most. Two across on a phone, four from md up. Each counts one thing over the same range. */}
61
+ <Grid compact columns={4}>
62
+ <StatTile label="New comments" value={1240} previous={1106} loading={loading} />
63
+ <StatTile label="Marked done" value={312} previous={280} loading={loading} />
64
+ <StatTile label="People engaged" value={18} previous={18} loading={loading} />
65
+ <StatTile label="Average reply time" value={8_640_000} format="duration" previous={9_200_000} loading={loading} />
66
+ </Grid>
67
+ </Stack>
68
+ </Center>
69
+ );
70
+ }
71
+ ```
72
+
73
+ ## Option: One number first
74
+
75
+ Use when: One number matters most, with two others under it.
76
+
77
+ Uses: `Center`, `Grid`, `Heading`, `Stack`, `StatTile`
78
+
79
+ ```tsx
80
+ 'use client';
81
+ import Heading from 'oneslash-design-system/components/heading';
82
+ import StatTile from 'oneslash-design-system/components/statTile';
83
+ import { Center, Grid, Stack } from 'oneslash-design-system/components/layout';
84
+
85
+ export default function StatRowFeatured() {
86
+ return (
87
+ <Center width="page">
88
+ <Stack gap="large">
89
+ <Heading level={2} size="h6">This month</Heading>
90
+ {/* The number that matters most is one step larger and has the row to itself. */}
91
+ <StatTile label="Responses" value={48210} previous={41980} period="month" size="large" />
92
+ <Grid compact columns={2}>
93
+ <StatTile label="Estimated cost" value={96.4} format="money" previous={88.2} period="month" />
94
+ <StatTile label="Data stored" value={1_288_490_188} format="bytes" previous={1_073_741_824} period="month" />
95
+ </Grid>
96
+ </Stack>
97
+ </Center>
98
+ );
99
+ }
100
+ ```
101
+
102
+ ## Native
103
+
104
+ On Apple use a `LabeledContent` or a `Grid` of `VStack`s with the number in `.title2` and `monospacedDigit()`. On Android use a `Row` of `Column`s with `headlineMedium` text.
@@ -0,0 +1 @@
1
+ export default function StatusLabelDot(): import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+ import Heading from '../../components/heading';
3
+ import Tag from '../../components/tag';
4
+ import TableContainer from '../../components/tableContainer';
5
+ import TableHeader from '../../components/tableHeader';
6
+ import TableHeaderCell from '../../components/tableHeaderCell';
7
+ import TableRow from '../../components/tableRow';
8
+ import TableCell from '../../components/tableCell';
9
+ import { Center, Stack } from '../../components/layout';
10
+ // A real app reads these from the server.
11
+ var workspaces = [
12
+ { id: 'acme', name: 'Acme', plan: 'Pro', status: 'Past due', color: 'error' },
13
+ { id: 'acme-labs', name: 'Acme Labs', plan: 'Pro', status: 'Canceling', color: 'warning' },
14
+ { id: 'acme-studio', name: 'Acme Studio', plan: 'Pro', status: 'Active', color: undefined },
15
+ ];
16
+ export default function StatusLabelDot() {
17
+ return (<Center width="page">
18
+ <Stack gap="large">
19
+ <Heading level={2} size="h5">Workspaces</Heading>
20
+ <TableContainer aria-label="Workspaces" minWidth="480px">
21
+ <TableHeader>
22
+ <TableRow>
23
+ <TableHeaderCell>Workspace</TableHeaderCell>
24
+ <TableHeaderCell width="100px">Plan</TableHeaderCell>
25
+ <TableHeaderCell width="160px">Status</TableHeaderCell>
26
+ </TableRow>
27
+ </TableHeader>
28
+ {workspaces.map(function (w) { return (<TableRow key={w.id}>
29
+ <TableCell>{w.name}</TableCell>
30
+ <TableCell width="100px">{w.plan}</TableCell>
31
+ <TableCell width="160px">
32
+ {/* The word is always there. Only a state that needs action gets a color: 'Active' keeps the grey dot. */}
33
+ <Tag variant="dot" size="small" color={w.color} label={w.status}/>
34
+ </TableCell>
35
+ </TableRow>); })}
36
+ </TableContainer>
37
+ </Stack>
38
+ </Center>);
39
+ }
@@ -0,0 +1 @@
1
+ export default function StatusLabelText(): import("react").JSX.Element;