oneslash-design-system 2.15.0 → 2.17.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 +6 -1
- package/dist/DESIGN.md +100 -73
- package/dist/cases/accept-invite/signed-in.d.ts +1 -0
- package/dist/cases/accept-invite/signed-in.jsx +57 -0
- package/dist/cases/accept-invite/signed-out.d.ts +1 -0
- package/dist/cases/accept-invite/signed-out.jsx +33 -0
- package/dist/cases/accept-invite.md +161 -0
- package/dist/cases/agent-asks-before-risky-action.md +1 -1
- package/dist/cases/agent-cancels-when-unanswered.md +1 -1
- package/dist/cases/agent-options/cards.d.ts +1 -0
- package/dist/cases/agent-options/cards.jsx +91 -0
- package/dist/cases/agent-options.md +168 -0
- package/dist/cases/agent-pending-reply/steps.d.ts +1 -0
- package/dist/cases/agent-pending-reply/steps.jsx +149 -0
- package/dist/cases/agent-pending-reply/streaming.d.ts +1 -0
- package/dist/cases/agent-pending-reply/streaming.jsx +146 -0
- package/dist/cases/agent-pending-reply.md +432 -0
- package/dist/cases/agent-plan-proposal/changes.d.ts +1 -0
- package/dist/cases/agent-plan-proposal/changes.jsx +224 -0
- package/dist/cases/agent-plan-proposal/steps.d.ts +1 -0
- package/dist/cases/agent-plan-proposal/steps.jsx +211 -0
- package/dist/cases/agent-plan-proposal.md +656 -0
- package/dist/cases/agent-question/choices.d.ts +1 -0
- package/dist/cases/agent-question/choices.jsx +132 -0
- package/dist/cases/agent-question/free-text.d.ts +1 -0
- package/dist/cases/agent-question/free-text.jsx +81 -0
- package/dist/cases/agent-question.md +338 -0
- package/dist/cases/agent-shows-sources.md +2 -2
- package/dist/cases/artifact-card/card.d.ts +1 -0
- package/dist/cases/artifact-card/card.jsx +45 -0
- package/dist/cases/artifact-card.md +103 -0
- package/dist/cases/auth-gate-loading/spinner-with-line.d.ts +1 -0
- package/dist/cases/auth-gate-loading/spinner-with-line.jsx +10 -0
- package/dist/cases/auth-gate-loading/spinner.d.ts +1 -0
- package/dist/cases/auth-gate-loading/spinner.jsx +10 -0
- package/dist/cases/auth-gate-loading.md +70 -0
- package/dist/cases/check-your-email/alert-on-login.d.ts +1 -0
- package/dist/cases/check-your-email/alert-on-login.jsx +78 -0
- package/dist/cases/check-your-email/page.d.ts +1 -0
- package/dist/cases/check-your-email/page.jsx +49 -0
- package/dist/cases/check-your-email.md +184 -0
- package/dist/cases/composer-limit/notice-with-action.d.ts +1 -0
- package/dist/cases/composer-limit/notice-with-action.jsx +87 -0
- package/dist/cases/composer-limit/notice.d.ts +1 -0
- package/dist/cases/composer-limit/notice.jsx +84 -0
- package/dist/cases/composer-limit.md +286 -0
- package/dist/cases/confirm-destructive-action/inline.d.ts +1 -0
- package/dist/cases/confirm-destructive-action/inline.jsx +69 -0
- package/dist/cases/confirm-destructive-action/modal.d.ts +1 -0
- package/dist/cases/confirm-destructive-action/modal.jsx +66 -0
- package/dist/cases/confirm-destructive-action.md +211 -0
- package/dist/cases/confirm-dialogs.md +36 -0
- package/dist/cases/conversation-starters/chips.d.ts +1 -0
- package/dist/cases/conversation-starters/chips.jsx +69 -0
- package/dist/cases/conversation-starters/none.d.ts +1 -0
- package/dist/cases/conversation-starters/none.jsx +45 -0
- package/dist/cases/conversation-starters.md +208 -0
- package/dist/cases/create-modal/quick.d.ts +1 -0
- package/dist/cases/create-modal/quick.jsx +80 -0
- package/dist/cases/create-modal/with-settings.d.ts +1 -0
- package/dist/cases/create-modal/with-settings.jsx +99 -0
- package/dist/cases/create-modal.md +244 -0
- package/dist/cases/device-login/popup.d.ts +1 -0
- package/dist/cases/device-login/popup.jsx +14 -0
- package/dist/cases/device-login/provider-first.d.ts +1 -0
- package/dist/cases/device-login/provider-first.jsx +98 -0
- package/dist/cases/device-login.md +171 -0
- package/dist/cases/email-confirmed/alert-on-login.d.ts +1 -0
- package/dist/cases/email-confirmed/alert-on-login.jsx +78 -0
- package/dist/cases/email-confirmed/page.d.ts +1 -0
- package/dist/cases/email-confirmed/page.jsx +21 -0
- package/dist/cases/email-confirmed.md +151 -0
- package/dist/cases/empty-list/region.d.ts +1 -0
- package/dist/cases/empty-list/region.jsx +13 -0
- package/dist/cases/empty-list/section.d.ts +1 -0
- package/dist/cases/empty-list/section.jsx +17 -0
- package/dist/cases/empty-list.md +77 -0
- package/dist/cases/empty-lists.md +35 -0
- package/dist/cases/empty-not-set-up/action.d.ts +1 -0
- package/dist/cases/empty-not-set-up/action.jsx +16 -0
- package/dist/cases/empty-not-set-up/pointer.d.ts +1 -0
- package/dist/cases/empty-not-set-up/pointer.jsx +13 -0
- package/dist/cases/empty-not-set-up.md +88 -0
- package/dist/cases/empty-search/clear-search.d.ts +1 -0
- package/dist/cases/empty-search/clear-search.jsx +29 -0
- package/dist/cases/empty-search.md +77 -0
- package/dist/cases/error-page/full-page.d.ts +1 -0
- package/dist/cases/error-page/full-page.jsx +19 -0
- package/dist/cases/error-page/in-shell.d.ts +1 -0
- package/dist/cases/error-page/in-shell.jsx +39 -0
- package/dist/cases/error-page.md +107 -0
- package/dist/cases/feedback-form/modal.d.ts +1 -0
- package/dist/cases/feedback-form/modal.jsx +89 -0
- package/dist/cases/feedback-form.md +139 -0
- package/dist/cases/forgot-password/in-place.d.ts +1 -0
- package/dist/cases/forgot-password/in-place.jsx +155 -0
- package/dist/cases/forgot-password/own-page.d.ts +1 -0
- package/dist/cases/forgot-password/own-page.jsx +99 -0
- package/dist/cases/forgot-password.md +328 -0
- package/dist/cases/form-errors.md +32 -0
- package/dist/cases/import-checklist/modal.d.ts +1 -0
- package/dist/cases/import-checklist/modal.jsx +125 -0
- package/dist/cases/import-checklist.md +188 -0
- package/dist/cases/inline-form-feedback/button-label.d.ts +1 -0
- package/dist/cases/inline-form-feedback/button-label.jsx +54 -0
- package/dist/cases/inline-form-feedback/inline-alert.d.ts +1 -0
- package/dist/cases/inline-form-feedback/inline-alert.jsx +49 -0
- package/dist/cases/inline-form-feedback/toast.d.ts +1 -0
- package/dist/cases/inline-form-feedback/toast.jsx +66 -0
- package/dist/cases/inline-form-feedback.md +237 -0
- package/dist/cases/invite-member/by-email.d.ts +1 -0
- package/dist/cases/invite-member/by-email.jsx +98 -0
- package/dist/cases/invite-member/by-link.d.ts +1 -0
- package/dist/cases/invite-member/by-link.jsx +122 -0
- package/dist/cases/invite-member.md +321 -0
- package/dist/cases/load-failure/inline.d.ts +1 -0
- package/dist/cases/load-failure/inline.jsx +52 -0
- package/dist/cases/load-failure/region.d.ts +1 -0
- package/dist/cases/load-failure/region.jsx +34 -0
- package/dist/cases/load-failure.md +155 -0
- package/dist/cases/log-out-confirm/modal.d.ts +1 -0
- package/dist/cases/log-out-confirm/modal.jsx +57 -0
- package/dist/cases/log-out-confirm.md +106 -0
- package/dist/cases/login-page/centered.jsx +10 -7
- package/dist/cases/login-page/email-only.jsx +11 -8
- package/dist/cases/login-page/provider-first.jsx +12 -9
- package/dist/cases/login-page/split.jsx +11 -8
- package/dist/cases/login-page.md +58 -41
- package/dist/cases/mention-list/in-composer.d.ts +1 -0
- package/dist/cases/mention-list/in-composer.jsx +169 -0
- package/dist/cases/mention-list.md +252 -0
- package/dist/cases/message-actions/hover-toolbar.d.ts +1 -0
- package/dist/cases/message-actions/hover-toolbar.jsx +229 -0
- package/dist/cases/message-actions/menu.d.ts +1 -0
- package/dist/cases/message-actions/menu.jsx +258 -0
- package/dist/cases/message-actions.md +651 -0
- package/dist/cases/message-attachments/in-composer.d.ts +1 -0
- package/dist/cases/message-attachments/in-composer.jsx +134 -0
- package/dist/cases/message-attachments/in-message.d.ts +1 -0
- package/dist/cases/message-attachments/in-message.jsx +46 -0
- package/dist/cases/message-attachments.md +310 -0
- package/dist/cases/message-composer/plain.d.ts +1 -0
- package/dist/cases/message-composer/plain.jsx +57 -0
- package/dist/cases/message-composer/with-tools.d.ts +1 -0
- package/dist/cases/message-composer/with-tools.jsx +182 -0
- package/dist/cases/message-composer.md +356 -0
- package/dist/cases/message-edit/in-place.d.ts +1 -0
- package/dist/cases/message-edit/in-place.jsx +99 -0
- package/dist/cases/message-edit.md +179 -0
- package/dist/cases/message-reactions/chips.d.ts +1 -0
- package/dist/cases/message-reactions/chips.jsx +118 -0
- package/dist/cases/message-reactions/quick-pick.d.ts +1 -0
- package/dist/cases/message-reactions/quick-pick.jsx +155 -0
- package/dist/cases/message-reactions.md +371 -0
- package/dist/cases/message-row/grouped.d.ts +1 -0
- package/dist/cases/message-row/grouped.jsx +56 -0
- package/dist/cases/message-row/person-and-agent.d.ts +1 -0
- package/dist/cases/message-row/person-and-agent.jsx +41 -0
- package/dist/cases/message-row.md +189 -0
- package/dist/cases/not-found-page/full-page.d.ts +1 -0
- package/dist/cases/not-found-page/full-page.jsx +16 -0
- package/dist/cases/not-found-page/in-shell.d.ts +1 -0
- package/dist/cases/not-found-page/in-shell.jsx +36 -0
- package/dist/cases/not-found-page.md +98 -0
- package/dist/cases/oauth-consent/simple.d.ts +1 -0
- package/dist/cases/oauth-consent/simple.jsx +73 -0
- package/dist/cases/oauth-consent/with-scope.d.ts +1 -0
- package/dist/cases/oauth-consent/with-scope.jsx +89 -0
- package/dist/cases/oauth-consent.md +233 -0
- package/dist/cases/rename/inline.d.ts +1 -0
- package/dist/cases/rename/inline.jsx +58 -0
- package/dist/cases/rename/modal.d.ts +1 -0
- package/dist/cases/rename/modal.jsx +70 -0
- package/dist/cases/rename.md +205 -0
- package/dist/cases/reply-feedback/thumbs.d.ts +1 -0
- package/dist/cases/reply-feedback/thumbs.jsx +191 -0
- package/dist/cases/reply-feedback/with-reason.d.ts +1 -0
- package/dist/cases/reply-feedback/with-reason.jsx +221 -0
- package/dist/cases/reply-feedback.md +552 -0
- package/dist/cases/reply-sources/cards.d.ts +1 -0
- package/dist/cases/reply-sources/cards.jsx +83 -0
- package/dist/cases/reply-sources/tag-only.d.ts +1 -0
- package/dist/cases/reply-sources/tag-only.jsx +45 -0
- package/dist/cases/reply-sources.md +247 -0
- package/dist/cases/route-loading/full-screen.d.ts +1 -0
- package/dist/cases/route-loading/full-screen.jsx +8 -0
- package/dist/cases/route-loading/region.d.ts +1 -0
- package/dist/cases/route-loading/region.jsx +26 -0
- package/dist/cases/route-loading.md +84 -0
- package/dist/cases/set-new-password/form.d.ts +1 -0
- package/dist/cases/set-new-password/form.jsx +130 -0
- package/dist/cases/set-new-password/invalid-link.d.ts +1 -0
- package/dist/cases/set-new-password/invalid-link.jsx +50 -0
- package/dist/cases/set-new-password.md +247 -0
- package/dist/cases/sign-up-page/centered.d.ts +1 -0
- package/dist/cases/sign-up-page/centered.jsx +124 -0
- package/dist/cases/sign-up-page/provider-first.d.ts +1 -0
- package/dist/cases/sign-up-page/provider-first.jsx +124 -0
- package/dist/cases/sign-up-page/split.d.ts +1 -0
- package/dist/cases/sign-up-page/split.jsx +134 -0
- package/dist/cases/sign-up-page.md +478 -0
- package/dist/cases/slash-command-list/in-composer.d.ts +1 -0
- package/dist/cases/slash-command-list/in-composer.jsx +162 -0
- package/dist/cases/slash-command-list.md +247 -0
- package/dist/cases/success-feedback.md +35 -0
- package/dist/cases/type-to-confirm/inline.d.ts +1 -0
- package/dist/cases/type-to-confirm/inline.jsx +69 -0
- package/dist/cases/type-to-confirm/modal.d.ts +1 -0
- package/dist/cases/type-to-confirm/modal.jsx +73 -0
- package/dist/cases/type-to-confirm.md +222 -0
- package/dist/cases/typing-and-status/line.d.ts +1 -0
- package/dist/cases/typing-and-status/line.jsx +50 -0
- package/dist/cases/typing-and-status.md +96 -0
- package/dist/cases/unsaved-changes-guard/discard.d.ts +1 -0
- package/dist/cases/unsaved-changes-guard/discard.jsx +81 -0
- package/dist/cases/unsaved-changes-guard/save-or-discard.d.ts +1 -0
- package/dist/cases/unsaved-changes-guard/save-or-discard.jsx +85 -0
- package/dist/cases/unsaved-changes-guard.md +239 -0
- package/dist/cases/upgrade-prompt/inline.d.ts +1 -0
- package/dist/cases/upgrade-prompt/inline.jsx +52 -0
- package/dist/cases/upgrade-prompt/modal.d.ts +1 -0
- package/dist/cases/upgrade-prompt/modal.jsx +43 -0
- package/dist/cases/upgrade-prompt.md +174 -0
- package/dist/cases.json +3138 -59
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +6 -4
- package/dist/components/button.d.ts +3 -2
- package/dist/components/button.jsx +9 -7
- package/dist/components/composer.d.ts +74 -0
- package/dist/components/composer.jsx +122 -0
- package/dist/components/emptyBox.d.ts +6 -1
- package/dist/components/emptyBox.jsx +4 -2
- package/dist/components/fileChip.d.ts +33 -0
- package/dist/components/fileChip.jsx +61 -0
- package/dist/components/heading.d.ts +2 -2
- package/dist/components/iconButton.d.ts +3 -3
- package/dist/components/iconButton.jsx +9 -7
- package/dist/components/layout.d.ts +7 -1
- package/dist/components/layout.jsx +5 -2
- package/dist/components/loadingScreen.d.ts +5 -1
- package/dist/components/loadingScreen.jsx +4 -2
- package/dist/components/menu.d.ts +21 -0
- package/dist/components/menu.jsx +27 -3
- package/dist/components/menuItem.d.ts +9 -1
- package/dist/components/menuItem.jsx +5 -4
- package/dist/components/message.d.ts +28 -0
- package/dist/components/message.jsx +25 -0
- package/dist/components/modal.d.ts +2 -1
- package/dist/components/modal.jsx +20 -8
- package/dist/components/paragraph.d.ts +3 -1
- package/dist/components/paragraph.jsx +2 -2
- package/dist/components/popover.d.ts +7 -1
- package/dist/components/popover.jsx +35 -9
- package/dist/components/radioGroup.d.ts +9 -1
- package/dist/components/radioGroup.jsx +20 -9
- package/dist/components/select.d.ts +2 -1
- package/dist/components/select.jsx +4 -2
- package/dist/components/sourceCard.d.ts +23 -0
- package/dist/components/sourceCard.jsx +56 -0
- package/dist/components/stepList.d.ts +17 -0
- package/dist/components/stepList.jsx +79 -0
- package/dist/components/tab.jsx +3 -2
- package/dist/components/tabsContainer.d.ts +4 -1
- package/dist/components/tabsContainer.jsx +7 -3
- package/dist/components/tag.d.ts +9 -1
- package/dist/components/tag.jsx +6 -4
- package/dist/components/textField.d.ts +5 -1
- package/dist/components/textField.jsx +7 -3
- package/dist/components/textarea.jsx +3 -18
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.jsx +103 -0
- package/dist/components/userImage.d.ts +9 -1
- package/dist/components/userImage.jsx +10 -3
- package/dist/internal/alert.d.ts +4 -0
- package/dist/internal/alert.js +6 -0
- package/dist/internal/autoGrow.d.ts +11 -0
- package/dist/internal/autoGrow.js +28 -0
- package/dist/internal/composer.d.ts +16 -0
- package/dist/internal/composer.js +18 -0
- package/dist/internal/menu.d.ts +6 -0
- package/dist/internal/menu.js +31 -0
- package/dist/internal/modal.d.ts +2 -0
- package/dist/internal/modal.js +21 -0
- package/dist/internal/toaster.d.ts +19 -0
- package/dist/internal/toaster.js +50 -0
- package/dist/native-mapping.json +38 -1
- package/dist/stories/Alert.stories.d.ts +1 -0
- package/dist/stories/Alert.stories.jsx +16 -0
- package/dist/stories/Button.stories.d.ts +1 -0
- package/dist/stories/Button.stories.jsx +17 -1
- package/dist/stories/Cases.generated.stories.d.ts +82 -0
- package/dist/stories/Cases.generated.stories.jsx +164 -0
- package/dist/stories/Composer.stories.d.ts +23 -0
- package/dist/stories/Composer.stories.jsx +121 -0
- package/dist/stories/EmptyBox.stories.d.ts +2 -0
- package/dist/stories/EmptyBox.stories.jsx +16 -0
- package/dist/stories/FileChip.stories.d.ts +7 -0
- package/dist/stories/FileChip.stories.jsx +35 -0
- package/dist/stories/Heading.stories.d.ts +6 -0
- package/dist/stories/Heading.stories.jsx +10 -0
- package/dist/stories/IconButton.stories.d.ts +1 -0
- package/dist/stories/IconButton.stories.jsx +18 -1
- package/dist/stories/LoadingScreen.stories.d.ts +1 -0
- package/dist/stories/LoadingScreen.stories.jsx +8 -0
- package/dist/stories/Menu.stories.d.ts +4 -0
- package/dist/stories/Menu.stories.jsx +46 -1
- package/dist/stories/MenuItem.stories.d.ts +1 -0
- package/dist/stories/MenuItem.stories.jsx +8 -0
- package/dist/stories/Message.stories.d.ts +10 -0
- package/dist/stories/Message.stories.jsx +77 -0
- package/dist/stories/Modal.stories.d.ts +2 -0
- package/dist/stories/Modal.stories.jsx +36 -0
- package/dist/stories/PageComponents.stories.d.ts +1 -0
- package/dist/stories/PageComponents.stories.jsx +21 -0
- package/dist/stories/RadioGroup.stories.d.ts +3 -0
- package/dist/stories/RadioGroup.stories.jsx +54 -1
- package/dist/stories/Select.stories.d.ts +1 -0
- package/dist/stories/Select.stories.jsx +14 -0
- package/dist/stories/SourceCard.stories.d.ts +8 -0
- package/dist/stories/SourceCard.stories.jsx +33 -0
- package/dist/stories/StepList.stories.d.ts +8 -0
- package/dist/stories/StepList.stories.jsx +35 -0
- package/dist/stories/TabsContainer.stories.d.ts +1 -0
- package/dist/stories/TabsContainer.stories.jsx +12 -0
- package/dist/stories/TextField.stories.d.ts +2 -0
- package/dist/stories/TextField.stories.jsx +22 -0
- package/dist/stories/Toaster.stories.d.ts +6 -0
- package/dist/stories/Toaster.stories.jsx +29 -0
- package/dist/stories/UserImage.stories.d.ts +2 -0
- package/dist/stories/UserImage.stories.jsx +19 -0
- package/package.json +4 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import Heading from '../../components/heading';
|
|
3
|
+
import Paragraph from '../../components/paragraph';
|
|
4
|
+
import Button from '../../components/button';
|
|
5
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
6
|
+
export default function NotFoundPageFullPage() {
|
|
7
|
+
return (<Center fill>
|
|
8
|
+
<Stack gap="medium">
|
|
9
|
+
<Heading level={1} size="h5">Page not found</Heading>
|
|
10
|
+
<Paragraph tone="secondary" measure="none">The link may be wrong, or the page was moved or removed.</Paragraph>
|
|
11
|
+
</Stack>
|
|
12
|
+
<Cluster>
|
|
13
|
+
<Button size="medium" type="primary" state="enabled" label="Go Home" href="/"/>
|
|
14
|
+
</Cluster>
|
|
15
|
+
</Center>);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function NotFoundPageInShell(): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import Image from '../../components/image';
|
|
3
|
+
import TabsContainer from '../../components/tabsContainer';
|
|
4
|
+
import Tab from '../../components/tab';
|
|
5
|
+
import Surface from '../../components/surface';
|
|
6
|
+
import Heading from '../../components/heading';
|
|
7
|
+
import Paragraph from '../../components/paragraph';
|
|
8
|
+
import Button from '../../components/button';
|
|
9
|
+
import { Cluster, Stack } from '../../components/layout';
|
|
10
|
+
// The product's mark. A real app passes its own file.
|
|
11
|
+
var productMark = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
12
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
13
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
14
|
+
export default function NotFoundPageInShell() {
|
|
15
|
+
return (<Stack gap="large">
|
|
16
|
+
<Cluster gap="large">
|
|
17
|
+
<Image src={productMark} alt="Acme" width={32} height={32}/>
|
|
18
|
+
<TabsContainer>
|
|
19
|
+
<Tab label="Home" isSelected={false} href="/" router={router} onClickTab={function () { }}/>
|
|
20
|
+
<Tab label="Projects" isSelected href="/projects" router={router} onClickTab={function () { }}/>
|
|
21
|
+
<Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={function () { }}/>
|
|
22
|
+
</TabsContainer>
|
|
23
|
+
</Cluster>
|
|
24
|
+
<Surface minHeight="tall" align="center">
|
|
25
|
+
<Stack gap="xlarge">
|
|
26
|
+
<Stack gap="medium">
|
|
27
|
+
<Heading level={1} size="h5">Page not found</Heading>
|
|
28
|
+
<Paragraph tone="secondary" measure="none">The link may be wrong, or the page was moved or removed.</Paragraph>
|
|
29
|
+
</Stack>
|
|
30
|
+
<Cluster>
|
|
31
|
+
<Button size="medium" type="primary" state="enabled" label="Go Home" href="/"/>
|
|
32
|
+
</Cluster>
|
|
33
|
+
</Stack>
|
|
34
|
+
</Surface>
|
|
35
|
+
</Stack>);
|
|
36
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Page not found
|
|
2
|
+
|
|
3
|
+
A person opens a link to a page that does not exist.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Commentify's page not found is one line of bare text, 'Page not found.', with no way home. Scindo on the web shows '404' as its heading, then bare text and a text link home. jinhwankim.com has no heading: it puts '404:' at the start of its `EmptyBox` text and labels its Button 'Go to Home'.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Say 'Page not found' in a `Heading` with `level={1}`.
|
|
10
|
+
- Add one line on what may have happened: 'The link may be wrong, or the page was moved or removed.'
|
|
11
|
+
- Offer one Button home: 'Go Home'.
|
|
12
|
+
|
|
13
|
+
## Don't
|
|
14
|
+
|
|
15
|
+
- Do not make '404' the heading.
|
|
16
|
+
- Do not show a line of text with no way home.
|
|
17
|
+
- Do not blame the person for the link.
|
|
18
|
+
|
|
19
|
+
## Option: Full page
|
|
20
|
+
|
|
21
|
+
Use when: The address is outside the app shell, so nothing else can show.
|
|
22
|
+
|
|
23
|
+
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Paragraph`, `Stack`
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
'use client';
|
|
27
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
28
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
29
|
+
import Button from 'oneslash-design-system/components/button';
|
|
30
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
31
|
+
|
|
32
|
+
export default function NotFoundPageFullPage() {
|
|
33
|
+
return (
|
|
34
|
+
<Center fill>
|
|
35
|
+
<Stack gap="medium">
|
|
36
|
+
<Heading level={1} size="h5">Page not found</Heading>
|
|
37
|
+
<Paragraph tone="secondary" measure="none">The link may be wrong, or the page was moved or removed.</Paragraph>
|
|
38
|
+
</Stack>
|
|
39
|
+
<Cluster>
|
|
40
|
+
<Button size="medium" type="primary" state="enabled" label="Go Home" href="/" />
|
|
41
|
+
</Cluster>
|
|
42
|
+
</Center>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Option: Inside the shell
|
|
48
|
+
|
|
49
|
+
Use when: The address is inside the app and the navigation still works.
|
|
50
|
+
|
|
51
|
+
Uses: `Button`, `Cluster`, `Heading`, `Image`, `Paragraph`, `Stack`, `Surface`, `Tab`, `TabsContainer`
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
'use client';
|
|
55
|
+
import Image from 'oneslash-design-system/components/image';
|
|
56
|
+
import TabsContainer from 'oneslash-design-system/components/tabsContainer';
|
|
57
|
+
import Tab from 'oneslash-design-system/components/tab';
|
|
58
|
+
import Surface from 'oneslash-design-system/components/surface';
|
|
59
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
60
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
61
|
+
import Button from 'oneslash-design-system/components/button';
|
|
62
|
+
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
63
|
+
|
|
64
|
+
// The product's mark. A real app passes its own file.
|
|
65
|
+
const productMark =
|
|
66
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
67
|
+
|
|
68
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
69
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
70
|
+
|
|
71
|
+
export default function NotFoundPageInShell() {
|
|
72
|
+
return (
|
|
73
|
+
<Stack gap="large">
|
|
74
|
+
<Cluster gap="large">
|
|
75
|
+
<Image src={productMark} alt="Acme" width={32} height={32} />
|
|
76
|
+
<TabsContainer>
|
|
77
|
+
<Tab label="Home" isSelected={false} href="/" router={router} onClickTab={() => {}} />
|
|
78
|
+
<Tab label="Projects" isSelected href="/projects" router={router} onClickTab={() => {}} />
|
|
79
|
+
<Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={() => {}} />
|
|
80
|
+
</TabsContainer>
|
|
81
|
+
</Cluster>
|
|
82
|
+
<Surface minHeight="tall" align="center">
|
|
83
|
+
<Stack gap="xlarge">
|
|
84
|
+
<Stack gap="medium">
|
|
85
|
+
<Heading level={1} size="h5">Page not found</Heading>
|
|
86
|
+
<Paragraph tone="secondary" measure="none">The link may be wrong, or the page was moved or removed.</Paragraph>
|
|
87
|
+
</Stack>
|
|
88
|
+
<Cluster>
|
|
89
|
+
<Button size="medium" type="primary" state="enabled" label="Go Home" href="/" />
|
|
90
|
+
</Cluster>
|
|
91
|
+
</Stack>
|
|
92
|
+
</Surface>
|
|
93
|
+
</Stack>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Seen in: Commentify, Scindo, jinhwankim.com.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function OAuthConsentSimple(): import("react").JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Image from '../../components/image';
|
|
4
|
+
import Heading from '../../components/heading';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import UserImage from '../../components/userImage';
|
|
7
|
+
import Alert from '../../components/alert';
|
|
8
|
+
import Button from '../../components/button';
|
|
9
|
+
import LoadingScreen from '../../components/loadingScreen';
|
|
10
|
+
import { Center, Cluster, Grid, Stack } from '../../components/layout';
|
|
11
|
+
// The product's mark. A real app passes its own file.
|
|
12
|
+
var productMark = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
13
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
14
|
+
// The app's name and cli.acme.dev come from the server's record of the registered app, never from the link.
|
|
15
|
+
// Going back to another site is a full page load, such as window.location.assign() in a real app.
|
|
16
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
17
|
+
export default function OAuthConsentSimple() {
|
|
18
|
+
var _a = useState(false), allowing = _a[0], setAllowing = _a[1];
|
|
19
|
+
var _b = useState(false), handingBack = _b[0], setHandingBack = _b[1];
|
|
20
|
+
var _c = useState(''), error = _c[0], setError = _c[1];
|
|
21
|
+
var timer = useRef();
|
|
22
|
+
// Stops the request if the example goes away before it ends.
|
|
23
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
24
|
+
function handleAllow() {
|
|
25
|
+
if (allowing)
|
|
26
|
+
return;
|
|
27
|
+
setError('');
|
|
28
|
+
setAllowing(true);
|
|
29
|
+
// Stands in for the request to the server.
|
|
30
|
+
// A failed request calls setError with one sentence instead, such as 'Acme CLI was not connected. Try again.'
|
|
31
|
+
timer.current = setTimeout(function () {
|
|
32
|
+
setAllowing(false);
|
|
33
|
+
setHandingBack(true);
|
|
34
|
+
// A real app also returns the `state` value the app sent, so the app can match the answer to its request.
|
|
35
|
+
router.push('https://cli.acme.dev/callback');
|
|
36
|
+
}, 1200);
|
|
37
|
+
}
|
|
38
|
+
// The app hears that the person said no, and nothing is shared.
|
|
39
|
+
// A real app also returns the `state` value the app sent.
|
|
40
|
+
function handleCancel() {
|
|
41
|
+
setHandingBack(true);
|
|
42
|
+
router.push('https://cli.acme.dev/callback?error=access_denied');
|
|
43
|
+
}
|
|
44
|
+
// Shown while the browser goes back to the app, the same as a named step in 'Login check loading'.
|
|
45
|
+
if (handingBack) {
|
|
46
|
+
return (<Center fill>
|
|
47
|
+
<LoadingScreen label="Going back to Acme CLI…"/>
|
|
48
|
+
</Center>);
|
|
49
|
+
}
|
|
50
|
+
return (<Center fill>
|
|
51
|
+
<Image src={productMark} alt="Acme" width={40} height={40}/>
|
|
52
|
+
<Stack gap="medium">
|
|
53
|
+
<Heading level={1} size="h5">Acme CLI wants to connect to Acme</Heading>
|
|
54
|
+
<Paragraph tone="secondary" measure="none">It will be able to read your projects and tasks, and create tasks as you. You can remove its access at any time in Settings, under Connected apps.</Paragraph>
|
|
55
|
+
</Stack>
|
|
56
|
+
{/* The account that gives the access, so the person can tell it is the right one. */}
|
|
57
|
+
<Stack gap="small" align="start">
|
|
58
|
+
<Cluster gap="small">
|
|
59
|
+
<UserImage userHandle="Ada Lovelace"/>
|
|
60
|
+
<Paragraph size="body2" measure="none">ada@example.com</Paragraph>
|
|
61
|
+
</Cluster>
|
|
62
|
+
<Button size="small" type="textOnly" state={allowing ? 'disabled' : 'enabled'} label="Not You? Switch Account" onClickButton={function () { return router.push('/login?next=%2Foauth%2Fauthorize'); }}/>
|
|
63
|
+
</Stack>
|
|
64
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={function () { return setError(''); }}/>}
|
|
65
|
+
<Stack gap="medium">
|
|
66
|
+
<Grid columns={2} gap="medium">
|
|
67
|
+
<Button size="medium" type="secondary" state={allowing ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel}/>
|
|
68
|
+
<Button size="medium" type="primary" state="enabled" label="Allow" loading={allowing} onClickButton={handleAllow}/>
|
|
69
|
+
</Grid>
|
|
70
|
+
<Paragraph tone="secondary" size="caption" measure="none">You will go back to cli.acme.dev.</Paragraph>
|
|
71
|
+
</Stack>
|
|
72
|
+
</Center>);
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function OAuthConsentWithScope(): import("react").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Image from '../../components/image';
|
|
4
|
+
import Heading from '../../components/heading';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import UserImage from '../../components/userImage';
|
|
7
|
+
import Alert from '../../components/alert';
|
|
8
|
+
import Select from '../../components/select';
|
|
9
|
+
import Checkbox from '../../components/checkBox';
|
|
10
|
+
import Button from '../../components/button';
|
|
11
|
+
import LoadingScreen from '../../components/loadingScreen';
|
|
12
|
+
import { Center, Cluster, Grid, Stack } from '../../components/layout';
|
|
13
|
+
// The product's mark. A real app passes its own file.
|
|
14
|
+
var productMark = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
15
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
16
|
+
// The app's name and cli.acme.dev come from the server's record of the registered app, never from the link.
|
|
17
|
+
// Going back to another site is a full page load, such as window.location.assign() in a real app.
|
|
18
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
19
|
+
// The workspaces the person belongs to.
|
|
20
|
+
var workspaces = [
|
|
21
|
+
{ value: 'design', label: 'Acme Design' },
|
|
22
|
+
{ value: 'marketing', label: 'Acme Marketing' },
|
|
23
|
+
];
|
|
24
|
+
export default function OAuthConsentWithScope() {
|
|
25
|
+
var _a = useState('design'), workspace = _a[0], setWorkspace = _a[1];
|
|
26
|
+
// The wider access is off until the person turns it on.
|
|
27
|
+
var _b = useState(false), allWorkspaces = _b[0], setAllWorkspaces = _b[1];
|
|
28
|
+
var _c = useState(false), allowing = _c[0], setAllowing = _c[1];
|
|
29
|
+
var _d = useState(false), handingBack = _d[0], setHandingBack = _d[1];
|
|
30
|
+
var _e = useState(''), error = _e[0], setError = _e[1];
|
|
31
|
+
var timer = useRef();
|
|
32
|
+
// Stops the request if the example goes away before it ends.
|
|
33
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
34
|
+
function handleAllow() {
|
|
35
|
+
if (allowing)
|
|
36
|
+
return;
|
|
37
|
+
setError('');
|
|
38
|
+
setAllowing(true);
|
|
39
|
+
// Stands in for the request to the server.
|
|
40
|
+
// A failed request calls setError with one sentence instead, such as 'Acme CLI was not connected. Try again.'
|
|
41
|
+
timer.current = setTimeout(function () {
|
|
42
|
+
setAllowing(false);
|
|
43
|
+
setHandingBack(true);
|
|
44
|
+
// A real app also returns the `state` value the app sent, so the app can match the answer to its request.
|
|
45
|
+
router.push('https://cli.acme.dev/callback');
|
|
46
|
+
}, 1200);
|
|
47
|
+
}
|
|
48
|
+
// The app hears that the person said no, and nothing is shared.
|
|
49
|
+
// A real app also returns the `state` value the app sent.
|
|
50
|
+
function handleCancel() {
|
|
51
|
+
setHandingBack(true);
|
|
52
|
+
router.push('https://cli.acme.dev/callback?error=access_denied');
|
|
53
|
+
}
|
|
54
|
+
// Shown while the browser goes back to the app, the same as a named step in 'Login check loading'.
|
|
55
|
+
if (handingBack) {
|
|
56
|
+
return (<Center fill>
|
|
57
|
+
<LoadingScreen label="Going back to Acme CLI…"/>
|
|
58
|
+
</Center>);
|
|
59
|
+
}
|
|
60
|
+
return (<Center fill>
|
|
61
|
+
<Image src={productMark} alt="Acme" width={40} height={40}/>
|
|
62
|
+
<Stack gap="medium">
|
|
63
|
+
<Heading level={1} size="h5">Acme CLI wants to connect to Acme</Heading>
|
|
64
|
+
<Paragraph tone="secondary" measure="none">It will be able to read the projects and tasks you can see, and create tasks as you, in the workspaces you allow below. You can remove its access at any time in Settings, under Connected apps.</Paragraph>
|
|
65
|
+
</Stack>
|
|
66
|
+
{/* The account that gives the access, so the person can tell it is the right one. */}
|
|
67
|
+
<Stack gap="small" align="start">
|
|
68
|
+
<Cluster gap="small">
|
|
69
|
+
<UserImage userHandle="Ada Lovelace"/>
|
|
70
|
+
<Paragraph size="body2" measure="none">ada@example.com</Paragraph>
|
|
71
|
+
</Cluster>
|
|
72
|
+
<Button size="small" type="textOnly" state={allowing ? 'disabled' : 'enabled'} label="Not You? Switch Account" onClickButton={function () { return router.push('/login?next=%2Foauth%2Fauthorize'); }}/>
|
|
73
|
+
</Stack>
|
|
74
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={function () { return setError(''); }}/>}
|
|
75
|
+
<Stack gap="small">
|
|
76
|
+
{/* The line above names the field on screen, and `aria-label` names it for a screen reader. */}
|
|
77
|
+
<Paragraph tone="secondary" size="body2" measure="none">Workspace</Paragraph>
|
|
78
|
+
<Select aria-label="Workspace" value={workspace} options={workspaces} disabled={allowing} onChange={function (v) { return setWorkspace(typeof v === 'string' ? v : v[0]); }}/>
|
|
79
|
+
</Stack>
|
|
80
|
+
<Checkbox label="Also allow my other workspaces" secondLabel="It can then do the same in every workspace you belong to. It still sees only what you can see." checked={allWorkspaces} disabled={allowing} onChange={setAllWorkspaces}/>
|
|
81
|
+
<Stack gap="medium">
|
|
82
|
+
<Grid columns={2} gap="medium">
|
|
83
|
+
<Button size="medium" type="secondary" state={allowing ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel}/>
|
|
84
|
+
<Button size="medium" type="primary" state="enabled" label="Allow" loading={allowing} onClickButton={handleAllow}/>
|
|
85
|
+
</Grid>
|
|
86
|
+
<Paragraph tone="secondary" size="caption" measure="none">You will go back to cli.acme.dev.</Paragraph>
|
|
87
|
+
</Stack>
|
|
88
|
+
</Center>);
|
|
89
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# OAuth consent
|
|
2
|
+
|
|
3
|
+
Another app, such as a CLI or an MCP client, asks to act for a person who is logged in, and the person must allow it.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Scindo on the web turns on access to every workspace for the person, and shows its spinner on neither Button while the request runs. Commentify puts 'Allow' before 'Deny', writes its error in a red caption by hand, and says nothing about how to remove the access.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Name the app in a `Heading` with `level={1}`: 'Acme CLI wants to connect to Acme'.
|
|
10
|
+
- Say in one or two plain sentences what the app will be able to do, in the person's words: 'read your projects and tasks, and create tasks as you'.
|
|
11
|
+
- Say how to remove the access later: 'You can remove its access at any time in Settings, under Connected apps.'
|
|
12
|
+
- Show the account that gives the access, with a text-only 'Not You? Switch Account' Button under it.
|
|
13
|
+
- Take the app's name and the place the person goes back to from the server's record of the registered app, never from the link.
|
|
14
|
+
- Say where the person goes next: 'You will go back to cli.acme.dev.'
|
|
15
|
+
- Put 'Cancel' first and 'Allow' second, side by side and the same width, in a `Grid` with `columns={2}`.
|
|
16
|
+
- Show `loading` on 'Allow' and disable 'Cancel' and every field while the request runs.
|
|
17
|
+
- Show `LoadingScreen` with `label="Going back to Acme CLI…"` while the browser goes back, after 'Allow' and after 'Cancel'.
|
|
18
|
+
- Send 'Cancel' back to the app with `error=access_denied`, and return the `state` value the app sent on both paths.
|
|
19
|
+
- Leave wider access off until the person turns it on, and say under it what it adds.
|
|
20
|
+
|
|
21
|
+
## Don't
|
|
22
|
+
|
|
23
|
+
- Do not color 'Allow' or 'Cancel' as danger. Allowing is the person's choice, not a destructive action.
|
|
24
|
+
- Do not turn on wider access for the person.
|
|
25
|
+
- Do not name the access by its scope id, such as 'tasks:write'.
|
|
26
|
+
- Do not label Cancel 'Deny' or 'No'.
|
|
27
|
+
|
|
28
|
+
## Option: One account, one access
|
|
29
|
+
|
|
30
|
+
Use when: The app gets one set of access to one account, so the only choice is to allow it or not.
|
|
31
|
+
|
|
32
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Grid`, `Heading`, `Image`, `LoadingScreen`, `Paragraph`, `Stack`, `UserImage`
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
'use client';
|
|
36
|
+
import { useEffect, useRef, useState } from 'react';
|
|
37
|
+
import Image from 'oneslash-design-system/components/image';
|
|
38
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
39
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
40
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
41
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
42
|
+
import Button from 'oneslash-design-system/components/button';
|
|
43
|
+
import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
|
|
44
|
+
import { Center, Cluster, Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
45
|
+
|
|
46
|
+
// The product's mark. A real app passes its own file.
|
|
47
|
+
const productMark =
|
|
48
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
49
|
+
|
|
50
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
51
|
+
// The app's name and cli.acme.dev come from the server's record of the registered app, never from the link.
|
|
52
|
+
// Going back to another site is a full page load, such as window.location.assign() in a real app.
|
|
53
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
54
|
+
|
|
55
|
+
export default function OAuthConsentSimple() {
|
|
56
|
+
const [allowing, setAllowing] = useState(false);
|
|
57
|
+
const [handingBack, setHandingBack] = useState(false);
|
|
58
|
+
const [error, setError] = useState('');
|
|
59
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
60
|
+
|
|
61
|
+
// Stops the request if the example goes away before it ends.
|
|
62
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
63
|
+
|
|
64
|
+
function handleAllow() {
|
|
65
|
+
if (allowing) return;
|
|
66
|
+
setError('');
|
|
67
|
+
setAllowing(true);
|
|
68
|
+
// Stands in for the request to the server.
|
|
69
|
+
// A failed request calls setError with one sentence instead, such as 'Acme CLI was not connected. Try again.'
|
|
70
|
+
timer.current = setTimeout(() => {
|
|
71
|
+
setAllowing(false);
|
|
72
|
+
setHandingBack(true);
|
|
73
|
+
// A real app also returns the `state` value the app sent, so the app can match the answer to its request.
|
|
74
|
+
router.push('https://cli.acme.dev/callback');
|
|
75
|
+
}, 1200);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// The app hears that the person said no, and nothing is shared.
|
|
79
|
+
// A real app also returns the `state` value the app sent.
|
|
80
|
+
function handleCancel() {
|
|
81
|
+
setHandingBack(true);
|
|
82
|
+
router.push('https://cli.acme.dev/callback?error=access_denied');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Shown while the browser goes back to the app, the same as a named step in 'Login check loading'.
|
|
86
|
+
if (handingBack) {
|
|
87
|
+
return (
|
|
88
|
+
<Center fill>
|
|
89
|
+
<LoadingScreen label="Going back to Acme CLI…" />
|
|
90
|
+
</Center>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Center fill>
|
|
96
|
+
<Image src={productMark} alt="Acme" width={40} height={40} />
|
|
97
|
+
<Stack gap="medium">
|
|
98
|
+
<Heading level={1} size="h5">Acme CLI wants to connect to Acme</Heading>
|
|
99
|
+
<Paragraph tone="secondary" measure="none">It will be able to read your projects and tasks, and create tasks as you. You can remove its access at any time in Settings, under Connected apps.</Paragraph>
|
|
100
|
+
</Stack>
|
|
101
|
+
{/* The account that gives the access, so the person can tell it is the right one. */}
|
|
102
|
+
<Stack gap="small" align="start">
|
|
103
|
+
<Cluster gap="small">
|
|
104
|
+
<UserImage userHandle="Ada Lovelace" />
|
|
105
|
+
<Paragraph size="body2" measure="none">ada@example.com</Paragraph>
|
|
106
|
+
</Cluster>
|
|
107
|
+
<Button size="small" type="textOnly" state={allowing ? 'disabled' : 'enabled'} label="Not You? Switch Account" onClickButton={() => router.push('/login?next=%2Foauth%2Fauthorize')} />
|
|
108
|
+
</Stack>
|
|
109
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
|
|
110
|
+
<Stack gap="medium">
|
|
111
|
+
<Grid columns={2} gap="medium">
|
|
112
|
+
<Button size="medium" type="secondary" state={allowing ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel} />
|
|
113
|
+
<Button size="medium" type="primary" state="enabled" label="Allow" loading={allowing} onClickButton={handleAllow} />
|
|
114
|
+
</Grid>
|
|
115
|
+
<Paragraph tone="secondary" size="caption" measure="none">You will go back to cli.acme.dev.</Paragraph>
|
|
116
|
+
</Stack>
|
|
117
|
+
</Center>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Option: Workspace and wider access
|
|
123
|
+
|
|
124
|
+
Use when: The person picks the workspace the app can use, or turns on wider access.
|
|
125
|
+
|
|
126
|
+
Uses: `Alert`, `Button`, `Center`, `Checkbox`, `Cluster`, `Grid`, `Heading`, `Image`, `LoadingScreen`, `Paragraph`, `Select`, `Stack`, `UserImage`
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
'use client';
|
|
130
|
+
import { useEffect, useRef, useState } from 'react';
|
|
131
|
+
import Image from 'oneslash-design-system/components/image';
|
|
132
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
133
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
134
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
135
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
136
|
+
import Select from 'oneslash-design-system/components/select';
|
|
137
|
+
import Checkbox from 'oneslash-design-system/components/checkBox';
|
|
138
|
+
import Button from 'oneslash-design-system/components/button';
|
|
139
|
+
import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
|
|
140
|
+
import { Center, Cluster, Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
141
|
+
|
|
142
|
+
// The product's mark. A real app passes its own file.
|
|
143
|
+
const productMark =
|
|
144
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
145
|
+
|
|
146
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
147
|
+
// The app's name and cli.acme.dev come from the server's record of the registered app, never from the link.
|
|
148
|
+
// Going back to another site is a full page load, such as window.location.assign() in a real app.
|
|
149
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
150
|
+
|
|
151
|
+
// The workspaces the person belongs to.
|
|
152
|
+
const workspaces = [
|
|
153
|
+
{ value: 'design', label: 'Acme Design' },
|
|
154
|
+
{ value: 'marketing', label: 'Acme Marketing' },
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
export default function OAuthConsentWithScope() {
|
|
158
|
+
const [workspace, setWorkspace] = useState('design');
|
|
159
|
+
// The wider access is off until the person turns it on.
|
|
160
|
+
const [allWorkspaces, setAllWorkspaces] = useState(false);
|
|
161
|
+
const [allowing, setAllowing] = useState(false);
|
|
162
|
+
const [handingBack, setHandingBack] = useState(false);
|
|
163
|
+
const [error, setError] = useState('');
|
|
164
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
165
|
+
|
|
166
|
+
// Stops the request if the example goes away before it ends.
|
|
167
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
168
|
+
|
|
169
|
+
function handleAllow() {
|
|
170
|
+
if (allowing) return;
|
|
171
|
+
setError('');
|
|
172
|
+
setAllowing(true);
|
|
173
|
+
// Stands in for the request to the server.
|
|
174
|
+
// A failed request calls setError with one sentence instead, such as 'Acme CLI was not connected. Try again.'
|
|
175
|
+
timer.current = setTimeout(() => {
|
|
176
|
+
setAllowing(false);
|
|
177
|
+
setHandingBack(true);
|
|
178
|
+
// A real app also returns the `state` value the app sent, so the app can match the answer to its request.
|
|
179
|
+
router.push('https://cli.acme.dev/callback');
|
|
180
|
+
}, 1200);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// The app hears that the person said no, and nothing is shared.
|
|
184
|
+
// A real app also returns the `state` value the app sent.
|
|
185
|
+
function handleCancel() {
|
|
186
|
+
setHandingBack(true);
|
|
187
|
+
router.push('https://cli.acme.dev/callback?error=access_denied');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Shown while the browser goes back to the app, the same as a named step in 'Login check loading'.
|
|
191
|
+
if (handingBack) {
|
|
192
|
+
return (
|
|
193
|
+
<Center fill>
|
|
194
|
+
<LoadingScreen label="Going back to Acme CLI…" />
|
|
195
|
+
</Center>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<Center fill>
|
|
201
|
+
<Image src={productMark} alt="Acme" width={40} height={40} />
|
|
202
|
+
<Stack gap="medium">
|
|
203
|
+
<Heading level={1} size="h5">Acme CLI wants to connect to Acme</Heading>
|
|
204
|
+
<Paragraph tone="secondary" measure="none">It will be able to read the projects and tasks you can see, and create tasks as you, in the workspaces you allow below. You can remove its access at any time in Settings, under Connected apps.</Paragraph>
|
|
205
|
+
</Stack>
|
|
206
|
+
{/* The account that gives the access, so the person can tell it is the right one. */}
|
|
207
|
+
<Stack gap="small" align="start">
|
|
208
|
+
<Cluster gap="small">
|
|
209
|
+
<UserImage userHandle="Ada Lovelace" />
|
|
210
|
+
<Paragraph size="body2" measure="none">ada@example.com</Paragraph>
|
|
211
|
+
</Cluster>
|
|
212
|
+
<Button size="small" type="textOnly" state={allowing ? 'disabled' : 'enabled'} label="Not You? Switch Account" onClickButton={() => router.push('/login?next=%2Foauth%2Fauthorize')} />
|
|
213
|
+
</Stack>
|
|
214
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
|
|
215
|
+
<Stack gap="small">
|
|
216
|
+
{/* The line above names the field on screen, and `aria-label` names it for a screen reader. */}
|
|
217
|
+
<Paragraph tone="secondary" size="body2" measure="none">Workspace</Paragraph>
|
|
218
|
+
<Select aria-label="Workspace" value={workspace} options={workspaces} disabled={allowing} onChange={(v) => setWorkspace(typeof v === 'string' ? v : v[0])} />
|
|
219
|
+
</Stack>
|
|
220
|
+
<Checkbox label="Also allow my other workspaces" secondLabel="It can then do the same in every workspace you belong to. It still sees only what you can see." checked={allWorkspaces} disabled={allowing} onChange={setAllWorkspaces} />
|
|
221
|
+
<Stack gap="medium">
|
|
222
|
+
<Grid columns={2} gap="medium">
|
|
223
|
+
<Button size="medium" type="secondary" state={allowing ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel} />
|
|
224
|
+
<Button size="medium" type="primary" state="enabled" label="Allow" loading={allowing} onClickButton={handleAllow} />
|
|
225
|
+
</Grid>
|
|
226
|
+
<Paragraph tone="secondary" size="caption" measure="none">You will go back to cli.acme.dev.</Paragraph>
|
|
227
|
+
</Stack>
|
|
228
|
+
</Center>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Seen in: Commentify, Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RenameInline(): import("react").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import Heading from '../../components/heading';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import TextField from '../../components/textField';
|
|
6
|
+
import IconButton from '../../components/iconButton';
|
|
7
|
+
import Tooltip from '../../components/tooltip';
|
|
8
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
9
|
+
export default function RenameInline() {
|
|
10
|
+
var _a = useState('Q3 plan'), name = _a[0], setName = _a[1];
|
|
11
|
+
// Opens with the name as a field, as if the person just chose Rename.
|
|
12
|
+
var _b = useState(true), editing = _b[0], setEditing = _b[1];
|
|
13
|
+
var _c = useState('Q3 plan'), draft = _c[0], setDraft = _c[1];
|
|
14
|
+
// Enter and Escape end the edit before the field goes away, so its blur must not save again.
|
|
15
|
+
var ended = useRef(false);
|
|
16
|
+
function startEditing() {
|
|
17
|
+
ended.current = false;
|
|
18
|
+
setDraft(name);
|
|
19
|
+
setEditing(true);
|
|
20
|
+
}
|
|
21
|
+
function save() {
|
|
22
|
+
if (ended.current)
|
|
23
|
+
return;
|
|
24
|
+
ended.current = true;
|
|
25
|
+
var next = draft.trim();
|
|
26
|
+
// An empty or unchanged name cancels: there is nothing to send.
|
|
27
|
+
// Otherwise a real app sends the new name to the server here and shows it at once.
|
|
28
|
+
if (next && next !== name)
|
|
29
|
+
setName(next);
|
|
30
|
+
setEditing(false);
|
|
31
|
+
}
|
|
32
|
+
function cancel() {
|
|
33
|
+
if (ended.current)
|
|
34
|
+
return;
|
|
35
|
+
ended.current = true;
|
|
36
|
+
setEditing(false);
|
|
37
|
+
}
|
|
38
|
+
return (<Center width="page">
|
|
39
|
+
<Stack gap="medium">
|
|
40
|
+
{editing ? (<TextField id="rename-inline-name" label="Project name" value={draft} autoFocus onChange={function (e) { return setDraft(e.target.value); }} onKeyDown={function (e) {
|
|
41
|
+
if (e.key === 'Enter') {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
save();
|
|
44
|
+
}
|
|
45
|
+
else if (e.key === 'Escape') {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
cancel();
|
|
48
|
+
}
|
|
49
|
+
}} onBlur={save}/>) : (<Cluster gap="small">
|
|
50
|
+
<Heading level={1} size="h5">{name}</Heading>
|
|
51
|
+
<Tooltip title="Rename">
|
|
52
|
+
<IconButton color="iconOnly" state="enabled" size="small" iconName="Pencil" ariaLabel="Rename project" onClick={startEditing}/>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</Cluster>)}
|
|
55
|
+
<Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
|
|
56
|
+
</Stack>
|
|
57
|
+
</Center>);
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RenameModal(): import("react").JSX.Element;
|