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,254 @@
|
|
|
1
|
+
# Admin inbox
|
|
2
|
+
|
|
3
|
+
The owner of a site reads the messages that visitors sent through its contact form.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Open with a `PageHeader` titled 'Messages' and a lede that counts what is unread: '3 of 12 unread'.
|
|
8
|
+
- Show the sender, the date and the first lines of each message. Write the date as plain text, such as Nov 12, 2026.
|
|
9
|
+
- Mark an unread message with a `Tag` that says 'Unread', so it does not rely on color.
|
|
10
|
+
- Give each row an `IconButton` that toggles read and unread, in a `Tooltip` with its name. Name it for the row's message: 'Mark message from Ben Carter as read'.
|
|
11
|
+
- Follow the case 'List and detail' for `split`. Name its Button 'Mark as Read' or 'Mark as Unread'.
|
|
12
|
+
- Keep the header while the list loads, and show `Skeleton` rows with one label: 'Loading messages'.
|
|
13
|
+
- Follow the case 'Load failure' when the list fails to load: `EmptyBox` 'Could not load messages' with a 'Try Again' Button that is `loading` while it retries.
|
|
14
|
+
- Show `EmptyBox` as the case 'Empty list' says when there are no messages: `size="large"` in `list`, `size="small"` in the list column of `split`. Text 'No messages yet', `secondText` 'Messages from the contact form appear here.'
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Do not replace the whole page with a loading screen while the list loads.
|
|
19
|
+
- Do not show 'No messages yet' when the list failed to load.
|
|
20
|
+
- Do not name every IconButton 'Mark as read'. Name the message it acts on.
|
|
21
|
+
- Do not mark a message read only by opening it, with no way to undo.
|
|
22
|
+
- Do not leave a failed read or unread change with no message.
|
|
23
|
+
|
|
24
|
+
## Option: One column of messages
|
|
25
|
+
|
|
26
|
+
Use when: A few messages arrive each week, and each one is read in full in the list.
|
|
27
|
+
|
|
28
|
+
Uses: `Button`, `Cluster`, `EmptyBox`, `Heading`, `IconButton`, `PageHeader`, `PageShell`, `Paragraph`, `Skeleton`, `Stack`, `Surface`, `Tag`, `Tooltip`
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
'use client';
|
|
32
|
+
import { useEffect, useRef, useState } from 'react';
|
|
33
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
34
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
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 Tag from 'oneslash-design-system/components/tag';
|
|
39
|
+
import IconButton from 'oneslash-design-system/components/iconButton';
|
|
40
|
+
import Button from 'oneslash-design-system/components/button';
|
|
41
|
+
import Tooltip from 'oneslash-design-system/components/tooltip';
|
|
42
|
+
import Skeleton from 'oneslash-design-system/components/skeleton';
|
|
43
|
+
import EmptyBox from 'oneslash-design-system/components/emptyBox';
|
|
44
|
+
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
45
|
+
|
|
46
|
+
type Message = { id: string; from: string; date: string; text: string; read: boolean };
|
|
47
|
+
|
|
48
|
+
const first: Message[] = [
|
|
49
|
+
{ id: 'm1', from: 'Ben Carter', date: 'Nov 16, 2026', text: 'I saw your page about error messages. Do you give talks? We are planning a day for our design team in January.', read: false },
|
|
50
|
+
{ id: 'm2', from: 'Omar Reyes', date: 'Nov 15, 2026', text: 'Is the plan changes case study open to everyone? I would like to share it with my team.', read: false },
|
|
51
|
+
{ id: 'm3', from: 'Maya Brooks', date: 'Nov 14, 2026', text: 'Thank you for the reading list. I read the piece on poor connections twice.', read: false },
|
|
52
|
+
{ id: 'm4', from: 'Leo Park', date: 'Nov 12, 2026', text: 'Could you share the password for the case studies? I would like to show it to my team.', read: true },
|
|
53
|
+
{ id: 'm5', from: 'Sara Idris', date: 'Nov 10, 2026', text: 'We are hiring a designer in the spring. Would you like to talk?', read: true },
|
|
54
|
+
{ id: 'm6', from: 'Noah Quinn', date: 'Nov 9, 2026', text: 'Your design system notes helped our team. Is there a newsletter?', read: true },
|
|
55
|
+
{ id: 'm7', from: 'Ana Silva', date: 'Nov 7, 2026', text: 'A small thing: the link to the second case study on the About page does not open.', read: true },
|
|
56
|
+
{ id: 'm8', from: 'Tom Hale', date: 'Nov 6, 2026', text: 'Can I use one of your diagrams in a talk? I will credit you.', read: true },
|
|
57
|
+
{ id: 'm9', from: 'Iris Chen', date: 'Nov 4, 2026', text: 'I would like to ask about the tools you use for prototyping.', read: true },
|
|
58
|
+
{ id: 'm10', from: 'Sam Ortiz', date: 'Nov 2, 2026', text: 'Congratulations on the new page. The facts row is very clear.', read: true },
|
|
59
|
+
{ id: 'm11', from: 'Eve Lund', date: 'Oct 29, 2026', text: 'We met at the meetup in October. I would like to stay in touch.', read: true },
|
|
60
|
+
{ id: 'm12', from: 'Raj Patel', date: 'Oct 22, 2026', text: 'Is the About page available as a printable resume?', read: true },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export default function AdminInboxList() {
|
|
64
|
+
const [messages, setMessages] = useState(first);
|
|
65
|
+
const [failed, setFailed] = useState(false);
|
|
66
|
+
const [busy, setBusy] = useState(false);
|
|
67
|
+
const [refreshes, setRefreshes] = useState(0);
|
|
68
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
69
|
+
|
|
70
|
+
// Stops the request if the example goes away before it ends.
|
|
71
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
72
|
+
|
|
73
|
+
const unread = messages.filter((m) => !m.read).length;
|
|
74
|
+
|
|
75
|
+
function toggle(id: string) {
|
|
76
|
+
setMessages((list) => list.map((m) => (m.id === id ? { ...m, read: !m.read } : m)));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function load() {
|
|
80
|
+
if (busy) return;
|
|
81
|
+
const attempt = refreshes + 1;
|
|
82
|
+
setRefreshes(attempt);
|
|
83
|
+
setBusy(true);
|
|
84
|
+
// Stands in for the request to the server. The second refresh fails, so you can see Try Again.
|
|
85
|
+
timer.current = setTimeout(() => {
|
|
86
|
+
setBusy(false);
|
|
87
|
+
setFailed(attempt === 2);
|
|
88
|
+
}, 1000);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<PageShell>
|
|
93
|
+
<Stack gap="xlarge">
|
|
94
|
+
{/* The header stays while the list loads or fails. */}
|
|
95
|
+
<PageHeader level={1} title="Messages" lede={`${unread} of ${messages.length} unread`} />
|
|
96
|
+
<Cluster>
|
|
97
|
+
<Button size="small" type="secondary" state="enabled" label="Refresh" decoIcon="RefreshCw" loading={busy && !failed} onClickButton={load} />
|
|
98
|
+
</Cluster>
|
|
99
|
+
{busy && !failed && (
|
|
100
|
+
<Stack gap="small">
|
|
101
|
+
<Skeleton variant="block" height="large" label="Loading messages" />
|
|
102
|
+
<Skeleton variant="block" height="large" />
|
|
103
|
+
<Skeleton variant="block" height="large" />
|
|
104
|
+
</Stack>
|
|
105
|
+
)}
|
|
106
|
+
{failed && (
|
|
107
|
+
// The list fails as a region, as the case 'Load failure' shows: it stays until the list loads.
|
|
108
|
+
<Surface minHeight="tall" align="center">
|
|
109
|
+
<EmptyBox
|
|
110
|
+
size="large"
|
|
111
|
+
icon="CloudOff"
|
|
112
|
+
text="Could not load messages"
|
|
113
|
+
secondText="Check your connection and try again."
|
|
114
|
+
action={<Button size="medium" type="primary" state="enabled" label="Try Again" loading={busy} onClickButton={load} />}
|
|
115
|
+
/>
|
|
116
|
+
</Surface>
|
|
117
|
+
)}
|
|
118
|
+
{!busy && !failed && messages.length === 0 && <EmptyBox size="large" text="No messages yet" secondText="Messages from the contact form appear here." />}
|
|
119
|
+
{!busy && !failed && (
|
|
120
|
+
<Stack gap="small">
|
|
121
|
+
{messages.map((m) => (
|
|
122
|
+
<Surface key={m.id} padding="small" align="start">
|
|
123
|
+
<Stack gap="small">
|
|
124
|
+
<Cluster justify="between">
|
|
125
|
+
<Cluster gap="small">
|
|
126
|
+
<Heading level={2} size="subtitle1">{m.from}</Heading>
|
|
127
|
+
{!m.read && <Tag variant="dot" size="small" color="info" label="Unread" />}
|
|
128
|
+
</Cluster>
|
|
129
|
+
<Cluster gap="small">
|
|
130
|
+
<Paragraph tone="secondary" size="caption">{m.date}</Paragraph>
|
|
131
|
+
{/* The icon shows what the Button does: an open envelope marks the message read, a closed one marks it unread. */}
|
|
132
|
+
<Tooltip title={`Mark message from ${m.from} as ${m.read ? 'unread' : 'read'}`}>
|
|
133
|
+
<IconButton
|
|
134
|
+
iconName={m.read ? 'Mail' : 'MailOpen'}
|
|
135
|
+
ariaLabel={`Mark message from ${m.from} as ${m.read ? 'unread' : 'read'}`}
|
|
136
|
+
color={m.read ? 'iconOnly' : 'primary'}
|
|
137
|
+
state="enabled"
|
|
138
|
+
size="medium"
|
|
139
|
+
onClick={() => toggle(m.id)}
|
|
140
|
+
/>
|
|
141
|
+
</Tooltip>
|
|
142
|
+
</Cluster>
|
|
143
|
+
</Cluster>
|
|
144
|
+
<Paragraph size="body2" measure="none">{m.text}</Paragraph>
|
|
145
|
+
</Stack>
|
|
146
|
+
</Surface>
|
|
147
|
+
))}
|
|
148
|
+
</Stack>
|
|
149
|
+
)}
|
|
150
|
+
</Stack>
|
|
151
|
+
</PageShell>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Option: List beside the message
|
|
157
|
+
|
|
158
|
+
Use when: Many messages arrive, and the owner works down them one after another.
|
|
159
|
+
|
|
160
|
+
Uses: `Button`, `Cluster`, `Heading`, `MenuItem`, `Navigation`, `PageHeader`, `PageShell`, `Paragraph`, `SettingsLayout`, `Stack`
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
'use client';
|
|
164
|
+
import { useState } from 'react';
|
|
165
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
166
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
167
|
+
import Navigation from 'oneslash-design-system/components/navigation';
|
|
168
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
169
|
+
import { SettingsLayout } from 'oneslash-design-system/components/settingsSection';
|
|
170
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
171
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
172
|
+
import Button from 'oneslash-design-system/components/button';
|
|
173
|
+
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
174
|
+
|
|
175
|
+
type Message = { id: string; from: string; subject: string; date: string; body: string[]; read: boolean };
|
|
176
|
+
|
|
177
|
+
const first: Message[] = [
|
|
178
|
+
{ id: 'talk', from: 'Ben Carter', subject: 'A talk in January?', date: 'Nov 16, 2026', body: ['I saw your page about error messages. Do you give talks?', 'We are planning a day for our design team in January.'], read: false },
|
|
179
|
+
{ id: 'share', from: 'Omar Reyes', subject: 'Sharing the case study', date: 'Nov 15, 2026', body: ['Is the plan changes case study open to everyone?', 'I would like to share it with my team.'], read: false },
|
|
180
|
+
{ id: 'thanks', from: 'Maya Brooks', subject: 'Thank you for the reading list', date: 'Nov 14, 2026', body: ['I read the piece on poor connections twice.'], read: false },
|
|
181
|
+
{ id: 'password', from: 'Leo Park', subject: 'The case study password', date: 'Nov 12, 2026', body: ['Could you share the password for the case studies?', 'I would like to show it to my team.'], read: true },
|
|
182
|
+
{ id: 'hiring', from: 'Sara Idris', subject: 'We are hiring in the spring', date: 'Nov 10, 2026', body: ['We are hiring a designer in the spring. Would you like to talk?'], read: true },
|
|
183
|
+
{ id: 'newsletter', from: 'Noah Quinn', subject: 'Is there a newsletter?', date: 'Nov 9, 2026', body: ['Your design system notes helped our team.'], read: true },
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
export default function AdminInboxSplit() {
|
|
187
|
+
const [messages, setMessages] = useState(first);
|
|
188
|
+
// One message is always open, the first at the start.
|
|
189
|
+
const [openId, setOpenId] = useState(first[0].id);
|
|
190
|
+
// On a phone the list is the screen until a message is chosen, and Back returns to it.
|
|
191
|
+
const [showDetail, setShowDetail] = useState(false);
|
|
192
|
+
|
|
193
|
+
const message = messages.find((m) => m.id === openId) ?? messages[0];
|
|
194
|
+
const unread = messages.filter((m) => !m.read).length;
|
|
195
|
+
|
|
196
|
+
function toggle(id: string) {
|
|
197
|
+
setMessages((list) => list.map((m) => (m.id === id ? { ...m, read: !m.read } : m)));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const list = (
|
|
201
|
+
<Navigation aria-label="Messages">
|
|
202
|
+
{messages.map((m) => (
|
|
203
|
+
<MenuItem
|
|
204
|
+
key={m.id}
|
|
205
|
+
size="medium"
|
|
206
|
+
label={m.from}
|
|
207
|
+
secondLabel={m.subject}
|
|
208
|
+
tag={m.read ? undefined : { label: 'Unread', color: 'info' }}
|
|
209
|
+
href={`/admin/messages/${m.id}`}
|
|
210
|
+
isSelected={m.id === message.id}
|
|
211
|
+
aria-current={m.id === message.id ? 'page' : undefined}
|
|
212
|
+
onClick={(event: { preventDefault: () => void }) => {
|
|
213
|
+
// A real app lets the link go to the message's own address, so it can be shared and reloaded. The example keeps the choice in state.
|
|
214
|
+
event.preventDefault();
|
|
215
|
+
setOpenId(m.id);
|
|
216
|
+
setShowDetail(true);
|
|
217
|
+
}}
|
|
218
|
+
/>
|
|
219
|
+
))}
|
|
220
|
+
</Navigation>
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<PageShell>
|
|
225
|
+
<Stack gap="xlarge">
|
|
226
|
+
<PageHeader level={1} title="Messages" lede={`${unread} of ${messages.length} unread`} />
|
|
227
|
+
<SettingsLayout
|
|
228
|
+
navWidth="wide"
|
|
229
|
+
nav={list}
|
|
230
|
+
showContent={showDetail}
|
|
231
|
+
back={<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Messages" onClickButton={() => setShowDetail(false)} />}
|
|
232
|
+
>
|
|
233
|
+
<Stack gap="small">
|
|
234
|
+
<Heading level={2} size="h6">{message.subject}</Heading>
|
|
235
|
+
<Paragraph tone="secondary" size="body2" measure="none">{message.from}, {message.date}</Paragraph>
|
|
236
|
+
</Stack>
|
|
237
|
+
<Stack gap="medium">
|
|
238
|
+
{message.body.map((paragraph) => (
|
|
239
|
+
<Paragraph key={paragraph} measure="none">{paragraph}</Paragraph>
|
|
240
|
+
))}
|
|
241
|
+
</Stack>
|
|
242
|
+
<Cluster>
|
|
243
|
+
<Button size="medium" type="secondary" state="enabled" decoIcon="CircleCheck" label={message.read ? 'Mark as Unread' : 'Mark as Read'} onClickButton={() => toggle(message.id)} />
|
|
244
|
+
</Cluster>
|
|
245
|
+
</SettingsLayout>
|
|
246
|
+
</Stack>
|
|
247
|
+
</PageShell>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Native
|
|
253
|
+
|
|
254
|
+
On Apple use a `List` with a swipe action to mark a message read or unread, and a `NavigationSplitView` for many messages.
|
package/dist/cases/api-keys.md
CHANGED
|
@@ -12,7 +12,7 @@ A person makes keys that let a script or a service use the product as them, and
|
|
|
12
12
|
- Give the Modal one Button, 'Done'. Ignore Escape and a click outside while the key shows, so a stray click cannot lose it.
|
|
13
13
|
- Confirm 'Revoke' in the row, as the case 'Delete confirm' does: the row asks 'Revoke CI pipeline?' and shows 'Cancel' and a danger 'Revoke'. Then show a toast: 'CI pipeline key revoked.'
|
|
14
14
|
- Give each row's 'Revoke', and the confirm's 'Cancel' and 'Revoke', an `aria-label` that names the key: 'Revoke CI pipeline' and 'Cancel revoking CI pipeline'.
|
|
15
|
-
- Show `EmptyBox` with 'No API keys' when the list is empty, as the rule 'An empty list says what
|
|
15
|
+
- Show `EmptyBox` with 'No API keys' when the list is empty, as the rule 'An empty list says what will fill it' says.
|
|
16
16
|
- Disable the name field while the key is made, and show `loading` on the Button without changing its label.
|
|
17
17
|
|
|
18
18
|
## Don't
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BillingPageBilledElsewhere(): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import Heading from '../../components/heading';
|
|
3
|
+
import Paragraph from '../../components/paragraph';
|
|
4
|
+
import Progress from '../../components/progress';
|
|
5
|
+
import SettingsSection from '../../components/settingsSection';
|
|
6
|
+
import TitleBar from '../../components/titleBar';
|
|
7
|
+
import { Center, Stack } from '../../components/layout';
|
|
8
|
+
export default function BillingPageBilledElsewhere() {
|
|
9
|
+
return (<Center width="page">
|
|
10
|
+
<Stack gap="xlarge">
|
|
11
|
+
<TitleBar title="Billing"/>
|
|
12
|
+
<SettingsSection id="billing-elsewhere-plan" title="Plan" description="What Acme pays for.">
|
|
13
|
+
<Stack gap="small">
|
|
14
|
+
<Heading level={3} size="h6">Pro</Heading>
|
|
15
|
+
<Paragraph tone="secondary" size="body2" measure="none">Renews on Dec 1, 2026.</Paragraph>
|
|
16
|
+
</Stack>
|
|
17
|
+
{/* No price, card or invoice: the app store that bills this plan keeps them. The page says who pays, where, and who can change it. */}
|
|
18
|
+
<Paragraph size="body2" measure="none">Ben Carter pays for this plan through an app store. Only Ben Carter can change or cancel it, in the app store settings on the device that bought it.</Paragraph>
|
|
19
|
+
</SettingsSection>
|
|
20
|
+
<SettingsSection id="billing-elsewhere-usage" title="Usage" description="This month.">
|
|
21
|
+
<Stack gap="medium">
|
|
22
|
+
<Progress label="AI agent responses" value={312} max={1000} unit="responses"/>
|
|
23
|
+
<Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
|
|
24
|
+
</Stack>
|
|
25
|
+
</SettingsSection>
|
|
26
|
+
</Stack>
|
|
27
|
+
</Center>);
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BillingPageSelfServe(): import("react").JSX.Element;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Modal from '../../components/modal';
|
|
4
|
+
import Alert from '../../components/alert';
|
|
5
|
+
import Surface from '../../components/surface';
|
|
6
|
+
import Heading from '../../components/heading';
|
|
7
|
+
import Paragraph from '../../components/paragraph';
|
|
8
|
+
import Progress from '../../components/progress';
|
|
9
|
+
import Tag from '../../components/tag';
|
|
10
|
+
import Link from '../../components/link';
|
|
11
|
+
import Button from '../../components/button';
|
|
12
|
+
import SettingsSection from '../../components/settingsSection';
|
|
13
|
+
import TitleBar from '../../components/titleBar';
|
|
14
|
+
import TableContainer from '../../components/tableContainer';
|
|
15
|
+
import TableHeader from '../../components/tableHeader';
|
|
16
|
+
import TableHeaderCell from '../../components/tableHeaderCell';
|
|
17
|
+
import TableRow from '../../components/tableRow';
|
|
18
|
+
import TableCell from '../../components/tableCell';
|
|
19
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
20
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
21
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
22
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
23
|
+
// A real app reads this from the person's role. Only an admin can change billing.
|
|
24
|
+
var isAdmin = true;
|
|
25
|
+
// A real app reads this from the server: set when the last payment failed.
|
|
26
|
+
var failedPayment = { fixBy: 'Nov 30, 2026' };
|
|
27
|
+
var invoices = [
|
|
28
|
+
{ id: 'inv-0', date: 'Nov 1, 2026', amount: 24, status: 'Paid' },
|
|
29
|
+
{ id: 'inv-1', date: 'Oct 1, 2026', amount: 24, status: 'Paid' },
|
|
30
|
+
{ id: 'inv-2', date: 'Sep 1, 2026', amount: 24, status: 'Paid' },
|
|
31
|
+
];
|
|
32
|
+
export default function BillingPageSelfServe() {
|
|
33
|
+
var _a = useState(false), canceling = _a[0], setCanceling = _a[1];
|
|
34
|
+
var _b = useState(false), confirmOpen = _b[0], setConfirmOpen = _b[1];
|
|
35
|
+
var _c = useState(false), busy = _c[0], setBusy = _c[1];
|
|
36
|
+
var timer = useRef();
|
|
37
|
+
// Stops the request if the example goes away before it ends.
|
|
38
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
39
|
+
// Stands in for the request to the server.
|
|
40
|
+
function request(done) {
|
|
41
|
+
if (busy)
|
|
42
|
+
return;
|
|
43
|
+
setBusy(true);
|
|
44
|
+
timer.current = setTimeout(function () {
|
|
45
|
+
setBusy(false);
|
|
46
|
+
done();
|
|
47
|
+
}, 1200);
|
|
48
|
+
}
|
|
49
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
50
|
+
function handleClose() {
|
|
51
|
+
if (busy)
|
|
52
|
+
return;
|
|
53
|
+
setConfirmOpen(false);
|
|
54
|
+
}
|
|
55
|
+
return (<Center width="page">
|
|
56
|
+
<Stack gap="xlarge">
|
|
57
|
+
<TitleBar title="Billing"/>
|
|
58
|
+
{failedPayment && (<Alert type="error" variant="inline" autoDismiss={false} message={"Your last payment did not go through. Update the payment method by ".concat(failedPayment.fixBy, " to keep Pro.")}/>)}
|
|
59
|
+
<SettingsSection id="billing-page-plan" title="Plan" description="What Acme pays for.">
|
|
60
|
+
<Stack gap="small">
|
|
61
|
+
<Cluster gap="small">
|
|
62
|
+
<Heading level={3} size="h6">Pro</Heading>
|
|
63
|
+
{failedPayment && <Tag variant="dot" size="small" color="error" label="Past due"/>}
|
|
64
|
+
{canceling && <Tag variant="dot" size="small" color="warning" label="Canceling"/>}
|
|
65
|
+
</Cluster>
|
|
66
|
+
<Paragraph size="body2" measure="none">{"".concat(formatMoney(8), " per member per month")}</Paragraph>
|
|
67
|
+
<Paragraph tone="secondary" size="body2" measure="none">{canceling ? 'Pro ends on Dec 1, 2026.' : 'Renews on Dec 1, 2026.'}</Paragraph>
|
|
68
|
+
</Stack>
|
|
69
|
+
{isAdmin ? (<Cluster gap="small">
|
|
70
|
+
{canceling ? (<Button size="small" type="primary" state="enabled" label="Resume Plan" loading={busy} onClickButton={function () { return request(function () { return setCanceling(false); }); }}/>) : (<Button size="small" type="secondary" state="enabled" label="Change Plan" onClickButton={function () { return router.push('/settings/billing/plans'); }}/>)}
|
|
71
|
+
</Cluster>) : (<Paragraph tone="secondary" size="body2" measure="none">Only admins can change billing.</Paragraph>)}
|
|
72
|
+
</SettingsSection>
|
|
73
|
+
<SettingsSection id="billing-page-usage" title="Usage" description="This month.">
|
|
74
|
+
<Stack gap="medium">
|
|
75
|
+
<Progress label="AI agent responses" value={312} max={1000} unit="responses"/>
|
|
76
|
+
<Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
|
|
77
|
+
<Progress label="Members" value={3} max={null} unit="members"/>
|
|
78
|
+
</Stack>
|
|
79
|
+
</SettingsSection>
|
|
80
|
+
<SettingsSection id="billing-page-payment" title="Payment method" description="Pays for Acme's plan.">
|
|
81
|
+
<Surface padding="small">
|
|
82
|
+
<Cluster justify="between" gap="medium">
|
|
83
|
+
<Stack gap="small">
|
|
84
|
+
<Paragraph measure="none">Visa ending in 4821</Paragraph>
|
|
85
|
+
<Paragraph tone="secondary" size="body2" measure="none">Expires 08/28</Paragraph>
|
|
86
|
+
</Stack>
|
|
87
|
+
{isAdmin && (
|
|
88
|
+
// A real app hands off to its payment provider's own page here. The page never takes card details.
|
|
89
|
+
<Button size="small" type="tertiary" state="enabled" label="Update" aria-label="Update Visa ending in 4821, opens in a new tab" actionIcon="ExternalLink" href="https://acme.example/billing/payment-method" openInNewTab/>)}
|
|
90
|
+
</Cluster>
|
|
91
|
+
</Surface>
|
|
92
|
+
{/* Pro needs a card, so there is no Remove here. */}
|
|
93
|
+
<Paragraph tone="secondary" size="body2" measure="none">Pro needs a card on file. Downgrade to Free to remove it.</Paragraph>
|
|
94
|
+
</SettingsSection>
|
|
95
|
+
<SettingsSection id="billing-page-invoices" title="Invoices" description="The last three.">
|
|
96
|
+
<TableContainer aria-label="Recent invoices" minWidth="520px">
|
|
97
|
+
<TableHeader>
|
|
98
|
+
<TableRow>
|
|
99
|
+
<TableHeaderCell width="140px">Date</TableHeaderCell>
|
|
100
|
+
<TableHeaderCell width="110px" align="right">Amount</TableHeaderCell>
|
|
101
|
+
<TableHeaderCell>Status</TableHeaderCell>
|
|
102
|
+
<TableHeaderCell width="130px">Download</TableHeaderCell>
|
|
103
|
+
</TableRow>
|
|
104
|
+
</TableHeader>
|
|
105
|
+
{invoices.map(function (inv) { return (<TableRow key={inv.id}>
|
|
106
|
+
<TableCell width="140px">{inv.date}</TableCell>
|
|
107
|
+
<TableCell width="110px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
108
|
+
<TableCell><Tag variant="textOnly" size="small" label={inv.status}/></TableCell>
|
|
109
|
+
<TableCell width="130px">
|
|
110
|
+
{/* A real app links to the file on its own server. */}
|
|
111
|
+
<Button size="small" type="tertiary" state="enabled" label="Download" aria-label={"Download invoice for ".concat(inv.date, ", opens in a new tab")} actionIcon="ExternalLink" href={"https://acme.example/invoices/".concat(inv.id, ".pdf")} openInNewTab/>
|
|
112
|
+
</TableCell>
|
|
113
|
+
</TableRow>); })}
|
|
114
|
+
</TableContainer>
|
|
115
|
+
<Link href="/settings/billing/invoices" size="body2">See All Invoices</Link>
|
|
116
|
+
</SettingsSection>
|
|
117
|
+
{isAdmin && !canceling && (
|
|
118
|
+
// The last section on the page, in the danger color, as the case 'Danger zone' says.
|
|
119
|
+
<SettingsSection id="billing-page-cancel" tone="danger" title="End plan" description="Pro stays on until Dec 1, 2026.">
|
|
120
|
+
<Paragraph size="body2" measure="none">Acme goes back to Free on Dec 1, 2026. Its members and messages stay.</Paragraph>
|
|
121
|
+
<Cluster>
|
|
122
|
+
<Button size="small" type="secondary" state="enabled" label="End Plan" onClickButton={function () { return setConfirmOpen(true); }}/>
|
|
123
|
+
</Cluster>
|
|
124
|
+
</SettingsSection>)}
|
|
125
|
+
</Stack>
|
|
126
|
+
<Modal isOpen={confirmOpen} size="small" title="End Plan" onClose={handleClose} actions={<>
|
|
127
|
+
<Button size="small" type="tertiary" state={busy ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
|
|
128
|
+
<Button size="small" type="primary" state="enabled" label="End Plan" loading={busy} onClickButton={function () { return request(function () { setConfirmOpen(false); setCanceling(true); }); }}/>
|
|
129
|
+
</>}>
|
|
130
|
+
<Paragraph measure="none">Pro stays on until Dec 1, 2026. After that Acme is on Free, which allows 3 members and 50 AI agent responses a month.</Paragraph>
|
|
131
|
+
<Paragraph tone="secondary" size="body2" measure="none">Nothing is deleted. You can resume the plan until then.</Paragraph>
|
|
132
|
+
</Modal>
|
|
133
|
+
</Center>);
|
|
134
|
+
}
|