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,81 @@
|
|
|
1
|
+
# Tabbed panels
|
|
2
|
+
|
|
3
|
+
A page shows several views of one thing, and a visitor reads one of them at a time.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Put the section's name in `SectionIntro`, so the section has a level 2 heading. Give the panel's title a level 3 `Heading`.
|
|
8
|
+
- Use `TabsContainer` with one `Tab` for each view. Write each label in Title Case, as one short word, and use `size="small"` so four fit on a phone.
|
|
9
|
+
- Give each `Tab` an `id` and `controls`, and put each view in a `TabPanel` named by its Tab. Every panel is in the page; only the selected one shows. Name the tablist with `aria-labelledby` on `TabsContainer`.
|
|
10
|
+
- Keep the selected tab in state. Put the view most visitors need first.
|
|
11
|
+
- Keep two to five tabs, and four when you can: they fit on a phone. A fifth scrolls inside the row and the page does not.
|
|
12
|
+
- Give every panel the same shape: a title, a line and a short `List`, so the page does not jump when a visitor changes tab.
|
|
13
|
+
- Use stacked sections, each with its own level 2 heading, for more than five views or for views everyone must read.
|
|
14
|
+
- Use `SegmentedControl` instead when the choice changes a value, as the case 'Range switch' says.
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Do not hide something a visitor must read behind a tab.
|
|
19
|
+
- Do not use these tabs for a site's sections or an app's areas. Those are `Tab`s with `href`, as the cases 'Site header' and 'Settings page' say.
|
|
20
|
+
- Do not give a tab an icon or a long label. It will not fit on a phone.
|
|
21
|
+
- Do not change the tab on a timer.
|
|
22
|
+
- Do not nest tabs inside a panel.
|
|
23
|
+
|
|
24
|
+
## Example: Tabs over one panel
|
|
25
|
+
|
|
26
|
+
Uses: `Heading`, `List`, `PageSection`, `PageShell`, `Paragraph`, `SectionIntro`, `Stack`, `Tab`, `TabPanel`, `TabsContainer`
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
'use client';
|
|
30
|
+
import { useState } from 'react';
|
|
31
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
32
|
+
import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
33
|
+
import TabsContainer from 'oneslash-design-system/components/tabsContainer';
|
|
34
|
+
import Tab from 'oneslash-design-system/components/tab';
|
|
35
|
+
import TabPanel from 'oneslash-design-system/components/tabPanel';
|
|
36
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
37
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
38
|
+
import List from 'oneslash-design-system/components/list';
|
|
39
|
+
import { PageSection, Stack } from 'oneslash-design-system/components/layout';
|
|
40
|
+
|
|
41
|
+
// Four views of one thing, and a visitor reads one. The first is the one most visitors need.
|
|
42
|
+
const views = [
|
|
43
|
+
{ id: 'channels', label: 'Channels', title: 'One place for each subject', line: 'A channel holds the talk about one team or project.', points: ['Everyone in a channel sees every message.', 'Pin the messages people need again.', 'Turn a message into a task when it needs an owner.'] },
|
|
44
|
+
{ id: 'tasks', label: 'Tasks', title: 'A task and its talk together', line: 'A task keeps its owner, its status and its talk together.', points: ['Give a task one owner and one due date.', 'Reply in the task, not in the channel.', 'Close the task when the work is done.'] },
|
|
45
|
+
{ id: 'notes', label: 'Notes', title: 'Notes the whole team can search', line: 'Write a decision once and find it later.', points: ['Link a note to the task it came from.', 'Search every note from one box.', 'Export a note to PDF on Pro and Business.'] },
|
|
46
|
+
{ id: 'agent', label: 'Agent', title: 'Answers with their sources', line: 'Ask the agent a question in any channel or task.', points: ['It says which notes and messages it used.', 'It never reads a channel you are not in.', 'Each reply counts as one AI agent response.'] },
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
export default function TabbedPanelsTabs() {
|
|
50
|
+
const [selected, setSelected] = useState('channels');
|
|
51
|
+
return (
|
|
52
|
+
<PageShell>
|
|
53
|
+
<PageSection gap="xxlarge">
|
|
54
|
+
<SectionIntro id="how-it-works" name="How it works" statement="Four parts, each for one kind of work." />
|
|
55
|
+
<Stack gap="xlarge">
|
|
56
|
+
{/* Title Case, one short word each. The tablist is named by the section's heading, and each Tab controls its panel. */}
|
|
57
|
+
<TabsContainer aria-labelledby="how-it-works">
|
|
58
|
+
{views.map((v) => (
|
|
59
|
+
<Tab key={v.id} id={`tabbed-panels-tab-${v.id}`} controls={`tabbed-panels-panel-${v.id}`} size="small" label={v.label} isSelected={v.id === selected} onClickTab={() => setSelected(v.id)} />
|
|
60
|
+
))}
|
|
61
|
+
</TabsContainer>
|
|
62
|
+
{/* Every panel is in the page. Only the selected one shows. */}
|
|
63
|
+
{views.map((v) => (
|
|
64
|
+
<TabPanel key={v.id} id={`tabbed-panels-panel-${v.id}`} labelledBy={`tabbed-panels-tab-${v.id}`} selected={v.id === selected}>
|
|
65
|
+
<Stack gap="medium">
|
|
66
|
+
<Heading level={3} size="h5">{v.title}</Heading>
|
|
67
|
+
<Paragraph tone="secondary" measure="none">{v.line}</Paragraph>
|
|
68
|
+
<List items={v.points} marker="dot" />
|
|
69
|
+
</Stack>
|
|
70
|
+
</TabPanel>
|
|
71
|
+
))}
|
|
72
|
+
</Stack>
|
|
73
|
+
</PageSection>
|
|
74
|
+
</PageShell>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Native
|
|
80
|
+
|
|
81
|
+
On Apple use a segmented `Picker` for two to five views, and a `TabView` only for the app's own areas. On Android use a `TabRow`.
|
|
@@ -3,6 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import Surface from '../../components/surface';
|
|
4
4
|
import Heading from '../../components/heading';
|
|
5
5
|
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import Progress from '../../components/progress';
|
|
6
7
|
import TextField from '../../components/textField';
|
|
7
8
|
import Button from '../../components/button';
|
|
8
9
|
import { Center, Cluster, Stack } from '../../components/layout';
|
|
@@ -27,12 +28,13 @@ export default function UpgradePromptInline() {
|
|
|
27
28
|
<Paragraph measure="none">{m.text}</Paragraph>
|
|
28
29
|
</Stack>); })}
|
|
29
30
|
</Stack>
|
|
31
|
+
<Progress label="AI agent responses" value={50} max={50} unit="responses" aria-describedby={showNotice ? 'upgrade-prompt-notice' : undefined}/>
|
|
30
32
|
{showNotice ? (
|
|
31
33
|
// The notice takes the place of the message box, where the person was about to type.
|
|
32
34
|
<Surface padding="medium">
|
|
33
35
|
<Stack gap="medium">
|
|
34
36
|
<Stack gap="small">
|
|
35
|
-
<Paragraph measure="none">You've used all 50 AI agent responses this month. They start again on
|
|
37
|
+
<Paragraph id="upgrade-prompt-notice" measure="none">You've used all 50 AI agent responses this month. They start again on Dec 1.</Paragraph>
|
|
36
38
|
<Paragraph tone="secondary" size="body2" measure="none">
|
|
37
39
|
{canChangePlan
|
|
38
40
|
? 'The Pro plan gives Acme Design 1,000 AI agent responses a month.'
|
|
@@ -46,7 +48,7 @@ export default function UpgradePromptInline() {
|
|
|
46
48
|
</Stack>
|
|
47
49
|
</Surface>) : (
|
|
48
50
|
// After 'Not Now' the message box comes back, closed until the replies start again.
|
|
49
|
-
<TextField id="upgrade-prompt-message" label="Message the agent" value="" placeholder="
|
|
51
|
+
<TextField id="upgrade-prompt-message" label="Message the agent" value="" placeholder="AI agent responses start again on Dec 1." disabled onChange={function () { }}/>)}
|
|
50
52
|
</Stack>
|
|
51
53
|
</Center>);
|
|
52
54
|
}
|
|
@@ -5,6 +5,7 @@ import Heading from '../../components/heading';
|
|
|
5
5
|
import Paragraph from '../../components/paragraph';
|
|
6
6
|
import Button from '../../components/button';
|
|
7
7
|
import { Center, Cluster, Stack } from '../../components/layout';
|
|
8
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
8
9
|
// A real app passes the router from its framework, such as Next's useRouter().
|
|
9
10
|
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
10
11
|
// A real app reads this from the person's role. Only an admin can change the plan.
|
|
@@ -35,7 +36,7 @@ export default function UpgradePromptModal() {
|
|
|
35
36
|
<Paragraph measure="none">Exporting to PDF is part of the Pro plan. Acme Design is on the Free plan.</Paragraph>
|
|
36
37
|
<Paragraph tone="secondary" size="body2" measure="none">
|
|
37
38
|
{canChangePlan
|
|
38
|
-
?
|
|
39
|
+
? "Pro also adds version history and unlimited guests, for ".concat(formatMoney(8), " per member each month.")
|
|
39
40
|
: 'Ask a workspace admin to upgrade Acme Design to Pro.'}
|
|
40
41
|
</Paragraph>
|
|
41
42
|
</Modal>
|
|
@@ -5,12 +5,13 @@ A person reaches something their plan does not include, or a limit of their plan
|
|
|
5
5
|
## Do
|
|
6
6
|
|
|
7
7
|
- Say what is locked and which plan unlocks it: 'Exporting to PDF is part of the Pro plan.'
|
|
8
|
-
- Say which limit was reached, with the number, and when it resets: "You've used all 50 AI agent responses this month. They start again on
|
|
8
|
+
- Say which limit was reached, with the number, and when it resets: "You've used all 50 AI agent responses this month. They start again on Dec 1."
|
|
9
9
|
- Offer 'Not Now' as a tertiary Button, then 'Upgrade to Pro' as a primary Button.
|
|
10
10
|
- Show 'Upgrade to Pro' only to a person who can change the plan. Tell everyone else to ask a workspace admin, and give them only 'Not Now'.
|
|
11
11
|
- Title the Modal 'Upgrade to Pro' only for a person who can upgrade. For everyone else, title it 'Pro Feature'.
|
|
12
12
|
- Follow the rule 'A confirm says exactly what will happen' for the Modal: `size="small"`, and Escape or a click outside means 'Not Now'.
|
|
13
13
|
- Put the notice where the control was, with the same two Buttons, when a limit is reached inside a flow.
|
|
14
|
+
- At a limit, show a `Progress` above the notice that says 'Limit reached', and point it at the notice with `aria-describedby`.
|
|
14
15
|
- Follow the rule 'An agent refuses clearly' too when the agent is the one refused.
|
|
15
16
|
|
|
16
17
|
## Don't
|
|
@@ -25,7 +26,7 @@ A person reaches something their plan does not include, or a limit of their plan
|
|
|
25
26
|
|
|
26
27
|
Use when: The person pressed something their plan does not include.
|
|
27
28
|
|
|
28
|
-
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Modal`, `Paragraph`, `Stack`
|
|
29
|
+
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Modal`, `Paragraph`, `Stack`, `formatMoney`
|
|
29
30
|
|
|
30
31
|
```tsx
|
|
31
32
|
'use client';
|
|
@@ -35,6 +36,7 @@ import Heading from 'oneslash-design-system/components/heading';
|
|
|
35
36
|
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
36
37
|
import Button from 'oneslash-design-system/components/button';
|
|
37
38
|
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
39
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
38
40
|
|
|
39
41
|
// A real app passes the router from its framework, such as Next's useRouter().
|
|
40
42
|
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
@@ -82,7 +84,7 @@ export default function UpgradePromptModal() {
|
|
|
82
84
|
<Paragraph measure="none">Exporting to PDF is part of the Pro plan. Acme Design is on the Free plan.</Paragraph>
|
|
83
85
|
<Paragraph tone="secondary" size="body2" measure="none">
|
|
84
86
|
{canChangePlan
|
|
85
|
-
?
|
|
87
|
+
? `Pro also adds version history and unlimited guests, for ${formatMoney(8)} per member each month.`
|
|
86
88
|
: 'Ask a workspace admin to upgrade Acme Design to Pro.'}
|
|
87
89
|
</Paragraph>
|
|
88
90
|
</Modal>
|
|
@@ -95,7 +97,7 @@ export default function UpgradePromptModal() {
|
|
|
95
97
|
|
|
96
98
|
Use when: A limit was reached inside a flow. The notice takes the place of the control that hit it.
|
|
97
99
|
|
|
98
|
-
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Paragraph`, `Stack`, `Surface`, `TextField`
|
|
100
|
+
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Paragraph`, `Progress`, `Stack`, `Surface`, `TextField`
|
|
99
101
|
|
|
100
102
|
```tsx
|
|
101
103
|
'use client';
|
|
@@ -103,6 +105,7 @@ import { useState } from 'react';
|
|
|
103
105
|
import Surface from 'oneslash-design-system/components/surface';
|
|
104
106
|
import Heading from 'oneslash-design-system/components/heading';
|
|
105
107
|
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
108
|
+
import Progress from 'oneslash-design-system/components/progress';
|
|
106
109
|
import TextField from 'oneslash-design-system/components/textField';
|
|
107
110
|
import Button from 'oneslash-design-system/components/button';
|
|
108
111
|
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
@@ -135,12 +138,13 @@ export default function UpgradePromptInline() {
|
|
|
135
138
|
</Stack>
|
|
136
139
|
))}
|
|
137
140
|
</Stack>
|
|
141
|
+
<Progress label="AI agent responses" value={50} max={50} unit="responses" aria-describedby={showNotice ? 'upgrade-prompt-notice' : undefined} />
|
|
138
142
|
{showNotice ? (
|
|
139
143
|
// The notice takes the place of the message box, where the person was about to type.
|
|
140
144
|
<Surface padding="medium">
|
|
141
145
|
<Stack gap="medium">
|
|
142
146
|
<Stack gap="small">
|
|
143
|
-
<Paragraph measure="none">You've used all 50 AI agent responses this month. They start again on
|
|
147
|
+
<Paragraph id="upgrade-prompt-notice" measure="none">You've used all 50 AI agent responses this month. They start again on Dec 1.</Paragraph>
|
|
144
148
|
<Paragraph tone="secondary" size="body2" measure="none">
|
|
145
149
|
{canChangePlan
|
|
146
150
|
? 'The Pro plan gives Acme Design 1,000 AI agent responses a month.'
|
|
@@ -157,7 +161,7 @@ export default function UpgradePromptInline() {
|
|
|
157
161
|
</Surface>
|
|
158
162
|
) : (
|
|
159
163
|
// After 'Not Now' the message box comes back, closed until the replies start again.
|
|
160
|
-
<TextField id="upgrade-prompt-message" label="Message the agent" value="" placeholder="
|
|
164
|
+
<TextField id="upgrade-prompt-message" label="Message the agent" value="" placeholder="AI agent responses start again on Dec 1." disabled onChange={() => {}} />
|
|
161
165
|
)}
|
|
162
166
|
</Stack>
|
|
163
167
|
</Center>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function UsageMetersByPerson(): import("react").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Surface from '../../components/surface';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import Heading from '../../components/heading';
|
|
6
|
+
import Progress from '../../components/progress';
|
|
7
|
+
import Button from '../../components/button';
|
|
8
|
+
import SettingsSection from '../../components/settingsSection';
|
|
9
|
+
import TableContainer from '../../components/tableContainer';
|
|
10
|
+
import TableHeader from '../../components/tableHeader';
|
|
11
|
+
import TableHeaderCell from '../../components/tableHeaderCell';
|
|
12
|
+
import TableRow from '../../components/tableRow';
|
|
13
|
+
import TableCell from '../../components/tableCell';
|
|
14
|
+
import { formatCount } from '../../components/formatNumber';
|
|
15
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
16
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
17
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
18
|
+
// A real app reads this from the person's role. Only an admin can change the plan.
|
|
19
|
+
var canChangePlan = true;
|
|
20
|
+
// A real app counts these on the server, most first. A count can pass its limit by a few: replies that were
|
|
21
|
+
// already running when the limit was reached still finish.
|
|
22
|
+
var people = [
|
|
23
|
+
{ id: 'dana', name: 'Dana Lee', responses: 21 },
|
|
24
|
+
{ id: 'ben', name: 'Ben Carter', responses: 19 },
|
|
25
|
+
{ id: 'omar', name: 'Omar Reyes', responses: 13 },
|
|
26
|
+
];
|
|
27
|
+
var total = people.reduce(function (sum, p) { return sum + p.responses; }, 0);
|
|
28
|
+
export default function UsageMetersByPerson() {
|
|
29
|
+
var _a = useState(true), showNotice = _a[0], setShowNotice = _a[1];
|
|
30
|
+
return (<Center width="page">
|
|
31
|
+
<SettingsSection title="Usage" description="This month, on the Free plan.">
|
|
32
|
+
<Stack gap="large">
|
|
33
|
+
<Stack gap="small">
|
|
34
|
+
<Progress label="AI agent responses" value={total} max={50} unit="responses" aria-describedby={showNotice ? 'usage-meters-person-notice' : undefined}/>
|
|
35
|
+
<Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
|
|
36
|
+
{showNotice && (<Surface padding="small">
|
|
37
|
+
<Stack gap="medium">
|
|
38
|
+
<Stack gap="small">
|
|
39
|
+
<Paragraph id="usage-meters-person-notice" measure="none">You've used all 50 AI agent responses this month. They start again on Dec 1.</Paragraph>
|
|
40
|
+
<Paragraph tone="secondary" size="body2" measure="none">
|
|
41
|
+
{canChangePlan
|
|
42
|
+
? 'The Pro plan gives Acme 1,000 AI agent responses a month.'
|
|
43
|
+
: 'Ask a workspace admin to upgrade Acme to Pro for more replies.'}
|
|
44
|
+
</Paragraph>
|
|
45
|
+
</Stack>
|
|
46
|
+
<Cluster gap="small">
|
|
47
|
+
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setShowNotice(false); }}/>
|
|
48
|
+
{canChangePlan && (<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return router.push('/settings/billing?plan=pro'); }}/>)}
|
|
49
|
+
</Cluster>
|
|
50
|
+
</Stack>
|
|
51
|
+
</Surface>)}
|
|
52
|
+
</Stack>
|
|
53
|
+
{/* Under the meters: who used it, most first, with exact numbers. */}
|
|
54
|
+
<Stack gap="small">
|
|
55
|
+
<Heading level={3} size="h6">Responses by person</Heading>
|
|
56
|
+
<TableContainer aria-label="Responses by person" minWidth="320px">
|
|
57
|
+
<TableHeader>
|
|
58
|
+
<TableRow>
|
|
59
|
+
<TableHeaderCell>Person</TableHeaderCell>
|
|
60
|
+
<TableHeaderCell width="130px" align="right">Responses</TableHeaderCell>
|
|
61
|
+
</TableRow>
|
|
62
|
+
</TableHeader>
|
|
63
|
+
{people.map(function (p) { return (<TableRow key={p.id}>
|
|
64
|
+
<TableCell>{p.name}</TableCell>
|
|
65
|
+
<TableCell width="130px" align="right">{formatCount(p.responses)}</TableCell>
|
|
66
|
+
</TableRow>); })}
|
|
67
|
+
</TableContainer>
|
|
68
|
+
</Stack>
|
|
69
|
+
</Stack>
|
|
70
|
+
</SettingsSection>
|
|
71
|
+
</Center>);
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function UsageMetersMeters(): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Surface from '../../components/surface';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import Progress from '../../components/progress';
|
|
6
|
+
import Button from '../../components/button';
|
|
7
|
+
import SettingsSection from '../../components/settingsSection';
|
|
8
|
+
import { formatBytes } from '../../components/formatNumber';
|
|
9
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
10
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
11
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
12
|
+
// A real app reads this from the person's role. Only an admin can change the plan.
|
|
13
|
+
var canChangePlan = true;
|
|
14
|
+
// A real app reads the numbers from the server. This is Free: 50 responses, 3 members and 1 GB.
|
|
15
|
+
var GB = Math.pow(1024, 3);
|
|
16
|
+
var storage = { used: Math.round(0.85 * GB), limit: GB };
|
|
17
|
+
export default function UsageMetersMeters() {
|
|
18
|
+
var _a = useState(true), showNotice = _a[0], setShowNotice = _a[1];
|
|
19
|
+
return (<Center width="page">
|
|
20
|
+
<SettingsSection title="Usage" description="This month, on the Free plan.">
|
|
21
|
+
<Stack gap="large">
|
|
22
|
+
<Stack gap="small">
|
|
23
|
+
{/* At the limit the meter says 'Limit reached' in words. The notice sits under it and names the limit. */}
|
|
24
|
+
<Progress id="usage-meters-responses" label="AI agent responses" value={50} max={50} unit="responses" aria-describedby={showNotice ? 'usage-meters-notice' : undefined}/>
|
|
25
|
+
<Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
|
|
26
|
+
{showNotice && (<Surface padding="small">
|
|
27
|
+
<Stack gap="medium">
|
|
28
|
+
<Stack gap="small">
|
|
29
|
+
<Paragraph id="usage-meters-notice" measure="none">You've used all 50 AI agent responses this month. They start again on Dec 1.</Paragraph>
|
|
30
|
+
<Paragraph tone="secondary" size="body2" measure="none">
|
|
31
|
+
{canChangePlan
|
|
32
|
+
? 'The Pro plan gives Acme 1,000 AI agent responses a month.'
|
|
33
|
+
: 'Ask a workspace admin to upgrade Acme to Pro for more replies.'}
|
|
34
|
+
</Paragraph>
|
|
35
|
+
</Stack>
|
|
36
|
+
<Cluster gap="small">
|
|
37
|
+
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setShowNotice(false); }}/>
|
|
38
|
+
{canChangePlan && (<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return router.push('/settings/billing?plan=pro'); }}/>)}
|
|
39
|
+
</Cluster>
|
|
40
|
+
</Stack>
|
|
41
|
+
</Surface>)}
|
|
42
|
+
</Stack>
|
|
43
|
+
<Progress label="Members" value={2} max={3} unit="members"/>
|
|
44
|
+
{/* Near the limit the bar turns to a warning, and says so in words. */}
|
|
45
|
+
<Progress label="Storage" value={storage.used} max={storage.limit} valueText={"".concat(formatBytes(storage.used), " of ").concat(formatBytes(storage.limit))}/>
|
|
46
|
+
</Stack>
|
|
47
|
+
</SettingsSection>
|
|
48
|
+
</Center>);
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function UsageMetersWithCap(): import("react").JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Alert from '../../components/alert';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import Progress from '../../components/progress';
|
|
6
|
+
import Button from '../../components/button';
|
|
7
|
+
import Form from '../../components/form';
|
|
8
|
+
import FormField from '../../components/formField';
|
|
9
|
+
import TextField from '../../components/textField';
|
|
10
|
+
import SettingsSection from '../../components/settingsSection';
|
|
11
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
12
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
13
|
+
// A real app reads these from the server. Extra AI agent responses cost $0.05 each, and $18.40 is spent so far.
|
|
14
|
+
var spent = 18.4;
|
|
15
|
+
// A real app reads this from the person's role. Only an admin sets the cap.
|
|
16
|
+
var canChangeCap = true;
|
|
17
|
+
export default function UsageMetersWithCap() {
|
|
18
|
+
var _a = useState(20), cap = _a[0], setCap = _a[1];
|
|
19
|
+
var _b = useState('20'), draft = _b[0], setDraft = _b[1];
|
|
20
|
+
var _c = useState(''), error = _c[0], setError = _c[1];
|
|
21
|
+
var _d = useState(false), saving = _d[0], setSaving = _d[1];
|
|
22
|
+
var _e = useState(false), saved = _e[0], setSaved = _e[1];
|
|
23
|
+
var timer = useRef();
|
|
24
|
+
// Cleared before a new 'Saved' starts, so an old timer cannot end it early.
|
|
25
|
+
var savedTimer = useRef();
|
|
26
|
+
// Stops the request and the 'Saved' if the example goes away before they end.
|
|
27
|
+
useEffect(function () { return function () {
|
|
28
|
+
clearTimeout(timer.current);
|
|
29
|
+
clearTimeout(savedTimer.current);
|
|
30
|
+
}; }, []);
|
|
31
|
+
var next = draft.trim() === '' ? null : Number(draft);
|
|
32
|
+
var changed = next !== cap;
|
|
33
|
+
// The cap is one field with one Save Button. Empty means no cap.
|
|
34
|
+
function handleSave() {
|
|
35
|
+
if (saving || !changed)
|
|
36
|
+
return;
|
|
37
|
+
if (next !== null && !(Number.isInteger(next) && next >= 1 && next <= 10000)) {
|
|
38
|
+
setError("Enter a whole amount from ".concat(formatMoney(1), " to ").concat(formatMoney(10000), ", or leave it empty for no cap."));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setError('');
|
|
42
|
+
setSaving(true);
|
|
43
|
+
// Stands in for the request to the server.
|
|
44
|
+
timer.current = setTimeout(function () {
|
|
45
|
+
setCap(next);
|
|
46
|
+
setSaving(false);
|
|
47
|
+
setSaved(true);
|
|
48
|
+
clearTimeout(savedTimer.current);
|
|
49
|
+
savedTimer.current = setTimeout(function () { return setSaved(false); }, 2000);
|
|
50
|
+
}, 1200);
|
|
51
|
+
}
|
|
52
|
+
var reached = cap !== null && spent >= cap;
|
|
53
|
+
return (<Center width="page">
|
|
54
|
+
<SettingsSection title="Usage" description={"This month, on the Pro plan. Extra AI agent responses cost ".concat(formatMoney(0.05), " each.")}>
|
|
55
|
+
<Stack gap="large">
|
|
56
|
+
<Stack gap="small">
|
|
57
|
+
{/* A cap is a limit: the bar warns near it and says 'Limit reached' at it. With no cap there is no bar. */}
|
|
58
|
+
<Progress label="Spend this month" value={spent} max={cap} valueText={cap === null ? "".concat(formatMoney(spent), " so far, no cap") : "".concat(formatMoney(spent), " of ").concat(formatMoney(cap))}/>
|
|
59
|
+
<Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
|
|
60
|
+
{reached && <Alert type="warning" variant="inline" autoDismiss={false} message="AI agent responses are paused. Raise the cap, or they start again on Dec 1."/>}
|
|
61
|
+
</Stack>
|
|
62
|
+
{canChangeCap ? (<Form aria-label="Monthly spend cap" gap="medium" onSubmit={handleSave}>
|
|
63
|
+
<FormField id="usage-meters-cap" label="Monthly spend cap (USD)" help="AI agent responses pause when the cap is reached. Leave it empty for no cap." error={error}>
|
|
64
|
+
{function (f) { return (<TextField id={f.id} aria-describedby={f['aria-describedby']} aria-invalid={f['aria-invalid']} type="number" value={draft} disabled={saving} onChange={function (e) { setDraft(e.target.value); setError(''); setSaved(false); }}/>); }}
|
|
65
|
+
</FormField>
|
|
66
|
+
<Cluster>
|
|
67
|
+
<Button size="medium" type="primary" state={changed || saving ? 'enabled' : 'disabled'} label={saved ? 'Saved' : 'Save'} htmlType="submit" loading={saving}/>
|
|
68
|
+
</Cluster>
|
|
69
|
+
</Form>) : (<Paragraph tone="secondary" size="body2" measure="none">{"The monthly spend cap is ".concat(cap === null ? 'not set' : formatMoney(cap), ". Only admins can change it.")}</Paragraph>)}
|
|
70
|
+
</Stack>
|
|
71
|
+
</SettingsSection>
|
|
72
|
+
</Center>);
|
|
73
|
+
}
|