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.
- package/README.md +1 -1
- package/dist/DESIGN.md +28 -4
- 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/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/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/number-format.md +36 -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/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/settings-page/top-tabs.jsx +4 -3
- package/dist/cases/settings-page.md +5 -4
- 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/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 +956 -19
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.jsx +11 -5
- package/dist/components/formatNumber.d.ts +25 -0
- package/dist/components/formatNumber.js +125 -0
- package/dist/components/iconButton.jsx +12 -7
- package/dist/components/pagination.d.ts +28 -0
- package/dist/components/pagination.jsx +89 -0
- package/dist/components/progress.d.ts +33 -0
- package/dist/components/progress.jsx +50 -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 +3 -1
- package/dist/components/titleBar.jsx +4 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/native-mapping.json +26 -2
- 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 +26 -0
- package/dist/stories/Cases.generated.stories.jsx +52 -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/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 +1 -0
- package/dist/stories/TitleBar.stories.jsx +7 -0
- package/package.json +5 -1
|
@@ -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>
|
|
@@ -35,6 +35,7 @@ import Tag from '../../components/tag';
|
|
|
35
35
|
import Button from '../../components/button';
|
|
36
36
|
import UserImage from '../../components/userImage';
|
|
37
37
|
import { Center, Cluster, Stack } from '../../components/layout';
|
|
38
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
38
39
|
// A real app reads these from the signed-in person and the plan.
|
|
39
40
|
var youId = 'dana';
|
|
40
41
|
var canManage = true;
|
|
@@ -312,7 +313,7 @@ export default function MembersListRows() {
|
|
|
312
313
|
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
313
314
|
<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
314
315
|
</>}>
|
|
315
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
316
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
316
317
|
</Modal>
|
|
317
318
|
</Center>);
|
|
318
319
|
}
|
|
@@ -37,6 +37,7 @@ import Tag from '../../components/tag';
|
|
|
37
37
|
import Button from '../../components/button';
|
|
38
38
|
import UserImage from '../../components/userImage';
|
|
39
39
|
import { Center, Cluster, Stack } from '../../components/layout';
|
|
40
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
40
41
|
// A real app reads these from the signed-in person and the plan.
|
|
41
42
|
var youId = 'dana';
|
|
42
43
|
var canManage = true;
|
|
@@ -124,12 +125,10 @@ export default function MembersListTable() {
|
|
|
124
125
|
var order = sort.by === 'name' ? byName : roleRank(roles[a.id]) - roleRank(roles[b.id]) || byName;
|
|
125
126
|
return sort.dir === 'ascending' ? order : -order;
|
|
126
127
|
});
|
|
127
|
-
// The header cell has
|
|
128
|
+
// The sorted column's header cell has `sort`; the other cells leave it unset. The Button is named by its label alone.
|
|
128
129
|
function sortButton(by, label) {
|
|
129
130
|
var active = sort.by === by;
|
|
130
|
-
|
|
131
|
-
var now = active ? "sorted ".concat(sort.dir) : 'not sorted';
|
|
132
|
-
return (<Button size="small" type="tertiary" state={active ? 'selected' : 'enabled'} label={label} aria-label={"".concat(label, ", ").concat(now, ". Sort ").concat(next, ".")} decoIcon={active ? (sort.dir === 'ascending' ? 'ArrowUp' : 'ArrowDown') : undefined} onClickButton={function () { return handleSort(by); }}/>);
|
|
131
|
+
return (<Button size="small" type="tertiary" state={active ? 'selected' : 'enabled'} label={label} decoIcon={active ? (sort.dir === 'ascending' ? 'ArrowUp' : 'ArrowDown') : undefined} onClickButton={function () { return handleSort(by); }}/>);
|
|
133
132
|
}
|
|
134
133
|
// The role is one control on its own, so it saves as soon as it changes. Nothing shows when it works.
|
|
135
134
|
function handleRoleChange(member, next) {
|
|
@@ -259,11 +258,11 @@ export default function MembersListTable() {
|
|
|
259
258
|
{!canManage && <Paragraph tone="secondary" size="body2" measure="none">Only admins can change this.</Paragraph>}
|
|
260
259
|
</Stack>
|
|
261
260
|
|
|
262
|
-
<TableContainer>
|
|
261
|
+
<TableContainer aria-label="Members" minWidth="720px">
|
|
263
262
|
<TableHeader>
|
|
264
263
|
<TableRow>
|
|
265
|
-
<TableHeaderCell>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
266
|
-
<TableHeaderCell width="170px">{sortButton('role', 'Role')}</TableHeaderCell>
|
|
264
|
+
<TableHeaderCell sort={sort.by === 'name' ? sort.dir : undefined}>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
265
|
+
<TableHeaderCell width="170px" sort={sort.by === 'role' ? sort.dir : undefined}>{sortButton('role', 'Role')}</TableHeaderCell>
|
|
267
266
|
<TableHeaderCell width="340px">Actions</TableHeaderCell>
|
|
268
267
|
</TableRow>
|
|
269
268
|
</TableHeader>
|
|
@@ -304,7 +303,7 @@ export default function MembersListTable() {
|
|
|
304
303
|
|
|
305
304
|
{canManage && invites.length > 0 && (<Stack gap="small">
|
|
306
305
|
<Heading level={2} size="subtitle1">Pending invites</Heading>
|
|
307
|
-
<TableContainer>
|
|
306
|
+
<TableContainer aria-label="Pending invites" minWidth="720px">
|
|
308
307
|
{invites.map(function (i) { return (<TableRow key={i.id}>
|
|
309
308
|
<TableCell>
|
|
310
309
|
<Cluster gap="small">
|
|
@@ -345,7 +344,7 @@ export default function MembersListTable() {
|
|
|
345
344
|
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
346
345
|
<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
347
346
|
</>}>
|
|
348
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
347
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
349
348
|
</Modal>
|
|
350
349
|
</Center>);
|
|
351
350
|
}
|
|
@@ -17,7 +17,7 @@ An admin sees who is in the workspace, changes their roles, removes people and i
|
|
|
17
17
|
- Open the Modal of the case 'Member invite' from an 'Invite Member' Button. Count a pending invite as a seat, because it holds one until it is accepted or revoked.
|
|
18
18
|
- Keep 'Invite Member' pressable at the seat limit. Open the Modal of the case 'Upgrade prompt', titled 'Upgrade to Pro', that says all the seats are filled.
|
|
19
19
|
- Say how many seats are used under the title: '7 of 8 seats used on the Free plan.'
|
|
20
|
-
- Sort a table by a Button in the header cell. `
|
|
20
|
+
- Sort a table by a Button in the header cell. Set `sort` on the `TableHeaderCell` of the sorted column only, and leave it unset on the others. The Button is named by its label alone: 'Name'.
|
|
21
21
|
- Use `state="selected"` and an arrow on the Button of the column that is sorted. The first press sorts A to Z and the next one reverses it.
|
|
22
22
|
|
|
23
23
|
## Don't
|
|
@@ -34,7 +34,7 @@ An admin sees who is in the workspace, changes their roles, removes people and i
|
|
|
34
34
|
|
|
35
35
|
Use when: A workspace of a few dozen people, so the whole list fits and a person finds someone by looking.
|
|
36
36
|
|
|
37
|
-
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `toast`
|
|
37
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `formatMoney`, `toast`
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
40
40
|
'use client';
|
|
@@ -54,6 +54,7 @@ import Tag from 'oneslash-design-system/components/tag';
|
|
|
54
54
|
import Button from 'oneslash-design-system/components/button';
|
|
55
55
|
import UserImage from 'oneslash-design-system/components/userImage';
|
|
56
56
|
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
57
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
57
58
|
|
|
58
59
|
type Member = { id: string; name: string; email: string; role: string };
|
|
59
60
|
type Invite = { id: string; email: string; sent: string; link: string };
|
|
@@ -382,7 +383,7 @@ export default function MembersListRows() {
|
|
|
382
383
|
</>
|
|
383
384
|
}
|
|
384
385
|
>
|
|
385
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
386
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
386
387
|
</Modal>
|
|
387
388
|
</Center>
|
|
388
389
|
);
|
|
@@ -393,7 +394,7 @@ export default function MembersListRows() {
|
|
|
393
394
|
|
|
394
395
|
Use when: More people than a person can scan. The columns Name and Role sort.
|
|
395
396
|
|
|
396
|
-
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `toast`
|
|
397
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `formatMoney`, `toast`
|
|
397
398
|
|
|
398
399
|
```tsx
|
|
399
400
|
'use client';
|
|
@@ -415,6 +416,7 @@ import Tag from 'oneslash-design-system/components/tag';
|
|
|
415
416
|
import Button from 'oneslash-design-system/components/button';
|
|
416
417
|
import UserImage from 'oneslash-design-system/components/userImage';
|
|
417
418
|
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
419
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
418
420
|
|
|
419
421
|
type Member = { id: string; name: string; email: string; role: string };
|
|
420
422
|
type Invite = { id: string; email: string; sent: string; link: string };
|
|
@@ -520,18 +522,15 @@ export default function MembersListTable() {
|
|
|
520
522
|
return sort.dir === 'ascending' ? order : -order;
|
|
521
523
|
});
|
|
522
524
|
|
|
523
|
-
// The header cell has
|
|
525
|
+
// The sorted column's header cell has `sort`; the other cells leave it unset. The Button is named by its label alone.
|
|
524
526
|
function sortButton(by: 'name' | 'role', label: string) {
|
|
525
527
|
const active = sort.by === by;
|
|
526
|
-
const next = active && sort.dir === 'ascending' ? 'descending' : 'ascending';
|
|
527
|
-
const now = active ? `sorted ${sort.dir}` : 'not sorted';
|
|
528
528
|
return (
|
|
529
529
|
<Button
|
|
530
530
|
size="small"
|
|
531
531
|
type="tertiary"
|
|
532
532
|
state={active ? 'selected' : 'enabled'}
|
|
533
533
|
label={label}
|
|
534
|
-
aria-label={`${label}, ${now}. Sort ${next}.`}
|
|
535
534
|
decoIcon={active ? (sort.dir === 'ascending' ? 'ArrowUp' : 'ArrowDown') : undefined}
|
|
536
535
|
onClickButton={() => handleSort(by)}
|
|
537
536
|
/>
|
|
@@ -656,11 +655,11 @@ export default function MembersListTable() {
|
|
|
656
655
|
{!canManage && <Paragraph tone="secondary" size="body2" measure="none">Only admins can change this.</Paragraph>}
|
|
657
656
|
</Stack>
|
|
658
657
|
|
|
659
|
-
<TableContainer>
|
|
658
|
+
<TableContainer aria-label="Members" minWidth="720px">
|
|
660
659
|
<TableHeader>
|
|
661
660
|
<TableRow>
|
|
662
|
-
<TableHeaderCell>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
663
|
-
<TableHeaderCell width="170px">{sortButton('role', 'Role')}</TableHeaderCell>
|
|
661
|
+
<TableHeaderCell sort={sort.by === 'name' ? sort.dir : undefined}>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
662
|
+
<TableHeaderCell width="170px" sort={sort.by === 'role' ? sort.dir : undefined}>{sortButton('role', 'Role')}</TableHeaderCell>
|
|
664
663
|
<TableHeaderCell width="340px">Actions</TableHeaderCell>
|
|
665
664
|
</TableRow>
|
|
666
665
|
</TableHeader>
|
|
@@ -722,7 +721,7 @@ export default function MembersListTable() {
|
|
|
722
721
|
{canManage && invites.length > 0 && (
|
|
723
722
|
<Stack gap="small">
|
|
724
723
|
<Heading level={2} size="subtitle1">Pending invites</Heading>
|
|
725
|
-
<TableContainer>
|
|
724
|
+
<TableContainer aria-label="Pending invites" minWidth="720px">
|
|
726
725
|
{invites.map((i) => (
|
|
727
726
|
<TableRow key={i.id}>
|
|
728
727
|
<TableCell>
|
|
@@ -787,7 +786,7 @@ export default function MembersListTable() {
|
|
|
787
786
|
</>
|
|
788
787
|
}
|
|
789
788
|
>
|
|
790
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
789
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
791
790
|
</Modal>
|
|
792
791
|
</Center>
|
|
793
792
|
);
|