oneslash-design-system 2.19.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 (122) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +28 -4
  3. package/dist/cases/billing-page/billed-elsewhere.d.ts +1 -0
  4. package/dist/cases/billing-page/billed-elsewhere.jsx +28 -0
  5. package/dist/cases/billing-page/self-serve.d.ts +1 -0
  6. package/dist/cases/billing-page/self-serve.jsx +134 -0
  7. package/dist/cases/billing-page.md +247 -0
  8. package/dist/cases/breakdown-list/bars.d.ts +1 -0
  9. package/dist/cases/breakdown-list/bars.jsx +47 -0
  10. package/dist/cases/breakdown-list/table.d.ts +1 -0
  11. package/dist/cases/breakdown-list/table.jsx +69 -0
  12. package/dist/cases/breakdown-list.md +158 -0
  13. package/dist/cases/composer-limit/notice-with-action.jsx +3 -3
  14. package/dist/cases/composer-limit/notice.jsx +3 -3
  15. package/dist/cases/composer-limit.md +8 -8
  16. package/dist/cases/dashboard/numbers-first.d.ts +1 -0
  17. package/dist/cases/dashboard/numbers-first.jsx +165 -0
  18. package/dist/cases/dashboard/work-first.d.ts +1 -0
  19. package/dist/cases/dashboard/work-first.jsx +165 -0
  20. package/dist/cases/dashboard.md +507 -0
  21. package/dist/cases/data-table-page/all-rows.d.ts +1 -0
  22. package/dist/cases/data-table-page/all-rows.jsx +226 -0
  23. package/dist/cases/data-table-page/paged.d.ts +1 -0
  24. package/dist/cases/data-table-page/paged.jsx +284 -0
  25. package/dist/cases/data-table-page.md +771 -0
  26. package/dist/cases/invoice-list/table.d.ts +1 -0
  27. package/dist/cases/invoice-list/table.jsx +64 -0
  28. package/dist/cases/invoice-list/with-upcoming.d.ts +1 -0
  29. package/dist/cases/invoice-list/with-upcoming.jsx +75 -0
  30. package/dist/cases/invoice-list.md +237 -0
  31. package/dist/cases/load-failure/inline.jsx +2 -2
  32. package/dist/cases/load-failure.md +2 -2
  33. package/dist/cases/members-list/rows.jsx +2 -1
  34. package/dist/cases/members-list/table.jsx +8 -9
  35. package/dist/cases/members-list.md +12 -13
  36. package/dist/cases/number-format.md +36 -0
  37. package/dist/cases/paged-card/pager.d.ts +1 -0
  38. package/dist/cases/paged-card/pager.jsx +41 -0
  39. package/dist/cases/paged-card/see-all.d.ts +1 -0
  40. package/dist/cases/paged-card/see-all.jsx +34 -0
  41. package/dist/cases/paged-card.md +147 -0
  42. package/dist/cases/payment-method/none.d.ts +1 -0
  43. package/dist/cases/payment-method/none.jsx +17 -0
  44. package/dist/cases/payment-method/on-file.d.ts +1 -0
  45. package/dist/cases/payment-method/on-file.jsx +92 -0
  46. package/dist/cases/payment-method.md +182 -0
  47. package/dist/cases/plan-change-confirm/blocked.d.ts +1 -0
  48. package/dist/cases/plan-change-confirm/blocked.jsx +48 -0
  49. package/dist/cases/plan-change-confirm/downgrade.d.ts +1 -0
  50. package/dist/cases/plan-change-confirm/downgrade.jsx +52 -0
  51. package/dist/cases/plan-change-confirm/upgrade.d.ts +1 -0
  52. package/dist/cases/plan-change-confirm/upgrade.jsx +51 -0
  53. package/dist/cases/plan-change-confirm.md +261 -0
  54. package/dist/cases/plan-picker/cards.d.ts +1 -0
  55. package/dist/cases/plan-picker/cards.jsx +97 -0
  56. package/dist/cases/plan-picker/list.d.ts +1 -0
  57. package/dist/cases/plan-picker/list.jsx +103 -0
  58. package/dist/cases/plan-picker.md +297 -0
  59. package/dist/cases/range-switch/segmented.jsx +11 -7
  60. package/dist/cases/range-switch.md +16 -11
  61. package/dist/cases/settings-page/top-tabs.jsx +4 -3
  62. package/dist/cases/settings-page.md +5 -4
  63. package/dist/cases/stat-row/featured.d.ts +1 -0
  64. package/dist/cases/stat-row/featured.jsx +17 -0
  65. package/dist/cases/stat-row/tiles.d.ts +1 -0
  66. package/dist/cases/stat-row/tiles.jsx +34 -0
  67. package/dist/cases/stat-row.md +104 -0
  68. package/dist/cases/status-label/dot.d.ts +1 -0
  69. package/dist/cases/status-label/dot.jsx +39 -0
  70. package/dist/cases/status-label/text.d.ts +1 -0
  71. package/dist/cases/status-label/text.jsx +44 -0
  72. package/dist/cases/status-label.md +143 -0
  73. package/dist/cases/upgrade-prompt/inline.jsx +4 -2
  74. package/dist/cases/upgrade-prompt/modal.jsx +2 -1
  75. package/dist/cases/upgrade-prompt.md +10 -6
  76. package/dist/cases/usage-meters/by-person.d.ts +1 -0
  77. package/dist/cases/usage-meters/by-person.jsx +72 -0
  78. package/dist/cases/usage-meters/meters.d.ts +1 -0
  79. package/dist/cases/usage-meters/meters.jsx +49 -0
  80. package/dist/cases/usage-meters/with-cap.d.ts +1 -0
  81. package/dist/cases/usage-meters/with-cap.jsx +73 -0
  82. package/dist/cases/usage-meters.md +303 -0
  83. package/dist/cases.json +956 -19
  84. package/dist/components/button.d.ts +1 -1
  85. package/dist/components/button.jsx +11 -5
  86. package/dist/components/formatNumber.d.ts +25 -0
  87. package/dist/components/formatNumber.js +125 -0
  88. package/dist/components/iconButton.jsx +12 -7
  89. package/dist/components/pagination.d.ts +28 -0
  90. package/dist/components/pagination.jsx +89 -0
  91. package/dist/components/progress.d.ts +33 -0
  92. package/dist/components/progress.jsx +50 -0
  93. package/dist/components/skeleton.d.ts +21 -0
  94. package/dist/components/skeleton.jsx +41 -0
  95. package/dist/components/statTile.d.ts +32 -0
  96. package/dist/components/statTile.jsx +61 -0
  97. package/dist/components/tableContainer.d.ts +5 -1
  98. package/dist/components/tableContainer.jsx +9 -1
  99. package/dist/components/tableHeaderCell.d.ts +3 -1
  100. package/dist/components/tableHeaderCell.jsx +2 -2
  101. package/dist/components/titleBar.d.ts +3 -1
  102. package/dist/components/titleBar.jsx +4 -3
  103. package/dist/index.d.ts +5 -0
  104. package/dist/index.js +5 -0
  105. package/dist/native-mapping.json +26 -2
  106. package/dist/stories/Button.stories.d.ts +1 -0
  107. package/dist/stories/Button.stories.jsx +19 -1
  108. package/dist/stories/Cases.generated.stories.d.ts +26 -0
  109. package/dist/stories/Cases.generated.stories.jsx +52 -0
  110. package/dist/stories/Pagination.stories.d.ts +9 -0
  111. package/dist/stories/Pagination.stories.jsx +75 -0
  112. package/dist/stories/Progress.stories.d.ts +9 -0
  113. package/dist/stories/Progress.stories.jsx +43 -0
  114. package/dist/stories/Skeleton.stories.d.ts +7 -0
  115. package/dist/stories/Skeleton.stories.jsx +27 -0
  116. package/dist/stories/StatTile.stories.d.ts +10 -0
  117. package/dist/stories/StatTile.stories.jsx +55 -0
  118. package/dist/stories/Table.stories.d.ts +1 -0
  119. package/dist/stories/Table.stories.jsx +49 -1
  120. package/dist/stories/TitleBar.stories.d.ts +1 -0
  121. package/dist/stories/TitleBar.stories.jsx +7 -0
  122. package/package.json +5 -1
package/README.md CHANGED
@@ -70,7 +70,7 @@ import SectionIntro from 'oneslash-design-system/components/sectionIntro';
70
70
 
71
71
  ## Design cases
72
72
 
73
- A case is one design situation with oneSlash's answer to it. A rule case has one answer, such as "an agent asks before a risky action". A design case has one to four options, each with a line on when to use it and a working example built only from this package. 2.19.0 has 85: twelve rules and 73 design cases for auth pages, confirms and modals, states, chat and agent interfaces, settings and menus, shells and navigation.
73
+ A case is one design situation with oneSlash's answer to it. A rule case has one answer, such as "an agent asks before a risky action". A design case has one to four options, each with a line on when to use it and a working example built only from this package. 2.20.0 has 98: thirteen rules and 85 design cases for auth pages, confirms and modals, states, chat and agent interfaces, settings and menus, shells and navigation, dashboards and billing.
74
74
 
75
75
  - `oneslash-design-system/cases.json` lists every case with its rule text, options, Do and Don't lines, and the source of each example.
76
76
  - `oneslash-design-system/cases/<id>.md` is one case as text, and `oneslash-design-system/cases/<id>/<option>.jsx` is the example itself.
package/dist/DESIGN.md CHANGED
@@ -325,7 +325,9 @@ For each web component, the table gives the native control to use. System contro
325
325
  | pageHeader | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `.navigationTitle` / `TopAppBar`. |
326
326
  | pageShell | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `NavigationStack` / `Scaffold`. |
327
327
  | paragraph | `Text` with `.font(.body)` | `Text` with `MaterialTheme.typography.bodyLarge` | |
328
+ | pagination | Not applicable: web page pattern | Not applicable: web page pattern | A list loads more as it scrolls: a `List` with `.onAppear` on the last row on Apple, Paging with a `LazyColumn` on Android. No page buttons in an app. |
328
329
  | popover | `.popover` | `DropdownMenu` | Larger anchored content on Android: `ModalBottomSheet`. |
330
+ | progress | `Gauge(value:in:)` with `.gaugeStyle(.accessoryLinearCapacity)`, or `ProgressView(value:)` with a `currentValueLabel` | `LinearProgressIndicator(progress = { … })` with `semantics { progressBarRangeInfo; stateDescription }` | A meter of use against a limit, not a task progress bar. Say "Almost at the limit" and "Limit reached" in words, not by color alone. With no limit show the text only. Numbers: `.number.notation(.compactName)` / `.currency(code:)` / `ByteCountFormatStyle(style: .memory)` on Apple; `CompactDecimalFormat` / `NumberFormat.getCurrencyInstance` / `Formatter.formatShortFileSize` on Android. |
329
331
  | radioGroup | `Picker` (`.inline` on iOS, `.radioGroup` on macOS) | `RadioButton`s in a `Column` with `Modifier.selectableGroup()` | `variant="card"`: each option is a bordered card with the radio in it, a `Picker` with custom rows on iOS / selectable `Card`s with a `RadioButton` in a `selectableGroup` on Android. |
330
332
  | sectionIntro | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `Section` header in a `List` or `Form` / a heading `Text`. |
331
333
  | segmentedControl | `Picker` with `.pickerStyle(.segmented)` | `SingleChoiceSegmentedButtonRow` with `SegmentedButton` | It sets a value on the same screen. To switch panels use `TabView` / `PrimaryTabRow`. Give the picker an accessibility label. |
@@ -334,15 +336,17 @@ For each web component, the table gives the native control to use. System contro
334
336
  | sidePane | `.inspector(isPresented:)` with `.inspectorColumnWidth(min:ideal:max:)` | `SupportingPaneScaffold` | The system resizes the inspector on iPad and Mac and shows it as a sheet on iPhone. `SupportingPaneScaffold` is in the Material 3 adaptive library and needs `@OptIn(ExperimentalMaterial3AdaptiveApi::class)`. |
335
337
  | siteFooter | Not applicable: web page pattern | Not applicable: web page pattern | A site is web only. An app has no footer: its links live in Settings, as rows. |
336
338
  | siteHeader | Not applicable: web page pattern | Not applicable: web page pattern | A site is web only. In an app: `NavigationStack` with a toolbar, and a `TabView` or `NavigationSuiteScaffold` for the places. |
339
+ | skeleton | `.redacted(reason: .placeholder)` on the real view | A `Box` shape filled with `surfaceVariant` | Compose has no stock part. No shimmer: keep it still, or a slow pulse that stops with reduced motion. Hide it from TalkBack and announce the loading once for the region. |
337
340
  | sourceCard | `Link` or `Button` with a `Label` (icon, title) and the meta as a secondary line | A `Card` with `onClick`, or a `ListItem` with a leading `Icon` | With no destination it is a plain `Label`, not a button. |
338
341
  | stepList | A `List` of `Label`s with an SF Symbol per status (`circle`, `checkmark.circle.fill`, `xmark.circle.fill`, `minus.circle`); `ProgressView` for the running one | A `Column` of `ListItem`s with an `Icon` per status; `CircularProgressIndicator` for the running one | Give each row a status text for VoiceOver / TalkBack, not color alone. |
339
342
  | surface | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `Form` section or `GroupBox` / `Card`. |
340
343
  | switch | `Toggle` in a `Form` row (`.toggleStyle(.switch)`); the description is the row's secondary line | `Switch` in a `ListItem` with `trailingContent` | While a change saves, disable the control or show a `ProgressView` / `CircularProgressIndicator` beside it and put the value back if it fails. |
344
+ | statTile | A `VStack` of `Text`s with `.accessibilityElement(children: .combine)` | A `Column` with `Modifier.semantics(mergeDescendants = true)` | Not colored by good or bad. Numbers: `.number.notation(.compactName)` / `.currency(code:)` on Apple; `CompactDecimalFormat` / `NumberFormat.getCurrencyInstance` on Android. Loading: `.redacted(reason: .placeholder)`. |
341
345
  | tab | `TabView` or segmented `Picker` | `PrimaryTabRow` | One `Tab` inside `TabView` or one segment / one `Tab`. `TabRow` is deprecated in Material 3. |
342
346
  | tableCell | A `TableColumn` content view | `Text` in a `Row` with `Modifier.weight` | Material 3 has no table. |
343
- | tableContainer | `Table` | `LazyColumn` of `Row`s | Material 3 has no table. A compact-width iPhone `Table` shows only its first column. |
347
+ | tableContainer | `Table` | `LazyColumn` of `Row`s | Material 3 has no table. A compact-width iPhone `Table` shows only its first column. `aria-label` names it: `.accessibilityLabel`. `minWidth` makes it scroll sideways inside its region: a horizontal `ScrollView` / `Modifier.horizontalScroll`. A sorted column uses `TableColumn(…, sortUsing:)` / `semantics { stateDescription }`. |
344
348
  | tableHeader | The `Table` column headers (`TableColumn` titles) | A header `Row` as the first `LazyColumn` item | Material 3 has no table. |
345
- | tableHeaderCell | A `TableColumn` title | `Text` in the header `Row` | Material 3 has no table. |
349
+ | tableHeaderCell | A `TableColumn` title | `Text` in the header `Row` | Material 3 has no table. `sort`: `TableColumn(…, sortUsing:)` with a `KeyPathComparator`; on Android a clickable header `Text` with `semantics { stateDescription = "Sorted ascending" }`. |
346
350
  | tableRow | `TableRow` | `Row` | Material 3 has no table. |
347
351
  | tabsContainer | `TabView` or segmented `Picker` | `PrimaryTabRow` | `TabRow` is deprecated in Material 3. |
348
352
  | tag | `ODSTag` | `OdsTag` | A count on a list row or tab stays `.badge` / `Badge`. A tag that acts: wrap `ODSTag` in a `Button` with the plain style; on Android use a Material `AssistChip` or `FilterChip`, which are made to be pressed. |
@@ -467,6 +471,14 @@ Answer: A problem with one field shows under that field, through the field's `er
467
471
 
468
472
  File: cases/form-errors.md
469
473
 
474
+ ### A number shows its unit and never shows 0 for unknown
475
+
476
+ A page shows counts, money, sizes, shares or changes.
477
+
478
+ Answer: Use the helpers in `formatNumber` (`formatCount`, `formatMoney`, `formatPercent`, `formatBytes`, `formatDuration`), `StatTile` and `Progress`. A count is whole and grouped: '1,240'. In a tile, a count or an amount from 10,000 up shows its short form: '12.4K', '$12.4K'. A table shows the exact number, right-aligned. Money has its symbol and two decimals: '$1,240.00'. A cost under a cent reads '< $0.01'. A share is a whole percent, and a small one reads '< 1%'. A size is base 1024: '52 MB', '1.2 GB'. A time reads '340 ms', '1.2 s', '2 h 24 min'. The unit is in the label or after the number in words: 'Responses', '7 of 8 seats', '340 responses, no limit'. A bare number is never shown, and a unit is never only in a tooltip. A change says its direction, its size and what it compares with: 'Up 12% from last week'. It reads 'New this week' when there was nothing before. It has no color, because more is not good or bad by itself. Unknown is never 0. `formatNumber` shows '–' for a value it cannot read. `StatTile` shows 'No data yet'. While a number loads, a `Skeleton` holds its place. On a failure, show the case 'Load failure'. A limit is a `Progress`, which says 'Limit reached' in words.
479
+
480
+ File: cases/number-format.md
481
+
470
482
  ### On a phone, a sidebar opens as a drawer and a list opens its detail
471
483
 
472
484
  A layout with a sidebar, a list beside its detail, or a side pane meets a phone screen.
@@ -504,13 +516,17 @@ File: cases/success-feedback.md
504
516
  | App shell | A person opens the product and moves between its places, such as Inbox, Tasks and Settings, from every page. | cases/app-shell.md |
505
517
  | Document card | The agent made a document for the person, such as a plan or a report. | cases/artifact-card.md |
506
518
  | Login check loading | The app is checking whether the person is logged in, or running a step such as checking an invite, before it knows what to show. | cases/auth-gate-loading.md |
519
+ | Billing page | 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. | cases/billing-page.md |
520
+ | Breakdown of a total | A page shows how a total splits into parts, such as responses by model or comments by project. | cases/breakdown-list.md |
507
521
  | Check your email | A person signed up, and the product sent a link to confirm their email. | cases/check-your-email.md |
508
522
  | Collapsible search | A person filters a list by a word, and the list should keep its room when they are not typing. | cases/collapsible-search.md |
509
- | Composer at a limit | The agent cannot be called from the composer because the workspace reached a limit, such as its agent replies for the month. | cases/composer-limit.md |
523
+ | Composer at a limit | The agent cannot be called from the composer because the workspace reached a limit, such as its AI agent responses for the month. | cases/composer-limit.md |
510
524
  | Delete confirm | A person asks to delete or remove something, and it cannot be undone. | cases/confirm-destructive-action.md |
511
525
  | Conversation starters | A thread has no messages yet, and the person may not know what to write first. | cases/conversation-starters.md |
512
526
  | Create modal | A person creates something new, such as a project or a task, and it needs a name before it exists. | cases/create-modal.md |
513
527
  | Danger zone | A settings page offers actions that are hard or impossible to undo, such as deleting an account or a workspace, or leaving one. | cases/danger-zone.md |
528
+ | Dashboard | A page that opens an app and says how things are going and what waits on the person. | cases/dashboard.md |
529
+ | Data table page | A page is one long table of records, such as invoices or customers, that a person searches, sorts and acts on. | cases/data-table-page.md |
514
530
  | Device login | A CLI, an editor or another app opened the browser so the person can log in, and the login must reach that app. | cases/device-login.md |
515
531
  | Email confirmed | A person opened the link that confirms their email. | cases/email-confirmed.md |
516
532
  | Empty list | A list has loaded, and there is nothing in it yet. | cases/empty-list.md |
@@ -524,6 +540,7 @@ File: cases/success-feedback.md
524
540
  | Form feedback | A person submits a small form, such as a settings field, and the request ends. The three options are the three outcomes of one save: it worked in place, it failed, or the result is elsewhere. | cases/inline-form-feedback.md |
525
541
  | Integrations | A person connects the product to other tools, sees which ones are connected and disconnects them. | cases/integrations-list.md |
526
542
  | Member invite | A person invites someone to join a workspace. | cases/invite-member.md |
543
+ | Invoices | A billing page lists what the workspace has paid, so an admin can find an invoice, check an amount and keep a copy. | cases/invoice-list.md |
527
544
  | Load failure | A list or a section could not load. | cases/load-failure.md |
528
545
  | Log-out confirm | A person chooses Log Out. | cases/log-out-confirm.md |
529
546
  | Login page | A person who already has an account opens the product and is not logged in. | cases/login-page.md |
@@ -544,9 +561,13 @@ File: cases/success-feedback.md
544
561
  | On this page | A person reads a long page and wants to see its sections, jump to one and know which one they are in. | cases/on-this-page.md |
545
562
  | More menu | A person opens a menu of less common actions, behind one button, for a thing or for the page. | cases/overflow-menu.md |
546
563
  | Page header with actions | A page names itself at the top and offers what the person can do with it. | cases/page-header.md |
564
+ | Short list on a dashboard | A dashboard section lists things that wait on the person, such as questions or comments, and the list may be longer than the section. | cases/paged-card.md |
565
+ | Payment method | A workspace pays by card. The admin sees which card, changes it or removes it. | cases/payment-method.md |
566
+ | Plan change confirm | An admin chose another plan. Before anything changes they need to know what it costs and when it starts. | cases/plan-change-confirm.md |
567
+ | Plan picker | An admin compares the plans a workspace can be on and chooses one. | cases/plan-picker.md |
547
568
  | Profile | A person changes how they appear and how they sign in: their picture, their name and their password. | cases/profile-form.md |
548
569
  | Quick switcher | A person jumps to a channel, task or document by typing part of its name, from anywhere in the product. | cases/quick-switcher.md |
549
- | Range switch | A person changes the time range of a chart or a list on the same page, such as Week, Month or Quarter. | cases/range-switch.md |
570
+ | Range switch | A person changes the time range of the numbers or a list on the same page, such as Week, Month or Quarter. | cases/range-switch.md |
550
571
  | Rename | A person renames something, such as a project or a channel. | cases/rename.md |
551
572
  | Reply feedback | The agent has replied, and the person can say whether the reply helped. | cases/reply-feedback.md |
552
573
  | Reply sources | The agent answered from things it read, and the person may want to check them. | cases/reply-sources.md |
@@ -560,9 +581,12 @@ File: cases/success-feedback.md
560
581
  | Site footer | 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. | cases/site-footer.md |
561
582
  | Site header | A site's pages name the site at the top and show the person where to go and what to do next. | cases/site-header.md |
562
583
  | Command list | A person types / at the start of the message box to run a command. | cases/slash-command-list.md |
584
+ | Stat row | A page opens with the few numbers that say how things are going, counted over one range. | cases/stat-row.md |
585
+ | Status in a row | A row in a table or a list says what state its thing is in, such as an invoice, a plan or a connection. ODS has no separate Badge part, because `Tag` does a Badge's job. | cases/status-label.md |
563
586
  | Tag filter | A person filters a list by a tag, and adds, renames and deletes the tags themselves. | cases/tag-filter.md |
564
587
  | Theme switcher | A person chooses between a light page, a dark page, or the one their device uses. | cases/theme-switcher.md |
565
588
  | Type to confirm | A person asks to delete something large that cannot be brought back, such as a workspace or an account. | cases/type-to-confirm.md |
566
589
  | Typing line | Other people in the thread are writing a message that has not arrived yet. | cases/typing-and-status.md |
567
590
  | Unsaved changes | A person closes or leaves something they changed and did not save. | cases/unsaved-changes-guard.md |
568
591
  | Upgrade prompt | A person reaches something their plan does not include, or a limit of their plan. | cases/upgrade-prompt.md |
592
+ | Usage against limits | A plan limits some things, such as AI agent responses, members and storage. The admin checks how close the workspace is. | cases/usage-meters.md |
@@ -0,0 +1 @@
1
+ export default function BillingPageBilledElsewhere(): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import Heading from '../../components/heading';
3
+ import Paragraph from '../../components/paragraph';
4
+ import Progress from '../../components/progress';
5
+ import SettingsSection from '../../components/settingsSection';
6
+ import TitleBar from '../../components/titleBar';
7
+ import { Center, Stack } from '../../components/layout';
8
+ export default function BillingPageBilledElsewhere() {
9
+ return (<Center width="page">
10
+ <Stack gap="xlarge">
11
+ <TitleBar title="Billing"/>
12
+ <SettingsSection id="billing-elsewhere-plan" title="Plan" description="What Acme pays for.">
13
+ <Stack gap="small">
14
+ <Heading level={3} size="h6">Pro</Heading>
15
+ <Paragraph tone="secondary" size="body2" measure="none">Renews on Dec 1, 2026.</Paragraph>
16
+ </Stack>
17
+ {/* No price, card or invoice: the app store that bills this plan keeps them. The page says who pays, where, and who can change it. */}
18
+ <Paragraph size="body2" measure="none">Ben Carter pays for this plan through an app store. Only Ben Carter can change or cancel it, in the app store settings on the device that bought it.</Paragraph>
19
+ </SettingsSection>
20
+ <SettingsSection id="billing-elsewhere-usage" title="Usage" description="This month.">
21
+ <Stack gap="medium">
22
+ <Progress label="AI agent responses" value={312} max={1000} unit="responses"/>
23
+ <Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
24
+ </Stack>
25
+ </SettingsSection>
26
+ </Stack>
27
+ </Center>);
28
+ }
@@ -0,0 +1 @@
1
+ export default function BillingPageSelfServe(): import("react").JSX.Element;
@@ -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;