oneslash-design-system 2.24.0 → 2.25.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 +8 -4
- package/dist/cases/ask-page/answered.jsx +10 -2
- package/dist/cases/ask-page.md +12 -3
- package/dist/cases/billing-page/self-serve.jsx +4 -4
- package/dist/cases/billing-page/trial.d.ts +1 -0
- package/dist/cases/billing-page/trial.jsx +115 -0
- package/dist/cases/billing-page.md +166 -5
- package/dist/cases/collapsible-search/popover.jsx +1 -1
- package/dist/cases/collapsible-search.md +2 -2
- package/dist/cases/cookie-choice/banner.d.ts +1 -0
- package/dist/cases/cookie-choice/banner.jsx +82 -0
- package/dist/cases/cookie-choice/settings.d.ts +1 -0
- package/dist/cases/cookie-choice/settings.jsx +75 -0
- package/dist/cases/cookie-choice.md +234 -0
- package/dist/cases/dashboard/numbers-first.jsx +1 -1
- package/dist/cases/dashboard/work-first.jsx +1 -1
- package/dist/cases/dashboard.md +2 -2
- package/dist/cases/data-table-page/all-rows.jsx +1 -1
- package/dist/cases/data-table-page/paged.jsx +1 -1
- package/dist/cases/data-table-page.md +2 -2
- package/dist/cases/invoice-list/table.jsx +21 -9
- package/dist/cases/invoice-list.md +27 -12
- package/dist/cases/message-reactions/picker.jsx +1 -1
- package/dist/cases/message-reactions.md +2 -2
- package/dist/cases/message-row.md +2 -1
- package/dist/cases/newsletter-signup/inline.d.ts +1 -0
- package/dist/cases/newsletter-signup/inline.jsx +72 -0
- package/dist/cases/newsletter-signup/section.d.ts +1 -0
- package/dist/cases/newsletter-signup/section.jsx +72 -0
- package/dist/cases/newsletter-signup.md +234 -0
- package/dist/cases/number-format.md +6 -2
- package/dist/cases/people-row/stack.jsx +1 -1
- package/dist/cases/people-row.md +2 -2
- package/dist/cases/plan-comparison/table.d.ts +1 -0
- package/dist/cases/plan-comparison/table.jsx +47 -0
- package/dist/cases/plan-comparison.md +94 -0
- package/dist/cases/plan-picker.md +1 -0
- package/dist/cases/pricing-section.md +1 -1
- package/dist/cases/site-footer/columns.jsx +2 -1
- package/dist/cases/site-footer.md +3 -1
- package/dist/cases/stat-row/tiles.jsx +2 -1
- package/dist/cases/stat-row.md +4 -1
- package/dist/cases/task-header/agent-sets-status.jsx +1 -1
- package/dist/cases/task-header/people-change-status.jsx +1 -1
- package/dist/cases/task-header.md +2 -2
- package/dist/cases.json +243 -28
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +5 -5
- package/dist/components/barChart.jsx +4 -2
- package/dist/components/dateField.jsx +1 -1
- package/dist/components/formatNumber.d.ts +10 -2
- package/dist/components/formatNumber.js +44 -9
- package/dist/components/layout.d.ts +4 -2
- package/dist/components/layout.jsx +13 -2
- package/dist/components/markdown.d.ts +24 -0
- package/dist/components/markdown.jsx +81 -0
- package/dist/components/pageShell.d.ts +3 -3
- package/dist/components/pageShell.jsx +6 -5
- package/dist/components/popover.d.ts +5 -1
- package/dist/components/popover.jsx +3 -2
- package/dist/components/progress.jsx +1 -1
- package/dist/components/select.jsx +5 -2
- package/dist/components/statTile.d.ts +1 -1
- package/dist/components/statTile.jsx +7 -2
- package/dist/components/tableCell.d.ts +4 -3
- package/dist/components/tableCell.jsx +2 -2
- package/dist/components/toaster.jsx +81 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/markdown.d.ts +40 -0
- package/dist/internal/markdown.js +577 -0
- package/dist/internal/toaster.d.ts +2 -0
- package/dist/internal/toaster.js +8 -0
- package/dist/native-mapping.json +9 -3
- package/dist/stories/Cases.generated.stories.d.ts +6 -0
- package/dist/stories/Cases.generated.stories.jsx +12 -0
- package/dist/stories/Markdown.stories.d.ts +9 -0
- package/dist/stories/Markdown.stories.jsx +66 -0
- package/dist/stories/Popover.stories.d.ts +2 -0
- package/dist/stories/Popover.stories.jsx +33 -0
- package/dist/stories/StatTile.stories.d.ts +4 -0
- package/dist/stories/StatTile.stories.jsx +47 -2
- package/dist/stories/Toaster.stories.d.ts +4 -0
- package/dist/stories/Toaster.stories.jsx +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Surface from '../../components/surface';
|
|
4
|
+
import Heading from '../../components/heading';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import Button from '../../components/button';
|
|
7
|
+
import Modal from '../../components/modal';
|
|
8
|
+
import Switch from '../../components/switch';
|
|
9
|
+
import SiteHeader from '../../components/siteHeader';
|
|
10
|
+
import PageShell from '../../components/pageShell';
|
|
11
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
12
|
+
var links = [
|
|
13
|
+
{ label: 'Features', href: '#features' },
|
|
14
|
+
{ label: 'Pricing', href: '#pricing' },
|
|
15
|
+
{ label: 'Docs', href: '#docs' },
|
|
16
|
+
];
|
|
17
|
+
export default function CookieChoiceBanner() {
|
|
18
|
+
var _a = useState(false), chosen = _a[0], setChosen = _a[1];
|
|
19
|
+
var _b = useState(false), choosing = _b[0], setChoosing = _b[1];
|
|
20
|
+
// Every optional cookie starts off. Only the visitor turns one on.
|
|
21
|
+
var _c = useState(false), visits = _c[0], setVisits = _c[1];
|
|
22
|
+
var _d = useState(false), marketing = _d[0], setMarketing = _d[1];
|
|
23
|
+
var main = useRef(null);
|
|
24
|
+
// The banner is gone, so focus moves to the page the visitor came to read.
|
|
25
|
+
// This runs after the Modal has tried to give focus back to 'Choose Cookies', which is gone too.
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
var _a;
|
|
28
|
+
if (chosen)
|
|
29
|
+
(_a = main.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
30
|
+
}, [chosen]);
|
|
31
|
+
// A real site keeps the choice in the browser, and sets a visit count or marketing cookie only when it is on.
|
|
32
|
+
function choose(next) {
|
|
33
|
+
setVisits(next.visits);
|
|
34
|
+
setMarketing(next.marketing);
|
|
35
|
+
setChoosing(false);
|
|
36
|
+
setChosen(true);
|
|
37
|
+
}
|
|
38
|
+
// Cancel puts every switch back off. The banner stays until the visitor chooses.
|
|
39
|
+
function handleCancel() {
|
|
40
|
+
setVisits(false);
|
|
41
|
+
setMarketing(false);
|
|
42
|
+
setChoosing(false);
|
|
43
|
+
}
|
|
44
|
+
return (<>
|
|
45
|
+
{/* In the page flow, before the header, so Tab reaches it first. It never covers the page, and the page stays usable. */}
|
|
46
|
+
{!chosen && (<Center width="page">
|
|
47
|
+
<Surface padding="small">
|
|
48
|
+
<Stack gap="medium">
|
|
49
|
+
<Stack gap="small">
|
|
50
|
+
<Heading level={2} size="h6">Cookies on Acme</Heading>
|
|
51
|
+
<Paragraph size="body2" measure="none">Acme uses cookies to keep you logged in. Accept All also allows cookies that count visits and cookies for marketing. Reject All turns both off.</Paragraph>
|
|
52
|
+
</Stack>
|
|
53
|
+
{/* Accept and Reject have the same weight, side by side. Neither is the page's main action. */}
|
|
54
|
+
<Cluster gap="small">
|
|
55
|
+
<Button size="medium" type="secondary" state="enabled" label="Accept All" onClickButton={function () { return choose({ visits: true, marketing: true }); }}/>
|
|
56
|
+
<Button size="medium" type="secondary" state="enabled" label="Reject All" onClickButton={function () { return choose({ visits: false, marketing: false }); }}/>
|
|
57
|
+
<Button size="medium" type="tertiary" state="enabled" label="Choose Cookies" onClickButton={function () { return setChoosing(true); }}/>
|
|
58
|
+
</Cluster>
|
|
59
|
+
</Stack>
|
|
60
|
+
</Surface>
|
|
61
|
+
</Center>)}
|
|
62
|
+
<SiteHeader brand={{ href: '#top', name: 'Acme' }} links={links} actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in"/>} phoneAction={<Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up"/>} mainId="cookie-choice-banner-main"/>
|
|
63
|
+
{/* tabIndex -1 lets the skip link and the banner move focus here. */}
|
|
64
|
+
<PageShell ref={main} id="cookie-choice-banner-main" tabIndex={-1}>
|
|
65
|
+
<Stack gap="large">
|
|
66
|
+
<Heading level={1} size="h5">Share files and decide together</Heading>
|
|
67
|
+
<Paragraph tone="secondary" measure="none">Acme keeps a small team's files, notes and decisions in one place.</Paragraph>
|
|
68
|
+
</Stack>
|
|
69
|
+
</PageShell>
|
|
70
|
+
<Modal isOpen={choosing} size="small" title="Cookie Settings" onClose={handleCancel} actions={<>
|
|
71
|
+
<Button size="small" type="tertiary" state="enabled" label="Cancel" onClickButton={handleCancel}/>
|
|
72
|
+
{/* No choice is saved yet, so Save is enabled at once: saving every switch off is a choice. */}
|
|
73
|
+
<Button size="small" type="primary" state="enabled" label="Save Choices" onClickButton={function () { return choose({ visits: visits, marketing: marketing }); }}/>
|
|
74
|
+
</>}>
|
|
75
|
+
<Stack gap="medium">
|
|
76
|
+
<Switch id="cookie-choice-banner-needed" label="Needed to run the site" description="Keeps you logged in. Always on." checked disabled onChange={function () { }}/>
|
|
77
|
+
<Switch id="cookie-choice-banner-visits" label="Visit counts" checked={visits} onChange={setVisits}/>
|
|
78
|
+
<Switch id="cookie-choice-banner-marketing" label="Marketing" checked={marketing} onChange={setMarketing}/>
|
|
79
|
+
</Stack>
|
|
80
|
+
</Modal>
|
|
81
|
+
</>);
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CookieChoiceSettings(): import("react").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
import { useEffect, useRef, useState } from 'react';
|
|
14
|
+
import Modal from '../../components/modal';
|
|
15
|
+
import Switch from '../../components/switch';
|
|
16
|
+
import Button from '../../components/button';
|
|
17
|
+
import Heading from '../../components/heading';
|
|
18
|
+
import Paragraph from '../../components/paragraph';
|
|
19
|
+
import SiteFooter from '../../components/siteFooter';
|
|
20
|
+
import { Center, Stack } from '../../components/layout';
|
|
21
|
+
export default function CookieChoiceSettings() {
|
|
22
|
+
// Opens on the Modal, as if the visitor just chose 'Cookie Settings' in the footer.
|
|
23
|
+
var _a = useState(true), open = _a[0], setOpen = _a[1];
|
|
24
|
+
// The visitor's last choice, kept in the browser. Here they chose Reject All, so every optional cookie is off.
|
|
25
|
+
var _b = useState({ visits: false, marketing: false }), saved = _b[0], setSaved = _b[1];
|
|
26
|
+
var _c = useState(saved), draft = _c[0], setDraft = _c[1];
|
|
27
|
+
var _d = useState(false), justSaved = _d[0], setJustSaved = _d[1];
|
|
28
|
+
var savedTimer = useRef();
|
|
29
|
+
// Save is disabled while the switches match what was saved, and while 'Saved' shows it stays enabled.
|
|
30
|
+
var changed = draft.visits !== saved.visits || draft.marketing !== saved.marketing;
|
|
31
|
+
// Stops the 'Saved' timer if the example goes away before it ends.
|
|
32
|
+
useEffect(function () { return function () { return clearTimeout(savedTimer.current); }; }, []);
|
|
33
|
+
// One Save for the group. The choice is kept in the browser, so it saves at once, and 'Saved' shows for 2 seconds.
|
|
34
|
+
// A press while 'Saved' shows and nothing changed does nothing.
|
|
35
|
+
function handleSave() {
|
|
36
|
+
if (!changed)
|
|
37
|
+
return;
|
|
38
|
+
setSaved(draft);
|
|
39
|
+
setJustSaved(true);
|
|
40
|
+
clearTimeout(savedTimer.current);
|
|
41
|
+
savedTimer.current = setTimeout(function () { return setJustSaved(false); }, 2000);
|
|
42
|
+
}
|
|
43
|
+
// Cancel, Escape and a click outside drop what was not saved.
|
|
44
|
+
function handleClose() {
|
|
45
|
+
setDraft(saved);
|
|
46
|
+
setJustSaved(false);
|
|
47
|
+
setOpen(false);
|
|
48
|
+
}
|
|
49
|
+
return (<>
|
|
50
|
+
<Stack gap="huge">
|
|
51
|
+
<Center width="page">
|
|
52
|
+
<Stack gap="large">
|
|
53
|
+
<Heading level={1} size="h5">Privacy</Heading>
|
|
54
|
+
<Paragraph tone="secondary" measure="none">Acme uses cookies to keep you logged in. Visit counts and marketing stay off until you turn them on.</Paragraph>
|
|
55
|
+
</Stack>
|
|
56
|
+
</Center>
|
|
57
|
+
{/* The footer's 'Cookie Settings' link comes to this page, which opens the Modal. The visitor can change the choice at any time. */}
|
|
58
|
+
<SiteFooter brand={{ href: '#top', name: 'Acme' }} links={[
|
|
59
|
+
{ label: 'Terms', href: '#terms' },
|
|
60
|
+
{ label: 'Privacy', href: '#privacy' },
|
|
61
|
+
{ label: 'Cookie Settings', href: '#cookie-settings' },
|
|
62
|
+
]} legal="© 2026 Acme. All rights reserved."/>
|
|
63
|
+
</Stack>
|
|
64
|
+
<Modal isOpen={open} size="small" title="Cookie Settings" onClose={handleClose} actions={<>
|
|
65
|
+
<Button size="small" type="tertiary" state="enabled" label="Cancel" onClickButton={handleClose}/>
|
|
66
|
+
<Button size="small" type="primary" state={changed || justSaved ? 'enabled' : 'disabled'} label={justSaved ? 'Saved' : 'Save Choices'} onClickButton={handleSave}/>
|
|
67
|
+
</>}>
|
|
68
|
+
<Stack gap="medium">
|
|
69
|
+
<Switch id="cookie-choice-settings-needed" label="Needed to run the site" description="Keeps you logged in. Always on." checked disabled onChange={function () { }}/>
|
|
70
|
+
<Switch id="cookie-choice-settings-visits" label="Visit counts" checked={draft.visits} onChange={function (visits) { return setDraft(function (d) { return (__assign(__assign({}, d), { visits: visits })); }); }}/>
|
|
71
|
+
<Switch id="cookie-choice-settings-marketing" label="Marketing" checked={draft.marketing} onChange={function (marketing) { return setDraft(function (d) { return (__assign(__assign({}, d), { marketing: marketing })); }); }}/>
|
|
72
|
+
</Stack>
|
|
73
|
+
</Modal>
|
|
74
|
+
</>);
|
|
75
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Cookie choice
|
|
2
|
+
|
|
3
|
+
A site sets cookies it does not need to run, and asks the visitor whether it may.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Ask only when the site sets a cookie it does not need. A cookie that keeps a person logged in needs no question.
|
|
8
|
+
- Put the banner in a `Surface` at the top of the page, in the normal flow, before the `SiteHeader`, so Tab reaches it first and it covers nothing.
|
|
9
|
+
- Name it with a `Heading level={2}` 'Cookies on Acme', and say in one `Paragraph` what each choice does: 'Acme uses cookies to keep you logged in. Accept All also allows cookies that count visits and cookies for marketing. Reject All turns both off.'
|
|
10
|
+
- Make Reject as easy as Accept: 'Accept All' and 'Reject All' are both secondary, side by side, then a tertiary 'Choose Cookies'.
|
|
11
|
+
- Remove the banner on any choice and move focus to the page's `main`. Give `PageShell` a `ref` and `tabIndex={-1}`.
|
|
12
|
+
- Show the choices in a `Modal` 'Cookie Settings' with one `Switch` for each kind: 'Needed to run the site' on and `disabled`, then 'Visit counts' and 'Marketing'.
|
|
13
|
+
- Leave every choice off until the visitor turns it on.
|
|
14
|
+
- Give the group one Save Button, 'Save Choices', with 'Cancel' beside it, as the rule 'A setting saves in place, or with one Save Button' says. Every Switch here waits for it, and none saves on its own.
|
|
15
|
+
- Keep it disabled until a switch changes from what was saved, then show 'Saved' in place of the label for 2 seconds. From the banner nothing is saved yet, so 'Save Choices' is enabled at once.
|
|
16
|
+
- Link 'Cookie Settings' in the footer to the page that holds the choice, such as the privacy page, and open the `Modal` there. The visitor can change the choice at any time.
|
|
17
|
+
|
|
18
|
+
## Don't
|
|
19
|
+
|
|
20
|
+
- Do not fix a banner over the page. It hides content at 375px and at 400% zoom.
|
|
21
|
+
- Do not make 'Accept' the only primary Button. Consent is not the page's main action.
|
|
22
|
+
- Do not block the page behind a wall until the visitor chooses.
|
|
23
|
+
- Do not turn a switch on before the visitor chooses.
|
|
24
|
+
- Do not hide Reject in the settings. It sits beside Accept.
|
|
25
|
+
|
|
26
|
+
## Option: Banner at the top of the page
|
|
27
|
+
|
|
28
|
+
Use when: The site sets cookies it does not need to run, such as for visit counts, and the visitor has not chosen yet.
|
|
29
|
+
|
|
30
|
+
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Modal`, `PageShell`, `Paragraph`, `SiteHeader`, `Stack`, `Surface`, `Switch`
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
'use client';
|
|
34
|
+
import { useEffect, useRef, useState } from 'react';
|
|
35
|
+
import Surface from 'oneslash-design-system/components/surface';
|
|
36
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
37
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
38
|
+
import Button from 'oneslash-design-system/components/button';
|
|
39
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
40
|
+
import Switch from 'oneslash-design-system/components/switch';
|
|
41
|
+
import SiteHeader from 'oneslash-design-system/components/siteHeader';
|
|
42
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
43
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
44
|
+
|
|
45
|
+
const links = [
|
|
46
|
+
{ label: 'Features', href: '#features' },
|
|
47
|
+
{ label: 'Pricing', href: '#pricing' },
|
|
48
|
+
{ label: 'Docs', href: '#docs' },
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export default function CookieChoiceBanner() {
|
|
52
|
+
const [chosen, setChosen] = useState(false);
|
|
53
|
+
const [choosing, setChoosing] = useState(false);
|
|
54
|
+
// Every optional cookie starts off. Only the visitor turns one on.
|
|
55
|
+
const [visits, setVisits] = useState(false);
|
|
56
|
+
const [marketing, setMarketing] = useState(false);
|
|
57
|
+
const main = useRef<HTMLElement>(null);
|
|
58
|
+
|
|
59
|
+
// The banner is gone, so focus moves to the page the visitor came to read.
|
|
60
|
+
// This runs after the Modal has tried to give focus back to 'Choose Cookies', which is gone too.
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (chosen) main.current?.focus({ preventScroll: true });
|
|
63
|
+
}, [chosen]);
|
|
64
|
+
|
|
65
|
+
// A real site keeps the choice in the browser, and sets a visit count or marketing cookie only when it is on.
|
|
66
|
+
function choose(next: { visits: boolean; marketing: boolean }) {
|
|
67
|
+
setVisits(next.visits);
|
|
68
|
+
setMarketing(next.marketing);
|
|
69
|
+
setChoosing(false);
|
|
70
|
+
setChosen(true);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Cancel puts every switch back off. The banner stays until the visitor chooses.
|
|
74
|
+
function handleCancel() {
|
|
75
|
+
setVisits(false);
|
|
76
|
+
setMarketing(false);
|
|
77
|
+
setChoosing(false);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
{/* In the page flow, before the header, so Tab reaches it first. It never covers the page, and the page stays usable. */}
|
|
83
|
+
{!chosen && (
|
|
84
|
+
<Center width="page">
|
|
85
|
+
<Surface padding="small">
|
|
86
|
+
<Stack gap="medium">
|
|
87
|
+
<Stack gap="small">
|
|
88
|
+
<Heading level={2} size="h6">Cookies on Acme</Heading>
|
|
89
|
+
<Paragraph size="body2" measure="none">Acme uses cookies to keep you logged in. Accept All also allows cookies that count visits and cookies for marketing. Reject All turns both off.</Paragraph>
|
|
90
|
+
</Stack>
|
|
91
|
+
{/* Accept and Reject have the same weight, side by side. Neither is the page's main action. */}
|
|
92
|
+
<Cluster gap="small">
|
|
93
|
+
<Button size="medium" type="secondary" state="enabled" label="Accept All" onClickButton={() => choose({ visits: true, marketing: true })} />
|
|
94
|
+
<Button size="medium" type="secondary" state="enabled" label="Reject All" onClickButton={() => choose({ visits: false, marketing: false })} />
|
|
95
|
+
<Button size="medium" type="tertiary" state="enabled" label="Choose Cookies" onClickButton={() => setChoosing(true)} />
|
|
96
|
+
</Cluster>
|
|
97
|
+
</Stack>
|
|
98
|
+
</Surface>
|
|
99
|
+
</Center>
|
|
100
|
+
)}
|
|
101
|
+
<SiteHeader
|
|
102
|
+
brand={{ href: '#top', name: 'Acme' }}
|
|
103
|
+
links={links}
|
|
104
|
+
actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in" />}
|
|
105
|
+
phoneAction={<Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up" />}
|
|
106
|
+
mainId="cookie-choice-banner-main"
|
|
107
|
+
/>
|
|
108
|
+
{/* tabIndex -1 lets the skip link and the banner move focus here. */}
|
|
109
|
+
<PageShell ref={main} id="cookie-choice-banner-main" tabIndex={-1}>
|
|
110
|
+
<Stack gap="large">
|
|
111
|
+
<Heading level={1} size="h5">Share files and decide together</Heading>
|
|
112
|
+
<Paragraph tone="secondary" measure="none">Acme keeps a small team's files, notes and decisions in one place.</Paragraph>
|
|
113
|
+
</Stack>
|
|
114
|
+
</PageShell>
|
|
115
|
+
<Modal
|
|
116
|
+
isOpen={choosing}
|
|
117
|
+
size="small"
|
|
118
|
+
title="Cookie Settings"
|
|
119
|
+
onClose={handleCancel}
|
|
120
|
+
actions={
|
|
121
|
+
<>
|
|
122
|
+
<Button size="small" type="tertiary" state="enabled" label="Cancel" onClickButton={handleCancel} />
|
|
123
|
+
{/* No choice is saved yet, so Save is enabled at once: saving every switch off is a choice. */}
|
|
124
|
+
<Button size="small" type="primary" state="enabled" label="Save Choices" onClickButton={() => choose({ visits, marketing })} />
|
|
125
|
+
</>
|
|
126
|
+
}
|
|
127
|
+
>
|
|
128
|
+
<Stack gap="medium">
|
|
129
|
+
<Switch id="cookie-choice-banner-needed" label="Needed to run the site" description="Keeps you logged in. Always on." checked disabled onChange={() => {}} />
|
|
130
|
+
<Switch id="cookie-choice-banner-visits" label="Visit counts" checked={visits} onChange={setVisits} />
|
|
131
|
+
<Switch id="cookie-choice-banner-marketing" label="Marketing" checked={marketing} onChange={setMarketing} />
|
|
132
|
+
</Stack>
|
|
133
|
+
</Modal>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Option: Settings from the footer
|
|
140
|
+
|
|
141
|
+
Use when: The visitor opens 'Cookie Settings' from the footer to change a choice.
|
|
142
|
+
|
|
143
|
+
Uses: `Button`, `Center`, `Heading`, `Modal`, `Paragraph`, `SiteFooter`, `Stack`, `Switch`
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
'use client';
|
|
147
|
+
import { useEffect, useRef, useState } from 'react';
|
|
148
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
149
|
+
import Switch from 'oneslash-design-system/components/switch';
|
|
150
|
+
import Button from 'oneslash-design-system/components/button';
|
|
151
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
152
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
153
|
+
import SiteFooter from 'oneslash-design-system/components/siteFooter';
|
|
154
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
155
|
+
|
|
156
|
+
type Choices = { visits: boolean; marketing: boolean };
|
|
157
|
+
|
|
158
|
+
export default function CookieChoiceSettings() {
|
|
159
|
+
// Opens on the Modal, as if the visitor just chose 'Cookie Settings' in the footer.
|
|
160
|
+
const [open, setOpen] = useState(true);
|
|
161
|
+
// The visitor's last choice, kept in the browser. Here they chose Reject All, so every optional cookie is off.
|
|
162
|
+
const [saved, setSaved] = useState<Choices>({ visits: false, marketing: false });
|
|
163
|
+
const [draft, setDraft] = useState<Choices>(saved);
|
|
164
|
+
const [justSaved, setJustSaved] = useState(false);
|
|
165
|
+
const savedTimer = useRef<ReturnType<typeof setTimeout>>();
|
|
166
|
+
// Save is disabled while the switches match what was saved, and while 'Saved' shows it stays enabled.
|
|
167
|
+
const changed = draft.visits !== saved.visits || draft.marketing !== saved.marketing;
|
|
168
|
+
|
|
169
|
+
// Stops the 'Saved' timer if the example goes away before it ends.
|
|
170
|
+
useEffect(() => () => clearTimeout(savedTimer.current), []);
|
|
171
|
+
|
|
172
|
+
// One Save for the group. The choice is kept in the browser, so it saves at once, and 'Saved' shows for 2 seconds.
|
|
173
|
+
// A press while 'Saved' shows and nothing changed does nothing.
|
|
174
|
+
function handleSave() {
|
|
175
|
+
if (!changed) return;
|
|
176
|
+
setSaved(draft);
|
|
177
|
+
setJustSaved(true);
|
|
178
|
+
clearTimeout(savedTimer.current);
|
|
179
|
+
savedTimer.current = setTimeout(() => setJustSaved(false), 2000);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Cancel, Escape and a click outside drop what was not saved.
|
|
183
|
+
function handleClose() {
|
|
184
|
+
setDraft(saved);
|
|
185
|
+
setJustSaved(false);
|
|
186
|
+
setOpen(false);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<>
|
|
191
|
+
<Stack gap="huge">
|
|
192
|
+
<Center width="page">
|
|
193
|
+
<Stack gap="large">
|
|
194
|
+
<Heading level={1} size="h5">Privacy</Heading>
|
|
195
|
+
<Paragraph tone="secondary" measure="none">Acme uses cookies to keep you logged in. Visit counts and marketing stay off until you turn them on.</Paragraph>
|
|
196
|
+
</Stack>
|
|
197
|
+
</Center>
|
|
198
|
+
{/* The footer's 'Cookie Settings' link comes to this page, which opens the Modal. The visitor can change the choice at any time. */}
|
|
199
|
+
<SiteFooter
|
|
200
|
+
brand={{ href: '#top', name: 'Acme' }}
|
|
201
|
+
links={[
|
|
202
|
+
{ label: 'Terms', href: '#terms' },
|
|
203
|
+
{ label: 'Privacy', href: '#privacy' },
|
|
204
|
+
{ label: 'Cookie Settings', href: '#cookie-settings' },
|
|
205
|
+
]}
|
|
206
|
+
legal="© 2026 Acme. All rights reserved."
|
|
207
|
+
/>
|
|
208
|
+
</Stack>
|
|
209
|
+
<Modal
|
|
210
|
+
isOpen={open}
|
|
211
|
+
size="small"
|
|
212
|
+
title="Cookie Settings"
|
|
213
|
+
onClose={handleClose}
|
|
214
|
+
actions={
|
|
215
|
+
<>
|
|
216
|
+
<Button size="small" type="tertiary" state="enabled" label="Cancel" onClickButton={handleClose} />
|
|
217
|
+
<Button size="small" type="primary" state={changed || justSaved ? 'enabled' : 'disabled'} label={justSaved ? 'Saved' : 'Save Choices'} onClickButton={handleSave} />
|
|
218
|
+
</>
|
|
219
|
+
}
|
|
220
|
+
>
|
|
221
|
+
<Stack gap="medium">
|
|
222
|
+
<Switch id="cookie-choice-settings-needed" label="Needed to run the site" description="Keeps you logged in. Always on." checked disabled onChange={() => {}} />
|
|
223
|
+
<Switch id="cookie-choice-settings-visits" label="Visit counts" checked={draft.visits} onChange={(visits) => setDraft((d) => ({ ...d, visits }))} />
|
|
224
|
+
<Switch id="cookie-choice-settings-marketing" label="Marketing" checked={draft.marketing} onChange={(marketing) => setDraft((d) => ({ ...d, marketing }))} />
|
|
225
|
+
</Stack>
|
|
226
|
+
</Modal>
|
|
227
|
+
</>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Native
|
|
233
|
+
|
|
234
|
+
An app uses the system tracking prompt (App Tracking Transparency on Apple) and never a banner.
|
|
@@ -158,7 +158,7 @@ export default function DashboardNumbersFirst() {
|
|
|
158
158
|
})}
|
|
159
159
|
</Navigation>);
|
|
160
160
|
var statRow = (<SettingsSection key="stats" title={"Numbers ".concat(noun[range])} id="dashboard-stats">
|
|
161
|
-
<Grid compact columns={4}>
|
|
161
|
+
<Grid compact columns={4} from="lg">
|
|
162
162
|
<StatTile label="New comments" value={d.stats.comments[0]} previous={d.stats.comments[1]} period={period} loading={loading}/>
|
|
163
163
|
<StatTile label="Marked done" value={d.stats.done[0]} previous={d.stats.done[1]} period={period} loading={loading}/>
|
|
164
164
|
<StatTile label="People engaged" value={d.stats.people[0]} previous={d.stats.people[1]} period={period} loading={loading}/>
|
|
@@ -108,7 +108,7 @@ export default function DashboardWorkFirst() {
|
|
|
108
108
|
})}
|
|
109
109
|
</Navigation>);
|
|
110
110
|
var statRow = (<SettingsSection key="stats" title={"Numbers ".concat(noun[range])} id="dashboard-stats">
|
|
111
|
-
<Grid compact columns={4}>
|
|
111
|
+
<Grid compact columns={4} from="lg">
|
|
112
112
|
<StatTile label="New comments" value={d.stats.comments[0]} previous={d.stats.comments[1]} period={period} loading={loading}/>
|
|
113
113
|
<StatTile label="Marked done" value={d.stats.done[0]} previous={d.stats.done[1]} period={period} loading={loading}/>
|
|
114
114
|
<StatTile label="People engaged" value={d.stats.people[0]} previous={d.stats.people[1]} period={period} loading={loading}/>
|
package/dist/cases/dashboard.md
CHANGED
|
@@ -207,7 +207,7 @@ export default function DashboardNumbersFirst() {
|
|
|
207
207
|
|
|
208
208
|
const statRow = (
|
|
209
209
|
<SettingsSection key="stats" title={`Numbers ${noun[range]}`} id="dashboard-stats">
|
|
210
|
-
<Grid compact columns={4}>
|
|
210
|
+
<Grid compact columns={4} from="lg">
|
|
211
211
|
<StatTile label="New comments" value={d.stats.comments[0]} previous={d.stats.comments[1]} period={period} loading={loading} />
|
|
212
212
|
<StatTile label="Marked done" value={d.stats.done[0]} previous={d.stats.done[1]} period={period} loading={loading} />
|
|
213
213
|
<StatTile label="People engaged" value={d.stats.people[0]} previous={d.stats.people[1]} period={period} loading={loading} />
|
|
@@ -473,7 +473,7 @@ export default function DashboardWorkFirst() {
|
|
|
473
473
|
|
|
474
474
|
const statRow = (
|
|
475
475
|
<SettingsSection key="stats" title={`Numbers ${noun[range]}`} id="dashboard-stats">
|
|
476
|
-
<Grid compact columns={4}>
|
|
476
|
+
<Grid compact columns={4} from="lg">
|
|
477
477
|
<StatTile label="New comments" value={d.stats.comments[0]} previous={d.stats.comments[1]} period={period} loading={loading} />
|
|
478
478
|
<StatTile label="Marked done" value={d.stats.done[0]} previous={d.stats.done[1]} period={period} loading={loading} />
|
|
479
479
|
<StatTile label="People engaged" value={d.stats.people[0]} previous={d.stats.people[1]} period={period} loading={loading} />
|
|
@@ -187,7 +187,7 @@ export default function DataTablePageAllRows() {
|
|
|
187
187
|
</TableContainer>)}
|
|
188
188
|
</Stack>
|
|
189
189
|
|
|
190
|
-
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={function () { return setSearchOpen(false); }} returnFocus>
|
|
190
|
+
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={function () { return setSearchOpen(false); }} returnFocus aria-label="Search">
|
|
191
191
|
<Menu width={288}>
|
|
192
192
|
<TextField id="data-table-page-all-rows-search" type="search" size="small" autoFocus aria-label="Search invoices" placeholder="Search invoices" value={query} onChange={function (e) { return setQuery(e.target.value); }} onKeyDown={function (e) {
|
|
193
193
|
// Escape clears the search and closes. Enter closes and keeps it.
|
|
@@ -245,7 +245,7 @@ export default function DataTablePagePaged() {
|
|
|
245
245
|
<Pagination aria-label="Invoice pages" page={page} pageCount={pageCount} onPageChange={goToPage} scrollTargetId="data-table-page-paged-top"/>
|
|
246
246
|
</Stack>
|
|
247
247
|
|
|
248
|
-
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={function () { return setSearchOpen(false); }} returnFocus>
|
|
248
|
+
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={function () { return setSearchOpen(false); }} returnFocus aria-label="Search">
|
|
249
249
|
<Menu width={288}>
|
|
250
250
|
<TextField id="data-table-page-paged-search" type="search" size="small" autoFocus aria-label="Search invoices" placeholder="Search invoices" value={query} onChange={function (e) { return change({ query: e.target.value }); }} onKeyDown={function (e) {
|
|
251
251
|
// Escape clears the search and closes. Enter closes and keeps it.
|
|
@@ -369,7 +369,7 @@ export default function DataTablePagePaged() {
|
|
|
369
369
|
<Pagination aria-label="Invoice pages" page={page} pageCount={pageCount} onPageChange={goToPage} scrollTargetId="data-table-page-paged-top" />
|
|
370
370
|
</Stack>
|
|
371
371
|
|
|
372
|
-
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={() => setSearchOpen(false)} returnFocus>
|
|
372
|
+
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={() => setSearchOpen(false)} returnFocus aria-label="Search">
|
|
373
373
|
<Menu width={288}>
|
|
374
374
|
<TextField
|
|
375
375
|
id="data-table-page-paged-search"
|
|
@@ -701,7 +701,7 @@ export default function DataTablePageAllRows() {
|
|
|
701
701
|
)}
|
|
702
702
|
</Stack>
|
|
703
703
|
|
|
704
|
-
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={() => setSearchOpen(false)} returnFocus>
|
|
704
|
+
<Popover open={searchOpen} anchorEl={searchAnchor} onClose={() => setSearchOpen(false)} returnFocus aria-label="Search">
|
|
705
705
|
<Menu width={288}>
|
|
706
706
|
<TextField
|
|
707
707
|
id="data-table-page-all-rows-search"
|
|
@@ -14,13 +14,25 @@ import { formatMoney } from '../../components/formatNumber';
|
|
|
14
14
|
import { Center, Stack } from '../../components/layout';
|
|
15
15
|
// A real app reads these from the server, newest first.
|
|
16
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
|
-
|
|
18
|
-
|
|
19
|
-
date:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
// Each refund by the charge it refunds: all of August, and 15 days of October.
|
|
18
|
+
var refunds = {
|
|
19
|
+
'Aug 1, 2026': { id: 'ref-0', kind: 'refund', date: 'Aug 6, 2026', description: 'Refund for Pro plan, Aug 2026', amount: -24, status: 'Issued' },
|
|
20
|
+
'Oct 1, 2026': { id: 'ref-1', kind: 'refund', date: 'Oct 16, 2026', description: 'Refund for 15 days of Pro, Oct 2026', amount: -12, status: 'Issued' },
|
|
21
|
+
};
|
|
22
|
+
var invoices = months.flatMap(function (date, i) {
|
|
23
|
+
var amount = 24;
|
|
24
|
+
var charge = {
|
|
25
|
+
id: "inv-".concat(i),
|
|
26
|
+
kind: 'charge',
|
|
27
|
+
date: date,
|
|
28
|
+
description: "Pro plan, ".concat(date.split(' ')[0], " ").concat(date.split(', ')[1]),
|
|
29
|
+
amount: amount,
|
|
30
|
+
// Refunded in full, or still Paid when only part came back
|
|
31
|
+
status: refunds[date] && -refunds[date].amount === amount ? 'Refunded' : 'Paid',
|
|
32
|
+
};
|
|
33
|
+
// The refund came later, so it sits above its charge
|
|
34
|
+
return refunds[date] ? [refunds[date], charge] : [charge];
|
|
35
|
+
});
|
|
24
36
|
var PAGE_SIZE = 12;
|
|
25
37
|
export default function InvoiceListTable() {
|
|
26
38
|
var _a = useState(1), page = _a[0], setPage = _a[1];
|
|
@@ -45,14 +57,14 @@ export default function InvoiceListTable() {
|
|
|
45
57
|
{rows.map(function (inv) { return (<TableRow key={inv.id}>
|
|
46
58
|
<TableCell width="130px">{inv.date}</TableCell>
|
|
47
59
|
<TableCell>{inv.description}</TableCell>
|
|
48
|
-
{/* A table shows the exact amount, right-aligned. */}
|
|
60
|
+
{/* A table shows the exact amount, right-aligned. A refund has a minus: '-$24.00'. */}
|
|
49
61
|
<TableCell width="100px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
50
62
|
<TableCell width="110px">
|
|
51
63
|
<Tag variant="textOnly" size="small" label={inv.status}/>
|
|
52
64
|
</TableCell>
|
|
53
65
|
<TableCell width="130px">
|
|
54
66
|
{/* 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/>
|
|
67
|
+
<Button size="small" type="tertiary" state="enabled" label="Download" aria-label={"Download ".concat(inv.kind === 'refund' ? 'refund' : 'invoice', " for ").concat(inv.date, ", opens in a new tab")} actionIcon="ExternalLink" href={"https://acme.example/invoices/".concat(inv.id, ".pdf")} openInNewTab/>
|
|
56
68
|
</TableCell>
|
|
57
69
|
</TableRow>); })}
|
|
58
70
|
</TableContainer>
|
|
@@ -7,7 +7,9 @@ A billing page lists what the workspace has paid, so an admin can find an invoic
|
|
|
7
7
|
- Follow the rule 'A number shows its unit and never shows 0 for unknown'.
|
|
8
8
|
- Show a `TableContainer` named 'Invoices', with `minWidth`, and the columns Date, Description, Amount, Status and Download.
|
|
9
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 '
|
|
10
|
+
- Show the status as the case 'Status in a row' says: 'Paid', 'Refunded' and a refund's 'Issued' as `Tag variant="textOnly"`, and 'Past due' as a dot.
|
|
11
|
+
- Show a refund as its own row: what it refunds, the amount with a minus, and the day it was made. Mark a charge 'Refunded' only when all of it came back.
|
|
12
|
+
- Write a refund row as 'Refund for Pro plan, Aug 2026' with '-$24.00', or 'Refund for 15 days of Pro, Oct 2026' with '-$12.00' while its charge stays 'Paid'. Put it above the charge it refunds.
|
|
11
13
|
- Show the newest first. Add `Pagination` named 'Invoice pages' past 12 invoices, and show none under that.
|
|
12
14
|
- 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
15
|
- 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.
|
|
@@ -18,7 +20,7 @@ A billing page lists what the workspace has paid, so an admin can find an invoic
|
|
|
18
20
|
|
|
19
21
|
## Don't
|
|
20
22
|
|
|
21
|
-
- Do not show the amount as '$24' or '24.00'. A table shows the exact amount, with its symbol and
|
|
23
|
+
- Do not show the amount as '$24' or '24.00'. A table shows the exact amount, with its symbol and its currency's decimals.
|
|
22
24
|
- Do not show a card number, even a part of it, in an invoice row.
|
|
23
25
|
- 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
26
|
- Do not name every Download link 'Download'. A screen reader lists the links apart from their rows.
|
|
@@ -48,17 +50,30 @@ import TableCell from 'oneslash-design-system/components/tableCell';
|
|
|
48
50
|
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
49
51
|
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
// A refund is a row of its own, with a minus. A charge reads 'Refunded' only when all of it came back.
|
|
54
|
+
type Invoice = { id: string; kind: 'charge' | 'refund'; date: string; description: string; amount: number; status: 'Paid' | 'Refunded' | 'Issued' };
|
|
52
55
|
|
|
53
56
|
// A real app reads these from the server, newest first.
|
|
54
57
|
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
|
-
|
|
56
|
-
|
|
57
|
-
date,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
// Each refund by the charge it refunds: all of August, and 15 days of October.
|
|
59
|
+
const refunds: Record<string, Invoice> = {
|
|
60
|
+
'Aug 1, 2026': { id: 'ref-0', kind: 'refund', date: 'Aug 6, 2026', description: 'Refund for Pro plan, Aug 2026', amount: -24, status: 'Issued' },
|
|
61
|
+
'Oct 1, 2026': { id: 'ref-1', kind: 'refund', date: 'Oct 16, 2026', description: 'Refund for 15 days of Pro, Oct 2026', amount: -12, status: 'Issued' },
|
|
62
|
+
};
|
|
63
|
+
const invoices: Invoice[] = months.flatMap((date, i): Invoice[] => {
|
|
64
|
+
const amount = 24;
|
|
65
|
+
const charge: Invoice = {
|
|
66
|
+
id: `inv-${i}`,
|
|
67
|
+
kind: 'charge',
|
|
68
|
+
date,
|
|
69
|
+
description: `Pro plan, ${date.split(' ')[0]} ${date.split(', ')[1]}`,
|
|
70
|
+
amount,
|
|
71
|
+
// Refunded in full, or still Paid when only part came back
|
|
72
|
+
status: refunds[date] && -refunds[date].amount === amount ? 'Refunded' : 'Paid',
|
|
73
|
+
};
|
|
74
|
+
// The refund came later, so it sits above its charge
|
|
75
|
+
return refunds[date] ? [refunds[date], charge] : [charge];
|
|
76
|
+
});
|
|
62
77
|
|
|
63
78
|
const PAGE_SIZE = 12;
|
|
64
79
|
|
|
@@ -90,7 +105,7 @@ export default function InvoiceListTable() {
|
|
|
90
105
|
<TableRow key={inv.id}>
|
|
91
106
|
<TableCell width="130px">{inv.date}</TableCell>
|
|
92
107
|
<TableCell>{inv.description}</TableCell>
|
|
93
|
-
{/* A table shows the exact amount, right-aligned. */}
|
|
108
|
+
{/* A table shows the exact amount, right-aligned. A refund has a minus: '-$24.00'. */}
|
|
94
109
|
<TableCell width="100px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
95
110
|
<TableCell width="110px">
|
|
96
111
|
<Tag variant="textOnly" size="small" label={inv.status} />
|
|
@@ -102,7 +117,7 @@ export default function InvoiceListTable() {
|
|
|
102
117
|
type="tertiary"
|
|
103
118
|
state="enabled"
|
|
104
119
|
label="Download"
|
|
105
|
-
aria-label={`Download invoice for ${inv.date}, opens in a new tab`}
|
|
120
|
+
aria-label={`Download ${inv.kind === 'refund' ? 'refund' : 'invoice'} for ${inv.date}, opens in a new tab`}
|
|
106
121
|
actionIcon="ExternalLink"
|
|
107
122
|
href={`https://acme.example/invoices/${inv.id}.pdf`}
|
|
108
123
|
openInNewTab
|
|
@@ -131,7 +131,7 @@ export default function MessageReactionsPicker() {
|
|
|
131
131
|
</Stack>
|
|
132
132
|
</Stack>
|
|
133
133
|
{/* The picker focuses its search. ArrowDown enters the grid; Tab and Shift+Tab move between the search and the grid. */}
|
|
134
|
-
<Popover open={pickOpen} anchorEl={pickAnchor} onClose={closePick} returnFocus>
|
|
134
|
+
<Popover open={pickOpen} anchorEl={pickAnchor} onClose={closePick} returnFocus aria-label="Pick a reaction">
|
|
135
135
|
<EmojiPicker id="message-reactions-picker" aria-label="Add reaction"
|
|
136
136
|
// The emoji the person already used show pressed. Picking one again removes it.
|
|
137
137
|
selected={mine} onPick={function (emoji) {
|