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.
- package/README.md +1 -1
- package/dist/DESIGN.md +54 -5
- package/dist/cases/app-shell/sidebar.d.ts +1 -0
- package/dist/cases/app-shell/sidebar.jsx +124 -0
- package/dist/cases/app-shell/top-tabs.d.ts +1 -0
- package/dist/cases/app-shell/top-tabs.jsx +106 -0
- package/dist/cases/app-shell.md +364 -0
- package/dist/cases/artifact-card/card.jsx +32 -6
- package/dist/cases/artifact-card.md +55 -7
- package/dist/cases/billing-page/billed-elsewhere.d.ts +1 -0
- package/dist/cases/billing-page/billed-elsewhere.jsx +28 -0
- package/dist/cases/billing-page/self-serve.d.ts +1 -0
- package/dist/cases/billing-page/self-serve.jsx +134 -0
- package/dist/cases/billing-page.md +247 -0
- package/dist/cases/breakdown-list/bars.d.ts +1 -0
- package/dist/cases/breakdown-list/bars.jsx +47 -0
- package/dist/cases/breakdown-list/table.d.ts +1 -0
- package/dist/cases/breakdown-list/table.jsx +69 -0
- package/dist/cases/breakdown-list.md +158 -0
- package/dist/cases/composer-limit/notice-with-action.jsx +3 -3
- package/dist/cases/composer-limit/notice.jsx +3 -3
- package/dist/cases/composer-limit.md +8 -8
- package/dist/cases/dashboard/numbers-first.d.ts +1 -0
- package/dist/cases/dashboard/numbers-first.jsx +165 -0
- package/dist/cases/dashboard/work-first.d.ts +1 -0
- package/dist/cases/dashboard/work-first.jsx +165 -0
- package/dist/cases/dashboard.md +507 -0
- package/dist/cases/data-table-page/all-rows.d.ts +1 -0
- package/dist/cases/data-table-page/all-rows.jsx +226 -0
- package/dist/cases/data-table-page/paged.d.ts +1 -0
- package/dist/cases/data-table-page/paged.jsx +284 -0
- package/dist/cases/data-table-page.md +771 -0
- package/dist/cases/error-page/in-shell.jsx +26 -17
- package/dist/cases/error-page.md +42 -21
- package/dist/cases/invoice-list/table.d.ts +1 -0
- package/dist/cases/invoice-list/table.jsx +64 -0
- package/dist/cases/invoice-list/with-upcoming.d.ts +1 -0
- package/dist/cases/invoice-list/with-upcoming.jsx +75 -0
- package/dist/cases/invoice-list.md +237 -0
- package/dist/cases/load-failure/inline.jsx +2 -2
- package/dist/cases/load-failure.md +2 -2
- package/dist/cases/master-detail/list-then-page.d.ts +1 -0
- package/dist/cases/master-detail/list-then-page.jsx +65 -0
- package/dist/cases/master-detail/split.d.ts +1 -0
- package/dist/cases/master-detail/split.jsx +49 -0
- package/dist/cases/master-detail.md +213 -0
- package/dist/cases/members-list/rows.jsx +2 -1
- package/dist/cases/members-list/table.jsx +8 -9
- package/dist/cases/members-list.md +12 -13
- package/dist/cases/mobile-menu/links.d.ts +1 -0
- package/dist/cases/mobile-menu/links.jsx +24 -0
- package/dist/cases/mobile-menu/sections.d.ts +1 -0
- package/dist/cases/mobile-menu/sections.jsx +61 -0
- package/dist/cases/mobile-menu.md +170 -0
- package/dist/cases/not-found-page/in-shell.jsx +26 -17
- package/dist/cases/not-found-page.md +41 -20
- package/dist/cases/number-format.md +36 -0
- package/dist/cases/on-this-page/aside.d.ts +1 -0
- package/dist/cases/on-this-page/aside.jsx +39 -0
- package/dist/cases/on-this-page.md +80 -0
- package/dist/cases/page-header/actions.d.ts +1 -0
- package/dist/cases/page-header/actions.jsx +65 -0
- package/dist/cases/page-header/sub-page.d.ts +1 -0
- package/dist/cases/page-header/sub-page.jsx +37 -0
- package/dist/cases/page-header.md +195 -0
- package/dist/cases/paged-card/pager.d.ts +1 -0
- package/dist/cases/paged-card/pager.jsx +41 -0
- package/dist/cases/paged-card/see-all.d.ts +1 -0
- package/dist/cases/paged-card/see-all.jsx +34 -0
- package/dist/cases/paged-card.md +147 -0
- package/dist/cases/payment-method/none.d.ts +1 -0
- package/dist/cases/payment-method/none.jsx +17 -0
- package/dist/cases/payment-method/on-file.d.ts +1 -0
- package/dist/cases/payment-method/on-file.jsx +92 -0
- package/dist/cases/payment-method.md +182 -0
- package/dist/cases/phone-navigation.md +32 -0
- package/dist/cases/plan-change-confirm/blocked.d.ts +1 -0
- package/dist/cases/plan-change-confirm/blocked.jsx +48 -0
- package/dist/cases/plan-change-confirm/downgrade.d.ts +1 -0
- package/dist/cases/plan-change-confirm/downgrade.jsx +52 -0
- package/dist/cases/plan-change-confirm/upgrade.d.ts +1 -0
- package/dist/cases/plan-change-confirm/upgrade.jsx +51 -0
- package/dist/cases/plan-change-confirm.md +261 -0
- package/dist/cases/plan-picker/cards.d.ts +1 -0
- package/dist/cases/plan-picker/cards.jsx +97 -0
- package/dist/cases/plan-picker/list.d.ts +1 -0
- package/dist/cases/plan-picker/list.jsx +103 -0
- package/dist/cases/plan-picker.md +297 -0
- package/dist/cases/range-switch/segmented.jsx +11 -7
- package/dist/cases/range-switch.md +16 -11
- package/dist/cases/route-loading/region.jsx +27 -18
- package/dist/cases/route-loading.md +42 -21
- package/dist/cases/settings-page/top-tabs.jsx +4 -3
- package/dist/cases/settings-page.md +5 -4
- package/dist/cases/side-pane/beside.d.ts +1 -0
- package/dist/cases/side-pane/beside.jsx +79 -0
- package/dist/cases/side-pane/over.d.ts +1 -0
- package/dist/cases/side-pane/over.jsx +58 -0
- package/dist/cases/side-pane.md +238 -0
- package/dist/cases/sidebar-nav/flat.d.ts +1 -0
- package/dist/cases/sidebar-nav/flat.jsx +81 -0
- package/dist/cases/sidebar-nav/nested.d.ts +1 -0
- package/dist/cases/sidebar-nav/nested.jsx +122 -0
- package/dist/cases/sidebar-nav.md +261 -0
- package/dist/cases/site-footer/columns.d.ts +1 -0
- package/dist/cases/site-footer/columns.jsx +51 -0
- package/dist/cases/site-footer/simple.d.ts +1 -0
- package/dist/cases/site-footer/simple.jsx +24 -0
- package/dist/cases/site-footer.md +133 -0
- package/dist/cases/site-header/links.d.ts +1 -0
- package/dist/cases/site-header/links.jsx +26 -0
- package/dist/cases/site-header/sections.d.ts +1 -0
- package/dist/cases/site-header/sections.jsx +64 -0
- package/dist/cases/site-header.md +183 -0
- package/dist/cases/stat-row/featured.d.ts +1 -0
- package/dist/cases/stat-row/featured.jsx +17 -0
- package/dist/cases/stat-row/tiles.d.ts +1 -0
- package/dist/cases/stat-row/tiles.jsx +34 -0
- package/dist/cases/stat-row.md +104 -0
- package/dist/cases/status-label/dot.d.ts +1 -0
- package/dist/cases/status-label/dot.jsx +39 -0
- package/dist/cases/status-label/text.d.ts +1 -0
- package/dist/cases/status-label/text.jsx +44 -0
- package/dist/cases/status-label.md +143 -0
- package/dist/cases/theme-switcher/menu.d.ts +1 -0
- package/dist/cases/theme-switcher/menu.jsx +47 -0
- package/dist/cases/theme-switcher/segmented.d.ts +1 -0
- package/dist/cases/theme-switcher/segmented.jsx +26 -0
- package/dist/cases/theme-switcher.md +149 -0
- package/dist/cases/upgrade-prompt/inline.jsx +4 -2
- package/dist/cases/upgrade-prompt/modal.jsx +2 -1
- package/dist/cases/upgrade-prompt.md +10 -6
- package/dist/cases/usage-meters/by-person.d.ts +1 -0
- package/dist/cases/usage-meters/by-person.jsx +72 -0
- package/dist/cases/usage-meters/meters.d.ts +1 -0
- package/dist/cases/usage-meters/meters.jsx +49 -0
- package/dist/cases/usage-meters/with-cap.d.ts +1 -0
- package/dist/cases/usage-meters/with-cap.jsx +73 -0
- package/dist/cases/usage-meters.md +303 -0
- package/dist/cases.json +1756 -172
- package/dist/components/appShell.d.ts +44 -0
- package/dist/components/appShell.jsx +121 -0
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.jsx +11 -5
- package/dist/components/drawer.d.ts +31 -0
- package/dist/components/drawer.jsx +121 -0
- package/dist/components/formatNumber.d.ts +25 -0
- package/dist/components/formatNumber.js +125 -0
- package/dist/components/heading.d.ts +3 -1
- package/dist/components/heading.jsx +2 -2
- package/dist/components/iconButton.jsx +12 -7
- package/dist/components/link.d.ts +6 -1
- package/dist/components/link.jsx +11 -3
- package/dist/components/menuItem.d.ts +7 -1
- package/dist/components/menuItem.jsx +4 -3
- package/dist/components/modal.jsx +12 -23
- package/dist/components/onThisPage.d.ts +29 -0
- package/dist/components/onThisPage.jsx +151 -0
- package/dist/components/pageShell.d.ts +7 -1
- package/dist/components/pageShell.jsx +14 -1
- package/dist/components/pagination.d.ts +28 -0
- package/dist/components/pagination.jsx +89 -0
- package/dist/components/popover.jsx +4 -0
- package/dist/components/progress.d.ts +33 -0
- package/dist/components/progress.jsx +50 -0
- package/dist/components/settingsSection.d.ts +6 -1
- package/dist/components/settingsSection.jsx +10 -3
- package/dist/components/sidePane.d.ts +32 -0
- package/dist/components/sidePane.jsx +128 -0
- package/dist/components/siteFooter.d.ts +24 -0
- package/dist/components/siteFooter.jsx +48 -0
- package/dist/components/siteHeader.d.ts +55 -0
- package/dist/components/siteHeader.jsx +125 -0
- package/dist/components/skeleton.d.ts +21 -0
- package/dist/components/skeleton.jsx +41 -0
- package/dist/components/statTile.d.ts +32 -0
- package/dist/components/statTile.jsx +61 -0
- package/dist/components/tableContainer.d.ts +5 -1
- package/dist/components/tableContainer.jsx +9 -1
- package/dist/components/tableHeaderCell.d.ts +3 -1
- package/dist/components/tableHeaderCell.jsx +2 -2
- package/dist/components/titleBar.d.ts +19 -0
- package/dist/components/titleBar.jsx +18 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/internal/overlayStack.d.ts +24 -0
- package/dist/internal/overlayStack.js +71 -0
- package/dist/internal/resize.d.ts +9 -0
- package/dist/internal/resize.js +31 -0
- package/dist/internal/scrollSpy.d.ts +24 -0
- package/dist/internal/scrollSpy.js +53 -0
- package/dist/internal/siteBrand.d.ts +6 -0
- package/dist/internal/siteBrand.jsx +11 -0
- package/dist/native-mapping.json +69 -3
- package/dist/stories/AppShell.stories.d.ts +15 -0
- package/dist/stories/AppShell.stories.jsx +137 -0
- package/dist/stories/Button.stories.d.ts +1 -0
- package/dist/stories/Button.stories.jsx +19 -1
- package/dist/stories/Cases.generated.stories.d.ts +45 -0
- package/dist/stories/Cases.generated.stories.jsx +90 -0
- package/dist/stories/Drawer.stories.d.ts +10 -0
- package/dist/stories/Drawer.stories.jsx +123 -0
- package/dist/stories/Link.stories.d.ts +1 -0
- package/dist/stories/Link.stories.jsx +8 -0
- package/dist/stories/OnThisPage.stories.d.ts +10 -0
- package/dist/stories/OnThisPage.stories.jsx +105 -0
- package/dist/stories/Pagination.stories.d.ts +9 -0
- package/dist/stories/Pagination.stories.jsx +75 -0
- package/dist/stories/Progress.stories.d.ts +9 -0
- package/dist/stories/Progress.stories.jsx +43 -0
- package/dist/stories/SettingsSection.stories.d.ts +1 -0
- package/dist/stories/SettingsSection.stories.jsx +27 -0
- package/dist/stories/SidePane.stories.d.ts +6 -0
- package/dist/stories/SidePane.stories.jsx +37 -0
- package/dist/stories/SiteFooter.stories.d.ts +7 -0
- package/dist/stories/SiteFooter.stories.jsx +63 -0
- package/dist/stories/SiteHeader.stories.d.ts +10 -0
- package/dist/stories/SiteHeader.stories.jsx +94 -0
- package/dist/stories/Skeleton.stories.d.ts +7 -0
- package/dist/stories/Skeleton.stories.jsx +27 -0
- package/dist/stories/StatTile.stories.d.ts +10 -0
- package/dist/stories/StatTile.stories.jsx +55 -0
- package/dist/stories/Table.stories.d.ts +1 -0
- package/dist/stories/Table.stories.jsx +49 -1
- package/dist/stories/TitleBar.stories.d.ts +7 -0
- package/dist/stories/TitleBar.stories.jsx +41 -0
- package/package.json +5 -1
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import AppShell from '../../components/appShell';
|
|
4
|
+
import Navigation, { NavigationGroup } from '../../components/navigation';
|
|
5
|
+
import MenuItem from '../../components/menuItem';
|
|
5
6
|
import Surface from '../../components/surface';
|
|
6
7
|
import Heading from '../../components/heading';
|
|
7
8
|
import Paragraph from '../../components/paragraph';
|
|
8
9
|
import Button from '../../components/button';
|
|
9
10
|
import { Cluster, Stack } from '../../components/layout';
|
|
10
|
-
// The product's mark. A real app passes its own file.
|
|
11
|
-
var productMark = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
12
|
-
// A real app passes the router from its framework, such as Next's useRouter().
|
|
13
|
-
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
14
11
|
// A real app passes the reset() its framework gives the error page, such as Next's error.tsx.
|
|
15
12
|
var reset = function () { return console.info('Render the page again'); };
|
|
13
|
+
// The places, and the projects the person made. The page that failed or loads is the current one.
|
|
14
|
+
var places = [
|
|
15
|
+
{ label: 'Home', icon: 'House', href: '/' },
|
|
16
|
+
{ label: 'Settings', icon: 'Settings', href: '/settings' },
|
|
17
|
+
];
|
|
18
|
+
var projects = [
|
|
19
|
+
{ label: 'Website', icon: 'Globe', href: '/projects/website' },
|
|
20
|
+
{ label: 'Mobile App', icon: 'Smartphone', href: '/projects/mobile-app' },
|
|
21
|
+
];
|
|
22
|
+
var current = '/projects/website';
|
|
23
|
+
var row = function (p) { return (<MenuItem key={p.href} size="small" label={p.label} iconName={p.icon} href={p.href} isSelected={p.href === current} aria-current={p.href === current ? 'page' : undefined}
|
|
24
|
+
// A real app lets the link go to its page.
|
|
25
|
+
onClick={function (event) { return event.preventDefault(); }}/>); };
|
|
26
|
+
var sidebar = (<Navigation aria-label="Main">
|
|
27
|
+
<Paragraph size="body1" measure="none">Acme</Paragraph>
|
|
28
|
+
{places.map(row)}
|
|
29
|
+
<NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
|
|
30
|
+
</Navigation>);
|
|
16
31
|
export default function ErrorPageInShell() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<TabsContainer>
|
|
21
|
-
<Tab label="Home" isSelected={false} href="/" router={router} onClickTab={function () { }}/>
|
|
22
|
-
<Tab label="Projects" isSelected href="/projects" router={router} onClickTab={function () { }}/>
|
|
23
|
-
<Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={function () { }}/>
|
|
24
|
-
</TabsContainer>
|
|
25
|
-
</Cluster>
|
|
32
|
+
// Below md the sidebar is a Drawer; this says whether it is open.
|
|
33
|
+
var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
|
|
34
|
+
return (<AppShell title="Website" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
|
|
26
35
|
<Surface minHeight="tall" align="center">
|
|
27
36
|
<Stack gap="xlarge">
|
|
28
37
|
<Stack gap="medium">
|
|
@@ -35,5 +44,5 @@ export default function ErrorPageInShell() {
|
|
|
35
44
|
</Cluster>
|
|
36
45
|
</Stack>
|
|
37
46
|
</Surface>
|
|
38
|
-
</
|
|
47
|
+
</AppShell>);
|
|
39
48
|
}
|
package/dist/cases/error-page.md
CHANGED
|
@@ -51,40 +51,61 @@ export default function ErrorPageFullPage() {
|
|
|
51
51
|
|
|
52
52
|
Use when: One route failed and the navigation still works.
|
|
53
53
|
|
|
54
|
-
Uses: `Button`, `Cluster`, `Heading`, `
|
|
54
|
+
Uses: `AppShell`, `Button`, `Cluster`, `Heading`, `MenuItem`, `Navigation`, `NavigationGroup`, `Paragraph`, `Stack`, `Surface`
|
|
55
55
|
|
|
56
56
|
```tsx
|
|
57
57
|
'use client';
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
58
|
+
import { useState } from 'react';
|
|
59
|
+
import AppShell from 'oneslash-design-system/components/appShell';
|
|
60
|
+
import Navigation, { NavigationGroup } from 'oneslash-design-system/components/navigation';
|
|
61
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
61
62
|
import Surface from 'oneslash-design-system/components/surface';
|
|
62
63
|
import Heading from 'oneslash-design-system/components/heading';
|
|
63
64
|
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
64
65
|
import Button from 'oneslash-design-system/components/button';
|
|
65
66
|
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
66
67
|
|
|
67
|
-
// The product's mark. A real app passes its own file.
|
|
68
|
-
const productMark =
|
|
69
|
-
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
70
|
-
|
|
71
|
-
// A real app passes the router from its framework, such as Next's useRouter().
|
|
72
|
-
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
73
|
-
|
|
74
68
|
// A real app passes the reset() its framework gives the error page, such as Next's error.tsx.
|
|
75
69
|
const reset = () => console.info('Render the page again');
|
|
76
70
|
|
|
71
|
+
// The places, and the projects the person made. The page that failed or loads is the current one.
|
|
72
|
+
const places = [
|
|
73
|
+
{ label: 'Home', icon: 'House', href: '/' },
|
|
74
|
+
{ label: 'Settings', icon: 'Settings', href: '/settings' },
|
|
75
|
+
];
|
|
76
|
+
const projects = [
|
|
77
|
+
{ label: 'Website', icon: 'Globe', href: '/projects/website' },
|
|
78
|
+
{ label: 'Mobile App', icon: 'Smartphone', href: '/projects/mobile-app' },
|
|
79
|
+
];
|
|
80
|
+
const current = '/projects/website';
|
|
81
|
+
|
|
82
|
+
const row = (p: { label: string; icon: string; href: string }) => (
|
|
83
|
+
<MenuItem
|
|
84
|
+
key={p.href}
|
|
85
|
+
size="small"
|
|
86
|
+
label={p.label}
|
|
87
|
+
iconName={p.icon}
|
|
88
|
+
href={p.href}
|
|
89
|
+
isSelected={p.href === current}
|
|
90
|
+
aria-current={p.href === current ? 'page' : undefined}
|
|
91
|
+
// A real app lets the link go to its page.
|
|
92
|
+
onClick={(event: { preventDefault: () => void }) => event.preventDefault()}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const sidebar = (
|
|
97
|
+
<Navigation aria-label="Main">
|
|
98
|
+
<Paragraph size="body1" measure="none">Acme</Paragraph>
|
|
99
|
+
{places.map(row)}
|
|
100
|
+
<NavigationGroup label="Projects">{projects.map(row)}</NavigationGroup>
|
|
101
|
+
</Navigation>
|
|
102
|
+
);
|
|
103
|
+
|
|
77
104
|
export default function ErrorPageInShell() {
|
|
105
|
+
// Below md the sidebar is a Drawer; this says whether it is open.
|
|
106
|
+
const [navOpen, setNavOpen] = useState(false);
|
|
78
107
|
return (
|
|
79
|
-
<
|
|
80
|
-
<Cluster gap="large">
|
|
81
|
-
<Image src={productMark} alt="Acme" width={32} height={32} />
|
|
82
|
-
<TabsContainer>
|
|
83
|
-
<Tab label="Home" isSelected={false} href="/" router={router} onClickTab={() => {}} />
|
|
84
|
-
<Tab label="Projects" isSelected href="/projects" router={router} onClickTab={() => {}} />
|
|
85
|
-
<Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={() => {}} />
|
|
86
|
-
</TabsContainer>
|
|
87
|
-
</Cluster>
|
|
108
|
+
<AppShell title="Website" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
|
|
88
109
|
<Surface minHeight="tall" align="center">
|
|
89
110
|
<Stack gap="xlarge">
|
|
90
111
|
<Stack gap="medium">
|
|
@@ -97,7 +118,7 @@ export default function ErrorPageInShell() {
|
|
|
97
118
|
</Cluster>
|
|
98
119
|
</Stack>
|
|
99
120
|
</Surface>
|
|
100
|
-
</
|
|
121
|
+
</AppShell>
|
|
101
122
|
);
|
|
102
123
|
}
|
|
103
124
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function InvoiceListTable(): import("react").JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Heading from '../../components/heading';
|
|
4
|
+
import Button from '../../components/button';
|
|
5
|
+
import Tag from '../../components/tag';
|
|
6
|
+
import EmptyBox from '../../components/emptyBox';
|
|
7
|
+
import Pagination from '../../components/pagination';
|
|
8
|
+
import TableContainer from '../../components/tableContainer';
|
|
9
|
+
import TableHeader from '../../components/tableHeader';
|
|
10
|
+
import TableHeaderCell from '../../components/tableHeaderCell';
|
|
11
|
+
import TableRow from '../../components/tableRow';
|
|
12
|
+
import TableCell from '../../components/tableCell';
|
|
13
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
14
|
+
import { Center, Stack } from '../../components/layout';
|
|
15
|
+
// A real app reads these from the server, newest first.
|
|
16
|
+
var months = ['Nov 1, 2026', 'Oct 1, 2026', 'Sep 1, 2026', 'Aug 1, 2026', 'Jul 1, 2026', 'Jun 1, 2026', 'May 1, 2026', 'Apr 1, 2026', 'Mar 1, 2026', 'Feb 1, 2026', 'Jan 1, 2026', 'Dec 1, 2025', 'Nov 1, 2025', 'Oct 1, 2025'];
|
|
17
|
+
var invoices = months.map(function (date, i) { return ({
|
|
18
|
+
id: "inv-".concat(i),
|
|
19
|
+
date: date,
|
|
20
|
+
description: "Pro plan, ".concat(date.split(' ')[0], " ").concat(date.split(', ')[1]),
|
|
21
|
+
amount: 24,
|
|
22
|
+
status: i === 3 ? 'Refunded' : 'Paid',
|
|
23
|
+
}); });
|
|
24
|
+
var PAGE_SIZE = 12;
|
|
25
|
+
export default function InvoiceListTable() {
|
|
26
|
+
var _a = useState(1), page = _a[0], setPage = _a[1];
|
|
27
|
+
var pageCount = Math.ceil(invoices.length / PAGE_SIZE);
|
|
28
|
+
var rows = invoices.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
|
29
|
+
return (<Center width="page">
|
|
30
|
+
<Stack gap="large">
|
|
31
|
+
<Heading level={2} size="h5">Invoices</Heading>
|
|
32
|
+
{invoices.length === 0 ? (
|
|
33
|
+
// A new workspace has none. The line says when the first one arrives.
|
|
34
|
+
<EmptyBox size="small" text="No invoices yet" secondText="Your first invoice appears here after your first payment."/>) : (<>
|
|
35
|
+
<TableContainer aria-label="Invoices" minWidth="640px">
|
|
36
|
+
<TableHeader>
|
|
37
|
+
<TableRow>
|
|
38
|
+
<TableHeaderCell width="130px">Date</TableHeaderCell>
|
|
39
|
+
<TableHeaderCell>Description</TableHeaderCell>
|
|
40
|
+
<TableHeaderCell width="100px" align="right">Amount</TableHeaderCell>
|
|
41
|
+
<TableHeaderCell width="110px">Status</TableHeaderCell>
|
|
42
|
+
<TableHeaderCell width="130px">Download</TableHeaderCell>
|
|
43
|
+
</TableRow>
|
|
44
|
+
</TableHeader>
|
|
45
|
+
{rows.map(function (inv) { return (<TableRow key={inv.id}>
|
|
46
|
+
<TableCell width="130px">{inv.date}</TableCell>
|
|
47
|
+
<TableCell>{inv.description}</TableCell>
|
|
48
|
+
{/* A table shows the exact amount, right-aligned. */}
|
|
49
|
+
<TableCell width="100px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
50
|
+
<TableCell width="110px">
|
|
51
|
+
<Tag variant="textOnly" size="small" label={inv.status}/>
|
|
52
|
+
</TableCell>
|
|
53
|
+
<TableCell width="130px">
|
|
54
|
+
{/* A real app links to the file on its own server. The name says which invoice and that it opens a tab. */}
|
|
55
|
+
<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/>
|
|
56
|
+
</TableCell>
|
|
57
|
+
</TableRow>); })}
|
|
58
|
+
</TableContainer>
|
|
59
|
+
{/* Shows nothing under 13 invoices. */}
|
|
60
|
+
<Pagination aria-label="Invoice pages" page={page} pageCount={pageCount} onPageChange={setPage}/>
|
|
61
|
+
</>)}
|
|
62
|
+
</Stack>
|
|
63
|
+
</Center>);
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function InvoiceListWithUpcoming(): import("react").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Heading from '../../components/heading';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import Button from '../../components/button';
|
|
6
|
+
import Tag from '../../components/tag';
|
|
7
|
+
import TableContainer from '../../components/tableContainer';
|
|
8
|
+
import TableHeader from '../../components/tableHeader';
|
|
9
|
+
import TableHeaderCell from '../../components/tableHeaderCell';
|
|
10
|
+
import TableRow from '../../components/tableRow';
|
|
11
|
+
import TableCell from '../../components/tableCell';
|
|
12
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
13
|
+
import { Center, Stack } from '../../components/layout';
|
|
14
|
+
// A real app reads these from the server. The plan is $8.00 a member each month; a fourth member
|
|
15
|
+
// joined on Nov 16, so the next charge also covers the 15 days left in November ($8.00 x 15/30).
|
|
16
|
+
var perMember = 8;
|
|
17
|
+
var members = 4;
|
|
18
|
+
var regular = perMember * members;
|
|
19
|
+
var added = 4;
|
|
20
|
+
var upcoming = { date: 'Dec 1, 2026', description: 'Pro plan, Dec 2026', amount: regular + added };
|
|
21
|
+
var paid = [
|
|
22
|
+
{ id: 'inv-0', date: 'Nov 1, 2026', description: 'Pro plan, Nov 2026', amount: 24, status: 'Paid' },
|
|
23
|
+
{ id: 'inv-1', date: 'Oct 1, 2026', description: 'Pro plan, Oct 2026', amount: 24, status: 'Paid' },
|
|
24
|
+
{ id: 'inv-2', date: 'Sep 1, 2026', description: 'Pro plan, Sep 2026', amount: 24, status: 'Paid' },
|
|
25
|
+
];
|
|
26
|
+
export default function InvoiceListWithUpcoming() {
|
|
27
|
+
var _a = useState(false), explaining = _a[0], setExplaining = _a[1];
|
|
28
|
+
return (<Center width="page">
|
|
29
|
+
<Stack gap="large">
|
|
30
|
+
<Heading level={2} size="h5">Invoices</Heading>
|
|
31
|
+
<TableContainer aria-label="Invoices" minWidth="640px">
|
|
32
|
+
<TableHeader>
|
|
33
|
+
<TableRow>
|
|
34
|
+
<TableHeaderCell width="130px">Date</TableHeaderCell>
|
|
35
|
+
<TableHeaderCell>Description</TableHeaderCell>
|
|
36
|
+
<TableHeaderCell width="100px" align="right">Amount</TableHeaderCell>
|
|
37
|
+
<TableHeaderCell width="110px">Status</TableHeaderCell>
|
|
38
|
+
<TableHeaderCell width="130px">Download</TableHeaderCell>
|
|
39
|
+
</TableRow>
|
|
40
|
+
</TableHeader>
|
|
41
|
+
{/* The next charge is the first row. It has no invoice yet, so it has no Download link. */}
|
|
42
|
+
<TableRow>
|
|
43
|
+
<TableCell width="130px">{upcoming.date}</TableCell>
|
|
44
|
+
<TableCell>
|
|
45
|
+
<Stack gap="small" align="start">
|
|
46
|
+
{upcoming.description}
|
|
47
|
+
{/* The label never changes. The state is in aria-expanded. */}
|
|
48
|
+
<Button size="small" type="tertiary" state="enabled" label="Why Is This Higher?" aria-expanded={explaining} aria-controls="invoice-list-upcoming-why" onClickButton={function () { return setExplaining(function (open) { return !open; }); }}/>
|
|
49
|
+
{explaining && (<Paragraph id="invoice-list-upcoming-why" tone="secondary" size="body2" measure="none">
|
|
50
|
+
{"Your regular charge is ".concat(formatMoney(regular), ": ").concat(members, " members at ").concat(formatMoney(perMember), ". This one is ").concat(formatMoney(upcoming.amount), " because it also adds ").concat(formatMoney(added), " for Omar Reyes, who joined on Nov 16, for the 15 days left in November. It happens once. The charge after this is ").concat(formatMoney(regular), ".")}
|
|
51
|
+
</Paragraph>)}
|
|
52
|
+
</Stack>
|
|
53
|
+
</TableCell>
|
|
54
|
+
<TableCell width="100px" align="right">{formatMoney(upcoming.amount)}</TableCell>
|
|
55
|
+
<TableCell width="110px">
|
|
56
|
+
<Tag variant="dot" size="small" color="info" label="Upcoming"/>
|
|
57
|
+
</TableCell>
|
|
58
|
+
<TableCell width="130px">{''}</TableCell>
|
|
59
|
+
</TableRow>
|
|
60
|
+
{paid.map(function (inv) { return (<TableRow key={inv.id}>
|
|
61
|
+
<TableCell width="130px">{inv.date}</TableCell>
|
|
62
|
+
<TableCell>{inv.description}</TableCell>
|
|
63
|
+
<TableCell width="100px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
64
|
+
<TableCell width="110px">
|
|
65
|
+
<Tag variant="textOnly" size="small" label={inv.status}/>
|
|
66
|
+
</TableCell>
|
|
67
|
+
<TableCell width="130px">
|
|
68
|
+
{/* A real app links to the file on its own server. */}
|
|
69
|
+
<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/>
|
|
70
|
+
</TableCell>
|
|
71
|
+
</TableRow>); })}
|
|
72
|
+
</TableContainer>
|
|
73
|
+
</Stack>
|
|
74
|
+
</Center>);
|
|
75
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Invoices
|
|
2
|
+
|
|
3
|
+
A billing page lists what the workspace has paid, so an admin can find an invoice, check an amount and keep a copy.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Follow the rule 'A number shows its unit and never shows 0 for unknown'.
|
|
8
|
+
- Show a `TableContainer` named 'Invoices', with `minWidth`, and the columns Date, Description, Amount, Status and Download.
|
|
9
|
+
- Write the amount exactly, with `formatMoney`, in a right-aligned column with a right-aligned header: '$24.00'.
|
|
10
|
+
- Show the status as the case 'Status in a row' says: 'Paid' and 'Refunded' as `Tag variant="textOnly"`, and 'Past due' as a dot.
|
|
11
|
+
- Show the newest first. Add `Pagination` named 'Invoice pages' past 12 invoices, and show none under that.
|
|
12
|
+
- Give each 'Download' link a name with the date: 'Download invoice for Nov 1, 2026, opens in a new tab'. Use `Button` with `type="tertiary"`, `href` and `openInNewTab`, with an external-link `actionIcon`.
|
|
13
|
+
- Put an upcoming charge in the first row with an 'Upcoming' `Tag variant="dot" color="info"`. Give it no Download link, because no invoice exists yet.
|
|
14
|
+
- Add a tertiary 'Why Is This Higher?' Button to that row when the charge is above the plan price. It shows the sum in words in the row, and sets `aria-expanded`. Its label never changes.
|
|
15
|
+
- Say in that explanation the regular charge, what is added and why, whether it happens once, and the charge after: 'Your regular charge is $32.00: 4 members at $8.00.'
|
|
16
|
+
- Show 'No invoices yet' in an `EmptyBox`, with one line on when the first arrives: 'Your first invoice appears here after your first payment.'
|
|
17
|
+
- Show only an amount and a status. Keep a card number, an account number and the name of the payment provider off the page.
|
|
18
|
+
|
|
19
|
+
## Don't
|
|
20
|
+
|
|
21
|
+
- Do not show the amount as '$24' or '24.00'. A table shows the exact amount, with its symbol and two decimals.
|
|
22
|
+
- Do not show a card number, even a part of it, in an invoice row.
|
|
23
|
+
- Do not make the upcoming charge look like a paid invoice, or leave it out of the table when it differs from the plan price.
|
|
24
|
+
- Do not name every Download link 'Download'. A screen reader lists the links apart from their rows.
|
|
25
|
+
- Do not use an icon-only link named by its icon. Every row would read the same.
|
|
26
|
+
- Do not hide the explanation behind a tooltip.
|
|
27
|
+
- Do not change the Button's label when the explanation opens. Do not write it in sentence case, 'Why is this higher?'.
|
|
28
|
+
|
|
29
|
+
## Option: A table of past invoices
|
|
30
|
+
|
|
31
|
+
Use when: A history of payments, the same amount each month or close to it.
|
|
32
|
+
|
|
33
|
+
Uses: `Button`, `Center`, `EmptyBox`, `Heading`, `Pagination`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `formatMoney`
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
'use client';
|
|
37
|
+
import { useState } from 'react';
|
|
38
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
39
|
+
import Button from 'oneslash-design-system/components/button';
|
|
40
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
41
|
+
import EmptyBox from 'oneslash-design-system/components/emptyBox';
|
|
42
|
+
import Pagination from 'oneslash-design-system/components/pagination';
|
|
43
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
44
|
+
import TableHeader from 'oneslash-design-system/components/tableHeader';
|
|
45
|
+
import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
|
|
46
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
47
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
48
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
49
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
50
|
+
|
|
51
|
+
type Invoice = { id: string; date: string; description: string; amount: number; status: 'Paid' | 'Refunded' };
|
|
52
|
+
|
|
53
|
+
// A real app reads these from the server, newest first.
|
|
54
|
+
const months = ['Nov 1, 2026', 'Oct 1, 2026', 'Sep 1, 2026', 'Aug 1, 2026', 'Jul 1, 2026', 'Jun 1, 2026', 'May 1, 2026', 'Apr 1, 2026', 'Mar 1, 2026', 'Feb 1, 2026', 'Jan 1, 2026', 'Dec 1, 2025', 'Nov 1, 2025', 'Oct 1, 2025'];
|
|
55
|
+
const invoices: Invoice[] = months.map((date, i) => ({
|
|
56
|
+
id: `inv-${i}`,
|
|
57
|
+
date,
|
|
58
|
+
description: `Pro plan, ${date.split(' ')[0]} ${date.split(', ')[1]}`,
|
|
59
|
+
amount: 24,
|
|
60
|
+
status: i === 3 ? 'Refunded' : 'Paid',
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
const PAGE_SIZE = 12;
|
|
64
|
+
|
|
65
|
+
export default function InvoiceListTable() {
|
|
66
|
+
const [page, setPage] = useState(1);
|
|
67
|
+
const pageCount = Math.ceil(invoices.length / PAGE_SIZE);
|
|
68
|
+
const rows = invoices.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Center width="page">
|
|
72
|
+
<Stack gap="large">
|
|
73
|
+
<Heading level={2} size="h5">Invoices</Heading>
|
|
74
|
+
{invoices.length === 0 ? (
|
|
75
|
+
// A new workspace has none. The line says when the first one arrives.
|
|
76
|
+
<EmptyBox size="small" text="No invoices yet" secondText="Your first invoice appears here after your first payment." />
|
|
77
|
+
) : (
|
|
78
|
+
<>
|
|
79
|
+
<TableContainer aria-label="Invoices" minWidth="640px">
|
|
80
|
+
<TableHeader>
|
|
81
|
+
<TableRow>
|
|
82
|
+
<TableHeaderCell width="130px">Date</TableHeaderCell>
|
|
83
|
+
<TableHeaderCell>Description</TableHeaderCell>
|
|
84
|
+
<TableHeaderCell width="100px" align="right">Amount</TableHeaderCell>
|
|
85
|
+
<TableHeaderCell width="110px">Status</TableHeaderCell>
|
|
86
|
+
<TableHeaderCell width="130px">Download</TableHeaderCell>
|
|
87
|
+
</TableRow>
|
|
88
|
+
</TableHeader>
|
|
89
|
+
{rows.map((inv) => (
|
|
90
|
+
<TableRow key={inv.id}>
|
|
91
|
+
<TableCell width="130px">{inv.date}</TableCell>
|
|
92
|
+
<TableCell>{inv.description}</TableCell>
|
|
93
|
+
{/* A table shows the exact amount, right-aligned. */}
|
|
94
|
+
<TableCell width="100px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
95
|
+
<TableCell width="110px">
|
|
96
|
+
<Tag variant="textOnly" size="small" label={inv.status} />
|
|
97
|
+
</TableCell>
|
|
98
|
+
<TableCell width="130px">
|
|
99
|
+
{/* A real app links to the file on its own server. The name says which invoice and that it opens a tab. */}
|
|
100
|
+
<Button
|
|
101
|
+
size="small"
|
|
102
|
+
type="tertiary"
|
|
103
|
+
state="enabled"
|
|
104
|
+
label="Download"
|
|
105
|
+
aria-label={`Download invoice for ${inv.date}, opens in a new tab`}
|
|
106
|
+
actionIcon="ExternalLink"
|
|
107
|
+
href={`https://acme.example/invoices/${inv.id}.pdf`}
|
|
108
|
+
openInNewTab
|
|
109
|
+
/>
|
|
110
|
+
</TableCell>
|
|
111
|
+
</TableRow>
|
|
112
|
+
))}
|
|
113
|
+
</TableContainer>
|
|
114
|
+
{/* Shows nothing under 13 invoices. */}
|
|
115
|
+
<Pagination aria-label="Invoice pages" page={page} pageCount={pageCount} onPageChange={setPage} />
|
|
116
|
+
</>
|
|
117
|
+
)}
|
|
118
|
+
</Stack>
|
|
119
|
+
</Center>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Option: The next charge first
|
|
125
|
+
|
|
126
|
+
Use when: The next charge is not the plan price, for example after a member joined mid-month, so it comes first and says why.
|
|
127
|
+
|
|
128
|
+
Uses: `Button`, `Center`, `Heading`, `Paragraph`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `formatMoney`
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
'use client';
|
|
132
|
+
import { useState } from 'react';
|
|
133
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
134
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
135
|
+
import Button from 'oneslash-design-system/components/button';
|
|
136
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
137
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
138
|
+
import TableHeader from 'oneslash-design-system/components/tableHeader';
|
|
139
|
+
import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
|
|
140
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
141
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
142
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
143
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
144
|
+
|
|
145
|
+
// A real app reads these from the server. The plan is $8.00 a member each month; a fourth member
|
|
146
|
+
// joined on Nov 16, so the next charge also covers the 15 days left in November ($8.00 x 15/30).
|
|
147
|
+
const perMember = 8;
|
|
148
|
+
const members = 4;
|
|
149
|
+
const regular = perMember * members;
|
|
150
|
+
const added = 4;
|
|
151
|
+
const upcoming = { date: 'Dec 1, 2026', description: 'Pro plan, Dec 2026', amount: regular + added };
|
|
152
|
+
|
|
153
|
+
const paid = [
|
|
154
|
+
{ id: 'inv-0', date: 'Nov 1, 2026', description: 'Pro plan, Nov 2026', amount: 24, status: 'Paid' },
|
|
155
|
+
{ id: 'inv-1', date: 'Oct 1, 2026', description: 'Pro plan, Oct 2026', amount: 24, status: 'Paid' },
|
|
156
|
+
{ id: 'inv-2', date: 'Sep 1, 2026', description: 'Pro plan, Sep 2026', amount: 24, status: 'Paid' },
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
export default function InvoiceListWithUpcoming() {
|
|
160
|
+
const [explaining, setExplaining] = useState(false);
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<Center width="page">
|
|
164
|
+
<Stack gap="large">
|
|
165
|
+
<Heading level={2} size="h5">Invoices</Heading>
|
|
166
|
+
<TableContainer aria-label="Invoices" minWidth="640px">
|
|
167
|
+
<TableHeader>
|
|
168
|
+
<TableRow>
|
|
169
|
+
<TableHeaderCell width="130px">Date</TableHeaderCell>
|
|
170
|
+
<TableHeaderCell>Description</TableHeaderCell>
|
|
171
|
+
<TableHeaderCell width="100px" align="right">Amount</TableHeaderCell>
|
|
172
|
+
<TableHeaderCell width="110px">Status</TableHeaderCell>
|
|
173
|
+
<TableHeaderCell width="130px">Download</TableHeaderCell>
|
|
174
|
+
</TableRow>
|
|
175
|
+
</TableHeader>
|
|
176
|
+
{/* The next charge is the first row. It has no invoice yet, so it has no Download link. */}
|
|
177
|
+
<TableRow>
|
|
178
|
+
<TableCell width="130px">{upcoming.date}</TableCell>
|
|
179
|
+
<TableCell>
|
|
180
|
+
<Stack gap="small" align="start">
|
|
181
|
+
{upcoming.description}
|
|
182
|
+
{/* The label never changes. The state is in aria-expanded. */}
|
|
183
|
+
<Button
|
|
184
|
+
size="small"
|
|
185
|
+
type="tertiary"
|
|
186
|
+
state="enabled"
|
|
187
|
+
label="Why Is This Higher?"
|
|
188
|
+
aria-expanded={explaining}
|
|
189
|
+
aria-controls="invoice-list-upcoming-why"
|
|
190
|
+
onClickButton={() => setExplaining((open) => !open)}
|
|
191
|
+
/>
|
|
192
|
+
{explaining && (
|
|
193
|
+
<Paragraph id="invoice-list-upcoming-why" tone="secondary" size="body2" measure="none">
|
|
194
|
+
{`Your regular charge is ${formatMoney(regular)}: ${members} members at ${formatMoney(perMember)}. This one is ${formatMoney(upcoming.amount)} because it also adds ${formatMoney(added)} for Omar Reyes, who joined on Nov 16, for the 15 days left in November. It happens once. The charge after this is ${formatMoney(regular)}.`}
|
|
195
|
+
</Paragraph>
|
|
196
|
+
)}
|
|
197
|
+
</Stack>
|
|
198
|
+
</TableCell>
|
|
199
|
+
<TableCell width="100px" align="right">{formatMoney(upcoming.amount)}</TableCell>
|
|
200
|
+
<TableCell width="110px">
|
|
201
|
+
<Tag variant="dot" size="small" color="info" label="Upcoming" />
|
|
202
|
+
</TableCell>
|
|
203
|
+
<TableCell width="130px">{''}</TableCell>
|
|
204
|
+
</TableRow>
|
|
205
|
+
{paid.map((inv) => (
|
|
206
|
+
<TableRow key={inv.id}>
|
|
207
|
+
<TableCell width="130px">{inv.date}</TableCell>
|
|
208
|
+
<TableCell>{inv.description}</TableCell>
|
|
209
|
+
<TableCell width="100px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
210
|
+
<TableCell width="110px">
|
|
211
|
+
<Tag variant="textOnly" size="small" label={inv.status} />
|
|
212
|
+
</TableCell>
|
|
213
|
+
<TableCell width="130px">
|
|
214
|
+
{/* A real app links to the file on its own server. */}
|
|
215
|
+
<Button
|
|
216
|
+
size="small"
|
|
217
|
+
type="tertiary"
|
|
218
|
+
state="enabled"
|
|
219
|
+
label="Download"
|
|
220
|
+
aria-label={`Download invoice for ${inv.date}, opens in a new tab`}
|
|
221
|
+
actionIcon="ExternalLink"
|
|
222
|
+
href={`https://acme.example/invoices/${inv.id}.pdf`}
|
|
223
|
+
openInNewTab
|
|
224
|
+
/>
|
|
225
|
+
</TableCell>
|
|
226
|
+
</TableRow>
|
|
227
|
+
))}
|
|
228
|
+
</TableContainer>
|
|
229
|
+
</Stack>
|
|
230
|
+
</Center>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Native
|
|
236
|
+
|
|
237
|
+
On Apple use a `Table` of rows with a `Link` to the invoice, and a `DisclosureGroup` for the explanation. On Android use a list with a text button for the invoice.
|
|
@@ -7,7 +7,7 @@ import Alert from '../../components/alert';
|
|
|
7
7
|
import List from '../../components/list';
|
|
8
8
|
import Button from '../../components/button';
|
|
9
9
|
import { Center, Cluster, Stack } from '../../components/layout';
|
|
10
|
-
var invoices = ['November 2026: $
|
|
10
|
+
var invoices = ['November 2026: $24.00', 'October 2026: $24.00', 'September 2026: $24.00'];
|
|
11
11
|
export default function LoadFailureInline() {
|
|
12
12
|
var _a = useState('Could not load your invoices.'), error = _a[0], setError = _a[1];
|
|
13
13
|
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
@@ -29,7 +29,7 @@ export default function LoadFailureInline() {
|
|
|
29
29
|
<Surface padding="large">
|
|
30
30
|
<Stack gap="medium">
|
|
31
31
|
<Heading level={2} size="h6">Plan</Heading>
|
|
32
|
-
<Paragraph size="body2" measure="none">
|
|
32
|
+
<Paragraph size="body2" measure="none">Pro plan, 3 members, renews on Dec 1, 2026.</Paragraph>
|
|
33
33
|
<Cluster>
|
|
34
34
|
<Button size="small" type="secondary" state="enabled" label="Change Plan"/>
|
|
35
35
|
</Cluster>
|
|
@@ -92,7 +92,7 @@ import List from 'oneslash-design-system/components/list';
|
|
|
92
92
|
import Button from 'oneslash-design-system/components/button';
|
|
93
93
|
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
94
94
|
|
|
95
|
-
const invoices = ['November 2026: $
|
|
95
|
+
const invoices = ['November 2026: $24.00', 'October 2026: $24.00', 'September 2026: $24.00'];
|
|
96
96
|
|
|
97
97
|
export default function LoadFailureInline() {
|
|
98
98
|
const [error, setError] = useState('Could not load your invoices.');
|
|
@@ -118,7 +118,7 @@ export default function LoadFailureInline() {
|
|
|
118
118
|
<Surface padding="large">
|
|
119
119
|
<Stack gap="medium">
|
|
120
120
|
<Heading level={2} size="h6">Plan</Heading>
|
|
121
|
-
<Paragraph size="body2" measure="none">
|
|
121
|
+
<Paragraph size="body2" measure="none">Pro plan, 3 members, renews on Dec 1, 2026.</Paragraph>
|
|
122
122
|
<Cluster>
|
|
123
123
|
<Button size="small" type="secondary" state="enabled" label="Change Plan" />
|
|
124
124
|
</Cluster>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MasterDetailListThenPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Navigation from '../../components/navigation';
|
|
4
|
+
import MenuItem from '../../components/menuItem';
|
|
5
|
+
import TitleBar from '../../components/titleBar';
|
|
6
|
+
import Heading from '../../components/heading';
|
|
7
|
+
import Paragraph from '../../components/paragraph';
|
|
8
|
+
import Button from '../../components/button';
|
|
9
|
+
import PageShell from '../../components/pageShell';
|
|
10
|
+
import { Stack } from '../../components/layout';
|
|
11
|
+
var reports = [
|
|
12
|
+
{
|
|
13
|
+
id: 'q3-review',
|
|
14
|
+
title: 'Q3 review',
|
|
15
|
+
summary: 'Revenue, churn and what changed since June.',
|
|
16
|
+
body: [
|
|
17
|
+
'Revenue grew 12 percent over the quarter, led by the new team plan. Churn fell to 2.1 percent.',
|
|
18
|
+
'Support tickets about sign-up dropped by a third after the new form shipped in August.',
|
|
19
|
+
'The main risk is the pricing page, which still sends people to a contact form. Ben Carter owns the fix.',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'hiring-plan',
|
|
24
|
+
title: 'Hiring plan',
|
|
25
|
+
summary: 'Roles to open next half, and why.',
|
|
26
|
+
body: [
|
|
27
|
+
'Two roles open in January: a designer for the web app and a support lead.',
|
|
28
|
+
'Omar Reyes will write both job posts. Dana Lee approves the budget on Monday.',
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'roadmap',
|
|
33
|
+
title: 'Roadmap',
|
|
34
|
+
summary: 'What ships, in order, through March.',
|
|
35
|
+
body: [
|
|
36
|
+
'The mobile app and the new billing page ship first. Integrations follow in February.',
|
|
37
|
+
'Each item lists its owner, its date and what must be true before it starts.',
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
export default function MasterDetailListThenPage() {
|
|
42
|
+
var _a = useState(null), openId = _a[0], setOpenId = _a[1];
|
|
43
|
+
var report = reports.find(function (r) { return r.id === openId; });
|
|
44
|
+
// A real app goes to the page's address. Back calls the router's back() when the person came from the list, so the list keeps its scroll,
|
|
45
|
+
// and otherwise links to the list's address. The example swaps the view.
|
|
46
|
+
if (report) {
|
|
47
|
+
return (<PageShell>
|
|
48
|
+
<Stack gap="large">
|
|
49
|
+
<TitleBar title={report.title} back={<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Reports" onClickButton={function () { return setOpenId(null); }}/>}/>
|
|
50
|
+
{report.body.map(function (paragraph) { return (<Paragraph key={paragraph} measure="body">{paragraph}</Paragraph>); })}
|
|
51
|
+
</Stack>
|
|
52
|
+
</PageShell>);
|
|
53
|
+
}
|
|
54
|
+
return (<PageShell>
|
|
55
|
+
<Stack gap="large">
|
|
56
|
+
<Heading level={1} size="h5">Reports</Heading>
|
|
57
|
+
<Navigation aria-label="Reports">
|
|
58
|
+
{reports.map(function (r) { return (<MenuItem key={r.id} size="medium" label={r.title} secondLabel={r.summary} iconRight="ChevronRight" href={"/reports/".concat(r.id)} onClick={function (event) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
setOpenId(r.id);
|
|
61
|
+
}}/>); })}
|
|
62
|
+
</Navigation>
|
|
63
|
+
</Stack>
|
|
64
|
+
</PageShell>);
|
|
65
|
+
}
|