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,103 @@
|
|
|
1
|
+
# Document card
|
|
2
|
+
|
|
3
|
+
The agent made a document for the person, such as a plan or a report.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Scindo's card shows the kind, the title and 'Open' on one line, with no icon and no length. Its reply is not short: it is cut to its first lines.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Keep the reply to one sentence on what the agent made. Then put the card in the reply's `footer`.
|
|
10
|
+
- Show the document as a `SourceCard`: an icon for its kind, its title, its kind and length in `meta` ('Document · 4 pages'), and `action="Open"`.
|
|
11
|
+
- Open the document from the card with `onClick`, in a pane beside the thread.
|
|
12
|
+
- Move focus into the pane when it opens.
|
|
13
|
+
- Give the pane a Close control, and move focus back to the card when the pane closes.
|
|
14
|
+
- Bring the open pane forward when the person presses the card again, instead of opening a second one.
|
|
15
|
+
- Mark the agent's row as the rule 'An agent says what it is' says.
|
|
16
|
+
- Give the list that holds the rows `role="log"`.
|
|
17
|
+
|
|
18
|
+
## Don't
|
|
19
|
+
|
|
20
|
+
- Do not paste the document into the thread.
|
|
21
|
+
- Do not repeat or list what the document says in the reply.
|
|
22
|
+
- Do not show the document's card on a person's message.
|
|
23
|
+
|
|
24
|
+
## Example: In the thread
|
|
25
|
+
|
|
26
|
+
Uses: `Center`, `Grid`, `Heading`, `Message`, `Paragraph`, `SourceCard`, `Stack`, `Tag`, `TimeStamp`, `UserImage`
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
'use client';
|
|
30
|
+
import { Bot, FileText } from 'lucide-react';
|
|
31
|
+
import Message from 'oneslash-design-system/components/message';
|
|
32
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
33
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
34
|
+
import TimeStamp from 'oneslash-design-system/components/timeStamp';
|
|
35
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
36
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
37
|
+
import SourceCard from 'oneslash-design-system/components/sourceCard';
|
|
38
|
+
import { Center, Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
39
|
+
|
|
40
|
+
const agentName = 'Acme Agent';
|
|
41
|
+
|
|
42
|
+
const request = { from: 'Dana Lee', at: new Date('2025-01-15T11:40:00Z'), text: 'Can you write up the launch plan as a document?' };
|
|
43
|
+
const repliedAt = new Date('2025-01-15T11:41:00Z');
|
|
44
|
+
// One sentence on what the agent made. The document itself stays out of the thread.
|
|
45
|
+
const reply = 'I wrote the launch plan for March 3 as a document.';
|
|
46
|
+
|
|
47
|
+
const doc = { title: 'Launch plan for March 3', meta: 'Document · 4 pages' };
|
|
48
|
+
|
|
49
|
+
// The agent's marks, as the rule 'An agent says what it is' says.
|
|
50
|
+
function agentMeta(at: Date) {
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<Tag variant="contained" size="small" label="Agent" />
|
|
54
|
+
<TimeStamp createdAt={at} dateFormat="absolute" data="time" />
|
|
55
|
+
<Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// A real app opens the document in a pane beside the thread and moves focus into it.
|
|
61
|
+
// ODS has no side pane part yet, so this example shows the card only.
|
|
62
|
+
function openDocument() {}
|
|
63
|
+
|
|
64
|
+
export default function ArtifactCardCard() {
|
|
65
|
+
return (
|
|
66
|
+
<Center width="page">
|
|
67
|
+
<Stack gap="large">
|
|
68
|
+
<Heading level={1} size="h5">Launch plan</Heading>
|
|
69
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
70
|
+
<Stack gap="small">
|
|
71
|
+
<Message
|
|
72
|
+
aria-label={request.from}
|
|
73
|
+
avatar={<UserImage userHandle={request.from} decorative />}
|
|
74
|
+
name={request.from}
|
|
75
|
+
meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time" />}
|
|
76
|
+
>
|
|
77
|
+
<Paragraph measure="none">{request.text}</Paragraph>
|
|
78
|
+
</Message>
|
|
79
|
+
<Message
|
|
80
|
+
aria-label={`${agentName}, agent`}
|
|
81
|
+
avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
|
|
82
|
+
name={agentName}
|
|
83
|
+
meta={agentMeta(repliedAt)}
|
|
84
|
+
footer={
|
|
85
|
+
<Grid columns={2} gap="medium">
|
|
86
|
+
<SourceCard icon={FileText} title={doc.title} meta={doc.meta} action="Open" onClick={openDocument} />
|
|
87
|
+
</Grid>
|
|
88
|
+
}
|
|
89
|
+
>
|
|
90
|
+
<Paragraph measure="none">{reply}</Paragraph>
|
|
91
|
+
</Message>
|
|
92
|
+
</Stack>
|
|
93
|
+
</Stack>
|
|
94
|
+
</Center>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Native
|
|
100
|
+
|
|
101
|
+
On Mac the card opens the document in the canvas beside the thread. On iPhone it opens the document in a read-only sheet.
|
|
102
|
+
|
|
103
|
+
Seen in: Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AuthGateLoadingSpinnerWithLine(): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import LoadingScreen from '../../components/loadingScreen';
|
|
3
|
+
import { Center } from '../../components/layout';
|
|
4
|
+
// Shown while a step that can take longer than a second runs, before the app knows where to send the person.
|
|
5
|
+
// A real app swaps it for the next page as soon as the step ends.
|
|
6
|
+
export default function AuthGateLoadingSpinnerWithLine() {
|
|
7
|
+
return (<Center fill>
|
|
8
|
+
<LoadingScreen label="Checking invite…"/>
|
|
9
|
+
</Center>);
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AuthGateLoadingSpinner(): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import LoadingScreen from '../../components/loadingScreen';
|
|
3
|
+
import { Center } from '../../components/layout';
|
|
4
|
+
// Shown while the app checks the session, before it knows whether to show the page or the login form.
|
|
5
|
+
// A real app swaps it for the page, or goes to the login page, as soon as the check ends.
|
|
6
|
+
export default function AuthGateLoadingSpinner() {
|
|
7
|
+
return (<Center fill>
|
|
8
|
+
<LoadingScreen />
|
|
9
|
+
</Center>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Login check loading
|
|
2
|
+
|
|
3
|
+
The app is checking whether the person is logged in, or running a step such as checking an invite, before it knows what to show.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Scindo on the web shows 'Please wait' under the step while it checks an invite, and a small spinner instead of `LoadingScreen` while onboarding checks for a workspace.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Show the spinner from the first render, before anything else, as `LoadingScreen` in `Center` with `fill`.
|
|
10
|
+
- Replace the spinner with the page, or go to the login page, as soon as the check ends.
|
|
11
|
+
- Show no text when the wait is normally under about a second.
|
|
12
|
+
- Name the step in `LoadingScreen`'s `label` when it can take longer than about a second: `label="Checking invite…"`.
|
|
13
|
+
- Use the same screen as the full-screen spinner in 'Page loading': `LoadingScreen` alone in `Center` with `fill`.
|
|
14
|
+
|
|
15
|
+
## Don't
|
|
16
|
+
|
|
17
|
+
- Do not show the login form, or the page, before the check ends. It flashes and then goes away.
|
|
18
|
+
- Do not write a line that names no step, such as 'Loading…' or 'Please wait'.
|
|
19
|
+
- Do not put a line under a spinner whose wait is normally under about a second.
|
|
20
|
+
- Do not put more than one line under the spinner, or write it in a separate Paragraph.
|
|
21
|
+
|
|
22
|
+
## Option: Spinner
|
|
23
|
+
|
|
24
|
+
Use when: The wait is normally under about a second, such as reading the session.
|
|
25
|
+
|
|
26
|
+
Uses: `Center`, `LoadingScreen`
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
'use client';
|
|
30
|
+
import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
|
|
31
|
+
import { Center } from 'oneslash-design-system/components/layout';
|
|
32
|
+
|
|
33
|
+
// Shown while the app checks the session, before it knows whether to show the page or the login form.
|
|
34
|
+
// A real app swaps it for the page, or goes to the login page, as soon as the check ends.
|
|
35
|
+
export default function AuthGateLoadingSpinner() {
|
|
36
|
+
return (
|
|
37
|
+
<Center fill>
|
|
38
|
+
<LoadingScreen />
|
|
39
|
+
</Center>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Option: Spinner with a line
|
|
45
|
+
|
|
46
|
+
Use when: A named step can take longer than about a second, such as 'Checking invite…' or 'Joining workspace…'.
|
|
47
|
+
|
|
48
|
+
Uses: `Center`, `LoadingScreen`
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
'use client';
|
|
52
|
+
import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
|
|
53
|
+
import { Center } from 'oneslash-design-system/components/layout';
|
|
54
|
+
|
|
55
|
+
// Shown while a step that can take longer than a second runs, before the app knows where to send the person.
|
|
56
|
+
// A real app swaps it for the next page as soon as the step ends.
|
|
57
|
+
export default function AuthGateLoadingSpinnerWithLine() {
|
|
58
|
+
return (
|
|
59
|
+
<Center fill>
|
|
60
|
+
<LoadingScreen label="Checking invite…" />
|
|
61
|
+
</Center>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Native
|
|
67
|
+
|
|
68
|
+
On Apple use `ProgressView()` centered in the window, with a label only for a named step that can take longer.
|
|
69
|
+
|
|
70
|
+
Seen in: Commentify admin, Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CheckYourEmailAlertOnLogin(): import("react").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Image from '../../components/image';
|
|
4
|
+
import TabsContainer from '../../components/tabsContainer';
|
|
5
|
+
import Tab from '../../components/tab';
|
|
6
|
+
import Form from '../../components/form';
|
|
7
|
+
import Alert from '../../components/alert';
|
|
8
|
+
import TextField from '../../components/textField';
|
|
9
|
+
import Button from '../../components/button';
|
|
10
|
+
import Line from '../../components/line';
|
|
11
|
+
import BrandIcon from '../../components/brandIcon';
|
|
12
|
+
import { Center } 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
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
17
|
+
// A small check: some text, an @, then some text.
|
|
18
|
+
function looksLikeEmail(value) {
|
|
19
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
20
|
+
}
|
|
21
|
+
export default function CheckYourEmailAlertOnLogin() {
|
|
22
|
+
// Opens as the login page does right after sign-up. The words are the same whether or not the address
|
|
23
|
+
// already had an account, so the page never says which.
|
|
24
|
+
var _a = useState('We sent a link to ada@example.com. Open it to continue, or log in below.'), notice = _a[0], setNotice = _a[1];
|
|
25
|
+
var _b = useState('ada@example.com'), email = _b[0], setEmail = _b[1];
|
|
26
|
+
var _c = useState(''), password = _c[0], setPassword = _c[1];
|
|
27
|
+
var _d = useState(''), error = _d[0], setError = _d[1];
|
|
28
|
+
var _e = useState(''), emailError = _e[0], setEmailError = _e[1];
|
|
29
|
+
var _f = useState(''), passwordError = _f[0], setPasswordError = _f[1];
|
|
30
|
+
var _g = useState(false), loading = _g[0], setLoading = _g[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 handleSubmit() {
|
|
35
|
+
if (loading)
|
|
36
|
+
return;
|
|
37
|
+
setNotice('');
|
|
38
|
+
setError('');
|
|
39
|
+
setEmailError('');
|
|
40
|
+
setPasswordError('');
|
|
41
|
+
if (!email.trim()) {
|
|
42
|
+
setEmailError('Enter your email.');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!looksLikeEmail(email.trim())) {
|
|
46
|
+
setEmailError('Enter an email address, like name@example.com.');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!password) {
|
|
50
|
+
setPasswordError('Enter your password.');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
setLoading(true);
|
|
54
|
+
// Stands in for the request to the server.
|
|
55
|
+
timer.current = setTimeout(function () {
|
|
56
|
+
setLoading(false);
|
|
57
|
+
setError('That email and password do not match.');
|
|
58
|
+
}, 1200);
|
|
59
|
+
}
|
|
60
|
+
return (<Center fill>
|
|
61
|
+
<Image src={productMark} alt="Acme" width={40} height={40}/>
|
|
62
|
+
<TabsContainer fill>
|
|
63
|
+
<Tab label="Log In" isSelected onClickTab={function () { }}/>
|
|
64
|
+
<Tab label="Sign Up" isSelected={false} href="/sign-up" router={router} onClickTab={function () { }}/>
|
|
65
|
+
</TabsContainer>
|
|
66
|
+
<Form aria-label="Log in" onSubmit={handleSubmit}>
|
|
67
|
+
{/* It says what to do next, so it stays until the person submits the form: no close button, and it does not close on its own. */}
|
|
68
|
+
{notice && <Alert type="success" variant="inline" message={notice} autoDismiss={false}/>}
|
|
69
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={function () { return setError(''); }}/>}
|
|
70
|
+
<TextField id="check-your-email-login-email" label="Email" type="email" autoComplete="username" value={email} disabled={loading} error={Boolean(emailError)} errorText={emailError} onChange={function (e) { setEmail(e.target.value); setEmailError(''); }}/>
|
|
71
|
+
<TextField id="check-your-email-login-password" label="Password" type="password" autoComplete="current-password" value={password} disabled={loading} error={Boolean(passwordError)} errorText={passwordError} onChange={function (e) { setPassword(e.target.value); setPasswordError(''); }}/>
|
|
72
|
+
<Button size="medium" type="primary" state="enabled" label="Log In" htmlType="submit" loading={loading}/>
|
|
73
|
+
<Button size="medium" type="textOnly" state="enabled" label="Forgot Password?"/>
|
|
74
|
+
</Form>
|
|
75
|
+
<Line label="or"/>
|
|
76
|
+
<Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google"/>}/>
|
|
77
|
+
</Center>);
|
|
78
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CheckYourEmailPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Mail } from 'lucide-react';
|
|
4
|
+
import Icon from '../../components/icon';
|
|
5
|
+
import Heading from '../../components/heading';
|
|
6
|
+
import Paragraph from '../../components/paragraph';
|
|
7
|
+
import Button from '../../components/button';
|
|
8
|
+
import { Center, Stack } from '../../components/layout';
|
|
9
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
10
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
11
|
+
// A real app passes the address the person signed up with.
|
|
12
|
+
var address = 'ada@example.com';
|
|
13
|
+
export default function CheckYourEmailPage() {
|
|
14
|
+
var _a = useState(false), loading = _a[0], setLoading = _a[1];
|
|
15
|
+
var _b = useState(false), sent = _b[0], setSent = _b[1];
|
|
16
|
+
var timer = useRef();
|
|
17
|
+
// Stops the request if the example goes away before it ends.
|
|
18
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
19
|
+
// 'Sent' shows for 2 seconds, then the Button reads 'Send Again'.
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
if (!sent)
|
|
22
|
+
return;
|
|
23
|
+
var timer = setTimeout(function () { return setSent(false); }, 2000);
|
|
24
|
+
return function () { return clearTimeout(timer); };
|
|
25
|
+
}, [sent]);
|
|
26
|
+
function handleSendAgain() {
|
|
27
|
+
// One click sends one email: clicks while it sends or reads 'Sent' do nothing.
|
|
28
|
+
if (loading || sent)
|
|
29
|
+
return;
|
|
30
|
+
setLoading(true);
|
|
31
|
+
// Stands in for the request to the server.
|
|
32
|
+
// A failed request shows an inline error Alert above the Buttons, such as 'The email was not sent. Try again.'
|
|
33
|
+
timer.current = setTimeout(function () {
|
|
34
|
+
setLoading(false);
|
|
35
|
+
setSent(true);
|
|
36
|
+
}, 1200);
|
|
37
|
+
}
|
|
38
|
+
return (<Center fill>
|
|
39
|
+
<Icon icon={Mail} size="large" color="secondary"/>
|
|
40
|
+
<Stack gap="medium">
|
|
41
|
+
<Heading level={1} size="h5">Check your email</Heading>
|
|
42
|
+
<Paragraph tone="secondary" measure="none">We sent a link to {address}. Open it to continue.</Paragraph>
|
|
43
|
+
</Stack>
|
|
44
|
+
<Stack gap="large">
|
|
45
|
+
<Button size="medium" type="secondary" state="enabled" label={sent ? 'Sent' : 'Send Again'} loading={loading} onClickButton={handleSendAgain}/>
|
|
46
|
+
<Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={function () { return router.push('/login'); }}/>
|
|
47
|
+
</Stack>
|
|
48
|
+
</Center>);
|
|
49
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Check your email
|
|
2
|
+
|
|
3
|
+
A person signed up, and the product sent a link to confirm their email.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Neither Commentify nor Scindo can send the email again from the check-your-email screen. Both show their success Alert above the login form with a close button, and it starts 'Account created.', even for an address that already had an account.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Name the page 'Check your email' in a `Heading` with `level={1}`, with a `Mail` icon above it.
|
|
10
|
+
- Say in one line which address the link went to, in words that are true whether or not it already had an account: 'We sent a link to ada@example.com. Open it to continue.'
|
|
11
|
+
- Offer 'Send Again' and a text-only 'Back to Login'.
|
|
12
|
+
- Show `loading` on 'Send Again' while it sends, then 'Sent' for 2 seconds.
|
|
13
|
+
- Ignore 'Send Again' while it sends and while it reads 'Sent', so one click sends one email. Let the server limit how often it sends.
|
|
14
|
+
- Put the success Alert above the login form with no close button and `autoDismiss={false}`: it says what to do next, so it stays until the person submits the form.
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Do not leave the sign-up form on screen once the link is sent.
|
|
19
|
+
- Do not say that an account was created, or that one already exists.
|
|
20
|
+
- Do not make the person close the success Alert, and do not let it close on its own before they have read it.
|
|
21
|
+
- Do not change 'Send Again' to 'Sending…' while it sends.
|
|
22
|
+
|
|
23
|
+
## Option: Page in place of the form
|
|
24
|
+
|
|
25
|
+
Use when: The person must leave for their inbox before they can go on.
|
|
26
|
+
|
|
27
|
+
Uses: `Button`, `Center`, `Heading`, `Icon`, `Paragraph`, `Stack`
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
'use client';
|
|
31
|
+
import { useEffect, useRef, useState } from 'react';
|
|
32
|
+
import { Mail } from 'lucide-react';
|
|
33
|
+
import Icon from 'oneslash-design-system/components/icon';
|
|
34
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
35
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
36
|
+
import Button from 'oneslash-design-system/components/button';
|
|
37
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
38
|
+
|
|
39
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
40
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
41
|
+
|
|
42
|
+
// A real app passes the address the person signed up with.
|
|
43
|
+
const address = 'ada@example.com';
|
|
44
|
+
|
|
45
|
+
export default function CheckYourEmailPage() {
|
|
46
|
+
const [loading, setLoading] = useState(false);
|
|
47
|
+
const [sent, setSent] = useState(false);
|
|
48
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
49
|
+
|
|
50
|
+
// Stops the request if the example goes away before it ends.
|
|
51
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
52
|
+
|
|
53
|
+
// 'Sent' shows for 2 seconds, then the Button reads 'Send Again'.
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!sent) return;
|
|
56
|
+
const timer = setTimeout(() => setSent(false), 2000);
|
|
57
|
+
return () => clearTimeout(timer);
|
|
58
|
+
}, [sent]);
|
|
59
|
+
|
|
60
|
+
function handleSendAgain() {
|
|
61
|
+
// One click sends one email: clicks while it sends or reads 'Sent' do nothing.
|
|
62
|
+
if (loading || sent) return;
|
|
63
|
+
setLoading(true);
|
|
64
|
+
// Stands in for the request to the server.
|
|
65
|
+
// A failed request shows an inline error Alert above the Buttons, such as 'The email was not sent. Try again.'
|
|
66
|
+
timer.current = setTimeout(() => {
|
|
67
|
+
setLoading(false);
|
|
68
|
+
setSent(true);
|
|
69
|
+
}, 1200);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Center fill>
|
|
74
|
+
<Icon icon={Mail} size="large" color="secondary" />
|
|
75
|
+
<Stack gap="medium">
|
|
76
|
+
<Heading level={1} size="h5">Check your email</Heading>
|
|
77
|
+
<Paragraph tone="secondary" measure="none">We sent a link to {address}. Open it to continue.</Paragraph>
|
|
78
|
+
</Stack>
|
|
79
|
+
<Stack gap="large">
|
|
80
|
+
<Button size="medium" type="secondary" state="enabled" label={sent ? 'Sent' : 'Send Again'} loading={loading} onClickButton={handleSendAgain} />
|
|
81
|
+
<Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={() => router.push('/login')} />
|
|
82
|
+
</Stack>
|
|
83
|
+
</Center>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Option: Alert above the login form
|
|
89
|
+
|
|
90
|
+
Use when: The product lets a person log in before they confirm their email.
|
|
91
|
+
|
|
92
|
+
Uses: `Alert`, `BrandIcon`, `Button`, `Center`, `Form`, `Image`, `Line`, `Tab`, `TabsContainer`, `TextField`
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
'use client';
|
|
96
|
+
import { useEffect, useRef, useState } from 'react';
|
|
97
|
+
import Image from 'oneslash-design-system/components/image';
|
|
98
|
+
import TabsContainer from 'oneslash-design-system/components/tabsContainer';
|
|
99
|
+
import Tab from 'oneslash-design-system/components/tab';
|
|
100
|
+
import Form from 'oneslash-design-system/components/form';
|
|
101
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
102
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
103
|
+
import Button from 'oneslash-design-system/components/button';
|
|
104
|
+
import Line from 'oneslash-design-system/components/line';
|
|
105
|
+
import BrandIcon from 'oneslash-design-system/components/brandIcon';
|
|
106
|
+
import { Center } from 'oneslash-design-system/components/layout';
|
|
107
|
+
|
|
108
|
+
// The product's mark. A real app passes its own file.
|
|
109
|
+
const productMark =
|
|
110
|
+
"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";
|
|
111
|
+
|
|
112
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
113
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
114
|
+
|
|
115
|
+
// A small check: some text, an @, then some text.
|
|
116
|
+
function looksLikeEmail(value: string) {
|
|
117
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default function CheckYourEmailAlertOnLogin() {
|
|
121
|
+
// Opens as the login page does right after sign-up. The words are the same whether or not the address
|
|
122
|
+
// already had an account, so the page never says which.
|
|
123
|
+
const [notice, setNotice] = useState('We sent a link to ada@example.com. Open it to continue, or log in below.');
|
|
124
|
+
const [email, setEmail] = useState('ada@example.com');
|
|
125
|
+
const [password, setPassword] = useState('');
|
|
126
|
+
const [error, setError] = useState('');
|
|
127
|
+
const [emailError, setEmailError] = useState('');
|
|
128
|
+
const [passwordError, setPasswordError] = useState('');
|
|
129
|
+
const [loading, setLoading] = useState(false);
|
|
130
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
131
|
+
|
|
132
|
+
// Stops the request if the example goes away before it ends.
|
|
133
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
134
|
+
|
|
135
|
+
function handleSubmit() {
|
|
136
|
+
if (loading) return;
|
|
137
|
+
setNotice('');
|
|
138
|
+
setError('');
|
|
139
|
+
setEmailError('');
|
|
140
|
+
setPasswordError('');
|
|
141
|
+
if (!email.trim()) {
|
|
142
|
+
setEmailError('Enter your email.');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (!looksLikeEmail(email.trim())) {
|
|
146
|
+
setEmailError('Enter an email address, like name@example.com.');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (!password) {
|
|
150
|
+
setPasswordError('Enter your password.');
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
setLoading(true);
|
|
154
|
+
// Stands in for the request to the server.
|
|
155
|
+
timer.current = setTimeout(() => {
|
|
156
|
+
setLoading(false);
|
|
157
|
+
setError('That email and password do not match.');
|
|
158
|
+
}, 1200);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<Center fill>
|
|
163
|
+
<Image src={productMark} alt="Acme" width={40} height={40} />
|
|
164
|
+
<TabsContainer fill>
|
|
165
|
+
<Tab label="Log In" isSelected onClickTab={() => {}} />
|
|
166
|
+
<Tab label="Sign Up" isSelected={false} href="/sign-up" router={router} onClickTab={() => {}} />
|
|
167
|
+
</TabsContainer>
|
|
168
|
+
<Form aria-label="Log in" onSubmit={handleSubmit}>
|
|
169
|
+
{/* It says what to do next, so it stays until the person submits the form: no close button, and it does not close on its own. */}
|
|
170
|
+
{notice && <Alert type="success" variant="inline" message={notice} autoDismiss={false} />}
|
|
171
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
|
|
172
|
+
<TextField id="check-your-email-login-email" label="Email" type="email" autoComplete="username" value={email} disabled={loading} error={Boolean(emailError)} errorText={emailError} onChange={(e) => { setEmail(e.target.value); setEmailError(''); }} />
|
|
173
|
+
<TextField id="check-your-email-login-password" label="Password" type="password" autoComplete="current-password" value={password} disabled={loading} error={Boolean(passwordError)} errorText={passwordError} onChange={(e) => { setPassword(e.target.value); setPasswordError(''); }} />
|
|
174
|
+
<Button size="medium" type="primary" state="enabled" label="Log In" htmlType="submit" loading={loading} />
|
|
175
|
+
<Button size="medium" type="textOnly" state="enabled" label="Forgot Password?" />
|
|
176
|
+
</Form>
|
|
177
|
+
<Line label="or" />
|
|
178
|
+
<Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google" />} />
|
|
179
|
+
</Center>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Seen in: Commentify, Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ComposerLimitNoticeWithAction(): import("react").JSX.Element;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
import { useRef, useState } from 'react';
|
|
12
|
+
import { Bot } from 'lucide-react';
|
|
13
|
+
import Message from '../../components/message';
|
|
14
|
+
import UserImage from '../../components/userImage';
|
|
15
|
+
import TimeStamp from '../../components/timeStamp';
|
|
16
|
+
import Heading from '../../components/heading';
|
|
17
|
+
import Paragraph from '../../components/paragraph';
|
|
18
|
+
import Composer from '../../components/composer';
|
|
19
|
+
import Alert from '../../components/alert';
|
|
20
|
+
import Button from '../../components/button';
|
|
21
|
+
import IconButton from '../../components/iconButton';
|
|
22
|
+
import Tooltip from '../../components/tooltip';
|
|
23
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
24
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
25
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
26
|
+
// A real app reads this from the session.
|
|
27
|
+
var me = 'Dana Lee';
|
|
28
|
+
var firstThread = [
|
|
29
|
+
{ id: 'm1', from: 'Ben Carter', at: new Date('2025-01-15T11:40:00Z'), text: 'The pricing page is live.' },
|
|
30
|
+
{ id: 'm2', from: 'Omar Reyes', at: new Date('2025-01-15T11:42:00Z'), text: 'Who writes the launch email?' },
|
|
31
|
+
];
|
|
32
|
+
var FIVE_MINUTES = 5 * 60 * 1000;
|
|
33
|
+
// A follow-on row: the same sender as the row above, less than 5 minutes later and on the same day.
|
|
34
|
+
function followsOn(rows, i) {
|
|
35
|
+
var prev = rows[i - 1];
|
|
36
|
+
return (!!prev &&
|
|
37
|
+
prev.from === rows[i].from &&
|
|
38
|
+
rows[i].at.getTime() - prev.at.getTime() < FIVE_MINUTES &&
|
|
39
|
+
rows[i].at.toDateString() === prev.at.toDateString());
|
|
40
|
+
}
|
|
41
|
+
export default function ComposerLimitNoticeWithAction() {
|
|
42
|
+
var _a = useState(firstThread), thread = _a[0], setThread = _a[1];
|
|
43
|
+
var _b = useState(''), text = _b[0], setText = _b[1];
|
|
44
|
+
// Opens on the notice, as if the workspace just used its last AI agent response of the month.
|
|
45
|
+
var _c = useState(true), showNotice = _c[0], setShowNotice = _c[1];
|
|
46
|
+
var field = useRef(null);
|
|
47
|
+
// 'Not Now' goes away with the notice, so focus goes to the message box.
|
|
48
|
+
function notNow() {
|
|
49
|
+
var _a;
|
|
50
|
+
setShowNotice(false);
|
|
51
|
+
(_a = field.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
52
|
+
}
|
|
53
|
+
// The agent cannot be called, but messages to people still send.
|
|
54
|
+
function send() {
|
|
55
|
+
// A real app sends the message to the server here and shows it at once.
|
|
56
|
+
setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: "m".concat(rows.length + 1), from: me, at: new Date(), text: text.trim() }], false); });
|
|
57
|
+
setText('');
|
|
58
|
+
}
|
|
59
|
+
return (<Center width="page">
|
|
60
|
+
<Stack gap="large">
|
|
61
|
+
<Heading level={1} size="h5">Launch plan</Heading>
|
|
62
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
63
|
+
<Stack gap="small">
|
|
64
|
+
{thread.map(function (m, i) { return (<Message key={m.id} aria-label={m.from} compact={followsOn(thread, i)} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}>
|
|
65
|
+
<Paragraph measure="none">{m.text}</Paragraph>
|
|
66
|
+
</Message>); })}
|
|
67
|
+
</Stack>
|
|
68
|
+
<Composer ref={field} id="composer-limit-action-message" aria-label="Message"
|
|
69
|
+
// After 'Not Now' the placeholder says when agent replies start again.
|
|
70
|
+
placeholder={showNotice ? 'Message the team' : 'Message the team. Agent replies start again on December 1.'} value={text} onChange={setText} onSubmit={send}
|
|
71
|
+
// A standing condition: no close button on the Alert, and no auto-dismiss. 'Not Now' closes it.
|
|
72
|
+
// This person can change the plan, so they get the button that lifts the limit. Alert has no action slot.
|
|
73
|
+
above={showNotice ? (<Stack gap="small">
|
|
74
|
+
<Alert type="warning" variant="inline" autoDismiss={false} message="You've used all 50 AI agent responses this month." secondMessage="They start again on December 1. The Pro plan gives Acme Design 1,000 AI agent responses a month."/>
|
|
75
|
+
<Cluster gap="small">
|
|
76
|
+
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow}/>
|
|
77
|
+
<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return router.push('/settings/billing?plan=pro'); }}/>
|
|
78
|
+
</Cluster>
|
|
79
|
+
</Stack>) : undefined} tools={
|
|
80
|
+
// It stays pressable while the limit stands, as the case 'Upgrade prompt' says: pressing it shows the notice
|
|
81
|
+
// again. It does not turn on until the limit is lifted.
|
|
82
|
+
<Tooltip title="Mention the agent">
|
|
83
|
+
<IconButton color="iconOnly" state="enabled" size="small" icon={Bot} ariaLabel="Mention the agent" aria-pressed={false} onClick={function () { return setShowNotice(true); }}/>
|
|
84
|
+
</Tooltip>}/>
|
|
85
|
+
</Stack>
|
|
86
|
+
</Center>);
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ComposerLimitNotice(): import("react").JSX.Element;
|