oneslash-design-system 2.28.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/DESIGN.md +31 -1
- package/dist/cases/about-page.md +2 -0
- package/dist/cases/accept-invite.md +2 -0
- package/dist/cases/account-menu.md +2 -0
- package/dist/cases/activity-timeline.md +2 -0
- package/dist/cases/admin-inbox.md +2 -0
- package/dist/cases/agent-asks-before-risky-action.md +3 -1
- package/dist/cases/agent-cancels-when-unanswered.md +2 -0
- package/dist/cases/agent-changes-review/all-at-once.d.ts +1 -0
- package/dist/cases/agent-changes-review/all-at-once.jsx +238 -0
- package/dist/cases/agent-changes-review/per-change.d.ts +1 -0
- package/dist/cases/agent-changes-review/per-change.jsx +203 -0
- package/dist/cases/agent-changes-review.md +585 -0
- package/dist/cases/agent-handoff/to-agent.d.ts +1 -0
- package/dist/cases/agent-handoff/to-agent.jsx +53 -0
- package/dist/cases/agent-handoff/to-person.d.ts +1 -0
- package/dist/cases/agent-handoff/to-person.jsx +84 -0
- package/dist/cases/agent-handoff.md +231 -0
- package/dist/cases/agent-memory/list.d.ts +1 -0
- package/dist/cases/agent-memory/list.jsx +256 -0
- package/dist/cases/agent-memory.md +354 -0
- package/dist/cases/agent-options.md +2 -0
- package/dist/cases/agent-pending-reply/steps.jsx +70 -21
- package/dist/cases/agent-pending-reply.md +74 -27
- package/dist/cases/agent-permissions/levels.d.ts +3 -0
- package/dist/cases/agent-permissions/levels.jsx +49 -0
- package/dist/cases/agent-permissions/per-tool.d.ts +3 -0
- package/dist/cases/agent-permissions/per-tool.jsx +178 -0
- package/dist/cases/agent-permissions.md +314 -0
- package/dist/cases/agent-plan-proposal/changes.jsx +18 -11
- package/dist/cases/agent-plan-proposal/steps.jsx +11 -4
- package/dist/cases/agent-plan-proposal.md +36 -21
- package/dist/cases/agent-question.md +2 -0
- package/dist/cases/agent-refuses-clearly.md +2 -0
- package/dist/cases/agent-run-failure/limit-reached.d.ts +1 -0
- package/dist/cases/agent-run-failure/limit-reached.jsx +172 -0
- package/dist/cases/agent-run-failure/step-failed.d.ts +3 -0
- package/dist/cases/agent-run-failure/step-failed.jsx +187 -0
- package/dist/cases/agent-run-failure.md +500 -0
- package/dist/cases/agent-says-what-it-is.md +2 -0
- package/dist/cases/agent-says-where-it-stopped.md +27 -0
- package/dist/cases/agent-settings.md +2 -0
- package/dist/cases/agent-shows-progress.md +2 -0
- package/dist/cases/agent-shows-sources.md +2 -0
- package/dist/cases/api-keys/list.jsx +30 -3
- package/dist/cases/api-keys.md +37 -3
- package/dist/cases/app-shell.md +2 -0
- package/dist/cases/artifact-card.md +2 -0
- package/dist/cases/ask-page.md +2 -0
- package/dist/cases/auth-gate-loading.md +2 -0
- package/dist/cases/billing-page.md +2 -0
- package/dist/cases/blog-index.md +2 -0
- package/dist/cases/breadcrumb.md +2 -0
- package/dist/cases/breakdown-list.md +2 -0
- package/dist/cases/bulk-actions/list.d.ts +1 -0
- package/dist/cases/bulk-actions/list.jsx +209 -0
- package/dist/cases/bulk-actions/paged-table.d.ts +1 -0
- package/dist/cases/bulk-actions/paged-table.jsx +246 -0
- package/dist/cases/bulk-actions.md +559 -0
- package/dist/cases/changelog.md +2 -0
- package/dist/cases/chart.md +2 -0
- package/dist/cases/check-your-email.md +2 -0
- package/dist/cases/code-sample.md +2 -0
- package/dist/cases/collapsible-search.md +2 -0
- package/dist/cases/comment-thread.md +2 -0
- package/dist/cases/comparison-page/table.d.ts +1 -0
- package/dist/cases/comparison-page/table.jsx +97 -0
- package/dist/cases/comparison-page.md +156 -0
- package/dist/cases/composer-limit.md +2 -0
- package/dist/cases/confirm-destructive-action.md +2 -0
- package/dist/cases/confirm-dialogs.md +2 -0
- package/dist/cases/connection-status/card.d.ts +1 -0
- package/dist/cases/connection-status/card.jsx +97 -0
- package/dist/cases/connection-status/row.d.ts +1 -0
- package/dist/cases/connection-status/row.jsx +120 -0
- package/dist/cases/connection-status.md +330 -0
- package/dist/cases/contact-page.md +2 -0
- package/dist/cases/conversation-starters.md +2 -0
- package/dist/cases/cookie-choice.md +2 -0
- package/dist/cases/create-modal.md +2 -0
- package/dist/cases/danger-zone.md +2 -0
- package/dist/cases/dashboard.md +2 -0
- package/dist/cases/data-table-page.md +2 -0
- package/dist/cases/date-field.md +2 -0
- package/dist/cases/device-login.md +2 -0
- package/dist/cases/docs-component-page.md +2 -0
- package/dist/cases/email-confirmed.md +2 -0
- package/dist/cases/empty-list.md +2 -0
- package/dist/cases/empty-lists.md +2 -0
- package/dist/cases/empty-not-set-up.md +2 -0
- package/dist/cases/empty-search.md +2 -0
- package/dist/cases/error-page.md +2 -0
- package/dist/cases/faq.md +2 -0
- package/dist/cases/feature-grid.md +2 -0
- package/dist/cases/feedback-form.md +2 -0
- package/dist/cases/file-upload.md +2 -0
- package/dist/cases/filter-menu.md +2 -0
- package/dist/cases/forgot-password.md +2 -0
- package/dist/cases/form-errors.md +2 -0
- package/dist/cases/image-viewer.md +2 -0
- package/dist/cases/import-checklist.md +2 -0
- package/dist/cases/inline-form-feedback.md +2 -0
- package/dist/cases/integrations-list/nested.jsx +1 -1
- package/dist/cases/integrations-list/rows.jsx +1 -1
- package/dist/cases/integrations-list.md +6 -4
- package/dist/cases/invite-member.md +2 -0
- package/dist/cases/invoice-list.md +2 -0
- package/dist/cases/landing-hero.md +2 -0
- package/dist/cases/leaderboard.md +2 -0
- package/dist/cases/legal-page.md +2 -0
- package/dist/cases/load-failure.md +2 -0
- package/dist/cases/log-out-confirm.md +2 -0
- package/dist/cases/login-page.md +2 -0
- package/dist/cases/long-form-page.md +2 -0
- package/dist/cases/master-detail.md +2 -0
- package/dist/cases/members-list/rows.jsx +37 -6
- package/dist/cases/members-list/table.jsx +37 -6
- package/dist/cases/members-list.md +83 -12
- package/dist/cases/mention-list.md +2 -0
- package/dist/cases/message-actions.md +2 -0
- package/dist/cases/message-attachments.md +2 -0
- package/dist/cases/message-composer/with-tools.jsx +17 -7
- package/dist/cases/message-composer.md +28 -11
- package/dist/cases/message-edit.md +2 -0
- package/dist/cases/message-reactions.md +2 -0
- package/dist/cases/message-row.md +2 -0
- package/dist/cases/message-send-failure/needs-a-person.d.ts +1 -0
- package/dist/cases/message-send-failure/needs-a-person.jsx +116 -0
- package/dist/cases/message-send-failure/retrying.d.ts +1 -0
- package/dist/cases/message-send-failure/retrying.jsx +116 -0
- package/dist/cases/message-send-failure.md +308 -0
- package/dist/cases/mobile-menu.md +2 -0
- package/dist/cases/newsletter-signup.md +2 -0
- package/dist/cases/no-access/page.d.ts +1 -0
- package/dist/cases/no-access/page.jsx +37 -0
- package/dist/cases/no-access/read-only.d.ts +1 -0
- package/dist/cases/no-access/read-only.jsx +33 -0
- package/dist/cases/no-access.md +147 -0
- package/dist/cases/not-found-page.md +2 -0
- package/dist/cases/notification-menu.md +2 -0
- package/dist/cases/number-format.md +2 -0
- package/dist/cases/oauth-consent.md +2 -0
- package/dist/cases/on-off-settings.md +2 -0
- package/dist/cases/on-this-page.md +2 -0
- package/dist/cases/onboarding.md +2 -0
- package/dist/cases/one-main-action.md +2 -0
- package/dist/cases/overflow-menu.md +2 -0
- package/dist/cases/page-end.md +2 -0
- package/dist/cases/page-header.md +2 -0
- package/dist/cases/paged-card.md +2 -0
- package/dist/cases/password-gate.md +2 -0
- package/dist/cases/payment-method.md +2 -0
- package/dist/cases/people-row.md +2 -0
- package/dist/cases/phone-navigation.md +2 -0
- package/dist/cases/plan-change-confirm.md +2 -0
- package/dist/cases/plan-comparison.md +3 -1
- package/dist/cases/plan-picker.md +4 -1
- package/dist/cases/plan-sign-off.md +2 -0
- package/dist/cases/pricing-section.md +5 -1
- package/dist/cases/product-cards.md +2 -0
- package/dist/cases/product-demo/scripted.d.ts +3 -0
- package/dist/cases/product-demo/scripted.jsx +95 -0
- package/dist/cases/product-demo/still.d.ts +1 -0
- package/dist/cases/product-demo/still.jsx +20 -0
- package/dist/cases/product-demo.md +221 -0
- package/dist/cases/profile-form.md +2 -0
- package/dist/cases/quick-switcher.md +2 -0
- package/dist/cases/range-switch.md +2 -0
- package/dist/cases/rename.md +2 -0
- package/dist/cases/reply-feedback.md +2 -0
- package/dist/cases/reply-sources.md +2 -0
- package/dist/cases/route-loading.md +2 -0
- package/dist/cases/scope-picker.md +2 -0
- package/dist/cases/section-index.md +2 -0
- package/dist/cases/session-expired/in-place.d.ts +1 -0
- package/dist/cases/session-expired/in-place.jsx +63 -0
- package/dist/cases/session-expired/redirect.d.ts +1 -0
- package/dist/cases/session-expired/redirect.jsx +62 -0
- package/dist/cases/session-expired.md +204 -0
- package/dist/cases/set-new-password.md +2 -0
- package/dist/cases/settings-page.md +2 -0
- package/dist/cases/settings-save.md +2 -0
- package/dist/cases/side-pane.md +2 -0
- package/dist/cases/sidebar-nav.md +2 -0
- package/dist/cases/sign-up-page.md +3 -0
- package/dist/cases/signup-from-site/plain.d.ts +1 -0
- package/dist/cases/signup-from-site/plain.jsx +125 -0
- package/dist/cases/signup-from-site/with-plan.d.ts +4 -0
- package/dist/cases/signup-from-site/with-plan.jsx +151 -0
- package/dist/cases/signup-from-site.md +351 -0
- package/dist/cases/site-footer.md +2 -0
- package/dist/cases/site-header/links.d.ts +3 -1
- package/dist/cases/site-header/links.jsx +6 -2
- package/dist/cases/site-header.md +11 -3
- package/dist/cases/site-matches-app.md +32 -0
- package/dist/cases/site-search.md +2 -0
- package/dist/cases/slash-command-list.md +2 -0
- package/dist/cases/stat-row.md +2 -0
- package/dist/cases/status-label.md +3 -1
- package/dist/cases/success-feedback.md +2 -0
- package/dist/cases/tabbed-panels.md +2 -0
- package/dist/cases/tag-filter.md +2 -0
- package/dist/cases/task-header.md +2 -0
- package/dist/cases/theme-switcher.md +2 -0
- package/dist/cases/type-to-confirm.md +2 -0
- package/dist/cases/typing-and-status.md +2 -0
- package/dist/cases/unsaved-changes-guard.md +2 -0
- package/dist/cases/upgrade-prompt.md +2 -0
- package/dist/cases/usage-meters.md +2 -0
- package/dist/cases.json +1494 -42
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +23 -9
- package/dist/components/diff.d.ts +29 -0
- package/dist/components/diff.jsx +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/diff.d.ts +17 -0
- package/dist/internal/diff.js +44 -0
- package/dist/native-mapping.json +9 -2
- package/dist/stories/AgentPermissions.probe.stories.d.ts +7 -0
- package/dist/stories/AgentPermissions.probe.stories.jsx +18 -0
- package/dist/stories/AgentRunFailure.probe.stories.d.ts +6 -0
- package/dist/stories/AgentRunFailure.probe.stories.jsx +12 -0
- package/dist/stories/Cases.generated.stories.d.ts +24 -0
- package/dist/stories/Cases.generated.stories.jsx +48 -0
- package/dist/stories/Checkbox.stories.d.ts +2 -0
- package/dist/stories/Checkbox.stories.jsx +18 -0
- package/dist/stories/Diff.stories.d.ts +9 -0
- package/dist/stories/Diff.stories.jsx +40 -0
- package/dist/stories/ProductDemo.probe.stories.d.ts +6 -0
- package/dist/stories/ProductDemo.probe.stories.jsx +12 -0
- package/dist/stories/SignupFromSite.probe.stories.d.ts +7 -0
- package/dist/stories/SignupFromSite.probe.stories.jsx +17 -0
- package/dist/stories/SiteHeader.probe.stories.d.ts +6 -0
- package/dist/stories/SiteHeader.probe.stories.jsx +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
# Sign-up from the site
|
|
2
|
+
|
|
3
|
+
A visitor pressed a Button on the public site and lands on the app's sign-up page, sometimes with a paid plan already picked.
|
|
4
|
+
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Follow the rule 'A site promises only what the app does, in the app's words': 'Sign Up' lands on sign-up, and a picked plan comes with it.
|
|
10
|
+
- Follow the case 'Sign-up page' in 'Centered column' for the fields, the errors and the loading Button.
|
|
11
|
+
- Open the 'Sign Up' tab, not 'Log In', when the visitor pressed 'Sign Up'.
|
|
12
|
+
- Carry the plan in the address, such as '/sign-up?plan=pro', and read it on the sign-up page.
|
|
13
|
+
- Put an info line above the form that names the plan, its price and when the person pays: 'You picked Pro, $8.00 per member per month. You pay after a 14-day trial.'
|
|
14
|
+
- Put a `Link` 'Change Plan' under that line. It goes back to the pricing section.
|
|
15
|
+
- Use the plan names and prices of the case 'Plan picker', word for word.
|
|
16
|
+
- Keep the plan when a submit fails, with the line and the fields as they were.
|
|
17
|
+
- Show the plan again on the first page after sign-up, so the person sees it was kept.
|
|
18
|
+
- Keep the plan in the 'Log In' tab's address too, for a visitor who already has an account.
|
|
19
|
+
- Show the plain sign-up for Free, and for a plan the app does not know.
|
|
20
|
+
- Carry the plan through a provider's sign-in, such as 'Continue with Google', too.
|
|
21
|
+
|
|
22
|
+
## Don't
|
|
23
|
+
|
|
24
|
+
- Do not ask for a card before the account exists.
|
|
25
|
+
- Do not drop a picked plan without a word. Say it, or keep it.
|
|
26
|
+
- Do not send a 'Sign Up' Button to the login page.
|
|
27
|
+
- Do not show a plan line for a plan the app does not have.
|
|
28
|
+
|
|
29
|
+
## Option: From Sign Up
|
|
30
|
+
|
|
31
|
+
Use when: The visitor pressed 'Sign Up' on the site.
|
|
32
|
+
|
|
33
|
+
Uses: `Alert`, `BrandIcon`, `Button`, `Center`, `Form`, `Heading`, `Icon`, `Image`, `Line`, `Paragraph`, `Stack`, `Tab`, `TabsContainer`, `TextField`
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
'use client';
|
|
37
|
+
import { useEffect, useRef, useState } from 'react';
|
|
38
|
+
import { Mail } from 'lucide-react';
|
|
39
|
+
import Image from 'oneslash-design-system/components/image';
|
|
40
|
+
import TabsContainer from 'oneslash-design-system/components/tabsContainer';
|
|
41
|
+
import Tab from 'oneslash-design-system/components/tab';
|
|
42
|
+
import Form from 'oneslash-design-system/components/form';
|
|
43
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
44
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
45
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
46
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
47
|
+
import Icon from 'oneslash-design-system/components/icon';
|
|
48
|
+
import Button from 'oneslash-design-system/components/button';
|
|
49
|
+
import Line from 'oneslash-design-system/components/line';
|
|
50
|
+
import BrandIcon from 'oneslash-design-system/components/brandIcon';
|
|
51
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
52
|
+
|
|
53
|
+
// The product's mark. A real app passes its own file.
|
|
54
|
+
const productMark =
|
|
55
|
+
"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";
|
|
56
|
+
|
|
57
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
58
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
59
|
+
|
|
60
|
+
// A small check: some text, an @, then some text.
|
|
61
|
+
function looksLikeEmail(value: string) {
|
|
62
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// The visitor pressed 'Sign Up' on the site, which links to '/sign-up', so the page opens on the Sign Up tab.
|
|
66
|
+
export default function SignupFromSitePlain() {
|
|
67
|
+
const [name, setName] = useState('Dana Lee');
|
|
68
|
+
const [email, setEmail] = useState('dana@acme.example');
|
|
69
|
+
const [password, setPassword] = useState('');
|
|
70
|
+
const [error, setError] = useState('');
|
|
71
|
+
const [nameError, setNameError] = useState('');
|
|
72
|
+
const [emailError, setEmailError] = useState('');
|
|
73
|
+
const [passwordError, setPasswordError] = useState('');
|
|
74
|
+
const [loading, setLoading] = useState(false);
|
|
75
|
+
// The address the link went to. Set once the account request ends, which shows the check-your-email view.
|
|
76
|
+
const [sentTo, setSentTo] = useState('');
|
|
77
|
+
const [resending, setResending] = useState(false);
|
|
78
|
+
const [resent, setResent] = useState(false);
|
|
79
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
80
|
+
|
|
81
|
+
// Stops the request if the example goes away before it ends.
|
|
82
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
83
|
+
|
|
84
|
+
// 'Sent' shows for 2 seconds, then the Button reads 'Send Again'.
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!resent) return;
|
|
87
|
+
const timer = setTimeout(() => setResent(false), 2000);
|
|
88
|
+
return () => clearTimeout(timer);
|
|
89
|
+
}, [resent]);
|
|
90
|
+
|
|
91
|
+
function handleSubmit() {
|
|
92
|
+
if (loading) return;
|
|
93
|
+
setError('');
|
|
94
|
+
setNameError('');
|
|
95
|
+
setEmailError('');
|
|
96
|
+
setPasswordError('');
|
|
97
|
+
if (!name.trim()) {
|
|
98
|
+
setNameError('Enter your name.');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!email.trim()) {
|
|
102
|
+
setEmailError('Enter your email.');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!looksLikeEmail(email.trim())) {
|
|
106
|
+
setEmailError('Enter an email address, like name@example.com.');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (password.length < 8) {
|
|
110
|
+
setPasswordError('Use at least 8 characters.');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
setLoading(true);
|
|
114
|
+
const address = email.trim();
|
|
115
|
+
// Stands in for the request to the server.
|
|
116
|
+
// A failed request calls setError with one sentence instead, such as 'Your account was not created. Try again.'
|
|
117
|
+
timer.current = setTimeout(() => {
|
|
118
|
+
// Every address goes on to the same view, so the page never says whether it has an account.
|
|
119
|
+
// The Button stays loading until the view changes.
|
|
120
|
+
setLoading(false);
|
|
121
|
+
setSentTo(address);
|
|
122
|
+
}, 1200);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function handleSendAgain() {
|
|
126
|
+
// One click sends one email: clicks while it sends or reads 'Sent' do nothing.
|
|
127
|
+
if (resending || resent) return;
|
|
128
|
+
setResending(true);
|
|
129
|
+
// Stands in for the request to the server.
|
|
130
|
+
// A failed request shows an inline error Alert above the Buttons, such as 'The email was not sent. Try again.'
|
|
131
|
+
timer.current = setTimeout(() => {
|
|
132
|
+
setResending(false);
|
|
133
|
+
setResent(true);
|
|
134
|
+
}, 1200);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// The same view as the 'Check your email' case, in place of the form.
|
|
138
|
+
if (sentTo) {
|
|
139
|
+
return (
|
|
140
|
+
<Center fill>
|
|
141
|
+
<Icon icon={Mail} size="large" color="secondary" />
|
|
142
|
+
<Stack gap="medium">
|
|
143
|
+
<Heading level={1} size="h5">Check your email</Heading>
|
|
144
|
+
<Paragraph tone="secondary" measure="none">We sent a link to {sentTo}. Open it to continue.</Paragraph>
|
|
145
|
+
</Stack>
|
|
146
|
+
<Stack gap="large">
|
|
147
|
+
<Button size="medium" type="secondary" state="enabled" label={resent ? 'Sent' : 'Send Again'} loading={resending} onClickButton={handleSendAgain} />
|
|
148
|
+
<Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={() => router.push('/login')} />
|
|
149
|
+
</Stack>
|
|
150
|
+
</Center>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<Center fill>
|
|
156
|
+
<Image src={productMark} alt="Acme" width={40} height={40} />
|
|
157
|
+
<TabsContainer fill>
|
|
158
|
+
<Tab label="Log In" isSelected={false} href="/login" router={router} onClickTab={() => {}} />
|
|
159
|
+
<Tab label="Sign Up" isSelected onClickTab={() => {}} />
|
|
160
|
+
</TabsContainer>
|
|
161
|
+
<Form aria-label="Sign up" onSubmit={handleSubmit}>
|
|
162
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
|
|
163
|
+
<TextField id="signup-from-site-name" label="Name" autoComplete="name" value={name} disabled={loading} error={Boolean(nameError)} errorText={nameError} onChange={(e) => { setName(e.target.value); setNameError(''); }} />
|
|
164
|
+
<TextField id="signup-from-site-email" label="Email" type="email" autoComplete="username" value={email} disabled={loading} error={Boolean(emailError)} errorText={emailError} onChange={(e) => { setEmail(e.target.value); setEmailError(''); }} />
|
|
165
|
+
<TextField id="signup-from-site-password" label="Password" type="password" autoComplete="new-password" value={password} disabled={loading} error={Boolean(passwordError)} errorText={passwordError} helperText="Use at least 8 characters." onChange={(e) => { setPassword(e.target.value); setPasswordError(''); }} />
|
|
166
|
+
<Button size="medium" type="primary" state="enabled" label="Sign Up" htmlType="submit" loading={loading} />
|
|
167
|
+
</Form>
|
|
168
|
+
<Line label="or" />
|
|
169
|
+
<Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google" />} />
|
|
170
|
+
</Center>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Option: With a plan
|
|
176
|
+
|
|
177
|
+
Use when: The visitor chose a paid plan on the site, such as 'Sign Up for Pro'.
|
|
178
|
+
|
|
179
|
+
Uses: `Alert`, `BrandIcon`, `Button`, `Center`, `Form`, `Heading`, `Icon`, `Image`, `Line`, `Link`, `Paragraph`, `Stack`, `Tab`, `TabsContainer`, `TextField`, `formatMoney`
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
'use client';
|
|
183
|
+
import { useEffect, useRef, useState } from 'react';
|
|
184
|
+
import { Mail } from 'lucide-react';
|
|
185
|
+
import Image from 'oneslash-design-system/components/image';
|
|
186
|
+
import TabsContainer from 'oneslash-design-system/components/tabsContainer';
|
|
187
|
+
import Tab from 'oneslash-design-system/components/tab';
|
|
188
|
+
import Form from 'oneslash-design-system/components/form';
|
|
189
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
190
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
191
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
192
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
193
|
+
import Icon from 'oneslash-design-system/components/icon';
|
|
194
|
+
import Button from 'oneslash-design-system/components/button';
|
|
195
|
+
import Link from 'oneslash-design-system/components/link';
|
|
196
|
+
import Line from 'oneslash-design-system/components/line';
|
|
197
|
+
import BrandIcon from 'oneslash-design-system/components/brandIcon';
|
|
198
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
199
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
200
|
+
|
|
201
|
+
// The product's mark. A real app passes its own file.
|
|
202
|
+
const productMark =
|
|
203
|
+
"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";
|
|
204
|
+
|
|
205
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
206
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
207
|
+
|
|
208
|
+
// The paid plans, with the names and prices of the case 'Plan picker'. A real app reads them from the same place.
|
|
209
|
+
// Free needs no line: it is what the plain sign-up gives.
|
|
210
|
+
const paidPlans: Record<string, { name: string; price: number }> = {
|
|
211
|
+
pro: { name: 'Pro', price: 8 },
|
|
212
|
+
business: { name: 'Business', price: 16 },
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const trialDays = 14;
|
|
216
|
+
|
|
217
|
+
// A small check: some text, an @, then some text.
|
|
218
|
+
function looksLikeEmail(value: string) {
|
|
219
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// `plan` is read from the address, such as '/sign-up?plan=pro'. A plan the app does not know shows the plain sign-up.
|
|
223
|
+
// `failOnce` is for tests only: the first request fails, so the plan can be seen to stay.
|
|
224
|
+
export default function SignupFromSiteWithPlan({ plan = 'pro', failOnce = false }: { plan?: string; failOnce?: boolean } = {}) {
|
|
225
|
+
const picked = Object.prototype.hasOwnProperty.call(paidPlans, plan) ? paidPlans[plan] : undefined;
|
|
226
|
+
const [name, setName] = useState('Dana Lee');
|
|
227
|
+
const [email, setEmail] = useState('dana@acme.example');
|
|
228
|
+
const [password, setPassword] = useState('');
|
|
229
|
+
const [error, setError] = useState('');
|
|
230
|
+
const [nameError, setNameError] = useState('');
|
|
231
|
+
const [emailError, setEmailError] = useState('');
|
|
232
|
+
const [passwordError, setPasswordError] = useState('');
|
|
233
|
+
const [loading, setLoading] = useState(false);
|
|
234
|
+
// The address the link went to. Set once the account request ends, which shows the check-your-email view.
|
|
235
|
+
const [sentTo, setSentTo] = useState('');
|
|
236
|
+
const [resending, setResending] = useState(false);
|
|
237
|
+
const [resent, setResent] = useState(false);
|
|
238
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
239
|
+
const failNext = useRef(failOnce);
|
|
240
|
+
|
|
241
|
+
// Stops the request if the example goes away before it ends.
|
|
242
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
243
|
+
|
|
244
|
+
// 'Sent' shows for 2 seconds, then the Button reads 'Send Again'.
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
if (!resent) return;
|
|
247
|
+
const timer = setTimeout(() => setResent(false), 2000);
|
|
248
|
+
return () => clearTimeout(timer);
|
|
249
|
+
}, [resent]);
|
|
250
|
+
|
|
251
|
+
function handleSubmit() {
|
|
252
|
+
if (loading) return;
|
|
253
|
+
setError('');
|
|
254
|
+
setNameError('');
|
|
255
|
+
setEmailError('');
|
|
256
|
+
setPasswordError('');
|
|
257
|
+
if (!name.trim()) {
|
|
258
|
+
setNameError('Enter your name.');
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (!email.trim()) {
|
|
262
|
+
setEmailError('Enter your email.');
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (!looksLikeEmail(email.trim())) {
|
|
266
|
+
setEmailError('Enter an email address, like name@example.com.');
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
if (password.length < 8) {
|
|
270
|
+
setPasswordError('Use at least 8 characters.');
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
setLoading(true);
|
|
274
|
+
const address = email.trim();
|
|
275
|
+
// Stands in for the request to the server. It sends the plan with the account, so the app starts the trial on it.
|
|
276
|
+
timer.current = setTimeout(() => {
|
|
277
|
+
setLoading(false);
|
|
278
|
+
if (failNext.current) {
|
|
279
|
+
failNext.current = false;
|
|
280
|
+
// The plan line, the plan and the fields stay as they were.
|
|
281
|
+
setError('Your account was not created. Try again.');
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
// Every address goes on to the same view, so the page never says whether it has an account.
|
|
285
|
+
// The Button stays loading until the view changes.
|
|
286
|
+
setSentTo(address);
|
|
287
|
+
}, 1200);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function handleSendAgain() {
|
|
291
|
+
// One click sends one email: clicks while it sends or reads 'Sent' do nothing.
|
|
292
|
+
if (resending || resent) return;
|
|
293
|
+
setResending(true);
|
|
294
|
+
// Stands in for the request to the server.
|
|
295
|
+
// A failed request shows an inline error Alert above the Buttons, such as 'The email was not sent. Try again.'
|
|
296
|
+
timer.current = setTimeout(() => {
|
|
297
|
+
setResending(false);
|
|
298
|
+
setResent(true);
|
|
299
|
+
}, 1200);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// The first page after sign-up says the plan again, so the person sees it was kept.
|
|
303
|
+
if (sentTo) {
|
|
304
|
+
return (
|
|
305
|
+
<Center fill>
|
|
306
|
+
<Icon icon={Mail} size="large" color="secondary" />
|
|
307
|
+
<Stack gap="medium">
|
|
308
|
+
<Heading level={1} size="h5">Check your email</Heading>
|
|
309
|
+
<Paragraph tone="secondary" measure="none">We sent a link to {sentTo}. Open it to continue.</Paragraph>
|
|
310
|
+
{picked && <Paragraph tone="secondary" measure="none">{`Your plan is ${picked.name}. The ${trialDays}-day trial starts when you open the link.`}</Paragraph>}
|
|
311
|
+
</Stack>
|
|
312
|
+
<Stack gap="large">
|
|
313
|
+
<Button size="medium" type="secondary" state="enabled" label={resent ? 'Sent' : 'Send Again'} loading={resending} onClickButton={handleSendAgain} />
|
|
314
|
+
<Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={() => router.push('/login')} />
|
|
315
|
+
</Stack>
|
|
316
|
+
</Center>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return (
|
|
321
|
+
<Center fill>
|
|
322
|
+
<Image src={productMark} alt="Acme" width={40} height={40} />
|
|
323
|
+
<TabsContainer fill>
|
|
324
|
+
{/* Log In keeps the plan too, for a visitor who already has an account. */}
|
|
325
|
+
<Tab label="Log In" isSelected={false} href={picked ? `/login?plan=${plan}` : '/login'} router={router} onClickTab={() => {}} />
|
|
326
|
+
<Tab label="Sign Up" isSelected onClickTab={() => {}} />
|
|
327
|
+
</TabsContainer>
|
|
328
|
+
{picked && (
|
|
329
|
+
// No card here: the person pays after the trial, once the account exists.
|
|
330
|
+
<Stack gap="small">
|
|
331
|
+
<Alert type="info" variant="inline" message={`You picked ${picked.name}, ${formatMoney(picked.price)} per member per month. You pay after a ${trialDays}-day trial.`} autoDismiss={false} />
|
|
332
|
+
<Link href="/#pricing" size="body2">Change Plan</Link>
|
|
333
|
+
</Stack>
|
|
334
|
+
)}
|
|
335
|
+
<Form aria-label="Sign up" onSubmit={handleSubmit}>
|
|
336
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
|
|
337
|
+
<TextField id="signup-from-site-name" label="Name" autoComplete="name" value={name} disabled={loading} error={Boolean(nameError)} errorText={nameError} onChange={(e) => { setName(e.target.value); setNameError(''); }} />
|
|
338
|
+
<TextField id="signup-from-site-email" label="Email" type="email" autoComplete="username" value={email} disabled={loading} error={Boolean(emailError)} errorText={emailError} onChange={(e) => { setEmail(e.target.value); setEmailError(''); }} />
|
|
339
|
+
<TextField id="signup-from-site-password" label="Password" type="password" autoComplete="new-password" value={password} disabled={loading} error={Boolean(passwordError)} errorText={passwordError} helperText="Use at least 8 characters." onChange={(e) => { setPassword(e.target.value); setPasswordError(''); }} />
|
|
340
|
+
<Button size="medium" type="primary" state="enabled" label="Sign Up" htmlType="submit" loading={loading} />
|
|
341
|
+
</Form>
|
|
342
|
+
<Line label="or" />
|
|
343
|
+
<Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google" />} />
|
|
344
|
+
</Center>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Native
|
|
350
|
+
|
|
351
|
+
On Apple and Android the store page is the site. A plan is bought in the app with the system purchase sheet, after the account exists.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A person reaches the end of a site's page and looks for the pages that are not in the header, and who runs the site.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Use `SiteFooter` at the end of the page, after `PageShell`. It is a `<footer>` with a `<nav aria-label="Footer">`.
|
|
@@ -11,10 +11,14 @@ var links = [
|
|
|
11
11
|
{ label: 'Changelog', href: '#changelog' },
|
|
12
12
|
{ label: 'Docs', href: '#docs' },
|
|
13
13
|
];
|
|
14
|
-
|
|
14
|
+
// `loggedIn` is for a visitor who has an account and is logged in: one 'Open App' takes the place of 'Log In' and 'Sign Up'.
|
|
15
|
+
export default function SiteHeaderLinks(_a) {
|
|
16
|
+
var _b = _a === void 0 ? {} : _a, loggedIn = _b.loggedIn;
|
|
15
17
|
return (<>
|
|
16
18
|
{/* From md the links are a row in the bar. Below md they and 'Log In' are in the Menu; Sign Up stays beside it. */}
|
|
17
|
-
<SiteHeader brand={{ href: '#top', name: 'Acme' }} links={links} actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in"/>} phoneAction={
|
|
19
|
+
<SiteHeader brand={{ href: '#top', name: 'Acme' }} links={links} actions={loggedIn ? undefined : <Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in"/>} phoneAction={loggedIn
|
|
20
|
+
? <Button size="medium" type="primary" state="enabled" label="Open App" href="#app"/>
|
|
21
|
+
: <Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up"/>} mainId="site-header-main"/>
|
|
18
22
|
{/* The skip link goes here: the id matches mainId, and tabIndex -1 lets focus move in. */}
|
|
19
23
|
<PageShell id="site-header-main" tabIndex={-1}>
|
|
20
24
|
<Stack gap="large">
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A site's pages name the site at the top and show the person where to go and what to do next.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail': below `md` the links go into a menu and one main action stays in the bar.
|
|
@@ -13,6 +15,7 @@ A site's pages name the site at the top and show the person where to go and what
|
|
|
13
15
|
- Pass search and the theme menu as `phoneAction`, so they stay at the end of the bar on a phone. With no `links` and no `actions` there is no menu.
|
|
14
16
|
- Keep the section tabs in the bar, so no section is hidden. On a phone, put the pages of the open section in a menu, as the case 'Menu on a phone' shows in 'Sections with their pages'.
|
|
15
17
|
- Open the theme menu as the case 'Theme switcher' says, and open search as the case 'Site search' says.
|
|
18
|
+
- Show a logged-in visitor one Button, 'Open App', in place of 'Log In' and 'Sign Up'.
|
|
16
19
|
|
|
17
20
|
## Don't
|
|
18
21
|
|
|
@@ -44,15 +47,20 @@ const links = [
|
|
|
44
47
|
{ label: 'Docs', href: '#docs' },
|
|
45
48
|
];
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
// `loggedIn` is for a visitor who has an account and is logged in: one 'Open App' takes the place of 'Log In' and 'Sign Up'.
|
|
51
|
+
export default function SiteHeaderLinks({ loggedIn }: { loggedIn?: boolean } = {}) {
|
|
48
52
|
return (
|
|
49
53
|
<>
|
|
50
54
|
{/* From md the links are a row in the bar. Below md they and 'Log In' are in the Menu; Sign Up stays beside it. */}
|
|
51
55
|
<SiteHeader
|
|
52
56
|
brand={{ href: '#top', name: 'Acme' }}
|
|
53
57
|
links={links}
|
|
54
|
-
actions={<Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in" />}
|
|
55
|
-
phoneAction={
|
|
58
|
+
actions={loggedIn ? undefined : <Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in" />}
|
|
59
|
+
phoneAction={
|
|
60
|
+
loggedIn
|
|
61
|
+
? <Button size="medium" type="primary" state="enabled" label="Open App" href="#app" />
|
|
62
|
+
: <Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up" />
|
|
63
|
+
}
|
|
56
64
|
mainId="site-header-main"
|
|
57
65
|
/>
|
|
58
66
|
{/* The skip link goes here: the id matches mainId, and tabIndex -1 lets focus move in. */}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# A site promises only what the app does, in the app's words
|
|
2
|
+
|
|
3
|
+
A product has a public site and an app. The site names the plans, shows the app and sends visitors into it.
|
|
4
|
+
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
7
|
+
## Answer
|
|
8
|
+
|
|
9
|
+
The site and the app use the same plan names, prices, limits and feature names. A button on the site lands on the page it names and carries the choice: 'Sign Up for Pro' opens the sign-up page with Pro chosen. A visitor who is logged in sees 'Open App' instead of 'Sign Up'. A demo of the app is marked as an example, and anything on the site that looks like the app shows only what the app has.
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
A visitor who signs up for what the site promised and finds less in the app stops trusting both. A button that lands on the wrong page, or forgets the plan, makes them choose again.
|
|
14
|
+
|
|
15
|
+
## Do
|
|
16
|
+
|
|
17
|
+
- Take plan names, prices and limits from one source, so the site and the app cannot differ.
|
|
18
|
+
- Use the feature names the app uses, word for word.
|
|
19
|
+
- Send 'Sign Up' to the sign-up page.
|
|
20
|
+
- Carry a chosen plan into sign-up: 'Sign Up for Pro' opens sign-up with Pro chosen.
|
|
21
|
+
- Show a logged-in visitor 'Open App' in place of 'Sign Up'.
|
|
22
|
+
- Mark a demo of the app as an example, and show only what the app has.
|
|
23
|
+
|
|
24
|
+
## Don't
|
|
25
|
+
|
|
26
|
+
- Do not list a feature a plan does not include.
|
|
27
|
+
- Do not show a control in a demo that the app does not have.
|
|
28
|
+
- Do not send a 'Sign Up' button to the login page.
|
|
29
|
+
|
|
30
|
+
## Native
|
|
31
|
+
|
|
32
|
+
On Apple and Android the store page is the site. Its screenshots show only what the app has, with the same plan names and prices as the app.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A site has many pages, and a person wants to reach one by its name or by a word in it, from any page.
|
|
4
4
|
|
|
5
|
+
For: a marketing site
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Put a 'Search' `Button` with `decoIcon="Search"` in the `SiteHeader`, in `phoneAction`, so it stays in the bar at every width. Give it `aria-haspopup="dialog"` and `aria-keyshortcuts="Meta+K Control+K"`.
|
package/dist/cases/stat-row.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A row in a table or a list says what state its thing is in, such as an invoice, a plan or a connection. ODS has no separate Badge part, because `Tag` does a Badge's job.
|
|
4
4
|
|
|
5
|
+
For: an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Use `Tag` for a state in a row, with `size="small"`. ODS has no Badge part: a second part for the same job would mark the same states two ways.
|
|
@@ -9,7 +11,7 @@ A row in a table or a list says what state its thing is in, such as an invoice,
|
|
|
9
11
|
- Use `variant="dot"` for a state that changes and may need the person: 'Past due', 'Canceling', 'Connected'.
|
|
10
12
|
- Give the dot a color only when the state needs action: `color="error"` for 'Past due', `color="warning"` for 'Canceling'. One exception: `color="info"` for a charge that has not happened yet, 'Upcoming', so it does not read as paid. A usual state, such as 'Connected', keeps the grey dot.
|
|
11
13
|
- Use `variant="textOnly"` with no color for a settled record: 'Paid', 'Refunded'.
|
|
12
|
-
- Write one word or two, in sentence case: 'Past due', 'Needs
|
|
14
|
+
- Write one word or two, in sentence case: 'Past due', 'Needs reconnect'.
|
|
13
15
|
- Put the Tag in a 'Status' column, or at the end of the row's text. It is not clickable.
|
|
14
16
|
|
|
15
17
|
## Don't
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Something the person did has worked.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Answer
|
|
6
8
|
|
|
7
9
|
The feedback depends on where the result shows. A Button that is `loading` keeps its label, and the spinner shows that it is working. Only success changes a label, and there are three success labels: 'Saved', 'Copied' and 'Sent', each for 2 seconds. When a form saves in place, its Button is `loading`, then reads 'Saved' for 2 seconds, then its own label again. There is no toast. Sometimes the result is somewhere else or gone. Something was deleted, sent, moved or duplicated somewhere else, or a long job has finished. Then call `toast({ type: 'success', message: '…' })` with one short sentence in the past tense, in sentence case. It closes after 5 seconds. When something is copied to the clipboard, a Button reads 'Copied' for 2 seconds, and an IconButton swaps its icon to `Check` for 2 seconds. When Copy is a menu item, the menu closes, so a toast says 'Message copied.' instead. When a Button sends an email again, it reads 'Sent' for 2 seconds. The message names the thing and does not say 'successfully'.
|
package/dist/cases/tag-filter.md
CHANGED