oneslash-design-system 2.14.2 → 2.16.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.
Files changed (232) hide show
  1. package/README.md +15 -0
  2. package/dist/DESIGN.md +138 -1
  3. package/dist/cases/accept-invite/signed-in.d.ts +1 -0
  4. package/dist/cases/accept-invite/signed-in.jsx +57 -0
  5. package/dist/cases/accept-invite/signed-out.d.ts +1 -0
  6. package/dist/cases/accept-invite/signed-out.jsx +33 -0
  7. package/dist/cases/accept-invite.md +161 -0
  8. package/dist/cases/agent-asks-before-risky-action.md +29 -0
  9. package/dist/cases/agent-cancels-when-unanswered.md +27 -0
  10. package/dist/cases/agent-refuses-clearly.md +31 -0
  11. package/dist/cases/agent-says-what-it-is.md +29 -0
  12. package/dist/cases/agent-shows-progress.md +30 -0
  13. package/dist/cases/agent-shows-sources.md +26 -0
  14. package/dist/cases/auth-gate-loading/spinner-with-line.d.ts +1 -0
  15. package/dist/cases/auth-gate-loading/spinner-with-line.jsx +10 -0
  16. package/dist/cases/auth-gate-loading/spinner.d.ts +1 -0
  17. package/dist/cases/auth-gate-loading/spinner.jsx +10 -0
  18. package/dist/cases/auth-gate-loading.md +70 -0
  19. package/dist/cases/check-your-email/alert-on-login.d.ts +1 -0
  20. package/dist/cases/check-your-email/alert-on-login.jsx +78 -0
  21. package/dist/cases/check-your-email/page.d.ts +1 -0
  22. package/dist/cases/check-your-email/page.jsx +49 -0
  23. package/dist/cases/check-your-email.md +184 -0
  24. package/dist/cases/confirm-destructive-action/inline.d.ts +1 -0
  25. package/dist/cases/confirm-destructive-action/inline.jsx +69 -0
  26. package/dist/cases/confirm-destructive-action/modal.d.ts +1 -0
  27. package/dist/cases/confirm-destructive-action/modal.jsx +66 -0
  28. package/dist/cases/confirm-destructive-action.md +211 -0
  29. package/dist/cases/confirm-dialogs.md +36 -0
  30. package/dist/cases/create-modal/quick.d.ts +1 -0
  31. package/dist/cases/create-modal/quick.jsx +80 -0
  32. package/dist/cases/create-modal/with-settings.d.ts +1 -0
  33. package/dist/cases/create-modal/with-settings.jsx +99 -0
  34. package/dist/cases/create-modal.md +244 -0
  35. package/dist/cases/device-login/popup.d.ts +1 -0
  36. package/dist/cases/device-login/popup.jsx +14 -0
  37. package/dist/cases/device-login/provider-first.d.ts +1 -0
  38. package/dist/cases/device-login/provider-first.jsx +98 -0
  39. package/dist/cases/device-login.md +171 -0
  40. package/dist/cases/email-confirmed/alert-on-login.d.ts +1 -0
  41. package/dist/cases/email-confirmed/alert-on-login.jsx +78 -0
  42. package/dist/cases/email-confirmed/page.d.ts +1 -0
  43. package/dist/cases/email-confirmed/page.jsx +21 -0
  44. package/dist/cases/email-confirmed.md +151 -0
  45. package/dist/cases/empty-list/region.d.ts +1 -0
  46. package/dist/cases/empty-list/region.jsx +13 -0
  47. package/dist/cases/empty-list/section.d.ts +1 -0
  48. package/dist/cases/empty-list/section.jsx +17 -0
  49. package/dist/cases/empty-list.md +77 -0
  50. package/dist/cases/empty-lists.md +35 -0
  51. package/dist/cases/empty-not-set-up/action.d.ts +1 -0
  52. package/dist/cases/empty-not-set-up/action.jsx +16 -0
  53. package/dist/cases/empty-not-set-up/pointer.d.ts +1 -0
  54. package/dist/cases/empty-not-set-up/pointer.jsx +13 -0
  55. package/dist/cases/empty-not-set-up.md +88 -0
  56. package/dist/cases/empty-search/clear-search.d.ts +1 -0
  57. package/dist/cases/empty-search/clear-search.jsx +29 -0
  58. package/dist/cases/empty-search.md +77 -0
  59. package/dist/cases/error-page/full-page.d.ts +1 -0
  60. package/dist/cases/error-page/full-page.jsx +19 -0
  61. package/dist/cases/error-page/in-shell.d.ts +1 -0
  62. package/dist/cases/error-page/in-shell.jsx +39 -0
  63. package/dist/cases/error-page.md +107 -0
  64. package/dist/cases/feedback-form/modal.d.ts +1 -0
  65. package/dist/cases/feedback-form/modal.jsx +89 -0
  66. package/dist/cases/feedback-form.md +139 -0
  67. package/dist/cases/forgot-password/in-place.d.ts +1 -0
  68. package/dist/cases/forgot-password/in-place.jsx +155 -0
  69. package/dist/cases/forgot-password/own-page.d.ts +1 -0
  70. package/dist/cases/forgot-password/own-page.jsx +99 -0
  71. package/dist/cases/forgot-password.md +328 -0
  72. package/dist/cases/form-errors.md +32 -0
  73. package/dist/cases/import-checklist/modal.d.ts +1 -0
  74. package/dist/cases/import-checklist/modal.jsx +125 -0
  75. package/dist/cases/import-checklist.md +188 -0
  76. package/dist/cases/inline-form-feedback/button-label.d.ts +1 -0
  77. package/dist/cases/inline-form-feedback/button-label.jsx +54 -0
  78. package/dist/cases/inline-form-feedback/inline-alert.d.ts +1 -0
  79. package/dist/cases/inline-form-feedback/inline-alert.jsx +49 -0
  80. package/dist/cases/inline-form-feedback/toast.d.ts +1 -0
  81. package/dist/cases/inline-form-feedback/toast.jsx +66 -0
  82. package/dist/cases/inline-form-feedback.md +237 -0
  83. package/dist/cases/invite-member/by-email.d.ts +1 -0
  84. package/dist/cases/invite-member/by-email.jsx +98 -0
  85. package/dist/cases/invite-member/by-link.d.ts +1 -0
  86. package/dist/cases/invite-member/by-link.jsx +122 -0
  87. package/dist/cases/invite-member.md +321 -0
  88. package/dist/cases/load-failure/inline.d.ts +1 -0
  89. package/dist/cases/load-failure/inline.jsx +52 -0
  90. package/dist/cases/load-failure/region.d.ts +1 -0
  91. package/dist/cases/load-failure/region.jsx +34 -0
  92. package/dist/cases/load-failure.md +155 -0
  93. package/dist/cases/log-out-confirm/modal.d.ts +1 -0
  94. package/dist/cases/log-out-confirm/modal.jsx +57 -0
  95. package/dist/cases/log-out-confirm.md +106 -0
  96. package/dist/cases/login-page/centered.d.ts +1 -0
  97. package/dist/cases/login-page/centered.jsx +72 -0
  98. package/dist/cases/login-page/email-only.d.ts +1 -0
  99. package/dist/cases/login-page/email-only.jsx +59 -0
  100. package/dist/cases/login-page/provider-first.d.ts +1 -0
  101. package/dist/cases/login-page/provider-first.jsx +66 -0
  102. package/dist/cases/login-page/split.d.ts +1 -0
  103. package/dist/cases/login-page/split.jsx +79 -0
  104. package/dist/cases/login-page.md +373 -0
  105. package/dist/cases/not-found-page/full-page.d.ts +1 -0
  106. package/dist/cases/not-found-page/full-page.jsx +16 -0
  107. package/dist/cases/not-found-page/in-shell.d.ts +1 -0
  108. package/dist/cases/not-found-page/in-shell.jsx +36 -0
  109. package/dist/cases/not-found-page.md +98 -0
  110. package/dist/cases/oauth-consent/simple.d.ts +1 -0
  111. package/dist/cases/oauth-consent/simple.jsx +73 -0
  112. package/dist/cases/oauth-consent/with-scope.d.ts +1 -0
  113. package/dist/cases/oauth-consent/with-scope.jsx +89 -0
  114. package/dist/cases/oauth-consent.md +233 -0
  115. package/dist/cases/rename/inline.d.ts +1 -0
  116. package/dist/cases/rename/inline.jsx +58 -0
  117. package/dist/cases/rename/modal.d.ts +1 -0
  118. package/dist/cases/rename/modal.jsx +70 -0
  119. package/dist/cases/rename.md +205 -0
  120. package/dist/cases/route-loading/full-screen.d.ts +1 -0
  121. package/dist/cases/route-loading/full-screen.jsx +8 -0
  122. package/dist/cases/route-loading/region.d.ts +1 -0
  123. package/dist/cases/route-loading/region.jsx +26 -0
  124. package/dist/cases/route-loading.md +84 -0
  125. package/dist/cases/set-new-password/form.d.ts +1 -0
  126. package/dist/cases/set-new-password/form.jsx +130 -0
  127. package/dist/cases/set-new-password/invalid-link.d.ts +1 -0
  128. package/dist/cases/set-new-password/invalid-link.jsx +50 -0
  129. package/dist/cases/set-new-password.md +247 -0
  130. package/dist/cases/sign-up-page/centered.d.ts +1 -0
  131. package/dist/cases/sign-up-page/centered.jsx +124 -0
  132. package/dist/cases/sign-up-page/provider-first.d.ts +1 -0
  133. package/dist/cases/sign-up-page/provider-first.jsx +124 -0
  134. package/dist/cases/sign-up-page/split.d.ts +1 -0
  135. package/dist/cases/sign-up-page/split.jsx +134 -0
  136. package/dist/cases/sign-up-page.md +478 -0
  137. package/dist/cases/success-feedback.md +35 -0
  138. package/dist/cases/type-to-confirm/inline.d.ts +1 -0
  139. package/dist/cases/type-to-confirm/inline.jsx +69 -0
  140. package/dist/cases/type-to-confirm/modal.d.ts +1 -0
  141. package/dist/cases/type-to-confirm/modal.jsx +73 -0
  142. package/dist/cases/type-to-confirm.md +222 -0
  143. package/dist/cases/unsaved-changes-guard/discard.d.ts +1 -0
  144. package/dist/cases/unsaved-changes-guard/discard.jsx +81 -0
  145. package/dist/cases/unsaved-changes-guard/save-or-discard.d.ts +1 -0
  146. package/dist/cases/unsaved-changes-guard/save-or-discard.jsx +85 -0
  147. package/dist/cases/unsaved-changes-guard.md +239 -0
  148. package/dist/cases/upgrade-prompt/inline.d.ts +1 -0
  149. package/dist/cases/upgrade-prompt/inline.jsx +52 -0
  150. package/dist/cases/upgrade-prompt/modal.d.ts +1 -0
  151. package/dist/cases/upgrade-prompt/modal.jsx +43 -0
  152. package/dist/cases/upgrade-prompt.md +174 -0
  153. package/dist/cases.json +2073 -0
  154. package/dist/components/alert.d.ts +3 -1
  155. package/dist/components/alert.jsx +6 -4
  156. package/dist/components/brandIcon.d.ts +12 -0
  157. package/dist/components/brandIcon.jsx +24 -0
  158. package/dist/components/emptyBox.d.ts +6 -1
  159. package/dist/components/emptyBox.jsx +4 -2
  160. package/dist/components/form.d.ts +11 -0
  161. package/dist/components/form.jsx +22 -0
  162. package/dist/components/heading.d.ts +2 -2
  163. package/dist/components/image.d.ts +14 -0
  164. package/dist/components/image.jsx +6 -0
  165. package/dist/components/layout.d.ts +18 -1
  166. package/dist/components/layout.jsx +16 -0
  167. package/dist/components/line.d.ts +3 -1
  168. package/dist/components/line.jsx +8 -1
  169. package/dist/components/loadingScreen.d.ts +5 -1
  170. package/dist/components/loadingScreen.jsx +4 -2
  171. package/dist/components/modal.d.ts +2 -1
  172. package/dist/components/modal.jsx +20 -8
  173. package/dist/components/radioGroup.d.ts +2 -1
  174. package/dist/components/radioGroup.jsx +2 -2
  175. package/dist/components/select.d.ts +2 -1
  176. package/dist/components/select.jsx +4 -2
  177. package/dist/components/tab.jsx +3 -2
  178. package/dist/components/tabsContainer.d.ts +4 -1
  179. package/dist/components/tabsContainer.jsx +11 -5
  180. package/dist/components/textField.d.ts +5 -1
  181. package/dist/components/textField.jsx +7 -3
  182. package/dist/components/toaster.d.ts +12 -0
  183. package/dist/components/toaster.jsx +103 -0
  184. package/dist/components/tooltip.jsx +3 -1
  185. package/dist/designTokens.d.ts +1 -0
  186. package/dist/designTokens.js +1 -0
  187. package/dist/internal/alert.d.ts +4 -0
  188. package/dist/internal/alert.js +6 -0
  189. package/dist/internal/modal.d.ts +2 -0
  190. package/dist/internal/modal.js +21 -0
  191. package/dist/internal/toaster.d.ts +19 -0
  192. package/dist/internal/toaster.js +50 -0
  193. package/dist/native-mapping.json +23 -1
  194. package/dist/stories/Alert.stories.d.ts +1 -0
  195. package/dist/stories/Alert.stories.jsx +16 -0
  196. package/dist/stories/BrandIcon.stories.d.ts +9 -0
  197. package/dist/stories/BrandIcon.stories.jsx +19 -0
  198. package/dist/stories/Cases.generated.stories.d.ts +60 -0
  199. package/dist/stories/Cases.generated.stories.jsx +116 -0
  200. package/dist/stories/EmptyBox.stories.d.ts +2 -0
  201. package/dist/stories/EmptyBox.stories.jsx +16 -0
  202. package/dist/stories/Form.stories.d.ts +6 -0
  203. package/dist/stories/Form.stories.jsx +26 -0
  204. package/dist/stories/Heading.stories.d.ts +6 -0
  205. package/dist/stories/Heading.stories.jsx +10 -0
  206. package/dist/stories/Image.stories.d.ts +7 -0
  207. package/dist/stories/Image.stories.jsx +18 -0
  208. package/dist/stories/Line.stories.d.ts +1 -0
  209. package/dist/stories/Line.stories.jsx +12 -0
  210. package/dist/stories/LoadingScreen.stories.d.ts +1 -0
  211. package/dist/stories/LoadingScreen.stories.jsx +8 -0
  212. package/dist/stories/Modal.stories.d.ts +2 -0
  213. package/dist/stories/Modal.stories.jsx +36 -0
  214. package/dist/stories/PageComponents.stories.d.ts +2 -0
  215. package/dist/stories/PageComponents.stories.jsx +15 -1
  216. package/dist/stories/RadioGroup.stories.d.ts +1 -0
  217. package/dist/stories/RadioGroup.stories.jsx +14 -0
  218. package/dist/stories/Select.stories.d.ts +1 -0
  219. package/dist/stories/Select.stories.jsx +14 -0
  220. package/dist/stories/TabsContainer.stories.d.ts +1 -0
  221. package/dist/stories/TabsContainer.stories.jsx +12 -0
  222. package/dist/stories/TextField.stories.d.ts +2 -0
  223. package/dist/stories/TextField.stories.jsx +22 -0
  224. package/dist/stories/Toaster.stories.d.ts +6 -0
  225. package/dist/stories/Toaster.stories.jsx +29 -0
  226. package/dist/tailwind-preset-auto.js +2 -1
  227. package/dist/tailwind-preset.js +2 -1
  228. package/dist/theme-auto.css +1 -0
  229. package/dist/theme.css +1 -0
  230. package/dist/tokens.css +1 -0
  231. package/dist/tokens.json +7 -0
  232. package/package.json +4 -2
@@ -0,0 +1,478 @@
1
+ # Sign-up page
2
+
3
+ A person who has no account yet opens the product and wants one.
4
+
5
+ **Not built yet:** Commentify and Scindo on the web replace the form with a spinner while creating the account. Neither says a password rule on its sign-up page. Their reset pages accept 6 characters and say 'Password must be at least 6 characters.' only after it is broken. Commentify asks for the first and last name in two fields.
6
+
7
+ ## Do
8
+
9
+ - Ask only for what the account needs: name, email and password.
10
+ - Say the product's password rule before the person breaks it, such as 'Use at least 8 characters.'
11
+ - Put the rule in the password field's `helperText`, so it is tied to the field.
12
+ - Check the rule on the server too, and show its refusal under the field.
13
+ - Show a problem with one field under that field.
14
+ - Show a failed request in an inline Alert above the fields.
15
+ - Show the loading state on the submit Button while creating the account, and keep the form in place.
16
+ - Show the check-your-email view in place of the form when the email must be confirmed, for every address, even one that already has an account. Tell that person by email that they can log in.
17
+ - Keep the submit Button loading until the check-your-email view shows.
18
+ - Name the provider on its button: 'Continue with Google'.
19
+ - Link or tab to login for people who already have an account.
20
+
21
+ ## Don't
22
+
23
+ - Do not ask for anything the account can do without, such as a username or the password twice.
24
+ - Do not clear the email field after a failed attempt.
25
+ - Do not replace the form with a spinner while creating the account.
26
+ - Do not say on the page whether an address already has an account.
27
+
28
+ ## Option: Centered column
29
+
30
+ Use when: The product has one way in, and most people sign up with email and a password.
31
+
32
+ Uses: `Alert`, `BrandIcon`, `Button`, `Center`, `Form`, `Heading`, `Icon`, `Image`, `Line`, `Paragraph`, `Stack`, `Tab`, `TabsContainer`, `TextField`
33
+
34
+ ```tsx
35
+ 'use client';
36
+ import { useEffect, useRef, useState } from 'react';
37
+ import { Mail } from 'lucide-react';
38
+ import Image from 'oneslash-design-system/components/image';
39
+ import TabsContainer from 'oneslash-design-system/components/tabsContainer';
40
+ import Tab from 'oneslash-design-system/components/tab';
41
+ import Form from 'oneslash-design-system/components/form';
42
+ import Alert from 'oneslash-design-system/components/alert';
43
+ import TextField from 'oneslash-design-system/components/textField';
44
+ import Paragraph from 'oneslash-design-system/components/paragraph';
45
+ import Heading from 'oneslash-design-system/components/heading';
46
+ import Icon from 'oneslash-design-system/components/icon';
47
+ import Button from 'oneslash-design-system/components/button';
48
+ import Line from 'oneslash-design-system/components/line';
49
+ import BrandIcon from 'oneslash-design-system/components/brandIcon';
50
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
51
+
52
+ // The product's mark. A real app passes its own file.
53
+ const productMark =
54
+ "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";
55
+
56
+ // A real app passes the router from its framework, such as Next's useRouter().
57
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
58
+
59
+ // A small check: some text, an @, then some text.
60
+ function looksLikeEmail(value: string) {
61
+ return /^[^@\s]+@[^@\s]+$/.test(value);
62
+ }
63
+
64
+ export default function SignUpCentered() {
65
+ const [name, setName] = useState('Ada Lovelace');
66
+ const [email, setEmail] = useState('ada@example.com');
67
+ const [password, setPassword] = useState('');
68
+ const [error, setError] = useState('');
69
+ const [nameError, setNameError] = useState('');
70
+ const [emailError, setEmailError] = useState('');
71
+ const [passwordError, setPasswordError] = useState('');
72
+ const [loading, setLoading] = useState(false);
73
+ // The address the link went to. Set once the account request ends, which shows the check-your-email view.
74
+ const [sentTo, setSentTo] = useState('');
75
+ const [resending, setResending] = useState(false);
76
+ const [resent, setResent] = useState(false);
77
+ const timer = useRef<ReturnType<typeof setTimeout>>();
78
+
79
+ // Stops the request if the example goes away before it ends.
80
+ useEffect(() => () => clearTimeout(timer.current), []);
81
+
82
+ // 'Sent' shows for 2 seconds, then the Button reads 'Send Again'.
83
+ useEffect(() => {
84
+ if (!resent) return;
85
+ const timer = setTimeout(() => setResent(false), 2000);
86
+ return () => clearTimeout(timer);
87
+ }, [resent]);
88
+
89
+ function handleSubmit() {
90
+ if (loading) return;
91
+ setError('');
92
+ setNameError('');
93
+ setEmailError('');
94
+ setPasswordError('');
95
+ if (!name.trim()) {
96
+ setNameError('Enter your name.');
97
+ return;
98
+ }
99
+ if (!email.trim()) {
100
+ setEmailError('Enter your email.');
101
+ return;
102
+ }
103
+ if (!looksLikeEmail(email.trim())) {
104
+ setEmailError('Enter an email address, like name@example.com.');
105
+ return;
106
+ }
107
+ if (password.length < 8) {
108
+ setPasswordError('Use at least 8 characters.');
109
+ return;
110
+ }
111
+ setLoading(true);
112
+ const address = email.trim();
113
+ // Stands in for the request to the server.
114
+ // A failed request calls setError with one sentence instead, such as 'Your account was not created. Try again.'
115
+ timer.current = setTimeout(() => {
116
+ // Every address goes on to the same view, so the page never says whether it has an account.
117
+ // The Button stays loading until the view changes.
118
+ setLoading(false);
119
+ setSentTo(address);
120
+ }, 1200);
121
+ }
122
+
123
+ function handleSendAgain() {
124
+ // One click sends one email: clicks while it sends or reads 'Sent' do nothing.
125
+ if (resending || resent) return;
126
+ setResending(true);
127
+ // Stands in for the request to the server.
128
+ // A failed request shows an inline error Alert above the Buttons, such as 'The email was not sent. Try again.'
129
+ timer.current = setTimeout(() => {
130
+ setResending(false);
131
+ setResent(true);
132
+ }, 1200);
133
+ }
134
+
135
+ // The same view as the 'Check your email' case, in place of the form.
136
+ if (sentTo) {
137
+ return (
138
+ <Center fill>
139
+ <Icon icon={Mail} size="large" color="secondary" />
140
+ <Stack gap="medium">
141
+ <Heading level={1} size="h5">Check your email</Heading>
142
+ <Paragraph tone="secondary" measure="none">We sent a link to {sentTo}. Open it to continue.</Paragraph>
143
+ </Stack>
144
+ <Stack gap="large">
145
+ <Button size="medium" type="secondary" state="enabled" label={resent ? 'Sent' : 'Send Again'} loading={resending} onClickButton={handleSendAgain} />
146
+ <Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={() => router.push('/login')} />
147
+ </Stack>
148
+ </Center>
149
+ );
150
+ }
151
+
152
+ return (
153
+ <Center fill>
154
+ <Image src={productMark} alt="Acme" width={40} height={40} />
155
+ <TabsContainer fill>
156
+ <Tab label="Log In" isSelected={false} href="/login" router={router} onClickTab={() => {}} />
157
+ <Tab label="Sign Up" isSelected onClickTab={() => {}} />
158
+ </TabsContainer>
159
+ <Form aria-label="Sign up" onSubmit={handleSubmit}>
160
+ {error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
161
+ <TextField id="sign-up-page-centered-name" label="Name" autoComplete="name" value={name} disabled={loading} error={Boolean(nameError)} errorText={nameError} onChange={(e) => { setName(e.target.value); setNameError(''); }} />
162
+ <TextField id="sign-up-page-centered-email" label="Email" type="email" autoComplete="username" value={email} disabled={loading} error={Boolean(emailError)} errorText={emailError} onChange={(e) => { setEmail(e.target.value); setEmailError(''); }} />
163
+ <TextField id="sign-up-page-centered-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(''); }} />
164
+ <Button size="medium" type="primary" state="enabled" label="Sign Up" htmlType="submit" loading={loading} />
165
+ </Form>
166
+ <Line label="or" />
167
+ <Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google" />} />
168
+ </Center>
169
+ );
170
+ }
171
+ ```
172
+
173
+ ## Option: Brand beside the form
174
+
175
+ Use when: People arrive from an ad or an invite and need one line on what the product is.
176
+
177
+ Uses: `Alert`, `BrandIcon`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Icon`, `Image`, `Line`, `Link`, `Paragraph`, `Split`, `Stack`, `TextField`
178
+
179
+ ```tsx
180
+ 'use client';
181
+ import { useEffect, useRef, useState } from 'react';
182
+ import { Mail } from 'lucide-react';
183
+ import Image from 'oneslash-design-system/components/image';
184
+ import Heading from 'oneslash-design-system/components/heading';
185
+ import Paragraph from 'oneslash-design-system/components/paragraph';
186
+ import Form from 'oneslash-design-system/components/form';
187
+ import Alert from 'oneslash-design-system/components/alert';
188
+ import TextField from 'oneslash-design-system/components/textField';
189
+ import Icon from 'oneslash-design-system/components/icon';
190
+ import Button from 'oneslash-design-system/components/button';
191
+ import Line from 'oneslash-design-system/components/line';
192
+ import Link from 'oneslash-design-system/components/link';
193
+ import BrandIcon from 'oneslash-design-system/components/brandIcon';
194
+ import { Center, Cluster, Split, Stack } from 'oneslash-design-system/components/layout';
195
+
196
+ // The product's mark. A real app passes its own file.
197
+ const productMark =
198
+ "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";
199
+
200
+ // A real app passes the router from its framework, such as Next's useRouter().
201
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
202
+
203
+ // A small check: some text, an @, then some text.
204
+ function looksLikeEmail(value: string) {
205
+ return /^[^@\s]+@[^@\s]+$/.test(value);
206
+ }
207
+
208
+ export default function SignUpSplit() {
209
+ const [name, setName] = useState('Ada Lovelace');
210
+ const [email, setEmail] = useState('ada@example.com');
211
+ const [password, setPassword] = useState('');
212
+ const [error, setError] = useState('');
213
+ const [nameError, setNameError] = useState('');
214
+ const [emailError, setEmailError] = useState('');
215
+ const [passwordError, setPasswordError] = useState('');
216
+ const [loading, setLoading] = useState(false);
217
+ // The address the link went to. Set once the account request ends, which shows the check-your-email view.
218
+ const [sentTo, setSentTo] = useState('');
219
+ const [resending, setResending] = useState(false);
220
+ const [resent, setResent] = useState(false);
221
+ const timer = useRef<ReturnType<typeof setTimeout>>();
222
+
223
+ // Stops the request if the example goes away before it ends.
224
+ useEffect(() => () => clearTimeout(timer.current), []);
225
+
226
+ // 'Sent' shows for 2 seconds, then the Button reads 'Send Again'.
227
+ useEffect(() => {
228
+ if (!resent) return;
229
+ const timer = setTimeout(() => setResent(false), 2000);
230
+ return () => clearTimeout(timer);
231
+ }, [resent]);
232
+
233
+ const aside = (
234
+ <Stack gap="large">
235
+ <Image src={productMark} alt="Acme" width={40} height={40} />
236
+ <Heading level={2} size="h4">Plan the week with your whole team.</Heading>
237
+ <Paragraph tone="secondary" measure="lede">
238
+ Acme keeps tasks, notes and decisions in one place.
239
+ </Paragraph>
240
+ </Stack>
241
+ );
242
+
243
+ function handleSubmit() {
244
+ if (loading) return;
245
+ setError('');
246
+ setNameError('');
247
+ setEmailError('');
248
+ setPasswordError('');
249
+ if (!name.trim()) {
250
+ setNameError('Enter your name.');
251
+ return;
252
+ }
253
+ if (!email.trim()) {
254
+ setEmailError('Enter your email.');
255
+ return;
256
+ }
257
+ if (!looksLikeEmail(email.trim())) {
258
+ setEmailError('Enter an email address, like name@example.com.');
259
+ return;
260
+ }
261
+ if (password.length < 8) {
262
+ setPasswordError('Use at least 8 characters.');
263
+ return;
264
+ }
265
+ setLoading(true);
266
+ const address = email.trim();
267
+ // Stands in for the request to the server.
268
+ // A failed request calls setError with one sentence instead, such as 'Your account was not created. Try again.'
269
+ timer.current = setTimeout(() => {
270
+ // Every address goes on to the same view, so the page never says whether it has an account.
271
+ // The Button stays loading until the view changes.
272
+ setLoading(false);
273
+ setSentTo(address);
274
+ }, 1200);
275
+ }
276
+
277
+ function handleSendAgain() {
278
+ // One click sends one email: clicks while it sends or reads 'Sent' do nothing.
279
+ if (resending || resent) return;
280
+ setResending(true);
281
+ // Stands in for the request to the server.
282
+ // A failed request shows an inline error Alert above the Buttons, such as 'The email was not sent. Try again.'
283
+ timer.current = setTimeout(() => {
284
+ setResending(false);
285
+ setResent(true);
286
+ }, 1200);
287
+ }
288
+
289
+ // The same view as the 'Check your email' case, in place of the form.
290
+ if (sentTo) {
291
+ return (
292
+ <Split fill aside={aside}>
293
+ <Center fill>
294
+ <Icon icon={Mail} size="large" color="secondary" />
295
+ <Stack gap="medium">
296
+ <Heading level={1} size="h5">Check your email</Heading>
297
+ <Paragraph tone="secondary" measure="none">We sent a link to {sentTo}. Open it to continue.</Paragraph>
298
+ </Stack>
299
+ <Stack gap="large">
300
+ <Button size="medium" type="secondary" state="enabled" label={resent ? 'Sent' : 'Send Again'} loading={resending} onClickButton={handleSendAgain} />
301
+ <Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={() => router.push('/login')} />
302
+ </Stack>
303
+ </Center>
304
+ </Split>
305
+ );
306
+ }
307
+
308
+ return (
309
+ <Split fill aside={aside}>
310
+ <Center fill>
311
+ <Heading level={1} size="h5">Create your Acme account</Heading>
312
+ <Form aria-label="Sign up" onSubmit={handleSubmit}>
313
+ {error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
314
+ <TextField id="sign-up-page-split-name" label="Name" autoComplete="name" value={name} disabled={loading} error={Boolean(nameError)} errorText={nameError} onChange={(e) => { setName(e.target.value); setNameError(''); }} />
315
+ <TextField id="sign-up-page-split-email" label="Email" type="email" autoComplete="username" value={email} disabled={loading} error={Boolean(emailError)} errorText={emailError} onChange={(e) => { setEmail(e.target.value); setEmailError(''); }} />
316
+ <TextField id="sign-up-page-split-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(''); }} />
317
+ <Button size="medium" type="primary" state="enabled" label="Sign Up" htmlType="submit" loading={loading} />
318
+ </Form>
319
+ <Line label="or" />
320
+ <Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google" />} />
321
+ <Cluster gap="small">
322
+ <Paragraph tone="secondary" size="body2" measure="none">Already have an account?</Paragraph>
323
+ <Link href="/login" size="body2">Log in</Link>
324
+ </Cluster>
325
+ </Center>
326
+ </Split>
327
+ );
328
+ }
329
+ ```
330
+
331
+ ## Option: Provider first
332
+
333
+ Use when: Most people sign up with Google, GitHub or Apple; email is the fallback.
334
+
335
+ Uses: `Alert`, `BrandIcon`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Icon`, `Line`, `Link`, `Paragraph`, `Stack`, `TextField`
336
+
337
+ ```tsx
338
+ 'use client';
339
+ import { useEffect, useRef, useState } from 'react';
340
+ import { Mail } from 'lucide-react';
341
+ import Heading from 'oneslash-design-system/components/heading';
342
+ import Paragraph from 'oneslash-design-system/components/paragraph';
343
+ import Form from 'oneslash-design-system/components/form';
344
+ import Alert from 'oneslash-design-system/components/alert';
345
+ import TextField from 'oneslash-design-system/components/textField';
346
+ import Icon from 'oneslash-design-system/components/icon';
347
+ import Button from 'oneslash-design-system/components/button';
348
+ import Line from 'oneslash-design-system/components/line';
349
+ import Link from 'oneslash-design-system/components/link';
350
+ import BrandIcon from 'oneslash-design-system/components/brandIcon';
351
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
352
+
353
+ // A real app passes the router from its framework, such as Next's useRouter().
354
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
355
+
356
+ // A small check: some text, an @, then some text.
357
+ function looksLikeEmail(value: string) {
358
+ return /^[^@\s]+@[^@\s]+$/.test(value);
359
+ }
360
+
361
+ export default function SignUpProviderFirst() {
362
+ const [name, setName] = useState('Ada Lovelace');
363
+ const [email, setEmail] = useState('ada@example.com');
364
+ const [password, setPassword] = useState('');
365
+ const [error, setError] = useState('');
366
+ const [nameError, setNameError] = useState('');
367
+ const [emailError, setEmailError] = useState('');
368
+ const [passwordError, setPasswordError] = useState('');
369
+ const [loading, setLoading] = useState(false);
370
+ // The address the link went to. Set once the account request ends, which shows the check-your-email view.
371
+ const [sentTo, setSentTo] = useState('');
372
+ const [resending, setResending] = useState(false);
373
+ const [resent, setResent] = useState(false);
374
+ const timer = useRef<ReturnType<typeof setTimeout>>();
375
+
376
+ // Stops the request if the example goes away before it ends.
377
+ useEffect(() => () => clearTimeout(timer.current), []);
378
+
379
+ // 'Sent' shows for 2 seconds, then the Button reads 'Send Again'.
380
+ useEffect(() => {
381
+ if (!resent) return;
382
+ const timer = setTimeout(() => setResent(false), 2000);
383
+ return () => clearTimeout(timer);
384
+ }, [resent]);
385
+
386
+ function handleSubmit() {
387
+ if (loading) return;
388
+ setError('');
389
+ setNameError('');
390
+ setEmailError('');
391
+ setPasswordError('');
392
+ if (!name.trim()) {
393
+ setNameError('Enter your name.');
394
+ return;
395
+ }
396
+ if (!email.trim()) {
397
+ setEmailError('Enter your email.');
398
+ return;
399
+ }
400
+ if (!looksLikeEmail(email.trim())) {
401
+ setEmailError('Enter an email address, like name@example.com.');
402
+ return;
403
+ }
404
+ if (password.length < 8) {
405
+ setPasswordError('Use at least 8 characters.');
406
+ return;
407
+ }
408
+ setLoading(true);
409
+ const address = email.trim();
410
+ // Stands in for the request to the server.
411
+ // A failed request calls setError with one sentence instead, such as 'Your account was not created. Try again.'
412
+ timer.current = setTimeout(() => {
413
+ // Every address goes on to the same view, so the page never says whether it has an account.
414
+ // The Button stays loading until the view changes.
415
+ setLoading(false);
416
+ setSentTo(address);
417
+ }, 1200);
418
+ }
419
+
420
+ function handleSendAgain() {
421
+ // One click sends one email: clicks while it sends or reads 'Sent' do nothing.
422
+ if (resending || resent) return;
423
+ setResending(true);
424
+ // Stands in for the request to the server.
425
+ // A failed request shows an inline error Alert above the Buttons, such as 'The email was not sent. Try again.'
426
+ timer.current = setTimeout(() => {
427
+ setResending(false);
428
+ setResent(true);
429
+ }, 1200);
430
+ }
431
+
432
+ // The same view as the 'Check your email' case, in place of the form.
433
+ if (sentTo) {
434
+ return (
435
+ <Center fill>
436
+ <Icon icon={Mail} size="large" color="secondary" />
437
+ <Stack gap="medium">
438
+ <Heading level={1} size="h5">Check your email</Heading>
439
+ <Paragraph tone="secondary" measure="none">We sent a link to {sentTo}. Open it to continue.</Paragraph>
440
+ </Stack>
441
+ <Stack gap="large">
442
+ <Button size="medium" type="secondary" state="enabled" label={resent ? 'Sent' : 'Send Again'} loading={resending} onClickButton={handleSendAgain} />
443
+ <Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={() => router.push('/login')} />
444
+ </Stack>
445
+ </Center>
446
+ );
447
+ }
448
+
449
+ return (
450
+ <Center fill>
451
+ <Heading level={1} size="h5">Sign up for Acme</Heading>
452
+ <Stack gap="medium">
453
+ <Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google" />} />
454
+ <Button size="medium" type="secondary" state="enabled" label="Continue with GitHub" decoIcon={<BrandIcon name="github" />} />
455
+ <Button size="medium" type="secondary" state="enabled" label="Continue with Apple" decoIcon={<BrandIcon name="apple" />} />
456
+ </Stack>
457
+ <Line label="or" />
458
+ <Form aria-label="Sign up with email" onSubmit={handleSubmit}>
459
+ {error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
460
+ <TextField id="sign-up-page-provider-name" label="Name" autoComplete="name" value={name} disabled={loading} error={Boolean(nameError)} errorText={nameError} onChange={(e) => { setName(e.target.value); setNameError(''); }} />
461
+ <TextField id="sign-up-page-provider-email" label="Email" type="email" autoComplete="username" value={email} disabled={loading} error={Boolean(emailError)} errorText={emailError} onChange={(e) => { setEmail(e.target.value); setEmailError(''); }} />
462
+ <TextField id="sign-up-page-provider-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(''); }} />
463
+ <Button size="medium" type="primary" state="enabled" label="Sign Up with Email" htmlType="submit" loading={loading} />
464
+ </Form>
465
+ <Cluster gap="small">
466
+ <Paragraph tone="secondary" size="body2" measure="none">Already have an account?</Paragraph>
467
+ <Link href="/login" size="body2">Log in</Link>
468
+ </Cluster>
469
+ </Center>
470
+ );
471
+ }
472
+ ```
473
+
474
+ ## Native
475
+
476
+ On Apple, Scindo opens the web sign-up page with a `Link`. A sign-up built in the app uses `SignInWithAppleButton` for Apple, a grouped form for the fields, and system buttons.
477
+
478
+ Seen in: Commentify, Scindo.
@@ -0,0 +1,35 @@
1
+ # Success shows where the person is looking
2
+
3
+ Something the person did has worked.
4
+
5
+ ## Answer
6
+
7
+ 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 a Button sends an email again, it reads 'Sent' for 2 seconds. The message names the thing and does not say 'successfully'.
8
+
9
+ **Not built yet:** Scindo on the web has no toast. It shows success in five ways: a 'Saved' Button label, a green caption, an inline Alert, a thank-you that replaces a dialog and a 'Copied' label. The timed ones clear after 1.5, 2, 3 or 4 seconds. Commentify shows toasts through `Alert`, one at a time, and many of them say 'successfully'.
10
+
11
+ ## Why
12
+
13
+ Feedback belongs where the person is looking. A change they can see needs only a word on the Button, and a result they cannot see needs a short message that names it.
14
+
15
+ ## Do
16
+
17
+ - Show `loading` on the Button while a form saves, then 'Saved' for 2 seconds.
18
+ - Write a toast as one short sentence in the past tense that names the thing: 'Invite sent to Dana.'
19
+ - Show 'Copied' on a copy Button, or the `Check` icon on a copy IconButton, for 2 seconds.
20
+ - Show 'Sent' for 2 seconds on a Button that sends an email again, such as 'Send Again'.
21
+ - Mount one `Toaster` near the app root, and show every toast with `toast()`.
22
+
23
+ ## Don't
24
+
25
+ - Do not say 'successfully'.
26
+ - Do not change a Button's label while it is loading, such as to 'Saving…' or 'Deleting…'.
27
+ - Do not show a toast for a change the person can already see.
28
+ - Do not build a toast from `Alert`. Use `toast()`.
29
+ - Do not make the person close a success message.
30
+
31
+ ## Native
32
+
33
+ On Apple there is no toast. Show the result in place.
34
+
35
+ Seen in: Commentify, Scindo.
@@ -0,0 +1 @@
1
+ export default function TypeToConfirmInline(): import("react").JSX.Element;
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Surface from '../../components/surface';
4
+ import Heading from '../../components/heading';
5
+ import Paragraph from '../../components/paragraph';
6
+ import TextField from '../../components/textField';
7
+ import Button from '../../components/button';
8
+ import { Center, Cluster, Stack } from '../../components/layout';
9
+ // An account has no name to type, so the person types a fixed word.
10
+ var word = 'DELETE';
11
+ export default function TypeToConfirmInline() {
12
+ // Opens with the field showing, as if the person just chose Delete Account.
13
+ var _a = useState(true), confirming = _a[0], setConfirming = _a[1];
14
+ var _b = useState(''), typed = _b[0], setTyped = _b[1];
15
+ var _c = useState(false), deleting = _c[0], setDeleting = _c[1];
16
+ var _d = useState(false), deleted = _d[0], setDeleted = _d[1];
17
+ var timer = useRef();
18
+ // Stops the request if the example goes away before it ends.
19
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
20
+ // An exact match, with case. Pasting the word is fine.
21
+ var matches = typed === word;
22
+ function handleCancel() {
23
+ setConfirming(false);
24
+ setTyped('');
25
+ }
26
+ function handleDelete() {
27
+ if (deleting || !matches)
28
+ return;
29
+ setDeleting(true);
30
+ // Stands in for the request to the server.
31
+ timer.current = setTimeout(function () {
32
+ setDeleting(false);
33
+ setDeleted(true);
34
+ }, 1200);
35
+ }
36
+ // The account is gone, so the page that showed it is gone too.
37
+ if (deleted) {
38
+ return (<Center fill>
39
+ <Heading level={1} size="h5">Your account is deleted</Heading>
40
+ <Paragraph tone="secondary" measure="none">We sent a note to ada@example.com to say so.</Paragraph>
41
+ </Center>);
42
+ }
43
+ return (<Center width="page">
44
+ <Stack gap="xlarge">
45
+ <Heading level={1} size="h5">Account settings</Heading>
46
+ <Surface padding="large">
47
+ <Stack gap="medium">
48
+ <Heading level={2} size="h6">Profile</Heading>
49
+ <Paragraph size="body2" measure="none">Ada Brooks, ada@example.com</Paragraph>
50
+ </Stack>
51
+ </Surface>
52
+ <Surface padding="large">
53
+ <Stack gap="medium">
54
+ <Heading level={2} size="h6">Delete account</Heading>
55
+ <Paragraph size="body2" measure="none">This deletes your account, your private documents and your settings. It cannot be undone. Projects you shared stay with your team.</Paragraph>
56
+ {confirming ? (<>
57
+ <TextField id="type-to-confirm-word" label={"Type ".concat(word, " to confirm")} value={typed} disabled={deleting} onChange={function (e) { return setTyped(e.target.value); }}/>
58
+ <Cluster gap="small">
59
+ <Button size="small" type="tertiary" state={deleting ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel}/>
60
+ <Button size="small" type="primary" color="danger" state={matches ? 'enabled' : 'disabled'} label="Delete Account" loading={deleting} onClickButton={handleDelete}/>
61
+ </Cluster>
62
+ </>) : (<Cluster>
63
+ <Button size="small" type="secondary" color="danger" state="enabled" label="Delete Account" onClickButton={function () { return setConfirming(true); }}/>
64
+ </Cluster>)}
65
+ </Stack>
66
+ </Surface>
67
+ </Stack>
68
+ </Center>);
69
+ }
@@ -0,0 +1 @@
1
+ export default function TypeToConfirmModal(): import("react").JSX.Element;
@@ -0,0 +1,73 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import Toaster, { toast, dismissToast } from '../../components/toaster';
4
+ import Modal from '../../components/modal';
5
+ import Surface from '../../components/surface';
6
+ import Heading from '../../components/heading';
7
+ import Paragraph from '../../components/paragraph';
8
+ import List from '../../components/list';
9
+ import TextField from '../../components/textField';
10
+ import Button from '../../components/button';
11
+ import { Center, Cluster, Stack } from '../../components/layout';
12
+ var workspace = 'Acme Design';
13
+ var otherWorkspaces = ['Acme Marketing', 'Acme Support'];
14
+ export default function TypeToConfirmModal() {
15
+ // Opens on the confirm, as if the person just chose Delete Workspace.
16
+ var _a = useState(true), open = _a[0], setOpen = _a[1];
17
+ var _b = useState(''), typed = _b[0], setTyped = _b[1];
18
+ var _c = useState(false), deleting = _c[0], setDeleting = _c[1];
19
+ var _d = useState(false), deleted = _d[0], setDeleted = _d[1];
20
+ var timer = useRef();
21
+ var toastIds = useRef([]);
22
+ // On unmount it stops the request and closes every toast it opened.
23
+ useEffect(function () { return function () {
24
+ clearTimeout(timer.current);
25
+ toastIds.current.forEach(function (id) { return dismissToast(id); });
26
+ toastIds.current = [];
27
+ }; }, []);
28
+ // An exact match, with case. Pasting the name is fine.
29
+ var matches = typed === workspace;
30
+ // Escape, a click outside and Cancel all close it, except while the request runs.
31
+ function handleClose() {
32
+ if (deleting)
33
+ return;
34
+ setOpen(false);
35
+ setTyped('');
36
+ }
37
+ function handleDelete() {
38
+ if (deleting || !matches)
39
+ return;
40
+ setDeleting(true);
41
+ // Stands in for the request to the server.
42
+ timer.current = setTimeout(function () {
43
+ setDeleting(false);
44
+ setOpen(false);
45
+ setDeleted(true);
46
+ toastIds.current.push(toast({ type: 'success', message: "Workspace '".concat(workspace, "' deleted.") }));
47
+ }, 1200);
48
+ }
49
+ return (<Center width="page">
50
+ {/* A real app mounts one Toaster near its root. */}
51
+ <Toaster />
52
+ {deleted ? (<Stack gap="large">
53
+ <Heading level={2} size="h5">Workspaces</Heading>
54
+ <Surface padding="large">
55
+ <List items={otherWorkspaces} size="body1"/>
56
+ </Surface>
57
+ </Stack>) : (<Stack gap="medium">
58
+ <Heading level={2} size="h5">{workspace}</Heading>
59
+ <Paragraph tone="secondary" size="body2" measure="none">6 members and 14 channels.</Paragraph>
60
+ <Cluster>
61
+ <Button size="small" type="secondary" color="danger" state="enabled" label="Delete Workspace" onClickButton={function () { return setOpen(true); }}/>
62
+ </Cluster>
63
+ </Stack>)}
64
+ <Modal isOpen={open} size="small" initialFocus="body" title="Delete Workspace" onClose={handleClose} actions={<>
65
+ <Button size="small" type="tertiary" state={deleting ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
66
+ <Button size="small" type="primary" color="danger" state={matches ? 'enabled' : 'disabled'} label="Delete" loading={deleting} onClickButton={handleDelete}/>
67
+ </>}>
68
+ <Paragraph measure="none">This deletes the workspace &apos;{workspace}&apos; with its 14 channels, tasks and messages. It cannot be undone.</Paragraph>
69
+ <Paragraph tone="secondary" size="body2" measure="none">Members keep their Acme accounts.</Paragraph>
70
+ <TextField id="type-to-confirm-name" label={"Type ".concat(workspace, " to confirm")} value={typed} disabled={deleting} onChange={function (e) { return setTyped(e.target.value); }}/>
71
+ </Modal>
72
+ </Center>);
73
+ }