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,81 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ import { useState } from 'react';
23
+ import Navigation, { NavigationGroup } from '../../components/navigation';
24
+ import MenuItem from '../../components/menuItem';
25
+ import Paragraph from '../../components/paragraph';
26
+ import { Center, Stack } from '../../components/layout';
27
+ var initialPlaces = [
28
+ { id: 'inbox', label: 'Inbox', icon: 'Inbox', group: 'Mail' },
29
+ { id: 'mentions', label: 'Mentions', icon: 'AtSign', group: 'Mail' },
30
+ { id: 'sent', label: 'Sent', icon: 'Send', group: 'Mail' },
31
+ { id: 'launch', label: 'Launch plan', icon: 'ListChecks', group: 'Tasks' },
32
+ { id: 'review', label: 'Design review', icon: 'ListChecks', group: 'Tasks' },
33
+ { id: 'pricing', label: 'Pricing page', icon: 'ListChecks', group: 'Tasks' },
34
+ ];
35
+ var groups = ['Mail', 'Tasks'];
36
+ // What has not been read, by place. A place with none has no entry, and shows no count.
37
+ var initialUnread = { inbox: 3, mentions: 1, launch: 2 };
38
+ export default function SidebarNavFlat() {
39
+ var _a;
40
+ var _b = useState(initialPlaces), places = _b[0], setPlaces = _b[1];
41
+ var _c = useState('sent'), currentId = _c[0], setCurrentId = _c[1];
42
+ var _d = useState(initialUnread), unread = _d[0], setUnread = _d[1];
43
+ var _e = useState(0), created = _e[0], setCreated = _e[1];
44
+ var current = (_a = places.find(function (p) { return p.id === currentId; })) !== null && _a !== void 0 ? _a : places[0];
45
+ // Opening a place reads it, so its count goes away.
46
+ function open(id) {
47
+ setCurrentId(id);
48
+ setUnread(function (u) {
49
+ var _a;
50
+ return (__assign(__assign({}, u), (_a = {}, _a[id] = 0, _a)));
51
+ });
52
+ }
53
+ // The new task goes to the top of its group, and opens.
54
+ function newTask() {
55
+ var id = "new-".concat(created + 1);
56
+ setCreated(created + 1);
57
+ setPlaces(function (all) { return __spreadArray([{ id: id, label: "New task ".concat(created + 1), icon: 'ListChecks', group: 'Tasks' }], all, true); });
58
+ setCurrentId(id);
59
+ }
60
+ return (<Center>
61
+ <Stack gap="large">
62
+ <Navigation aria-label="Main">
63
+ {groups.map(function (group) { return (<NavigationGroup key={group} label={group}>
64
+ {group === 'Tasks' && <MenuItem size="small" iconName="Plus" label="New Task" role="button" onClick={newTask}/>}
65
+ {places.filter(function (p) { return p.group === group; }).map(function (p) {
66
+ var _a;
67
+ var count = (_a = unread[p.id]) !== null && _a !== void 0 ? _a : 0;
68
+ return (<MenuItem key={p.id} size="small" label={p.label} iconName={p.icon} href={"/".concat(p.id)} isSelected={p.id === current.id} aria-current={p.id === current.id ? 'page' : undefined}
69
+ // A count is what has not been read, as quiet text. Nothing shows at zero, and the name says the count.
70
+ tag={count > 0 ? { label: String(count), variant: 'textOnly' } : undefined} aria-label={count > 0 ? "".concat(p.label, ", ").concat(count, " unread") : undefined} onClick={function (event) {
71
+ // A real app lets the link go to its page. The example keeps the choice in state.
72
+ event.preventDefault();
73
+ open(p.id);
74
+ }}/>);
75
+ })}
76
+ </NavigationGroup>); })}
77
+ </Navigation>
78
+ <Paragraph tone="secondary" size="body2" measure="none">You are in {current.label}.</Paragraph>
79
+ </Stack>
80
+ </Center>);
81
+ }
@@ -0,0 +1 @@
1
+ export default function SidebarNavNested(): import("react").JSX.Element;
@@ -0,0 +1,122 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ import { useEffect, useState } from 'react';
23
+ import Navigation, { NavigationGroup } from '../../components/navigation';
24
+ import MenuItem from '../../components/menuItem';
25
+ import Paragraph from '../../components/paragraph';
26
+ import { Center, Stack } from '../../components/layout';
27
+ var initialWorkspaces = [
28
+ {
29
+ id: 'acme',
30
+ name: 'Acme',
31
+ tasks: [
32
+ { id: 'launch', label: 'Launch plan' },
33
+ { id: 'pricing', label: 'Pricing page' },
34
+ ],
35
+ },
36
+ {
37
+ id: 'studio',
38
+ name: 'Side Studio',
39
+ tasks: [
40
+ { id: 'logo', label: 'New logo' },
41
+ { id: 'site', label: 'Landing page' },
42
+ ],
43
+ },
44
+ ];
45
+ // What has not been read, by place. A place with none has no entry, and shows no count.
46
+ var initialUnread = { pricing: 2, site: 1 };
47
+ var STORAGE_KEY = 'sidebar-nav-hidden-groups';
48
+ export default function SidebarNavNested() {
49
+ var _a, _b;
50
+ var _c = useState(initialWorkspaces), workspaces = _c[0], setWorkspaces = _c[1];
51
+ var _d = useState('launch'), currentId = _d[0], setCurrentId = _d[1];
52
+ var _e = useState(initialUnread), unread = _e[0], setUnread = _e[1];
53
+ var _f = useState(0), created = _f[0], setCreated = _f[1];
54
+ // The groups the person hid. They stay hidden when the person comes back, so a real app saves them per person.
55
+ var _g = useState([]), hiddenGroups = _g[0], setHiddenGroups = _g[1];
56
+ // Read after the first render, so the server and the browser start from the same page.
57
+ useEffect(function () {
58
+ var _a;
59
+ try {
60
+ var saved = JSON.parse((_a = localStorage.getItem(STORAGE_KEY)) !== null && _a !== void 0 ? _a : '[]');
61
+ if (Array.isArray(saved))
62
+ setHiddenGroups(saved.filter(function (id) { return typeof id === 'string'; }));
63
+ }
64
+ catch (_b) {
65
+ // Storage can be blocked. The groups then start shown.
66
+ }
67
+ }, []);
68
+ function toggleGroup(id) {
69
+ var next = hiddenGroups.includes(id) ? hiddenGroups.filter(function (g) { return g !== id; }) : __spreadArray(__spreadArray([], hiddenGroups, true), [id], false);
70
+ setHiddenGroups(next);
71
+ try {
72
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
73
+ }
74
+ catch (_a) {
75
+ // Storage can be blocked. The choice then lasts until the page closes.
76
+ }
77
+ }
78
+ function open(id) {
79
+ setCurrentId(id);
80
+ setUnread(function (u) {
81
+ var _a;
82
+ return (__assign(__assign({}, u), (_a = {}, _a[id] = 0, _a)));
83
+ });
84
+ }
85
+ // The new task goes to the top of its group, and opens.
86
+ function newTask(workspaceId) {
87
+ var id = "new-".concat(created + 1);
88
+ setCreated(created + 1);
89
+ setWorkspaces(function (all) { return all.map(function (w) { return (w.id === workspaceId ? __assign(__assign({}, w), { tasks: __spreadArray([{ id: id, label: "New task ".concat(created + 1) }], w.tasks, true) }) : w); }); });
90
+ setCurrentId(id);
91
+ }
92
+ var currentName = (_b = (_a = workspaces.flatMap(function (w) { return w.tasks; }).find(function (t) { return t.id === currentId; })) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '';
93
+ return (<Center>
94
+ <Stack gap="large">
95
+ <Navigation aria-label="Main">
96
+ <NavigationGroup label="Workspaces">
97
+ {workspaces.map(function (w) {
98
+ var hidden = hiddenGroups.includes(w.id);
99
+ // A closed place keeps its count, on its own row, so nothing unread is out of sight.
100
+ var hiddenUnread = hidden ? w.tasks.reduce(function (sum, t) { var _a; return sum + ((_a = unread[t.id]) !== null && _a !== void 0 ? _a : 0); }, 0) : 0;
101
+ return (<Stack key={w.id} gap="small">
102
+ {/* The row that holds the others shows or hides them. It keeps its name; aria-expanded says which. */}
103
+ <MenuItem size="small" label={w.name} iconName="Building2" iconRight={hidden ? 'ChevronRight' : 'ChevronDown'} role="button" aria-expanded={!hidden}
104
+ // A closed place keeps its count here, and the name says it.
105
+ tag={hiddenUnread > 0 ? { label: String(hiddenUnread), variant: 'textOnly' } : undefined} aria-label={hiddenUnread > 0 ? "".concat(w.name, ", ").concat(hiddenUnread, " unread") : undefined} onClick={function () { return toggleGroup(w.id); }}/>
106
+ {/* Each workspace has its own New Task, so its name says which. In a phone menu, close the menu in this onClick. */}
107
+ {!hidden && <MenuItem size="small" level={2} iconName="Plus" label="New Task" aria-label={"New task in ".concat(w.name)} role="button" onClick={function () { return newTask(w.id); }}/>}
108
+ {!hidden && w.tasks.map(function (t) {
109
+ var _a, _b;
110
+ return (<MenuItem key={t.id} size="small" label={t.label} level={2} iconName="ListChecks" href={"/".concat(w.id, "/").concat(t.id)} isSelected={t.id === currentId} aria-current={t.id === currentId ? 'page' : undefined} tag={((_a = unread[t.id]) !== null && _a !== void 0 ? _a : 0) > 0 ? { label: String(unread[t.id]), variant: 'textOnly' } : undefined} aria-label={((_b = unread[t.id]) !== null && _b !== void 0 ? _b : 0) > 0 ? "".concat(t.label, ", ").concat(unread[t.id], " unread") : undefined} onClick={function (event) {
111
+ event.preventDefault();
112
+ open(t.id);
113
+ }}/>);
114
+ })}
115
+ </Stack>);
116
+ })}
117
+ </NavigationGroup>
118
+ </Navigation>
119
+ <Paragraph tone="secondary" size="body2" measure="none">You are in {currentName}.</Paragraph>
120
+ </Stack>
121
+ </Center>);
122
+ }
@@ -0,0 +1,261 @@
1
+ # Sidebar with sections and counts
2
+
3
+ A person looks down the sidebar for a place, and for what has something new in it.
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 it as a `Navigation` with `aria-label="Main"`, and put the places in `NavigationGroup`s with a short `label`, such as 'Mail' and 'Tasks'.
9
+ - Make each place a `MenuItem` with an `href`. Mark the open one with `isSelected` and `aria-current="page"`.
10
+ - Show the count of what has not been read, never a total, as a `tag` with `variant="textOnly"`.
11
+ - Put the count in the row's name too: `aria-label="Inbox, 3 unread"`. Start the name with the visible label.
12
+ - Show nothing at zero. Opening a place reads it, so its count goes away.
13
+ - Put 'New Task' at the top of its group, as a `MenuItem` with `role="button"`. The new task opens at the top of the group.
14
+ - Make the row that holds the others a `MenuItem` with `role="button"`, `aria-expanded` and a chevron in `iconRight`. Name it for the place: 'Acme'.
15
+ - Keep a place the person closed closed when they return. Save it for the person, such as in local storage or their profile.
16
+ - Show the sum of what is unread under a closed place on its own row, so nothing unread is out of sight.
17
+ - Show a place inside another with `level={2}` on its `MenuItem`, and keep its own icon.
18
+ - Give each 'New Task' a name that says where it goes: `aria-label="New task in Acme"`. In a phone menu, close the menu in its `onClick`, since a button row does not close it.
19
+
20
+ ## Don't
21
+
22
+ - Do not show a total of everything, such as every task. A count is what needs the person.
23
+ - Do not show '0'. Leave the count out.
24
+ - Do not color a count red, even for a mention. A count is quiet text.
25
+ - Do not close a place with no sign of what is inside it. A closed place keeps its count.
26
+ - Do not close a place without `aria-expanded` on its row.
27
+
28
+ ## Option: One list in a few groups
29
+
30
+ Use when: Each place is one row, and the places fall into a few groups.
31
+
32
+ Uses: `Center`, `MenuItem`, `Navigation`, `NavigationGroup`, `Paragraph`, `Stack`
33
+
34
+ ```tsx
35
+ 'use client';
36
+ import { useState } from 'react';
37
+ import Navigation, { NavigationGroup } from 'oneslash-design-system/components/navigation';
38
+ import MenuItem from 'oneslash-design-system/components/menuItem';
39
+ import Paragraph from 'oneslash-design-system/components/paragraph';
40
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
41
+
42
+ type Place = { id: string; label: string; icon: string; group: string };
43
+
44
+ const initialPlaces: Place[] = [
45
+ { id: 'inbox', label: 'Inbox', icon: 'Inbox', group: 'Mail' },
46
+ { id: 'mentions', label: 'Mentions', icon: 'AtSign', group: 'Mail' },
47
+ { id: 'sent', label: 'Sent', icon: 'Send', group: 'Mail' },
48
+ { id: 'launch', label: 'Launch plan', icon: 'ListChecks', group: 'Tasks' },
49
+ { id: 'review', label: 'Design review', icon: 'ListChecks', group: 'Tasks' },
50
+ { id: 'pricing', label: 'Pricing page', icon: 'ListChecks', group: 'Tasks' },
51
+ ];
52
+
53
+ const groups = ['Mail', 'Tasks'];
54
+
55
+ // What has not been read, by place. A place with none has no entry, and shows no count.
56
+ const initialUnread: Record<string, number> = { inbox: 3, mentions: 1, launch: 2 };
57
+
58
+ export default function SidebarNavFlat() {
59
+ const [places, setPlaces] = useState(initialPlaces);
60
+ const [currentId, setCurrentId] = useState('sent');
61
+ const [unread, setUnread] = useState(initialUnread);
62
+ const [created, setCreated] = useState(0);
63
+
64
+ const current = places.find((p) => p.id === currentId) ?? places[0];
65
+
66
+ // Opening a place reads it, so its count goes away.
67
+ function open(id: string) {
68
+ setCurrentId(id);
69
+ setUnread((u) => ({ ...u, [id]: 0 }));
70
+ }
71
+
72
+ // The new task goes to the top of its group, and opens.
73
+ function newTask() {
74
+ const id = `new-${created + 1}`;
75
+ setCreated(created + 1);
76
+ setPlaces((all) => [{ id, label: `New task ${created + 1}`, icon: 'ListChecks', group: 'Tasks' }, ...all]);
77
+ setCurrentId(id);
78
+ }
79
+
80
+ return (
81
+ <Center>
82
+ <Stack gap="large">
83
+ <Navigation aria-label="Main">
84
+ {groups.map((group) => (
85
+ <NavigationGroup key={group} label={group}>
86
+ {group === 'Tasks' && <MenuItem size="small" iconName="Plus" label="New Task" role="button" onClick={newTask} />}
87
+ {places.filter((p) => p.group === group).map((p) => {
88
+ const count = unread[p.id] ?? 0;
89
+ return (
90
+ <MenuItem
91
+ key={p.id}
92
+ size="small"
93
+ label={p.label}
94
+ iconName={p.icon}
95
+ href={`/${p.id}`}
96
+ isSelected={p.id === current.id}
97
+ aria-current={p.id === current.id ? 'page' : undefined}
98
+ // A count is what has not been read, as quiet text. Nothing shows at zero, and the name says the count.
99
+ tag={count > 0 ? { label: String(count), variant: 'textOnly' } : undefined}
100
+ aria-label={count > 0 ? `${p.label}, ${count} unread` : undefined}
101
+ onClick={(event: { preventDefault: () => void }) => {
102
+ // A real app lets the link go to its page. The example keeps the choice in state.
103
+ event.preventDefault();
104
+ open(p.id);
105
+ }}
106
+ />
107
+ );
108
+ })}
109
+ </NavigationGroup>
110
+ ))}
111
+ </Navigation>
112
+ <Paragraph tone="secondary" size="body2" measure="none">You are in {current.label}.</Paragraph>
113
+ </Stack>
114
+ </Center>
115
+ );
116
+ }
117
+ ```
118
+
119
+ ## Option: Places that hold places
120
+
121
+ Use when: A place holds others, such as a workspace and its tasks, and the person wants to hide what they do not use.
122
+
123
+ Uses: `Center`, `MenuItem`, `Navigation`, `NavigationGroup`, `Paragraph`, `Stack`
124
+
125
+ ```tsx
126
+ 'use client';
127
+ import { useEffect, useState } from 'react';
128
+ import Navigation, { NavigationGroup } from 'oneslash-design-system/components/navigation';
129
+ import MenuItem from 'oneslash-design-system/components/menuItem';
130
+ import Paragraph from 'oneslash-design-system/components/paragraph';
131
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
132
+
133
+ type Task = { id: string; label: string };
134
+ type Workspace = { id: string; name: string; tasks: Task[] };
135
+
136
+ const initialWorkspaces: Workspace[] = [
137
+ {
138
+ id: 'acme',
139
+ name: 'Acme',
140
+ tasks: [
141
+ { id: 'launch', label: 'Launch plan' },
142
+ { id: 'pricing', label: 'Pricing page' },
143
+ ],
144
+ },
145
+ {
146
+ id: 'studio',
147
+ name: 'Side Studio',
148
+ tasks: [
149
+ { id: 'logo', label: 'New logo' },
150
+ { id: 'site', label: 'Landing page' },
151
+ ],
152
+ },
153
+ ];
154
+
155
+ // What has not been read, by place. A place with none has no entry, and shows no count.
156
+ const initialUnread: Record<string, number> = { pricing: 2, site: 1 };
157
+
158
+ const STORAGE_KEY = 'sidebar-nav-hidden-groups';
159
+
160
+ export default function SidebarNavNested() {
161
+ const [workspaces, setWorkspaces] = useState(initialWorkspaces);
162
+ const [currentId, setCurrentId] = useState('launch');
163
+ const [unread, setUnread] = useState(initialUnread);
164
+ const [created, setCreated] = useState(0);
165
+ // The groups the person hid. They stay hidden when the person comes back, so a real app saves them per person.
166
+ const [hiddenGroups, setHiddenGroups] = useState<string[]>([]);
167
+
168
+ // Read after the first render, so the server and the browser start from the same page.
169
+ useEffect(() => {
170
+ try {
171
+ const saved = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');
172
+ if (Array.isArray(saved)) setHiddenGroups(saved.filter((id) => typeof id === 'string'));
173
+ } catch {
174
+ // Storage can be blocked. The groups then start shown.
175
+ }
176
+ }, []);
177
+
178
+ function toggleGroup(id: string) {
179
+ const next = hiddenGroups.includes(id) ? hiddenGroups.filter((g) => g !== id) : [...hiddenGroups, id];
180
+ setHiddenGroups(next);
181
+ try {
182
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
183
+ } catch {
184
+ // Storage can be blocked. The choice then lasts until the page closes.
185
+ }
186
+ }
187
+
188
+ function open(id: string) {
189
+ setCurrentId(id);
190
+ setUnread((u) => ({ ...u, [id]: 0 }));
191
+ }
192
+
193
+ // The new task goes to the top of its group, and opens.
194
+ function newTask(workspaceId: string) {
195
+ const id = `new-${created + 1}`;
196
+ setCreated(created + 1);
197
+ setWorkspaces((all) => all.map((w) => (w.id === workspaceId ? { ...w, tasks: [{ id, label: `New task ${created + 1}` }, ...w.tasks] } : w)));
198
+ setCurrentId(id);
199
+ }
200
+
201
+ const currentName = workspaces.flatMap((w) => w.tasks).find((t) => t.id === currentId)?.label ?? '';
202
+
203
+ return (
204
+ <Center>
205
+ <Stack gap="large">
206
+ <Navigation aria-label="Main">
207
+ <NavigationGroup label="Workspaces">
208
+ {workspaces.map((w) => {
209
+ const hidden = hiddenGroups.includes(w.id);
210
+ // A closed place keeps its count, on its own row, so nothing unread is out of sight.
211
+ const hiddenUnread = hidden ? w.tasks.reduce((sum, t) => sum + (unread[t.id] ?? 0), 0) : 0;
212
+ return (
213
+ <Stack key={w.id} gap="small">
214
+ {/* The row that holds the others shows or hides them. It keeps its name; aria-expanded says which. */}
215
+ <MenuItem
216
+ size="small"
217
+ label={w.name}
218
+ iconName="Building2"
219
+ iconRight={hidden ? 'ChevronRight' : 'ChevronDown'}
220
+ role="button"
221
+ aria-expanded={!hidden}
222
+ // A closed place keeps its count here, and the name says it.
223
+ tag={hiddenUnread > 0 ? { label: String(hiddenUnread), variant: 'textOnly' } : undefined}
224
+ aria-label={hiddenUnread > 0 ? `${w.name}, ${hiddenUnread} unread` : undefined}
225
+ onClick={() => toggleGroup(w.id)}
226
+ />
227
+ {/* Each workspace has its own New Task, so its name says which. In a phone menu, close the menu in this onClick. */}
228
+ {!hidden && <MenuItem size="small" level={2} iconName="Plus" label="New Task" aria-label={`New task in ${w.name}`} role="button" onClick={() => newTask(w.id)} />}
229
+ {!hidden && w.tasks.map((t) => (
230
+ <MenuItem
231
+ key={t.id}
232
+ size="small"
233
+ label={t.label}
234
+ level={2}
235
+ iconName="ListChecks"
236
+ href={`/${w.id}/${t.id}`}
237
+ isSelected={t.id === currentId}
238
+ aria-current={t.id === currentId ? 'page' : undefined}
239
+ tag={(unread[t.id] ?? 0) > 0 ? { label: String(unread[t.id]), variant: 'textOnly' } : undefined}
240
+ aria-label={(unread[t.id] ?? 0) > 0 ? `${t.label}, ${unread[t.id]} unread` : undefined}
241
+ onClick={(event: { preventDefault: () => void }) => {
242
+ event.preventDefault();
243
+ open(t.id);
244
+ }}
245
+ />
246
+ ))}
247
+ </Stack>
248
+ );
249
+ })}
250
+ </NavigationGroup>
251
+ </Navigation>
252
+ <Paragraph tone="secondary" size="body2" measure="none">You are in {currentName}.</Paragraph>
253
+ </Stack>
254
+ </Center>
255
+ );
256
+ }
257
+ ```
258
+
259
+ ## Native
260
+
261
+ On Apple use a sidebar `List` with `Section`s, a `.badge(count)` on each row, and a `DisclosureGroup` for places that hold places. On Android use a navigation drawer with a `Badge`.
@@ -0,0 +1 @@
1
+ export default function SiteFooterColumns(): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ 'use client';
2
+ import SiteFooter from '../../components/siteFooter';
3
+ import Heading from '../../components/heading';
4
+ import Paragraph from '../../components/paragraph';
5
+ import { Center, Stack } from '../../components/layout';
6
+ var columns = [
7
+ {
8
+ title: 'Product',
9
+ links: [
10
+ { label: 'Features', href: '#features' },
11
+ { label: 'Pricing', href: '#pricing' },
12
+ { label: 'Changelog', href: '#changelog' },
13
+ { label: 'Docs', href: '#docs' },
14
+ ],
15
+ },
16
+ {
17
+ title: 'Company',
18
+ links: [
19
+ { label: 'About', href: '#about' },
20
+ { label: 'Blog', href: '#blog' },
21
+ { label: 'Contact', href: '#contact' },
22
+ ],
23
+ },
24
+ {
25
+ title: 'Follow',
26
+ links: [
27
+ { label: 'GitHub', href: 'https://github.com/acme/acme', external: true },
28
+ { label: 'Newsletter', href: 'https://acme.example/newsletter', external: true },
29
+ ],
30
+ },
31
+ {
32
+ title: 'Legal',
33
+ links: [
34
+ { label: 'Terms', href: '#terms' },
35
+ { label: 'Privacy', href: '#privacy' },
36
+ ],
37
+ },
38
+ ];
39
+ export default function SiteFooterColumns() {
40
+ return (<>
41
+ {/* A real page puts its content in PageShell, then SiteFooter. Center keeps the footer in view here. */}
42
+ <Center width="page">
43
+ <Stack gap="large">
44
+ <Heading level={1} size="h5">About Acme</Heading>
45
+ <Paragraph tone="secondary" measure="none">Acme helps small teams share files and decide together.</Paragraph>
46
+ </Stack>
47
+ </Center>
48
+ {/* Groups of links, two across on a phone and four across from md. The legal line is last. */}
49
+ <SiteFooter brand={{ href: '#top', name: 'Acme' }} columns={columns} legal="© 2026 Acme. All rights reserved."/>
50
+ </>);
51
+ }
@@ -0,0 +1 @@
1
+ export default function SiteFooterSimple(): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import SiteFooter from '../../components/siteFooter';
3
+ import Heading from '../../components/heading';
4
+ import Paragraph from '../../components/paragraph';
5
+ import { Center, Stack } from '../../components/layout';
6
+ var links = [
7
+ { label: 'Pricing', href: '#pricing' },
8
+ { label: 'Changelog', href: '#changelog' },
9
+ { label: 'Privacy', href: '#privacy' },
10
+ { label: 'GitHub', href: 'https://github.com/acme/acme', external: true },
11
+ ];
12
+ export default function SiteFooterSimple() {
13
+ return (<>
14
+ {/* A real page puts its content in PageShell, then SiteFooter. Center keeps the footer in view here. */}
15
+ <Center width="page">
16
+ <Stack gap="large">
17
+ <Heading level={1} size="h5">Changelog</Heading>
18
+ <Paragraph tone="secondary" measure="none">Version 2.4 adds shared folders. Ben Carter wrote the notes.</Paragraph>
19
+ </Stack>
20
+ </Center>
21
+ {/* A few links in one row that wraps, then the legal line last. */}
22
+ <SiteFooter brand={{ href: '#top', name: 'Acme' }} links={links} legal="© 2026 Acme. Released under the MIT License."/>
23
+ </>);
24
+ }