oneslash-design-system 2.17.0 → 2.19.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 +2 -2
- package/dist/DESIGN.md +55 -14
- package/dist/cases/accept-invite.md +1 -5
- package/dist/cases/account-menu/menu.d.ts +1 -0
- package/dist/cases/account-menu/menu.jsx +99 -0
- package/dist/cases/account-menu.md +164 -0
- package/dist/cases/agent-asks-before-risky-action.md +0 -4
- package/dist/cases/agent-cancels-when-unanswered.md +0 -4
- package/dist/cases/agent-options.md +0 -4
- package/dist/cases/agent-pending-reply.md +0 -4
- package/dist/cases/agent-plan-proposal.md +0 -4
- package/dist/cases/agent-question.md +0 -4
- package/dist/cases/agent-refuses-clearly.md +0 -4
- package/dist/cases/agent-says-what-it-is.md +0 -2
- package/dist/cases/agent-settings/form.d.ts +1 -0
- package/dist/cases/agent-settings/form.jsx +164 -0
- package/dist/cases/agent-settings.md +259 -0
- package/dist/cases/agent-shows-progress.md +0 -2
- package/dist/cases/agent-shows-sources.md +0 -2
- package/dist/cases/api-keys/list.d.ts +1 -0
- package/dist/cases/api-keys/list.jsx +162 -0
- package/dist/cases/api-keys.md +229 -0
- package/dist/cases/app-shell/sidebar.d.ts +1 -0
- package/dist/cases/app-shell/sidebar.jsx +124 -0
- package/dist/cases/app-shell/top-tabs.d.ts +1 -0
- package/dist/cases/app-shell/top-tabs.jsx +106 -0
- package/dist/cases/app-shell.md +364 -0
- package/dist/cases/artifact-card/card.jsx +32 -6
- package/dist/cases/artifact-card.md +55 -11
- package/dist/cases/auth-gate-loading.md +0 -4
- package/dist/cases/check-your-email.md +0 -4
- package/dist/cases/collapsible-search/popover.d.ts +1 -0
- package/dist/cases/collapsible-search/popover.jsx +74 -0
- package/dist/cases/collapsible-search.md +143 -0
- package/dist/cases/composer-limit.md +0 -4
- package/dist/cases/confirm-destructive-action.md +0 -4
- package/dist/cases/confirm-dialogs.md +0 -4
- package/dist/cases/conversation-starters.md +0 -4
- package/dist/cases/create-modal.md +0 -4
- package/dist/cases/danger-zone/collapsed.d.ts +1 -0
- package/dist/cases/danger-zone/collapsed.jsx +75 -0
- package/dist/cases/danger-zone/shown.d.ts +1 -0
- package/dist/cases/danger-zone/shown.jsx +95 -0
- package/dist/cases/danger-zone.md +263 -0
- package/dist/cases/device-login.md +0 -4
- package/dist/cases/email-confirmed.md +0 -4
- package/dist/cases/empty-list.md +0 -4
- package/dist/cases/empty-lists.md +0 -4
- package/dist/cases/empty-not-set-up.md +0 -4
- package/dist/cases/empty-search.md +0 -4
- package/dist/cases/error-page/in-shell.jsx +26 -17
- package/dist/cases/error-page.md +42 -25
- package/dist/cases/feedback-form.md +0 -4
- package/dist/cases/filter-menu/presets.d.ts +1 -0
- package/dist/cases/filter-menu/presets.jsx +53 -0
- package/dist/cases/filter-menu/with-clear.d.ts +1 -0
- package/dist/cases/filter-menu/with-clear.jsx +56 -0
- package/dist/cases/filter-menu.md +204 -0
- package/dist/cases/forgot-password.md +0 -4
- package/dist/cases/form-errors.md +0 -4
- package/dist/cases/import-checklist.md +0 -4
- package/dist/cases/inline-form-feedback.md +0 -4
- package/dist/cases/integrations-list/nested.d.ts +1 -0
- package/dist/cases/integrations-list/nested.jsx +164 -0
- package/dist/cases/integrations-list/rows.d.ts +1 -0
- package/dist/cases/integrations-list/rows.jsx +134 -0
- package/dist/cases/integrations-list.md +379 -0
- package/dist/cases/invite-member.md +0 -4
- package/dist/cases/load-failure.md +0 -4
- package/dist/cases/log-out-confirm.md +0 -4
- package/dist/cases/login-page.md +0 -4
- package/dist/cases/master-detail/list-then-page.d.ts +1 -0
- package/dist/cases/master-detail/list-then-page.jsx +65 -0
- package/dist/cases/master-detail/split.d.ts +1 -0
- package/dist/cases/master-detail/split.jsx +49 -0
- package/dist/cases/master-detail.md +213 -0
- package/dist/cases/members-list/rows.d.ts +1 -0
- package/dist/cases/members-list/rows.jsx +318 -0
- package/dist/cases/members-list/table.d.ts +1 -0
- package/dist/cases/members-list/table.jsx +351 -0
- package/dist/cases/members-list.md +799 -0
- package/dist/cases/mention-list.md +0 -4
- package/dist/cases/message-actions.md +0 -4
- package/dist/cases/message-attachments.md +0 -4
- package/dist/cases/message-composer.md +0 -4
- package/dist/cases/message-edit.md +0 -4
- package/dist/cases/message-reactions.md +0 -4
- package/dist/cases/message-row.md +0 -4
- package/dist/cases/mobile-menu/links.d.ts +1 -0
- package/dist/cases/mobile-menu/links.jsx +24 -0
- package/dist/cases/mobile-menu/sections.d.ts +1 -0
- package/dist/cases/mobile-menu/sections.jsx +61 -0
- package/dist/cases/mobile-menu.md +170 -0
- package/dist/cases/not-found-page/in-shell.jsx +26 -17
- package/dist/cases/not-found-page.md +41 -24
- package/dist/cases/notification-menu/menu.d.ts +1 -0
- package/dist/cases/notification-menu/menu.jsx +74 -0
- package/dist/cases/notification-menu.md +135 -0
- package/dist/cases/oauth-consent.md +0 -4
- package/dist/cases/on-off-settings/list.d.ts +1 -0
- package/dist/cases/on-off-settings/list.jsx +97 -0
- package/dist/cases/on-off-settings.md +116 -0
- package/dist/cases/on-this-page/aside.d.ts +1 -0
- package/dist/cases/on-this-page/aside.jsx +39 -0
- package/dist/cases/on-this-page.md +80 -0
- package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
- package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
- package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
- package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
- package/dist/cases/overflow-menu.md +410 -0
- package/dist/cases/page-header/actions.d.ts +1 -0
- package/dist/cases/page-header/actions.jsx +65 -0
- package/dist/cases/page-header/sub-page.d.ts +1 -0
- package/dist/cases/page-header/sub-page.jsx +37 -0
- package/dist/cases/page-header.md +195 -0
- package/dist/cases/phone-navigation.md +32 -0
- package/dist/cases/profile-form/form.d.ts +1 -0
- package/dist/cases/profile-form/form.jsx +153 -0
- package/dist/cases/profile-form.md +236 -0
- package/dist/cases/quick-switcher/modal.d.ts +1 -0
- package/dist/cases/quick-switcher/modal.jsx +114 -0
- package/dist/cases/quick-switcher.md +205 -0
- package/dist/cases/range-switch/segmented.d.ts +1 -0
- package/dist/cases/range-switch/segmented.jsx +30 -0
- package/dist/cases/range-switch.md +67 -0
- package/dist/cases/rename.md +0 -4
- package/dist/cases/reply-feedback.md +0 -4
- package/dist/cases/reply-sources.md +0 -4
- package/dist/cases/route-loading/region.jsx +27 -18
- package/dist/cases/route-loading.md +42 -23
- package/dist/cases/scope-picker/menu.d.ts +1 -0
- package/dist/cases/scope-picker/menu.jsx +47 -0
- package/dist/cases/scope-picker.md +97 -0
- package/dist/cases/set-new-password.md +0 -4
- package/dist/cases/settings-page/side-nav.d.ts +1 -0
- package/dist/cases/settings-page/side-nav.jsx +171 -0
- package/dist/cases/settings-page/top-tabs.d.ts +1 -0
- package/dist/cases/settings-page/top-tabs.jsx +129 -0
- package/dist/cases/settings-page.md +378 -0
- package/dist/cases/settings-save.md +35 -0
- package/dist/cases/side-pane/beside.d.ts +1 -0
- package/dist/cases/side-pane/beside.jsx +79 -0
- package/dist/cases/side-pane/over.d.ts +1 -0
- package/dist/cases/side-pane/over.jsx +58 -0
- package/dist/cases/side-pane.md +238 -0
- package/dist/cases/sidebar-nav/flat.d.ts +1 -0
- package/dist/cases/sidebar-nav/flat.jsx +81 -0
- package/dist/cases/sidebar-nav/nested.d.ts +1 -0
- package/dist/cases/sidebar-nav/nested.jsx +122 -0
- package/dist/cases/sidebar-nav.md +261 -0
- package/dist/cases/sign-up-page.md +1 -5
- package/dist/cases/site-footer/columns.d.ts +1 -0
- package/dist/cases/site-footer/columns.jsx +51 -0
- package/dist/cases/site-footer/simple.d.ts +1 -0
- package/dist/cases/site-footer/simple.jsx +24 -0
- package/dist/cases/site-footer.md +133 -0
- package/dist/cases/site-header/links.d.ts +1 -0
- package/dist/cases/site-header/links.jsx +26 -0
- package/dist/cases/site-header/sections.d.ts +1 -0
- package/dist/cases/site-header/sections.jsx +64 -0
- package/dist/cases/site-header.md +183 -0
- package/dist/cases/slash-command-list.md +0 -4
- package/dist/cases/success-feedback.md +0 -4
- package/dist/cases/tag-filter/tags.d.ts +1 -0
- package/dist/cases/tag-filter/tags.jsx +226 -0
- package/dist/cases/tag-filter.md +298 -0
- package/dist/cases/theme-switcher/menu.d.ts +1 -0
- package/dist/cases/theme-switcher/menu.jsx +47 -0
- package/dist/cases/theme-switcher/segmented.d.ts +1 -0
- package/dist/cases/theme-switcher/segmented.jsx +26 -0
- package/dist/cases/theme-switcher.md +149 -0
- package/dist/cases/type-to-confirm.md +0 -4
- package/dist/cases/typing-and-status.md +0 -4
- package/dist/cases/unsaved-changes-guard.md +0 -4
- package/dist/cases/upgrade-prompt.md +0 -4
- package/dist/cases.json +1737 -315
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +2 -2
- package/dist/components/appShell.d.ts +44 -0
- package/dist/components/appShell.jsx +121 -0
- package/dist/components/button.jsx +5 -2
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +2 -2
- package/dist/components/copyField.d.ts +20 -0
- package/dist/components/copyField.jsx +99 -0
- package/dist/components/drawer.d.ts +31 -0
- package/dist/components/drawer.jsx +121 -0
- package/dist/components/formField.d.ts +34 -0
- package/dist/components/formField.jsx +28 -0
- package/dist/components/heading.d.ts +5 -1
- package/dist/components/heading.jsx +2 -2
- package/dist/components/link.d.ts +6 -1
- package/dist/components/link.jsx +11 -3
- package/dist/components/menu.jsx +2 -2
- package/dist/components/menuItem.d.ts +10 -2
- package/dist/components/menuItem.jsx +4 -3
- package/dist/components/modal.jsx +12 -23
- package/dist/components/navigation.d.ts +9 -1
- package/dist/components/navigation.jsx +15 -3
- package/dist/components/onThisPage.d.ts +29 -0
- package/dist/components/onThisPage.jsx +151 -0
- package/dist/components/pageShell.d.ts +7 -1
- package/dist/components/pageShell.jsx +14 -1
- package/dist/components/popover.jsx +4 -0
- package/dist/components/radioGroup.d.ts +5 -1
- package/dist/components/radioGroup.jsx +2 -2
- package/dist/components/segmentedControl.d.ts +22 -0
- package/dist/components/segmentedControl.jsx +54 -0
- package/dist/components/select.d.ts +5 -1
- package/dist/components/select.jsx +2 -2
- package/dist/components/settingsSection.d.ts +36 -0
- package/dist/components/settingsSection.jsx +65 -0
- package/dist/components/sidePane.d.ts +32 -0
- package/dist/components/sidePane.jsx +128 -0
- package/dist/components/siteFooter.d.ts +24 -0
- package/dist/components/siteFooter.jsx +48 -0
- package/dist/components/siteHeader.d.ts +55 -0
- package/dist/components/siteHeader.jsx +125 -0
- package/dist/components/slidingIndicator.d.ts +50 -0
- package/dist/components/slidingIndicator.jsx +102 -0
- package/dist/components/switch.d.ts +25 -0
- package/dist/components/switch.jsx +55 -0
- package/dist/components/tab.jsx +5 -11
- package/dist/components/tabsContainer.jsx +5 -67
- package/dist/components/textField.d.ts +12 -2
- package/dist/components/textField.jsx +11 -4
- package/dist/components/textarea.d.ts +5 -1
- package/dist/components/textarea.jsx +3 -3
- package/dist/components/titleBar.d.ts +17 -0
- package/dist/components/titleBar.jsx +17 -0
- package/dist/components/useHotkey.d.ts +7 -0
- package/dist/components/useHotkey.js +24 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/internal/copyField.d.ts +5 -0
- package/dist/internal/copyField.js +61 -0
- package/dist/internal/hotkey.d.ts +16 -0
- package/dist/internal/hotkey.js +20 -0
- package/dist/internal/overlayStack.d.ts +24 -0
- package/dist/internal/overlayStack.js +71 -0
- package/dist/internal/resize.d.ts +9 -0
- package/dist/internal/resize.js +31 -0
- package/dist/internal/scrollSpy.d.ts +24 -0
- package/dist/internal/scrollSpy.js +53 -0
- package/dist/internal/siteBrand.d.ts +6 -0
- package/dist/internal/siteBrand.jsx +11 -0
- package/dist/internal/switch.d.ts +5 -0
- package/dist/internal/switch.js +9 -0
- package/dist/native-mapping.json +72 -0
- package/dist/stories/AppShell.stories.d.ts +15 -0
- package/dist/stories/AppShell.stories.jsx +137 -0
- package/dist/stories/Cases.generated.stories.d.ts +42 -0
- package/dist/stories/Cases.generated.stories.jsx +84 -0
- package/dist/stories/CopyField.stories.d.ts +11 -0
- package/dist/stories/CopyField.stories.jsx +65 -0
- package/dist/stories/Drawer.stories.d.ts +10 -0
- package/dist/stories/Drawer.stories.jsx +123 -0
- package/dist/stories/FormField.stories.d.ts +6 -0
- package/dist/stories/FormField.stories.jsx +44 -0
- package/dist/stories/Link.stories.d.ts +1 -0
- package/dist/stories/Link.stories.jsx +8 -0
- package/dist/stories/Navigation.stories.d.ts +1 -0
- package/dist/stories/Navigation.stories.jsx +17 -1
- package/dist/stories/OnThisPage.stories.d.ts +10 -0
- package/dist/stories/OnThisPage.stories.jsx +105 -0
- package/dist/stories/SegmentedControl.stories.d.ts +8 -0
- package/dist/stories/SegmentedControl.stories.jsx +33 -0
- package/dist/stories/SettingsSection.stories.d.ts +12 -0
- package/dist/stories/SettingsSection.stories.jsx +91 -0
- package/dist/stories/SidePane.stories.d.ts +6 -0
- package/dist/stories/SidePane.stories.jsx +37 -0
- package/dist/stories/SiteFooter.stories.d.ts +7 -0
- package/dist/stories/SiteFooter.stories.jsx +63 -0
- package/dist/stories/SiteHeader.stories.d.ts +10 -0
- package/dist/stories/SiteHeader.stories.jsx +94 -0
- package/dist/stories/Switch.stories.d.ts +14 -0
- package/dist/stories/Switch.stories.jsx +87 -0
- package/dist/stories/TextField.stories.d.ts +1 -0
- package/dist/stories/TextField.stories.jsx +13 -0
- package/dist/stories/TitleBar.stories.d.ts +6 -0
- package/dist/stories/TitleBar.stories.jsx +34 -0
- package/package.json +5 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# List and detail
|
|
2
|
+
|
|
3
|
+
A person opens an item from a list, such as a message or a report, and reads or acts on it.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail'.
|
|
8
|
+
- Use `SettingsLayout` with `navWidth="wide"` for a list beside its detail. The list is a `Navigation` of `MenuItem` rows.
|
|
9
|
+
- Make each row a link with an `href`, so the open item has an address that can be shared and reloaded. Mark the open row with `isSelected` and `aria-current="page"`.
|
|
10
|
+
- Keep one item open at all times from `md` up, the first at the start.
|
|
11
|
+
- Name the row with the sender or the title, and put the subject or the summary in `secondLabel`.
|
|
12
|
+
- Show the list first on a phone, then the detail alone with a Back Button named for the list: 'Back to Inbox'. Pass it as `back` of `SettingsLayout`.
|
|
13
|
+
- Title the page with a level 1 heading, such as 'Inbox'. The open item's title is a level 2 heading.
|
|
14
|
+
- Make each row of a list of long items a link to a page of its own. Put 'Back to Reports' in the page's `TitleBar` as `back`.
|
|
15
|
+
- Let 'Back to Reports' call the router's `back()` when the person came from the list, so the list keeps its scroll. Otherwise link to the list's address.
|
|
16
|
+
- After the person acts on an item, such as Archive, open the next one.
|
|
17
|
+
|
|
18
|
+
## Don't
|
|
19
|
+
|
|
20
|
+
- Do not show the list and the detail together on a phone.
|
|
21
|
+
- Do not leave the detail empty with nothing open on a wide screen. Open the first item.
|
|
22
|
+
- Do not keep the open item only in state. Give it an address.
|
|
23
|
+
- Do not name the Back Button 'Back'. Name the list it goes to.
|
|
24
|
+
- Do not use a split for long items that need the whole width.
|
|
25
|
+
|
|
26
|
+
## Option: List beside the detail
|
|
27
|
+
|
|
28
|
+
Use when: The person works down the list, one item after another, such as an inbox.
|
|
29
|
+
|
|
30
|
+
Uses: `Button`, `Cluster`, `Heading`, `MenuItem`, `Navigation`, `PageShell`, `Paragraph`, `SettingsLayout`, `Stack`
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
'use client';
|
|
34
|
+
import { useState } from 'react';
|
|
35
|
+
import Navigation from 'oneslash-design-system/components/navigation';
|
|
36
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
37
|
+
import { SettingsLayout } from 'oneslash-design-system/components/settingsSection';
|
|
38
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
39
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
40
|
+
import Button from 'oneslash-design-system/components/button';
|
|
41
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
42
|
+
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
43
|
+
|
|
44
|
+
type Message = { id: string; from: string; subject: string; time: string; body: string[] };
|
|
45
|
+
|
|
46
|
+
const messages: Message[] = [
|
|
47
|
+
{ id: 'launch-plan', from: 'Ben Carter', subject: 'Launch plan is ready', time: '9:12 AM', body: ['The plan is in the shared folder. It covers the announcement, the pricing page and the support hand-off.', 'Can you read the pricing part before noon? Omar Reyes is waiting on it.'] },
|
|
48
|
+
{ id: 'new-screens', from: 'Omar Reyes', subject: 'New screens for Friday', time: '8:40 AM', body: ['I added the new home page screens. The sign-up form now sits above the pricing table.', 'Tell me what to change by Thursday.'] },
|
|
49
|
+
{ id: 'invoice', from: 'Ben Carter', subject: 'Invoice for October', time: 'Yesterday', body: ['The invoice for October is attached. It includes the three new seats.'] },
|
|
50
|
+
{ id: 'offsite', from: 'Omar Reyes', subject: 'Team offsite in March', time: 'Monday', body: ['I found two dates for the offsite. Please say which one works for you.'] },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export default function MasterDetailSplit() {
|
|
54
|
+
// One message is always open, the first at the start.
|
|
55
|
+
const [openId, setOpenId] = useState(messages[0].id);
|
|
56
|
+
// On a phone the list is the screen until a message is chosen, and Back returns to it.
|
|
57
|
+
const [showDetail, setShowDetail] = useState(false);
|
|
58
|
+
|
|
59
|
+
const message = messages.find((m) => m.id === openId) ?? messages[0];
|
|
60
|
+
|
|
61
|
+
const list = (
|
|
62
|
+
<Navigation aria-label="Messages">
|
|
63
|
+
{messages.map((m) => (
|
|
64
|
+
<MenuItem
|
|
65
|
+
key={m.id}
|
|
66
|
+
size="medium"
|
|
67
|
+
label={m.from}
|
|
68
|
+
secondLabel={m.subject}
|
|
69
|
+
href={`/inbox/${m.id}`}
|
|
70
|
+
isSelected={m.id === message.id}
|
|
71
|
+
aria-current={m.id === message.id ? 'page' : undefined}
|
|
72
|
+
onClick={(event: { preventDefault: () => void }) => {
|
|
73
|
+
// 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.
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
setOpenId(m.id);
|
|
76
|
+
setShowDetail(true);
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
))}
|
|
80
|
+
</Navigation>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<PageShell>
|
|
85
|
+
<Stack gap="xlarge">
|
|
86
|
+
<Heading level={1} size="h5">Inbox</Heading>
|
|
87
|
+
<SettingsLayout
|
|
88
|
+
navWidth="wide"
|
|
89
|
+
nav={list}
|
|
90
|
+
showContent={showDetail}
|
|
91
|
+
back={<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Inbox" onClickButton={() => setShowDetail(false)} />}
|
|
92
|
+
>
|
|
93
|
+
<Stack gap="small">
|
|
94
|
+
<Heading level={2} size="h6">{message.subject}</Heading>
|
|
95
|
+
<Paragraph tone="secondary" size="body2" measure="none">{message.from}, {message.time}</Paragraph>
|
|
96
|
+
</Stack>
|
|
97
|
+
<Stack gap="medium">
|
|
98
|
+
{message.body.map((paragraph) => (
|
|
99
|
+
<Paragraph key={paragraph} measure="none">{paragraph}</Paragraph>
|
|
100
|
+
))}
|
|
101
|
+
</Stack>
|
|
102
|
+
<Cluster>
|
|
103
|
+
<Button size="medium" type="primary" state="enabled" label="Reply" decoIcon="Reply" />
|
|
104
|
+
</Cluster>
|
|
105
|
+
</SettingsLayout>
|
|
106
|
+
</Stack>
|
|
107
|
+
</PageShell>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Option: List, then a page for each item
|
|
113
|
+
|
|
114
|
+
Use when: Each item is long and has its own address, such as a report.
|
|
115
|
+
|
|
116
|
+
Uses: `Button`, `Heading`, `MenuItem`, `Navigation`, `PageShell`, `Paragraph`, `Stack`, `TitleBar`
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
'use client';
|
|
120
|
+
import { useState } from 'react';
|
|
121
|
+
import Navigation from 'oneslash-design-system/components/navigation';
|
|
122
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
123
|
+
import TitleBar from 'oneslash-design-system/components/titleBar';
|
|
124
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
125
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
126
|
+
import Button from 'oneslash-design-system/components/button';
|
|
127
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
128
|
+
import { Stack } from 'oneslash-design-system/components/layout';
|
|
129
|
+
|
|
130
|
+
type Report = { id: string; title: string; summary: string; body: string[] };
|
|
131
|
+
|
|
132
|
+
const reports: Report[] = [
|
|
133
|
+
{
|
|
134
|
+
id: 'q3-review',
|
|
135
|
+
title: 'Q3 review',
|
|
136
|
+
summary: 'Revenue, churn and what changed since June.',
|
|
137
|
+
body: [
|
|
138
|
+
'Revenue grew 12 percent over the quarter, led by the new team plan. Churn fell to 2.1 percent.',
|
|
139
|
+
'Support tickets about sign-up dropped by a third after the new form shipped in August.',
|
|
140
|
+
'The main risk is the pricing page, which still sends people to a contact form. Ben Carter owns the fix.',
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'hiring-plan',
|
|
145
|
+
title: 'Hiring plan',
|
|
146
|
+
summary: 'Roles to open next half, and why.',
|
|
147
|
+
body: [
|
|
148
|
+
'Two roles open in January: a designer for the web app and a support lead.',
|
|
149
|
+
'Omar Reyes will write both job posts. Dana Lee approves the budget on Monday.',
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'roadmap',
|
|
154
|
+
title: 'Roadmap',
|
|
155
|
+
summary: 'What ships, in order, through March.',
|
|
156
|
+
body: [
|
|
157
|
+
'The mobile app and the new billing page ship first. Integrations follow in February.',
|
|
158
|
+
'Each item lists its owner, its date and what must be true before it starts.',
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
export default function MasterDetailListThenPage() {
|
|
164
|
+
const [openId, setOpenId] = useState<string | null>(null);
|
|
165
|
+
const report = reports.find((r) => r.id === openId);
|
|
166
|
+
|
|
167
|
+
// A real app goes to the page's address. Back calls the router's back() when the person came from the list, so the list keeps its scroll,
|
|
168
|
+
// and otherwise links to the list's address. The example swaps the view.
|
|
169
|
+
if (report) {
|
|
170
|
+
return (
|
|
171
|
+
<PageShell>
|
|
172
|
+
<Stack gap="large">
|
|
173
|
+
<TitleBar
|
|
174
|
+
title={report.title}
|
|
175
|
+
back={<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Reports" onClickButton={() => setOpenId(null)} />}
|
|
176
|
+
/>
|
|
177
|
+
{report.body.map((paragraph) => (
|
|
178
|
+
<Paragraph key={paragraph} measure="body">{paragraph}</Paragraph>
|
|
179
|
+
))}
|
|
180
|
+
</Stack>
|
|
181
|
+
</PageShell>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<PageShell>
|
|
187
|
+
<Stack gap="large">
|
|
188
|
+
<Heading level={1} size="h5">Reports</Heading>
|
|
189
|
+
<Navigation aria-label="Reports">
|
|
190
|
+
{reports.map((r) => (
|
|
191
|
+
<MenuItem
|
|
192
|
+
key={r.id}
|
|
193
|
+
size="medium"
|
|
194
|
+
label={r.title}
|
|
195
|
+
secondLabel={r.summary}
|
|
196
|
+
iconRight="ChevronRight"
|
|
197
|
+
href={`/reports/${r.id}`}
|
|
198
|
+
onClick={(event: { preventDefault: () => void }) => {
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
setOpenId(r.id);
|
|
201
|
+
}}
|
|
202
|
+
/>
|
|
203
|
+
))}
|
|
204
|
+
</Navigation>
|
|
205
|
+
</Stack>
|
|
206
|
+
</PageShell>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Native
|
|
212
|
+
|
|
213
|
+
On Apple use a `NavigationSplitView` with a list and a detail. On iPhone it shows the list, then pushes the detail with the system back button. On Android use a list-detail layout that shows one pane on a phone.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MembersListRows(): import("react").JSX.Element;
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
import { useEffect, useRef, useState } from 'react';
|
|
23
|
+
import Toaster, { toast, dismissToast } from '../../components/toaster';
|
|
24
|
+
import Modal from '../../components/modal';
|
|
25
|
+
import Heading from '../../components/heading';
|
|
26
|
+
import Paragraph from '../../components/paragraph';
|
|
27
|
+
import TableContainer from '../../components/tableContainer';
|
|
28
|
+
import TableRow from '../../components/tableRow';
|
|
29
|
+
import TableCell from '../../components/tableCell';
|
|
30
|
+
import Form from '../../components/form';
|
|
31
|
+
import TextField from '../../components/textField';
|
|
32
|
+
import Select from '../../components/select';
|
|
33
|
+
import Alert from '../../components/alert';
|
|
34
|
+
import Tag from '../../components/tag';
|
|
35
|
+
import Button from '../../components/button';
|
|
36
|
+
import UserImage from '../../components/userImage';
|
|
37
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
38
|
+
// A real app reads these from the signed-in person and the plan.
|
|
39
|
+
var youId = 'dana';
|
|
40
|
+
var canManage = true;
|
|
41
|
+
var seatLimit = 8;
|
|
42
|
+
var roleOptions = [
|
|
43
|
+
{ value: 'Admin', label: 'Admin' },
|
|
44
|
+
{ value: 'Member', label: 'Member' },
|
|
45
|
+
{ value: 'Guest', label: 'Guest' },
|
|
46
|
+
];
|
|
47
|
+
var firstMembers = [
|
|
48
|
+
{ id: 'dana', name: 'Dana Lee', email: 'dana@acme.example', role: 'Admin' },
|
|
49
|
+
{ id: 'ben', name: 'Ben Carter', email: 'ben@acme.example', role: 'Member' },
|
|
50
|
+
{ id: 'omar', name: 'Omar Reyes', email: 'omar@acme.example', role: 'Member' },
|
|
51
|
+
{ id: 'mei', name: 'Mei Tanaka', email: 'mei@acme.example', role: 'Member' },
|
|
52
|
+
{ id: 'luis', name: 'Luis Ortega', email: 'luis@acme.example', role: 'Guest' },
|
|
53
|
+
];
|
|
54
|
+
var firstInvites = [
|
|
55
|
+
{ id: 'i1', email: 'priya@acme.example', sent: 'Sent 2 days ago', link: 'https://acme.example/join/k7Qm2xLp' },
|
|
56
|
+
{ id: 'i2', email: 'sam@partner.example', sent: 'Sent 5 days ago', link: 'https://acme.example/join/b4Tn8zVw' },
|
|
57
|
+
];
|
|
58
|
+
// Stands in for a save that does not go through: Omar's role never saves.
|
|
59
|
+
var failsFor = 'omar';
|
|
60
|
+
var failedMessage = 'Could not save. Try again.';
|
|
61
|
+
// A small check: some text, an @, then some text.
|
|
62
|
+
function looksLikeEmail(value) {
|
|
63
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
64
|
+
}
|
|
65
|
+
export default function MembersListRows() {
|
|
66
|
+
var _a = useState(firstMembers), members = _a[0], setMembers = _a[1];
|
|
67
|
+
var _b = useState(firstInvites), invites = _b[0], setInvites = _b[1];
|
|
68
|
+
var _c = useState(function () { return Object.fromEntries(firstMembers.map(function (m) { return [m.id, m.role]; })); }), roles = _c[0], setRoles = _c[1];
|
|
69
|
+
var _d = useState(null), savingRole = _d[0], setSavingRole = _d[1];
|
|
70
|
+
// Opens on a failed save, as if the person just changed Omar Reyes's role.
|
|
71
|
+
var _e = useState({ omar: failedMessage }), roleErrors = _e[0], setRoleErrors = _e[1];
|
|
72
|
+
// Opens with one row confirming, as if the person just chose Remove on it.
|
|
73
|
+
var _f = useState('ben'), confirmingMember = _f[0], setConfirmingMember = _f[1];
|
|
74
|
+
var _g = useState(null), confirmingInvite = _g[0], setConfirmingInvite = _g[1];
|
|
75
|
+
var _h = useState(null), busyRow = _h[0], setBusyRow = _h[1];
|
|
76
|
+
var _j = useState(null), copiedInvite = _j[0], setCopiedInvite = _j[1];
|
|
77
|
+
var _k = useState(null), copyBlocked = _k[0], setCopyBlocked = _k[1];
|
|
78
|
+
var _l = useState(false), inviteOpen = _l[0], setInviteOpen = _l[1];
|
|
79
|
+
var _m = useState(''), email = _m[0], setEmail = _m[1];
|
|
80
|
+
var _o = useState(''), emailError = _o[0], setEmailError = _o[1];
|
|
81
|
+
var _p = useState(false), sending = _p[0], setSending = _p[1];
|
|
82
|
+
var _q = useState(false), upgradeOpen = _q[0], setUpgradeOpen = _q[1];
|
|
83
|
+
var timers = useRef([]);
|
|
84
|
+
var copyTimer = useRef();
|
|
85
|
+
var mounted = useRef(true);
|
|
86
|
+
var toastIds = useRef([]);
|
|
87
|
+
// Gives each new invite its own id, so no two rows share a key.
|
|
88
|
+
var inviteCount = useRef(0);
|
|
89
|
+
// On unmount it stops every request and closes every toast it opened.
|
|
90
|
+
useEffect(function () {
|
|
91
|
+
mounted.current = true;
|
|
92
|
+
return function () {
|
|
93
|
+
mounted.current = false;
|
|
94
|
+
timers.current.forEach(clearTimeout);
|
|
95
|
+
clearTimeout(copyTimer.current);
|
|
96
|
+
toastIds.current.forEach(function (id) { return dismissToast(id); });
|
|
97
|
+
toastIds.current = [];
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
100
|
+
// Stands in for the request to the server.
|
|
101
|
+
function later(callback, ms) {
|
|
102
|
+
timers.current.push(setTimeout(callback, ms));
|
|
103
|
+
}
|
|
104
|
+
// A pending invite holds a seat until it is accepted or revoked.
|
|
105
|
+
var seatsUsed = members.length + invites.length;
|
|
106
|
+
var atSeatLimit = seatsUsed >= seatLimit;
|
|
107
|
+
var address = email.trim();
|
|
108
|
+
// The role is one control on its own, so it saves as soon as it changes. Nothing shows when it works.
|
|
109
|
+
function handleRoleChange(member, next) {
|
|
110
|
+
if (savingRole)
|
|
111
|
+
return;
|
|
112
|
+
var before = roles[member.id];
|
|
113
|
+
setRoleErrors(function (current) {
|
|
114
|
+
var _a;
|
|
115
|
+
return (__assign(__assign({}, current), (_a = {}, _a[member.id] = '', _a)));
|
|
116
|
+
});
|
|
117
|
+
setSavingRole(member.id);
|
|
118
|
+
setRoles(function (current) {
|
|
119
|
+
var _a;
|
|
120
|
+
return (__assign(__assign({}, current), (_a = {}, _a[member.id] = next, _a)));
|
|
121
|
+
});
|
|
122
|
+
later(function () {
|
|
123
|
+
setSavingRole(null);
|
|
124
|
+
if (member.id === failsFor) {
|
|
125
|
+
setRoles(function (current) {
|
|
126
|
+
var _a;
|
|
127
|
+
return (__assign(__assign({}, current), (_a = {}, _a[member.id] = before, _a)));
|
|
128
|
+
});
|
|
129
|
+
setRoleErrors(function (current) {
|
|
130
|
+
var _a;
|
|
131
|
+
return (__assign(__assign({}, current), (_a = {}, _a[member.id] = failedMessage, _a)));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, 900);
|
|
135
|
+
}
|
|
136
|
+
// Starting a confirm on one row cancels the confirm on any other.
|
|
137
|
+
function startConfirm(kind, id) {
|
|
138
|
+
setConfirmingMember(kind === 'member' ? id : null);
|
|
139
|
+
setConfirmingInvite(kind === 'invite' ? id : null);
|
|
140
|
+
}
|
|
141
|
+
function handleRemove(member) {
|
|
142
|
+
if (busyRow)
|
|
143
|
+
return;
|
|
144
|
+
setBusyRow(member.id);
|
|
145
|
+
later(function () {
|
|
146
|
+
setBusyRow(null);
|
|
147
|
+
setConfirmingMember(null);
|
|
148
|
+
setMembers(function (list) { return list.filter(function (m) { return m.id !== member.id; }); });
|
|
149
|
+
toastIds.current.push(toast({ type: 'success', message: "".concat(member.name, " removed from Acme.") }));
|
|
150
|
+
}, 1200);
|
|
151
|
+
}
|
|
152
|
+
function handleRevokeInvite(invite) {
|
|
153
|
+
if (busyRow)
|
|
154
|
+
return;
|
|
155
|
+
setBusyRow(invite.id);
|
|
156
|
+
later(function () {
|
|
157
|
+
setBusyRow(null);
|
|
158
|
+
setConfirmingInvite(null);
|
|
159
|
+
setInvites(function (list) { return list.filter(function (i) { return i.id !== invite.id; }); });
|
|
160
|
+
toastIds.current.push(toast({ type: 'success', message: "Invite for ".concat(invite.email, " revoked.") }));
|
|
161
|
+
}, 1200);
|
|
162
|
+
}
|
|
163
|
+
// Only reads 'Copied' when the link reached the clipboard. When the browser has no
|
|
164
|
+
// clipboard or refuses the write, a line under the row says so.
|
|
165
|
+
function handleCopy(invite) {
|
|
166
|
+
clearTimeout(copyTimer.current);
|
|
167
|
+
setCopiedInvite(null);
|
|
168
|
+
var blocked = function () {
|
|
169
|
+
if (mounted.current)
|
|
170
|
+
setCopyBlocked(invite.id);
|
|
171
|
+
};
|
|
172
|
+
if (!navigator.clipboard) {
|
|
173
|
+
blocked();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
navigator.clipboard.writeText(invite.link).then(function () {
|
|
177
|
+
if (!mounted.current)
|
|
178
|
+
return;
|
|
179
|
+
setCopyBlocked(null);
|
|
180
|
+
setCopiedInvite(invite.id);
|
|
181
|
+
copyTimer.current = setTimeout(function () { return setCopiedInvite(null); }, 2000);
|
|
182
|
+
}, blocked);
|
|
183
|
+
}
|
|
184
|
+
// At the seat limit the Button still works: it tells the person why they cannot invite.
|
|
185
|
+
function handleInviteMember() {
|
|
186
|
+
if (atSeatLimit) {
|
|
187
|
+
setUpgradeOpen(true);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
setEmail('');
|
|
191
|
+
setEmailError('');
|
|
192
|
+
setInviteOpen(true);
|
|
193
|
+
}
|
|
194
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
195
|
+
function handleInviteClose() {
|
|
196
|
+
if (sending)
|
|
197
|
+
return;
|
|
198
|
+
setInviteOpen(false);
|
|
199
|
+
}
|
|
200
|
+
function handleSendInvite() {
|
|
201
|
+
if (sending || address === '')
|
|
202
|
+
return;
|
|
203
|
+
setEmailError('');
|
|
204
|
+
if (!looksLikeEmail(address)) {
|
|
205
|
+
setEmailError('Enter an email address, like name@example.com.');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
var member = members.find(function (m) { return m.email === address.toLowerCase(); });
|
|
209
|
+
if (member) {
|
|
210
|
+
setEmailError("".concat(member.name, " is already a member of Acme."));
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
setSending(true);
|
|
214
|
+
later(function () {
|
|
215
|
+
setSending(false);
|
|
216
|
+
setInviteOpen(false);
|
|
217
|
+
inviteCount.current += 1;
|
|
218
|
+
var id = "new-".concat(inviteCount.current);
|
|
219
|
+
setInvites(function (list) { return __spreadArray(__spreadArray([], list, true), [{ id: id, email: address, sent: 'Sent just now', link: 'https://acme.example/join/p9Rd3cYs' }], false); });
|
|
220
|
+
toastIds.current.push(toast({ type: 'success', message: "Invite sent to ".concat(address, ".") }));
|
|
221
|
+
}, 1200);
|
|
222
|
+
}
|
|
223
|
+
return (<Center width="page">
|
|
224
|
+
{/* A real app mounts one Toaster near its root. */}
|
|
225
|
+
<Toaster />
|
|
226
|
+
<Stack gap="xlarge">
|
|
227
|
+
<Stack gap="small">
|
|
228
|
+
<Cluster justify="between">
|
|
229
|
+
<Heading level={1} size="h5">Members</Heading>
|
|
230
|
+
{canManage && <Button size="small" type="primary" state="enabled" label="Invite Member" decoIcon="UserPlus" onClickButton={handleInviteMember}/>}
|
|
231
|
+
</Cluster>
|
|
232
|
+
<Paragraph tone="secondary" size="body2" measure="none">{seatsUsed} of {seatLimit} seats used on the Free plan.</Paragraph>
|
|
233
|
+
{!canManage && <Paragraph tone="secondary" size="body2" measure="none">Only admins can change this.</Paragraph>}
|
|
234
|
+
</Stack>
|
|
235
|
+
|
|
236
|
+
<TableContainer>
|
|
237
|
+
{members.map(function (m) {
|
|
238
|
+
var isYou = m.id === youId;
|
|
239
|
+
return (<TableRow key={m.id}>
|
|
240
|
+
<TableCell>
|
|
241
|
+
<Cluster gap="small" align="start">
|
|
242
|
+
{/* The avatar sits beside the same name, so it is hidden from a screen reader. */}
|
|
243
|
+
<UserImage userHandle={m.name} size={28} decorative/>
|
|
244
|
+
<Stack gap="small">
|
|
245
|
+
<Cluster gap="small">
|
|
246
|
+
{m.name}
|
|
247
|
+
{isYou && <Tag variant="textOnly" size="small" label="You"/>}
|
|
248
|
+
</Cluster>
|
|
249
|
+
<Paragraph tone="secondary" size="caption" measure="none">{m.email}</Paragraph>
|
|
250
|
+
</Stack>
|
|
251
|
+
</Cluster>
|
|
252
|
+
</TableCell>
|
|
253
|
+
<TableCell width="170px">
|
|
254
|
+
{/* Only an admin gets the Select, and nobody changes their own role. */}
|
|
255
|
+
{canManage && !isYou ? (<Stack gap="small">
|
|
256
|
+
<Select width={140} aria-label={"Role for ".concat(m.name)} aria-describedby={roleErrors[m.id] ? "members-list-rows-".concat(m.id, "-role-error") : undefined} value={roles[m.id]} options={roleOptions} disabled={savingRole === m.id || busyRow === m.id} onChange={function (v) { return handleRoleChange(m, typeof v === 'string' ? v : v[0]); }}/>
|
|
257
|
+
{roleErrors[m.id] && <Alert id={"members-list-rows-".concat(m.id, "-role-error")} type="error" variant="inline" autoDismiss={false} message={roleErrors[m.id]}/>}
|
|
258
|
+
</Stack>) : (roles[m.id])}
|
|
259
|
+
</TableCell>
|
|
260
|
+
{/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
|
|
261
|
+
<TableCell width="340px">
|
|
262
|
+
{canManage && !isYou && (confirmingMember === m.id ? (<Cluster gap="small">
|
|
263
|
+
<Paragraph size="body2" measure="none">Remove {m.name}?</Paragraph>
|
|
264
|
+
<Button size="small" type="tertiary" state={busyRow === m.id ? 'disabled' : 'enabled'} label="Cancel" aria-label={"Cancel removing ".concat(m.name)} onClickButton={function () { return setConfirmingMember(null); }}/>
|
|
265
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Remove" aria-label={"Remove ".concat(m.name)} loading={busyRow === m.id} onClickButton={function () { return handleRemove(m); }}/>
|
|
266
|
+
</Cluster>) : (<Button size="small" type="tertiary" state={busyRow ? 'disabled' : 'enabled'} label="Remove" aria-label={"Remove ".concat(m.name)} onClickButton={function () { return startConfirm('member', m.id); }}/>))}
|
|
267
|
+
</TableCell>
|
|
268
|
+
</TableRow>);
|
|
269
|
+
})}
|
|
270
|
+
</TableContainer>
|
|
271
|
+
|
|
272
|
+
{canManage && invites.length > 0 && (<Stack gap="small">
|
|
273
|
+
<Heading level={2} size="subtitle1">Pending invites</Heading>
|
|
274
|
+
<TableContainer>
|
|
275
|
+
{invites.map(function (i) { return (<TableRow key={i.id}>
|
|
276
|
+
<TableCell>
|
|
277
|
+
<Cluster gap="small">
|
|
278
|
+
<UserImage userHandle={i.email} size={28} decorative/>
|
|
279
|
+
{i.email}
|
|
280
|
+
</Cluster>
|
|
281
|
+
</TableCell>
|
|
282
|
+
<TableCell width="170px">{i.sent}</TableCell>
|
|
283
|
+
<TableCell width="340px">
|
|
284
|
+
{confirmingInvite === i.id ? (<Cluster gap="small">
|
|
285
|
+
<Paragraph size="body2" measure="none">Revoke this invite?</Paragraph>
|
|
286
|
+
<Button size="small" type="tertiary" state={busyRow === i.id ? 'disabled' : 'enabled'} label="Cancel" aria-label={"Cancel revoking the invite for ".concat(i.email)} onClickButton={function () { return setConfirmingInvite(null); }}/>
|
|
287
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Revoke" aria-label={"Revoke invite for ".concat(i.email)} loading={busyRow === i.id} onClickButton={function () { return handleRevokeInvite(i); }}/>
|
|
288
|
+
</Cluster>) : (<Stack gap="small">
|
|
289
|
+
<Cluster gap="small">
|
|
290
|
+
<Button size="small" type="tertiary" state={busyRow ? 'disabled' : 'enabled'} label={copiedInvite === i.id ? 'Copied' : 'Copy Link'} aria-label={"".concat(copiedInvite === i.id ? 'Copied' : 'Copy Link', " for ").concat(i.email)} onClickButton={function () { return handleCopy(i); }}/>
|
|
291
|
+
<Button size="small" type="tertiary" state={busyRow ? 'disabled' : 'enabled'} label="Revoke Invite" aria-label={"Revoke invite for ".concat(i.email)} onClickButton={function () { return startConfirm('invite', i.id); }}/>
|
|
292
|
+
</Cluster>
|
|
293
|
+
{copyBlocked === i.id && <Paragraph tone="secondary" size="caption" measure="none">Copying is blocked here. Select the link and copy it: {i.link}</Paragraph>}
|
|
294
|
+
</Stack>)}
|
|
295
|
+
</TableCell>
|
|
296
|
+
</TableRow>); })}
|
|
297
|
+
</TableContainer>
|
|
298
|
+
</Stack>)}
|
|
299
|
+
</Stack>
|
|
300
|
+
|
|
301
|
+
<Modal isOpen={inviteOpen} size="small" initialFocus="body" title="Invite Member" onClose={handleInviteClose} actions={<>
|
|
302
|
+
<Button size="small" type="tertiary" state={sending ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleInviteClose}/>
|
|
303
|
+
<Button size="small" type="primary" state={address === '' ? 'disabled' : 'enabled'} label="Invite" loading={sending} onClickButton={handleSendInvite}/>
|
|
304
|
+
</>}>
|
|
305
|
+
<Paragraph measure="none">We email them a link to join Acme as a member. The link works for 7 days.</Paragraph>
|
|
306
|
+
<Form aria-label="Invite member" onSubmit={handleSendInvite}>
|
|
307
|
+
<TextField id="members-list-invite-email" label="Email" type="email" value={email} disabled={sending} error={Boolean(emailError)} errorText={emailError} onChange={function (e) { setEmail(e.target.value); setEmailError(''); }}/>
|
|
308
|
+
</Form>
|
|
309
|
+
</Modal>
|
|
310
|
+
|
|
311
|
+
<Modal isOpen={upgradeOpen} size="small" title="Upgrade to Pro" onClose={function () { return setUpgradeOpen(false); }} actions={<>
|
|
312
|
+
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
313
|
+
<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
314
|
+
</>}>
|
|
315
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for $8 per member each month.</Paragraph>
|
|
316
|
+
</Modal>
|
|
317
|
+
</Center>);
|
|
318
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MembersListTable(): import("react").JSX.Element;
|