oneslash-design-system 2.19.0 → 2.21.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 +62 -5
- package/dist/cases/about-page/profile.d.ts +1 -0
- package/dist/cases/about-page/profile.jsx +64 -0
- package/dist/cases/about-page.md +114 -0
- package/dist/cases/admin-inbox/list.d.ts +1 -0
- package/dist/cases/admin-inbox/list.jsx +104 -0
- package/dist/cases/admin-inbox/split.d.ts +1 -0
- package/dist/cases/admin-inbox/split.jsx +68 -0
- package/dist/cases/admin-inbox.md +254 -0
- package/dist/cases/api-keys.md +1 -1
- 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/blog-index/cards.d.ts +1 -0
- package/dist/cases/blog-index/cards.jsx +45 -0
- package/dist/cases/blog-index/list.d.ts +1 -0
- package/dist/cases/blog-index/list.jsx +46 -0
- package/dist/cases/blog-index.md +160 -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/changelog/by-month.d.ts +1 -0
- package/dist/cases/changelog/by-month.jsx +70 -0
- package/dist/cases/changelog/one-page.d.ts +1 -0
- package/dist/cases/changelog/one-page.jsx +70 -0
- package/dist/cases/changelog.md +200 -0
- package/dist/cases/code-sample/block.d.ts +1 -0
- package/dist/cases/code-sample/block.jsx +19 -0
- package/dist/cases/code-sample/command.d.ts +1 -0
- package/dist/cases/code-sample/command.jsx +17 -0
- package/dist/cases/code-sample.md +96 -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/contact-page/form.d.ts +1 -0
- package/dist/cases/contact-page/form.jsx +83 -0
- package/dist/cases/contact-page/links.d.ts +1 -0
- package/dist/cases/contact-page/links.jsx +19 -0
- package/dist/cases/contact-page.md +142 -0
- 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/docs-component-page/reference.d.ts +1 -0
- package/dist/cases/docs-component-page/reference.jsx +93 -0
- package/dist/cases/docs-component-page.md +144 -0
- package/dist/cases/faq/accordion.d.ts +1 -0
- package/dist/cases/faq/accordion.jsx +25 -0
- package/dist/cases/faq/open-list.d.ts +1 -0
- package/dist/cases/faq/open-list.jsx +27 -0
- package/dist/cases/faq.md +110 -0
- package/dist/cases/feature-grid/cards.d.ts +1 -0
- package/dist/cases/feature-grid/cards.jsx +33 -0
- package/dist/cases/feature-grid/rows.d.ts +1 -0
- package/dist/cases/feature-grid/rows.jsx +30 -0
- package/dist/cases/feature-grid.md +132 -0
- package/dist/cases/image-viewer/gallery.d.ts +1 -0
- package/dist/cases/image-viewer/gallery.jsx +32 -0
- package/dist/cases/image-viewer/single.d.ts +1 -0
- package/dist/cases/image-viewer/single.jsx +25 -0
- package/dist/cases/image-viewer.md +123 -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/landing-hero/centered.d.ts +1 -0
- package/dist/cases/landing-hero/centered.jsx +22 -0
- package/dist/cases/landing-hero/split.d.ts +1 -0
- package/dist/cases/landing-hero/split.jsx +30 -0
- package/dist/cases/landing-hero.md +114 -0
- package/dist/cases/legal-page/sections.d.ts +1 -0
- package/dist/cases/legal-page/sections.jsx +61 -0
- package/dist/cases/legal-page.md +96 -0
- package/dist/cases/load-failure/inline.jsx +2 -2
- package/dist/cases/load-failure.md +2 -2
- package/dist/cases/long-form-page/article.d.ts +1 -0
- package/dist/cases/long-form-page/article.jsx +58 -0
- package/dist/cases/long-form-page/with-contents.d.ts +1 -0
- package/dist/cases/long-form-page/with-contents.jsx +41 -0
- package/dist/cases/long-form-page.md +170 -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/message-actions/hover-toolbar.jsx +11 -8
- package/dist/cases/message-actions/menu.jsx +10 -7
- package/dist/cases/message-actions.md +19 -13
- package/dist/cases/message-attachments/in-composer.jsx +2 -2
- package/dist/cases/message-attachments/in-message.jsx +16 -11
- package/dist/cases/message-attachments.md +29 -17
- package/dist/cases/number-format.md +36 -0
- package/dist/cases/one-main-action.md +33 -0
- package/dist/cases/overflow-menu/in-a-header.jsx +9 -6
- package/dist/cases/overflow-menu/on-a-row.jsx +9 -6
- package/dist/cases/overflow-menu.md +16 -10
- package/dist/cases/page-end/cta-band.d.ts +1 -0
- package/dist/cases/page-end/cta-band.jsx +24 -0
- package/dist/cases/page-end/next-link.d.ts +1 -0
- package/dist/cases/page-end/next-link.jsx +18 -0
- package/dist/cases/page-end.md +88 -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/password-gate/inline.d.ts +1 -0
- package/dist/cases/password-gate/inline.jsx +94 -0
- package/dist/cases/password-gate/modal.d.ts +1 -0
- package/dist/cases/password-gate/modal.jsx +81 -0
- package/dist/cases/password-gate/page.d.ts +1 -0
- package/dist/cases/password-gate/page.jsx +82 -0
- package/dist/cases/password-gate.md +351 -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/pricing-section/cards.d.ts +1 -0
- package/dist/cases/pricing-section/cards.jsx +40 -0
- package/dist/cases/pricing-section.md +85 -0
- package/dist/cases/product-cards/grid.d.ts +1 -0
- package/dist/cases/product-cards/grid.jsx +20 -0
- package/dist/cases/product-cards.md +71 -0
- package/dist/cases/range-switch/segmented.jsx +11 -7
- package/dist/cases/range-switch.md +16 -11
- package/dist/cases/reply-feedback/thumbs.jsx +11 -8
- package/dist/cases/reply-feedback/with-reason.jsx +11 -8
- package/dist/cases/reply-feedback.md +20 -14
- package/dist/cases/section-index/cards.d.ts +1 -0
- package/dist/cases/section-index/cards.jsx +25 -0
- package/dist/cases/section-index/list.d.ts +1 -0
- package/dist/cases/section-index/list.jsx +56 -0
- package/dist/cases/section-index.md +140 -0
- package/dist/cases/settings-page/top-tabs.jsx +4 -3
- package/dist/cases/settings-page.md +5 -4
- package/dist/cases/site-header.md +1 -1
- package/dist/cases/site-search/dialog.d.ts +1 -0
- package/dist/cases/site-search/dialog.jsx +131 -0
- package/dist/cases/site-search.md +176 -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/tabbed-panels/tabs.d.ts +1 -0
- package/dist/cases/tabbed-panels/tabs.jsx +40 -0
- package/dist/cases/tabbed-panels.md +81 -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 +2178 -97
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.jsx +103 -0
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.jsx +11 -5
- package/dist/components/codeBlock.d.ts +26 -0
- package/dist/components/codeBlock.jsx +101 -0
- 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/lightbox.d.ts +31 -0
- package/dist/components/lightbox.jsx +161 -0
- package/dist/components/linkCard.d.ts +10 -1
- package/dist/components/linkCard.jsx +32 -6
- package/dist/components/modal.d.ts +10 -2
- package/dist/components/modal.jsx +17 -12
- package/dist/components/pageHeader.jsx +1 -1
- 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/searchDialog.d.ts +44 -0
- package/dist/components/searchDialog.jsx +152 -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/tab.d.ts +5 -1
- package/dist/components/tab.jsx +2 -2
- package/dist/components/tabPanel.d.ts +16 -0
- package/dist/components/tabPanel.jsx +12 -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/tabsContainer.d.ts +5 -1
- package/dist/components/tabsContainer.jsx +2 -2
- package/dist/components/titleBar.d.ts +3 -1
- package/dist/components/titleBar.jsx +4 -3
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/internal/accordion.d.ts +4 -0
- package/dist/internal/accordion.js +53 -0
- package/dist/internal/combobox.d.ts +20 -0
- package/dist/internal/combobox.js +28 -0
- package/dist/internal/highlight.d.ts +5 -0
- package/dist/internal/highlight.js +18 -0
- package/dist/native-mapping.json +57 -3
- package/dist/stories/Accordion.stories.d.ts +11 -0
- package/dist/stories/Accordion.stories.jsx +93 -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 +60 -0
- package/dist/stories/Cases.generated.stories.jsx +120 -0
- package/dist/stories/CodeBlock.stories.d.ts +12 -0
- package/dist/stories/CodeBlock.stories.jsx +65 -0
- package/dist/stories/Lightbox.stories.d.ts +8 -0
- package/dist/stories/Lightbox.stories.jsx +40 -0
- package/dist/stories/LinkCard.stories.d.ts +6 -0
- package/dist/stories/LinkCard.stories.jsx +17 -0
- package/dist/stories/PageHeader.stories.d.ts +2 -0
- package/dist/stories/PageHeader.stories.jsx +13 -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/SearchDialog.stories.d.ts +17 -0
- package/dist/stories/SearchDialog.stories.jsx +111 -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/TabPanel.stories.d.ts +7 -0
- package/dist/stories/TabPanel.stories.jsx +31 -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,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import PageShell from '../../components/pageShell';
|
|
4
|
+
import SectionIntro from '../../components/sectionIntro';
|
|
5
|
+
import Lightbox, { LightboxThumbnail } from '../../components/lightbox';
|
|
6
|
+
import { Grid, PageSection } from '../../components/layout';
|
|
7
|
+
// Three drawings stand in for the photos. A real page passes its own files.
|
|
8
|
+
var hillside = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Crect width='160' height='120' fill='%23dfe9f2'/%3E%3Ccircle cx='120' cy='32' r='14' fill='%23f2c46d'/%3E%3Cpath d='M0 90 50 60l40 22 30-18 40 24v32H0z' fill='%232f6b4f'/%3E%3C/svg%3E";
|
|
9
|
+
var desk = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Crect width='160' height='120' fill='%23efe6da'/%3E%3Crect x='30' y='30' width='100' height='60' rx='6' fill='%23333d47'/%3E%3Crect x='38' y='38' width='84' height='44' rx='2' fill='%2389b4d9'/%3E%3Crect x='20' y='92' width='120' height='6' rx='3' fill='%238a6d4b'/%3E%3C/svg%3E";
|
|
10
|
+
var board = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 720'%3E%3Crect width='1280' height='720' fill='%23eef2f6'/%3E%3Crect x='120' y='120' width='460' height='480' rx='24' fill='%23ffffff'/%3E%3Crect x='680' y='120' width='480' height='220' rx='24' fill='%23dfe7ef'/%3E%3Crect x='680' y='380' width='480' height='220' rx='24' fill='%232f6b4f'/%3E%3Crect x='160' y='170' width='240' height='20' rx='10' fill='%23aab8c6'/%3E%3Crect x='160' y='220' width='360' height='16' rx='8' fill='%23c2cfdb'/%3E%3Crect x='160' y='260' width='320' height='16' rx='8' fill='%23c2cfdb'/%3E%3C/svg%3E";
|
|
11
|
+
var images = [
|
|
12
|
+
{ src: hillside, alt: 'A green hillside under a pale sky with the sun on the right', caption: 'The hill behind the new office.' },
|
|
13
|
+
{ src: desk, alt: 'A laptop on a wooden desk, its screen blue', caption: 'A desk set up for the first day.' },
|
|
14
|
+
{ src: board, alt: 'A thread beside a note, with the decision marked in green', caption: 'A decision, with the notes that led to it.' },
|
|
15
|
+
];
|
|
16
|
+
export default function ImageViewerGallery() {
|
|
17
|
+
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
18
|
+
var _b = useState(0), index = _b[0], setIndex = _b[1];
|
|
19
|
+
return (<PageShell>
|
|
20
|
+
<PageSection gap="xlarge">
|
|
21
|
+
<SectionIntro id="image-viewer-gallery-intro" name="Pictures" statement="The office and a decision."/>
|
|
22
|
+
{/* Each thumbnail is a button named 'Open image: <alt>'. Closing the viewer gives focus back to the one that opened it. */}
|
|
23
|
+
<Grid compact columns={3}>
|
|
24
|
+
{images.map(function (image, i) { return (<LightboxThumbnail key={image.alt} image={image} onOpen={function () {
|
|
25
|
+
setIndex(i);
|
|
26
|
+
setOpen(true);
|
|
27
|
+
}}/>); })}
|
|
28
|
+
</Grid>
|
|
29
|
+
</PageSection>
|
|
30
|
+
<Lightbox images={images} index={index} onIndexChange={setIndex} isOpen={open} onClose={function () { return setOpen(false); }} aria-label="Pictures"/>
|
|
31
|
+
</PageShell>);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ImageViewerSingle(): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import PageShell from '../../components/pageShell';
|
|
4
|
+
import SectionIntro from '../../components/sectionIntro';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import Lightbox, { LightboxThumbnail } from '../../components/lightbox';
|
|
7
|
+
import { Grid, PageSection } from '../../components/layout';
|
|
8
|
+
// One drawing stands in for the photo. A real page passes its own file.
|
|
9
|
+
var board = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 720'%3E%3Crect width='1280' height='720' fill='%23eef2f6'/%3E%3Crect x='120' y='120' width='460' height='480' rx='24' fill='%23ffffff'/%3E%3Crect x='680' y='120' width='480' height='220' rx='24' fill='%23dfe7ef'/%3E%3Crect x='680' y='380' width='480' height='220' rx='24' fill='%232f6b4f'/%3E%3Crect x='160' y='170' width='240' height='20' rx='10' fill='%23aab8c6'/%3E%3Crect x='160' y='220' width='360' height='16' rx='8' fill='%23c2cfdb'/%3E%3Crect x='160' y='260' width='320' height='16' rx='8' fill='%23c2cfdb'/%3E%3C/svg%3E";
|
|
10
|
+
var image = { src: board, alt: 'A thread beside a note, with the decision marked in green', caption: 'A decision, with the notes that led to it.' };
|
|
11
|
+
export default function ImageViewerSingle() {
|
|
12
|
+
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
13
|
+
return (<PageShell>
|
|
14
|
+
<PageSection gap="xlarge">
|
|
15
|
+
<SectionIntro id="image-viewer-single-intro" name="A decision" statement="The thread and the note, side by side.">
|
|
16
|
+
<Paragraph tone="secondary">Open the picture to read it at full size.</Paragraph>
|
|
17
|
+
</SectionIntro>
|
|
18
|
+
{/* One image: the viewer shows no arrows and no count. */}
|
|
19
|
+
<Grid columns={2}>
|
|
20
|
+
<LightboxThumbnail image={image} onOpen={function () { return setOpen(true); }}/>
|
|
21
|
+
</Grid>
|
|
22
|
+
</PageSection>
|
|
23
|
+
<Lightbox images={[image]} index={0} onIndexChange={function () { }} isOpen={open} onClose={function () { return setOpen(false); }} aria-label="Decision picture"/>
|
|
24
|
+
</PageShell>);
|
|
25
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Image viewer
|
|
2
|
+
|
|
3
|
+
A page shows images small, and a person wants to see one larger without leaving the page.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Show each image as a `LightboxThumbnail` and keep the open state and the index of the shown image in your page. For `gallery`, put the thumbnails in a `Grid compact`, two across on a phone.
|
|
8
|
+
- Render one `Lightbox` for the page with the list of images, the `index`, `onIndexChange`, `isOpen` and `onClose`. Give it an `aria-label` that names the set, such as "Pictures".
|
|
9
|
+
- Write alt text that says what the image shows, such as "A laptop on a wooden desk, its screen blue". It names the thumbnail and stands in for an image that fails to load.
|
|
10
|
+
- Add a `caption` when the image needs words. The viewer shows it under the image and uses it as its title.
|
|
11
|
+
- Pass two or more images to get the arrows: the viewer shows 'Previous image', 'Next image' and '2 of 3' after the title. ArrowLeft, ArrowRight and a swipe step; the first and the last image stop there.
|
|
12
|
+
- Pass a single image in a list too, so the page keeps one way to open an image. The viewer then shows no arrows and no count.
|
|
13
|
+
- Let Escape, the backdrop and 'Close' close the viewer. Focus goes back to the thumbnail that opened it.
|
|
14
|
+
- Count on the viewer when an image fails to load: it shows 'This image could not be loaded.' with its alt text, and the arrows still work.
|
|
15
|
+
- Follow the case 'Attachments' for images that sit in a message.
|
|
16
|
+
|
|
17
|
+
## Don't
|
|
18
|
+
|
|
19
|
+
- Do not open an image from a click on an `Image`. Use `LightboxThumbnail`, a button that a keyboard reaches.
|
|
20
|
+
- Do not leave the alt text empty on a thumbnail, or write "image" or a file name.
|
|
21
|
+
- Do not build a full-screen layer with a portal of your own. `Lightbox` is a dialog with a focus trap and the focus return.
|
|
22
|
+
- Do not handle Escape or the arrow keys with a listener of your own. The viewer does.
|
|
23
|
+
- Do not use the viewer for video, or for a page that has one image and nothing to see larger.
|
|
24
|
+
- Do not hide the arrows on a phone. A swipe is a second way to step, not the only one.
|
|
25
|
+
|
|
26
|
+
## Option: Several images opened from thumbnails
|
|
27
|
+
|
|
28
|
+
Use when: Two or more images that a person may want to step through.
|
|
29
|
+
|
|
30
|
+
Uses: `Grid`, `Lightbox`, `LightboxThumbnail`, `PageSection`, `PageShell`, `SectionIntro`
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
'use client';
|
|
34
|
+
import { useState } from 'react';
|
|
35
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
36
|
+
import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
37
|
+
import Lightbox, { LightboxThumbnail } from 'oneslash-design-system/components/lightbox';
|
|
38
|
+
import { Grid, PageSection } from 'oneslash-design-system/components/layout';
|
|
39
|
+
|
|
40
|
+
// Three drawings stand in for the photos. A real page passes its own files.
|
|
41
|
+
const hillside =
|
|
42
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Crect width='160' height='120' fill='%23dfe9f2'/%3E%3Ccircle cx='120' cy='32' r='14' fill='%23f2c46d'/%3E%3Cpath d='M0 90 50 60l40 22 30-18 40 24v32H0z' fill='%232f6b4f'/%3E%3C/svg%3E";
|
|
43
|
+
const desk =
|
|
44
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Crect width='160' height='120' fill='%23efe6da'/%3E%3Crect x='30' y='30' width='100' height='60' rx='6' fill='%23333d47'/%3E%3Crect x='38' y='38' width='84' height='44' rx='2' fill='%2389b4d9'/%3E%3Crect x='20' y='92' width='120' height='6' rx='3' fill='%238a6d4b'/%3E%3C/svg%3E";
|
|
45
|
+
const board =
|
|
46
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 720'%3E%3Crect width='1280' height='720' fill='%23eef2f6'/%3E%3Crect x='120' y='120' width='460' height='480' rx='24' fill='%23ffffff'/%3E%3Crect x='680' y='120' width='480' height='220' rx='24' fill='%23dfe7ef'/%3E%3Crect x='680' y='380' width='480' height='220' rx='24' fill='%232f6b4f'/%3E%3Crect x='160' y='170' width='240' height='20' rx='10' fill='%23aab8c6'/%3E%3Crect x='160' y='220' width='360' height='16' rx='8' fill='%23c2cfdb'/%3E%3Crect x='160' y='260' width='320' height='16' rx='8' fill='%23c2cfdb'/%3E%3C/svg%3E";
|
|
47
|
+
|
|
48
|
+
const images = [
|
|
49
|
+
{ src: hillside, alt: 'A green hillside under a pale sky with the sun on the right', caption: 'The hill behind the new office.' },
|
|
50
|
+
{ src: desk, alt: 'A laptop on a wooden desk, its screen blue', caption: 'A desk set up for the first day.' },
|
|
51
|
+
{ src: board, alt: 'A thread beside a note, with the decision marked in green', caption: 'A decision, with the notes that led to it.' },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export default function ImageViewerGallery() {
|
|
55
|
+
const [open, setOpen] = useState(false);
|
|
56
|
+
const [index, setIndex] = useState(0);
|
|
57
|
+
return (
|
|
58
|
+
<PageShell>
|
|
59
|
+
<PageSection gap="xlarge">
|
|
60
|
+
<SectionIntro id="image-viewer-gallery-intro" name="Pictures" statement="The office and a decision." />
|
|
61
|
+
{/* Each thumbnail is a button named 'Open image: <alt>'. Closing the viewer gives focus back to the one that opened it. */}
|
|
62
|
+
<Grid compact columns={3}>
|
|
63
|
+
{images.map((image, i) => (
|
|
64
|
+
<LightboxThumbnail
|
|
65
|
+
key={image.alt}
|
|
66
|
+
image={image}
|
|
67
|
+
onOpen={() => {
|
|
68
|
+
setIndex(i);
|
|
69
|
+
setOpen(true);
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
))}
|
|
73
|
+
</Grid>
|
|
74
|
+
</PageSection>
|
|
75
|
+
<Lightbox images={images} index={index} onIndexChange={setIndex} isOpen={open} onClose={() => setOpen(false)} aria-label="Pictures" />
|
|
76
|
+
</PageShell>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Option: One image opened larger
|
|
82
|
+
|
|
83
|
+
Use when: One image whose detail is too small to read in the page.
|
|
84
|
+
|
|
85
|
+
Uses: `Grid`, `Lightbox`, `LightboxThumbnail`, `PageSection`, `PageShell`, `Paragraph`, `SectionIntro`
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
'use client';
|
|
89
|
+
import { useState } from 'react';
|
|
90
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
91
|
+
import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
92
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
93
|
+
import Lightbox, { LightboxThumbnail } from 'oneslash-design-system/components/lightbox';
|
|
94
|
+
import { Grid, PageSection } from 'oneslash-design-system/components/layout';
|
|
95
|
+
|
|
96
|
+
// One drawing stands in for the photo. A real page passes its own file.
|
|
97
|
+
const board =
|
|
98
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 720'%3E%3Crect width='1280' height='720' fill='%23eef2f6'/%3E%3Crect x='120' y='120' width='460' height='480' rx='24' fill='%23ffffff'/%3E%3Crect x='680' y='120' width='480' height='220' rx='24' fill='%23dfe7ef'/%3E%3Crect x='680' y='380' width='480' height='220' rx='24' fill='%232f6b4f'/%3E%3Crect x='160' y='170' width='240' height='20' rx='10' fill='%23aab8c6'/%3E%3Crect x='160' y='220' width='360' height='16' rx='8' fill='%23c2cfdb'/%3E%3Crect x='160' y='260' width='320' height='16' rx='8' fill='%23c2cfdb'/%3E%3C/svg%3E";
|
|
99
|
+
|
|
100
|
+
const image = { src: board, alt: 'A thread beside a note, with the decision marked in green', caption: 'A decision, with the notes that led to it.' };
|
|
101
|
+
|
|
102
|
+
export default function ImageViewerSingle() {
|
|
103
|
+
const [open, setOpen] = useState(false);
|
|
104
|
+
return (
|
|
105
|
+
<PageShell>
|
|
106
|
+
<PageSection gap="xlarge">
|
|
107
|
+
<SectionIntro id="image-viewer-single-intro" name="A decision" statement="The thread and the note, side by side.">
|
|
108
|
+
<Paragraph tone="secondary">Open the picture to read it at full size.</Paragraph>
|
|
109
|
+
</SectionIntro>
|
|
110
|
+
{/* One image: the viewer shows no arrows and no count. */}
|
|
111
|
+
<Grid columns={2}>
|
|
112
|
+
<LightboxThumbnail image={image} onOpen={() => setOpen(true)} />
|
|
113
|
+
</Grid>
|
|
114
|
+
</PageSection>
|
|
115
|
+
<Lightbox images={[image]} index={0} onIndexChange={() => {}} isOpen={open} onClose={() => setOpen(false)} aria-label="Decision picture" />
|
|
116
|
+
</PageShell>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Native
|
|
122
|
+
|
|
123
|
+
On Apple use a `fullScreenCover` with a `TabView` in `page` style, and `accessibilityLabel` on each image. On Android use a full-screen dialog with a `HorizontalPager` and a content description on each image.
|
|
@@ -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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LandingHeroCentered(): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import PageShell from '../../components/pageShell';
|
|
3
|
+
import PageHeader from '../../components/pageHeader';
|
|
4
|
+
import Button from '../../components/button';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import { Cluster, Stack } from '../../components/layout';
|
|
7
|
+
export default function LandingHeroCentered() {
|
|
8
|
+
return (<PageShell>
|
|
9
|
+
<Stack gap="xxlarge">
|
|
10
|
+
{/* The only h1 on the page: level 1 is the default. */}
|
|
11
|
+
<PageHeader level={1} eyebrow="Team workspace with an AI agent" title="A shared workspace for your team and its agent" lede="Plan the work in threads, keep notes the whole team can search, and ask the agent when you need an answer."/>
|
|
12
|
+
{/* The rule's one main action first, then one secondary. They wrap on a phone. */}
|
|
13
|
+
<Stack gap="medium">
|
|
14
|
+
<Cluster>
|
|
15
|
+
<Button size="large" type="primary" state="enabled" label="Sign Up" href="#sign-up"/>
|
|
16
|
+
<Button size="large" type="secondary" state="enabled" label="See How It Works" href="#how-it-works"/>
|
|
17
|
+
</Cluster>
|
|
18
|
+
<Paragraph tone="secondary" size="body2" measure="none">Start on Free with 3 members. No card needed.</Paragraph>
|
|
19
|
+
</Stack>
|
|
20
|
+
</Stack>
|
|
21
|
+
</PageShell>);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LandingHeroSplit(): import("react").JSX.Element;
|