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,134 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Modal from '../../components/modal';
4
+ import Alert from '../../components/alert';
5
+ import Surface from '../../components/surface';
6
+ import Heading from '../../components/heading';
7
+ import Paragraph from '../../components/paragraph';
8
+ import Progress from '../../components/progress';
9
+ import Tag from '../../components/tag';
10
+ import Link from '../../components/link';
11
+ import Button from '../../components/button';
12
+ import SettingsSection from '../../components/settingsSection';
13
+ import TitleBar from '../../components/titleBar';
14
+ import TableContainer from '../../components/tableContainer';
15
+ import TableHeader from '../../components/tableHeader';
16
+ import TableHeaderCell from '../../components/tableHeaderCell';
17
+ import TableRow from '../../components/tableRow';
18
+ import TableCell from '../../components/tableCell';
19
+ import { formatMoney } from '../../components/formatNumber';
20
+ import { Center, Cluster, Stack } from '../../components/layout';
21
+ // A real app passes the router from its framework, such as Next's useRouter().
22
+ var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
23
+ // A real app reads this from the person's role. Only an admin can change billing.
24
+ var isAdmin = true;
25
+ // A real app reads this from the server: set when the last payment failed.
26
+ var failedPayment = { fixBy: 'Nov 30, 2026' };
27
+ var invoices = [
28
+ { id: 'inv-0', date: 'Nov 1, 2026', amount: 24, status: 'Paid' },
29
+ { id: 'inv-1', date: 'Oct 1, 2026', amount: 24, status: 'Paid' },
30
+ { id: 'inv-2', date: 'Sep 1, 2026', amount: 24, status: 'Paid' },
31
+ ];
32
+ export default function BillingPageSelfServe() {
33
+ var _a = useState(false), canceling = _a[0], setCanceling = _a[1];
34
+ var _b = useState(false), confirmOpen = _b[0], setConfirmOpen = _b[1];
35
+ var _c = useState(false), busy = _c[0], setBusy = _c[1];
36
+ var timer = useRef();
37
+ // Stops the request if the example goes away before it ends.
38
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
39
+ // Stands in for the request to the server.
40
+ function request(done) {
41
+ if (busy)
42
+ return;
43
+ setBusy(true);
44
+ timer.current = setTimeout(function () {
45
+ setBusy(false);
46
+ done();
47
+ }, 1200);
48
+ }
49
+ // Escape, a click outside and Cancel all close it, except while the request runs.
50
+ function handleClose() {
51
+ if (busy)
52
+ return;
53
+ setConfirmOpen(false);
54
+ }
55
+ return (<Center width="page">
56
+ <Stack gap="xlarge">
57
+ <TitleBar title="Billing"/>
58
+ {failedPayment && (<Alert type="error" variant="inline" autoDismiss={false} message={"Your last payment did not go through. Update the payment method by ".concat(failedPayment.fixBy, " to keep Pro.")}/>)}
59
+ <SettingsSection id="billing-page-plan" title="Plan" description="What Acme pays for.">
60
+ <Stack gap="small">
61
+ <Cluster gap="small">
62
+ <Heading level={3} size="h6">Pro</Heading>
63
+ {failedPayment && <Tag variant="dot" size="small" color="error" label="Past due"/>}
64
+ {canceling && <Tag variant="dot" size="small" color="warning" label="Canceling"/>}
65
+ </Cluster>
66
+ <Paragraph size="body2" measure="none">{"".concat(formatMoney(8), " per member per month")}</Paragraph>
67
+ <Paragraph tone="secondary" size="body2" measure="none">{canceling ? 'Pro ends on Dec 1, 2026.' : 'Renews on Dec 1, 2026.'}</Paragraph>
68
+ </Stack>
69
+ {isAdmin ? (<Cluster gap="small">
70
+ {canceling ? (<Button size="small" type="primary" state="enabled" label="Resume Plan" loading={busy} onClickButton={function () { return request(function () { return setCanceling(false); }); }}/>) : (<Button size="small" type="secondary" state="enabled" label="Change Plan" onClickButton={function () { return router.push('/settings/billing/plans'); }}/>)}
71
+ </Cluster>) : (<Paragraph tone="secondary" size="body2" measure="none">Only admins can change billing.</Paragraph>)}
72
+ </SettingsSection>
73
+ <SettingsSection id="billing-page-usage" title="Usage" description="This month.">
74
+ <Stack gap="medium">
75
+ <Progress label="AI agent responses" value={312} max={1000} unit="responses"/>
76
+ <Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
77
+ <Progress label="Members" value={3} max={null} unit="members"/>
78
+ </Stack>
79
+ </SettingsSection>
80
+ <SettingsSection id="billing-page-payment" title="Payment method" description="Pays for Acme's plan.">
81
+ <Surface padding="small">
82
+ <Cluster justify="between" gap="medium">
83
+ <Stack gap="small">
84
+ <Paragraph measure="none">Visa ending in 4821</Paragraph>
85
+ <Paragraph tone="secondary" size="body2" measure="none">Expires 08/28</Paragraph>
86
+ </Stack>
87
+ {isAdmin && (
88
+ // A real app hands off to its payment provider's own page here. The page never takes card details.
89
+ <Button size="small" type="tertiary" state="enabled" label="Update" aria-label="Update Visa ending in 4821, opens in a new tab" actionIcon="ExternalLink" href="https://acme.example/billing/payment-method" openInNewTab/>)}
90
+ </Cluster>
91
+ </Surface>
92
+ {/* Pro needs a card, so there is no Remove here. */}
93
+ <Paragraph tone="secondary" size="body2" measure="none">Pro needs a card on file. Downgrade to Free to remove it.</Paragraph>
94
+ </SettingsSection>
95
+ <SettingsSection id="billing-page-invoices" title="Invoices" description="The last three.">
96
+ <TableContainer aria-label="Recent invoices" minWidth="520px">
97
+ <TableHeader>
98
+ <TableRow>
99
+ <TableHeaderCell width="140px">Date</TableHeaderCell>
100
+ <TableHeaderCell width="110px" align="right">Amount</TableHeaderCell>
101
+ <TableHeaderCell>Status</TableHeaderCell>
102
+ <TableHeaderCell width="130px">Download</TableHeaderCell>
103
+ </TableRow>
104
+ </TableHeader>
105
+ {invoices.map(function (inv) { return (<TableRow key={inv.id}>
106
+ <TableCell width="140px">{inv.date}</TableCell>
107
+ <TableCell width="110px" align="right">{formatMoney(inv.amount)}</TableCell>
108
+ <TableCell><Tag variant="textOnly" size="small" label={inv.status}/></TableCell>
109
+ <TableCell width="130px">
110
+ {/* A real app links to the file on its own server. */}
111
+ <Button size="small" type="tertiary" state="enabled" label="Download" aria-label={"Download invoice for ".concat(inv.date, ", opens in a new tab")} actionIcon="ExternalLink" href={"https://acme.example/invoices/".concat(inv.id, ".pdf")} openInNewTab/>
112
+ </TableCell>
113
+ </TableRow>); })}
114
+ </TableContainer>
115
+ <Link href="/settings/billing/invoices" size="body2">See All Invoices</Link>
116
+ </SettingsSection>
117
+ {isAdmin && !canceling && (
118
+ // The last section on the page, in the danger color, as the case 'Danger zone' says.
119
+ <SettingsSection id="billing-page-cancel" tone="danger" title="End plan" description="Pro stays on until Dec 1, 2026.">
120
+ <Paragraph size="body2" measure="none">Acme goes back to Free on Dec 1, 2026. Its members and messages stay.</Paragraph>
121
+ <Cluster>
122
+ <Button size="small" type="secondary" state="enabled" label="End Plan" onClickButton={function () { return setConfirmOpen(true); }}/>
123
+ </Cluster>
124
+ </SettingsSection>)}
125
+ </Stack>
126
+ <Modal isOpen={confirmOpen} size="small" title="End Plan" onClose={handleClose} actions={<>
127
+ <Button size="small" type="tertiary" state={busy ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
128
+ <Button size="small" type="primary" state="enabled" label="End Plan" loading={busy} onClickButton={function () { return request(function () { setConfirmOpen(false); setCanceling(true); }); }}/>
129
+ </>}>
130
+ <Paragraph measure="none">Pro stays on until Dec 1, 2026. After that Acme is on Free, which allows 3 members and 50 AI agent responses a month.</Paragraph>
131
+ <Paragraph tone="secondary" size="body2" measure="none">Nothing is deleted. You can resume the plan until then.</Paragraph>
132
+ </Modal>
133
+ </Center>);
134
+ }
@@ -0,0 +1,247 @@
1
+ # Billing page
2
+
3
+ A workspace pays for a plan. One page says what it pays for, what it has used, how it pays and what it has paid.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'A number shows its unit and never shows 0 for unknown'.
8
+ - Put these `SettingsSection`s in this order under a `TitleBar` named 'Billing': Plan, Usage, Payment method, Invoices. The danger section, if any, comes last.
9
+ - Show in Plan the plan's name, its price, 'Renews on Dec 1, 2026.' and one 'Change Plan' Button. The price names its unit: '$8.00 per member per month'.
10
+ - Show the usage as the case 'Usage against limits' says, and the payment method as the case 'Payment method' says.
11
+ - Show the last three invoices in a short table with a Download link on each row, and a 'See All Invoices' link to the case 'Invoices'.
12
+ - Show a plan that ends as a `warning` dot `Tag` 'Canceling'. Add the line 'Pro ends on Dec 1, 2026.' and a primary 'Resume Plan' Button in place of 'Change Plan'.
13
+ - Show a payment that failed as an `error` inline `Alert` at the top, with the date to fix it by: 'Your last payment did not go through. Update the payment method by Nov 30, 2026 to keep Pro.'
14
+ - Add an error dot `Tag` 'Past due' by the plan name.
15
+ - Put 'End plan' in a `SettingsSection tone="danger"` as the case 'Danger zone' says. Confirm 'End Plan' in a small `Modal` that says what stays on until when and what is kept. It is confirmed because paid features stop on a date the person must see.
16
+ - Show a person who cannot change billing every section as text, with no Buttons, and one line: 'Only admins can change billing.'
17
+ - Say who pays and where for a plan billed elsewhere: 'Ben Carter pays for this plan through an app store.' Say who can change it.
18
+ - Leave out every control, price, card and invoice on a plan billed elsewhere.
19
+ - Show a status as the case 'Status in a row' says: 'Past due' and 'Canceling' as dots, 'Paid' as text.
20
+
21
+ ## Don't
22
+
23
+ - Do not collect or show a card number. A card is only 'Visa ending in 4821', and it changes on the payment provider's own page.
24
+ - Do not show Change Plan, Update or End Plan to someone who cannot use them. Show the text and the line that says who can.
25
+ - Do not leave a failed payment without the date it must be fixed by.
26
+ - Do not end the plan on the first click. Ask in a Modal first.
27
+ - Do not name the action 'Cancel Plan'. It would sit beside 'Cancel' in the confirm.
28
+ - Do not show a plan billed elsewhere with a 'Change Plan' Button that does nothing. Say where to change it.
29
+ - Do not write 'Canceled' for a plan that is still on. Say 'Canceling' and when it ends.
30
+
31
+ ## Option: An admin pays here
32
+
33
+ Use when: The person who manages billing changes the plan, the card and the cancel on this page.
34
+
35
+ Uses: `Alert`, `Button`, `Center`, `Cluster`, `Heading`, `Link`, `Modal`, `Paragraph`, `Progress`, `SettingsSection`, `Stack`, `Surface`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `TitleBar`, `formatMoney`
36
+
37
+ ```tsx
38
+ 'use client';
39
+ import { useEffect, useRef, useState } from 'react';
40
+ import Modal from 'oneslash-design-system/components/modal';
41
+ import Alert from 'oneslash-design-system/components/alert';
42
+ import Surface from 'oneslash-design-system/components/surface';
43
+ import Heading from 'oneslash-design-system/components/heading';
44
+ import Paragraph from 'oneslash-design-system/components/paragraph';
45
+ import Progress from 'oneslash-design-system/components/progress';
46
+ import Tag from 'oneslash-design-system/components/tag';
47
+ import Link from 'oneslash-design-system/components/link';
48
+ import Button from 'oneslash-design-system/components/button';
49
+ import SettingsSection from 'oneslash-design-system/components/settingsSection';
50
+ import TitleBar from 'oneslash-design-system/components/titleBar';
51
+ import TableContainer from 'oneslash-design-system/components/tableContainer';
52
+ import TableHeader from 'oneslash-design-system/components/tableHeader';
53
+ import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
54
+ import TableRow from 'oneslash-design-system/components/tableRow';
55
+ import TableCell from 'oneslash-design-system/components/tableCell';
56
+ import { formatMoney } from 'oneslash-design-system/components/formatNumber';
57
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
58
+
59
+ // A real app passes the router from its framework, such as Next's useRouter().
60
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
61
+
62
+ // A real app reads this from the person's role. Only an admin can change billing.
63
+ const isAdmin = true;
64
+
65
+ // A real app reads this from the server: set when the last payment failed.
66
+ const failedPayment: { fixBy: string } | null = { fixBy: 'Nov 30, 2026' };
67
+
68
+ const invoices = [
69
+ { id: 'inv-0', date: 'Nov 1, 2026', amount: 24, status: 'Paid' },
70
+ { id: 'inv-1', date: 'Oct 1, 2026', amount: 24, status: 'Paid' },
71
+ { id: 'inv-2', date: 'Sep 1, 2026', amount: 24, status: 'Paid' },
72
+ ];
73
+
74
+ export default function BillingPageSelfServe() {
75
+ const [canceling, setCanceling] = useState(false);
76
+ const [confirmOpen, setConfirmOpen] = useState(false);
77
+ const [busy, setBusy] = useState(false);
78
+ const timer = useRef<ReturnType<typeof setTimeout>>();
79
+
80
+ // Stops the request if the example goes away before it ends.
81
+ useEffect(() => () => clearTimeout(timer.current), []);
82
+
83
+ // Stands in for the request to the server.
84
+ function request(done: () => void) {
85
+ if (busy) return;
86
+ setBusy(true);
87
+ timer.current = setTimeout(() => {
88
+ setBusy(false);
89
+ done();
90
+ }, 1200);
91
+ }
92
+
93
+ // Escape, a click outside and Cancel all close it, except while the request runs.
94
+ function handleClose() {
95
+ if (busy) return;
96
+ setConfirmOpen(false);
97
+ }
98
+
99
+ return (
100
+ <Center width="page">
101
+ <Stack gap="xlarge">
102
+ <TitleBar title="Billing" />
103
+ {failedPayment && (
104
+ <Alert type="error" variant="inline" autoDismiss={false} message={`Your last payment did not go through. Update the payment method by ${failedPayment.fixBy} to keep Pro.`} />
105
+ )}
106
+ <SettingsSection id="billing-page-plan" title="Plan" description="What Acme pays for.">
107
+ <Stack gap="small">
108
+ <Cluster gap="small">
109
+ <Heading level={3} size="h6">Pro</Heading>
110
+ {failedPayment && <Tag variant="dot" size="small" color="error" label="Past due" />}
111
+ {canceling && <Tag variant="dot" size="small" color="warning" label="Canceling" />}
112
+ </Cluster>
113
+ <Paragraph size="body2" measure="none">{`${formatMoney(8)} per member per month`}</Paragraph>
114
+ <Paragraph tone="secondary" size="body2" measure="none">{canceling ? 'Pro ends on Dec 1, 2026.' : 'Renews on Dec 1, 2026.'}</Paragraph>
115
+ </Stack>
116
+ {isAdmin ? (
117
+ <Cluster gap="small">
118
+ {canceling ? (
119
+ <Button size="small" type="primary" state="enabled" label="Resume Plan" loading={busy} onClickButton={() => request(() => setCanceling(false))} />
120
+ ) : (
121
+ <Button size="small" type="secondary" state="enabled" label="Change Plan" onClickButton={() => router.push('/settings/billing/plans')} />
122
+ )}
123
+ </Cluster>
124
+ ) : (
125
+ <Paragraph tone="secondary" size="body2" measure="none">Only admins can change billing.</Paragraph>
126
+ )}
127
+ </SettingsSection>
128
+ <SettingsSection id="billing-page-usage" title="Usage" description="This month.">
129
+ <Stack gap="medium">
130
+ <Progress label="AI agent responses" value={312} max={1000} unit="responses" />
131
+ <Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
132
+ <Progress label="Members" value={3} max={null} unit="members" />
133
+ </Stack>
134
+ </SettingsSection>
135
+ <SettingsSection id="billing-page-payment" title="Payment method" description="Pays for Acme's plan.">
136
+ <Surface padding="small">
137
+ <Cluster justify="between" gap="medium">
138
+ <Stack gap="small">
139
+ <Paragraph measure="none">Visa ending in 4821</Paragraph>
140
+ <Paragraph tone="secondary" size="body2" measure="none">Expires 08/28</Paragraph>
141
+ </Stack>
142
+ {isAdmin && (
143
+ // A real app hands off to its payment provider's own page here. The page never takes card details.
144
+ <Button size="small" type="tertiary" state="enabled" label="Update" aria-label="Update Visa ending in 4821, opens in a new tab" actionIcon="ExternalLink" href="https://acme.example/billing/payment-method" openInNewTab />
145
+ )}
146
+ </Cluster>
147
+ </Surface>
148
+ {/* Pro needs a card, so there is no Remove here. */}
149
+ <Paragraph tone="secondary" size="body2" measure="none">Pro needs a card on file. Downgrade to Free to remove it.</Paragraph>
150
+ </SettingsSection>
151
+ <SettingsSection id="billing-page-invoices" title="Invoices" description="The last three.">
152
+ <TableContainer aria-label="Recent invoices" minWidth="520px">
153
+ <TableHeader>
154
+ <TableRow>
155
+ <TableHeaderCell width="140px">Date</TableHeaderCell>
156
+ <TableHeaderCell width="110px" align="right">Amount</TableHeaderCell>
157
+ <TableHeaderCell>Status</TableHeaderCell>
158
+ <TableHeaderCell width="130px">Download</TableHeaderCell>
159
+ </TableRow>
160
+ </TableHeader>
161
+ {invoices.map((inv) => (
162
+ <TableRow key={inv.id}>
163
+ <TableCell width="140px">{inv.date}</TableCell>
164
+ <TableCell width="110px" align="right">{formatMoney(inv.amount)}</TableCell>
165
+ <TableCell><Tag variant="textOnly" size="small" label={inv.status} /></TableCell>
166
+ <TableCell width="130px">
167
+ {/* A real app links to the file on its own server. */}
168
+ <Button size="small" type="tertiary" state="enabled" label="Download" aria-label={`Download invoice for ${inv.date}, opens in a new tab`} actionIcon="ExternalLink" href={`https://acme.example/invoices/${inv.id}.pdf`} openInNewTab />
169
+ </TableCell>
170
+ </TableRow>
171
+ ))}
172
+ </TableContainer>
173
+ <Link href="/settings/billing/invoices" size="body2">See All Invoices</Link>
174
+ </SettingsSection>
175
+ {isAdmin && !canceling && (
176
+ // The last section on the page, in the danger color, as the case 'Danger zone' says.
177
+ <SettingsSection id="billing-page-cancel" tone="danger" title="End plan" description="Pro stays on until Dec 1, 2026.">
178
+ <Paragraph size="body2" measure="none">Acme goes back to Free on Dec 1, 2026. Its members and messages stay.</Paragraph>
179
+ <Cluster>
180
+ <Button size="small" type="secondary" state="enabled" label="End Plan" onClickButton={() => setConfirmOpen(true)} />
181
+ </Cluster>
182
+ </SettingsSection>
183
+ )}
184
+ </Stack>
185
+ <Modal
186
+ isOpen={confirmOpen}
187
+ size="small"
188
+ title="End Plan"
189
+ onClose={handleClose}
190
+ actions={
191
+ <>
192
+ <Button size="small" type="tertiary" state={busy ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose} />
193
+ <Button size="small" type="primary" state="enabled" label="End Plan" loading={busy} onClickButton={() => request(() => { setConfirmOpen(false); setCanceling(true); })} />
194
+ </>
195
+ }
196
+ >
197
+ <Paragraph measure="none">Pro stays on until Dec 1, 2026. After that Acme is on Free, which allows 3 members and 50 AI agent responses a month.</Paragraph>
198
+ <Paragraph tone="secondary" size="body2" measure="none">Nothing is deleted. You can resume the plan until then.</Paragraph>
199
+ </Modal>
200
+ </Center>
201
+ );
202
+ }
203
+ ```
204
+
205
+ ## Option: Billed elsewhere
206
+
207
+ Use when: An app store bills the plan, or another person pays for it, so this page only says who pays and where to change it.
208
+
209
+ Uses: `Center`, `Heading`, `Paragraph`, `Progress`, `SettingsSection`, `Stack`, `TitleBar`
210
+
211
+ ```tsx
212
+ 'use client';
213
+ import Heading from 'oneslash-design-system/components/heading';
214
+ import Paragraph from 'oneslash-design-system/components/paragraph';
215
+ import Progress from 'oneslash-design-system/components/progress';
216
+ import SettingsSection from 'oneslash-design-system/components/settingsSection';
217
+ import TitleBar from 'oneslash-design-system/components/titleBar';
218
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
219
+
220
+ export default function BillingPageBilledElsewhere() {
221
+ return (
222
+ <Center width="page">
223
+ <Stack gap="xlarge">
224
+ <TitleBar title="Billing" />
225
+ <SettingsSection id="billing-elsewhere-plan" title="Plan" description="What Acme pays for.">
226
+ <Stack gap="small">
227
+ <Heading level={3} size="h6">Pro</Heading>
228
+ <Paragraph tone="secondary" size="body2" measure="none">Renews on Dec 1, 2026.</Paragraph>
229
+ </Stack>
230
+ {/* No price, card or invoice: the app store that bills this plan keeps them. The page says who pays, where, and who can change it. */}
231
+ <Paragraph size="body2" measure="none">Ben Carter pays for this plan through an app store. Only Ben Carter can change or cancel it, in the app store settings on the device that bought it.</Paragraph>
232
+ </SettingsSection>
233
+ <SettingsSection id="billing-elsewhere-usage" title="Usage" description="This month.">
234
+ <Stack gap="medium">
235
+ <Progress label="AI agent responses" value={312} max={1000} unit="responses" />
236
+ <Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
237
+ </Stack>
238
+ </SettingsSection>
239
+ </Stack>
240
+ </Center>
241
+ );
242
+ }
243
+ ```
244
+
245
+ ## Native
246
+
247
+ On Apple a plan bought in the app is managed in the system subscription sheet. Show who pays and open that sheet from one Button, never a card form.
@@ -0,0 +1 @@
1
+ export default function BreakdownListBars(): import("react").JSX.Element;
@@ -0,0 +1,47 @@
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 Heading from '../../components/heading';
12
+ import Paragraph from '../../components/paragraph';
13
+ import Progress from '../../components/progress';
14
+ import List from '../../components/list';
15
+ import { formatCount } from '../../components/formatNumber';
16
+ import { Center, Stack } from '../../components/layout';
17
+ // A real app counts these on the server.
18
+ var models = [
19
+ { name: 'Atlas Large', count: 512 },
20
+ { name: 'Atlas Medium', count: 301 },
21
+ { name: 'Birch 4', count: 168 },
22
+ { name: 'Birch 4 Mini', count: 96 },
23
+ { name: 'Cedar Pro', count: 62 },
24
+ { name: 'Cedar Lite', count: 41 },
25
+ { name: 'Delta 2', count: 28 },
26
+ { name: 'Delta 1', count: 17 },
27
+ { name: 'Elm', count: 9 },
28
+ { name: 'Fern', count: 6 },
29
+ ];
30
+ // The largest seven are listed and the rest fold into 'Other', so the list is never longer than eight rows.
31
+ var sorted = __spreadArray([], models, true).sort(function (a, b) { return b.count - a.count; });
32
+ var total = sorted.reduce(function (sum, m) { return sum + m.count; }, 0);
33
+ var rest = sorted.slice(7).reduce(function (sum, m) { return sum + m.count; }, 0);
34
+ var parts = __spreadArray(__spreadArray([], sorted.slice(0, 7), true), (rest > 0 ? [{ name: 'Other', count: rest }] : []), true);
35
+ export default function BreakdownListBars() {
36
+ return (<Center width="page">
37
+ <Stack gap="large">
38
+ <Stack gap="small">
39
+ <Heading level={2} size="h6">Responses by model</Heading>
40
+ <Paragraph tone="secondary" size="body2" measure="none">{formatCount(total)} responses this week.</Paragraph>
41
+ </Stack>
42
+ <List size="body2" items={parts.map(function (p) { return (
43
+ // `max` is the total, so each bar is the part's share. A share is not a limit, so it never turns to a warning.
44
+ <Progress key={p.name} kind="share" label={p.name} value={p.count} max={total} unit="responses"/>); })}/>
45
+ </Stack>
46
+ </Center>);
47
+ }
@@ -0,0 +1 @@
1
+ export default function BreakdownListTable(): import("react").JSX.Element;
@@ -0,0 +1,69 @@
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 Heading from '../../components/heading';
12
+ import Paragraph from '../../components/paragraph';
13
+ import TableContainer from '../../components/tableContainer';
14
+ import TableHeader from '../../components/tableHeader';
15
+ import TableHeaderCell from '../../components/tableHeaderCell';
16
+ import TableRow from '../../components/tableRow';
17
+ import TableCell from '../../components/tableCell';
18
+ import { formatCount, formatMoney, formatPercent } from '../../components/formatNumber';
19
+ import { Center, Stack } from '../../components/layout';
20
+ // A real app counts these on the server.
21
+ var models = [
22
+ { name: 'Atlas Large', responses: 5120, cost: 61.4 },
23
+ { name: 'Atlas Medium', responses: 3010, cost: 18.06 },
24
+ { name: 'Birch 4', responses: 1680, cost: 12.3 },
25
+ { name: 'Birch 4 Mini', responses: 960, cost: 1.92 },
26
+ { name: 'Cedar Pro', responses: 620, cost: 4.65 },
27
+ { name: 'Cedar Lite', responses: 410, cost: 0.41 },
28
+ { name: 'Delta 2', responses: 280, cost: 0.84 },
29
+ { name: 'Delta 1', responses: 170, cost: 0.17 },
30
+ { name: 'Elm', responses: 90, cost: 0.004 },
31
+ { name: 'Fern', responses: 60, cost: 0 },
32
+ ];
33
+ // Largest first: the table is sorted by its main number.
34
+ var rows = __spreadArray([], models, true).sort(function (a, b) { return b.responses - a.responses; });
35
+ var total = rows.reduce(function (sum, m) { return sum + m.responses; }, 0);
36
+ var totalCost = rows.reduce(function (sum, m) { return sum + m.cost; }, 0);
37
+ export default function BreakdownListTable() {
38
+ return (<Center width="page">
39
+ <Stack gap="large">
40
+ <Stack gap="small">
41
+ <Heading level={2} size="h6">Responses and cost by model</Heading>
42
+ <Paragraph tone="secondary" size="body2" measure="none">{formatCount(total)} responses this month, largest first.</Paragraph>
43
+ </Stack>
44
+ {/* A named table sits in a region that scrolls sideways by itself, so the page never does. */}
45
+ <TableContainer aria-label="Responses and cost by model" minWidth="520px">
46
+ <TableHeader>
47
+ <TableRow>
48
+ <TableHeaderCell>Model</TableHeaderCell>
49
+ <TableHeaderCell align="right" width="120px" sort="descending">Responses</TableHeaderCell>
50
+ <TableHeaderCell align="right" width="90px">Share</TableHeaderCell>
51
+ <TableHeaderCell align="right" width="110px">Cost</TableHeaderCell>
52
+ </TableRow>
53
+ </TableHeader>
54
+ {rows.map(function (m) { return (<TableRow key={m.name}>
55
+ <TableCell>{m.name}</TableCell>
56
+ <TableCell align="right" width="120px">{formatCount(m.responses)}</TableCell>
57
+ <TableCell align="right" width="90px">{formatPercent(m.responses / total)}</TableCell>
58
+ <TableCell align="right" width="110px">{formatMoney(m.cost)}</TableCell>
59
+ </TableRow>); })}
60
+ <TableRow>
61
+ <TableCell>Total</TableCell>
62
+ <TableCell align="right" width="120px">{formatCount(total)}</TableCell>
63
+ <TableCell align="right" width="90px">{formatPercent(1)}</TableCell>
64
+ <TableCell align="right" width="110px">{formatMoney(totalCost)}</TableCell>
65
+ </TableRow>
66
+ </TableContainer>
67
+ </Stack>
68
+ </Center>);
69
+ }