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.
Files changed (331) hide show
  1. package/README.md +6 -1
  2. package/dist/DESIGN.md +100 -73
  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 +1 -1
  9. package/dist/cases/agent-cancels-when-unanswered.md +1 -1
  10. package/dist/cases/agent-options/cards.d.ts +1 -0
  11. package/dist/cases/agent-options/cards.jsx +91 -0
  12. package/dist/cases/agent-options.md +168 -0
  13. package/dist/cases/agent-pending-reply/steps.d.ts +1 -0
  14. package/dist/cases/agent-pending-reply/steps.jsx +149 -0
  15. package/dist/cases/agent-pending-reply/streaming.d.ts +1 -0
  16. package/dist/cases/agent-pending-reply/streaming.jsx +146 -0
  17. package/dist/cases/agent-pending-reply.md +432 -0
  18. package/dist/cases/agent-plan-proposal/changes.d.ts +1 -0
  19. package/dist/cases/agent-plan-proposal/changes.jsx +224 -0
  20. package/dist/cases/agent-plan-proposal/steps.d.ts +1 -0
  21. package/dist/cases/agent-plan-proposal/steps.jsx +211 -0
  22. package/dist/cases/agent-plan-proposal.md +656 -0
  23. package/dist/cases/agent-question/choices.d.ts +1 -0
  24. package/dist/cases/agent-question/choices.jsx +132 -0
  25. package/dist/cases/agent-question/free-text.d.ts +1 -0
  26. package/dist/cases/agent-question/free-text.jsx +81 -0
  27. package/dist/cases/agent-question.md +338 -0
  28. package/dist/cases/agent-shows-sources.md +2 -2
  29. package/dist/cases/artifact-card/card.d.ts +1 -0
  30. package/dist/cases/artifact-card/card.jsx +45 -0
  31. package/dist/cases/artifact-card.md +103 -0
  32. package/dist/cases/auth-gate-loading/spinner-with-line.d.ts +1 -0
  33. package/dist/cases/auth-gate-loading/spinner-with-line.jsx +10 -0
  34. package/dist/cases/auth-gate-loading/spinner.d.ts +1 -0
  35. package/dist/cases/auth-gate-loading/spinner.jsx +10 -0
  36. package/dist/cases/auth-gate-loading.md +70 -0
  37. package/dist/cases/check-your-email/alert-on-login.d.ts +1 -0
  38. package/dist/cases/check-your-email/alert-on-login.jsx +78 -0
  39. package/dist/cases/check-your-email/page.d.ts +1 -0
  40. package/dist/cases/check-your-email/page.jsx +49 -0
  41. package/dist/cases/check-your-email.md +184 -0
  42. package/dist/cases/composer-limit/notice-with-action.d.ts +1 -0
  43. package/dist/cases/composer-limit/notice-with-action.jsx +87 -0
  44. package/dist/cases/composer-limit/notice.d.ts +1 -0
  45. package/dist/cases/composer-limit/notice.jsx +84 -0
  46. package/dist/cases/composer-limit.md +286 -0
  47. package/dist/cases/confirm-destructive-action/inline.d.ts +1 -0
  48. package/dist/cases/confirm-destructive-action/inline.jsx +69 -0
  49. package/dist/cases/confirm-destructive-action/modal.d.ts +1 -0
  50. package/dist/cases/confirm-destructive-action/modal.jsx +66 -0
  51. package/dist/cases/confirm-destructive-action.md +211 -0
  52. package/dist/cases/confirm-dialogs.md +36 -0
  53. package/dist/cases/conversation-starters/chips.d.ts +1 -0
  54. package/dist/cases/conversation-starters/chips.jsx +69 -0
  55. package/dist/cases/conversation-starters/none.d.ts +1 -0
  56. package/dist/cases/conversation-starters/none.jsx +45 -0
  57. package/dist/cases/conversation-starters.md +208 -0
  58. package/dist/cases/create-modal/quick.d.ts +1 -0
  59. package/dist/cases/create-modal/quick.jsx +80 -0
  60. package/dist/cases/create-modal/with-settings.d.ts +1 -0
  61. package/dist/cases/create-modal/with-settings.jsx +99 -0
  62. package/dist/cases/create-modal.md +244 -0
  63. package/dist/cases/device-login/popup.d.ts +1 -0
  64. package/dist/cases/device-login/popup.jsx +14 -0
  65. package/dist/cases/device-login/provider-first.d.ts +1 -0
  66. package/dist/cases/device-login/provider-first.jsx +98 -0
  67. package/dist/cases/device-login.md +171 -0
  68. package/dist/cases/email-confirmed/alert-on-login.d.ts +1 -0
  69. package/dist/cases/email-confirmed/alert-on-login.jsx +78 -0
  70. package/dist/cases/email-confirmed/page.d.ts +1 -0
  71. package/dist/cases/email-confirmed/page.jsx +21 -0
  72. package/dist/cases/email-confirmed.md +151 -0
  73. package/dist/cases/empty-list/region.d.ts +1 -0
  74. package/dist/cases/empty-list/region.jsx +13 -0
  75. package/dist/cases/empty-list/section.d.ts +1 -0
  76. package/dist/cases/empty-list/section.jsx +17 -0
  77. package/dist/cases/empty-list.md +77 -0
  78. package/dist/cases/empty-lists.md +35 -0
  79. package/dist/cases/empty-not-set-up/action.d.ts +1 -0
  80. package/dist/cases/empty-not-set-up/action.jsx +16 -0
  81. package/dist/cases/empty-not-set-up/pointer.d.ts +1 -0
  82. package/dist/cases/empty-not-set-up/pointer.jsx +13 -0
  83. package/dist/cases/empty-not-set-up.md +88 -0
  84. package/dist/cases/empty-search/clear-search.d.ts +1 -0
  85. package/dist/cases/empty-search/clear-search.jsx +29 -0
  86. package/dist/cases/empty-search.md +77 -0
  87. package/dist/cases/error-page/full-page.d.ts +1 -0
  88. package/dist/cases/error-page/full-page.jsx +19 -0
  89. package/dist/cases/error-page/in-shell.d.ts +1 -0
  90. package/dist/cases/error-page/in-shell.jsx +39 -0
  91. package/dist/cases/error-page.md +107 -0
  92. package/dist/cases/feedback-form/modal.d.ts +1 -0
  93. package/dist/cases/feedback-form/modal.jsx +89 -0
  94. package/dist/cases/feedback-form.md +139 -0
  95. package/dist/cases/forgot-password/in-place.d.ts +1 -0
  96. package/dist/cases/forgot-password/in-place.jsx +155 -0
  97. package/dist/cases/forgot-password/own-page.d.ts +1 -0
  98. package/dist/cases/forgot-password/own-page.jsx +99 -0
  99. package/dist/cases/forgot-password.md +328 -0
  100. package/dist/cases/form-errors.md +32 -0
  101. package/dist/cases/import-checklist/modal.d.ts +1 -0
  102. package/dist/cases/import-checklist/modal.jsx +125 -0
  103. package/dist/cases/import-checklist.md +188 -0
  104. package/dist/cases/inline-form-feedback/button-label.d.ts +1 -0
  105. package/dist/cases/inline-form-feedback/button-label.jsx +54 -0
  106. package/dist/cases/inline-form-feedback/inline-alert.d.ts +1 -0
  107. package/dist/cases/inline-form-feedback/inline-alert.jsx +49 -0
  108. package/dist/cases/inline-form-feedback/toast.d.ts +1 -0
  109. package/dist/cases/inline-form-feedback/toast.jsx +66 -0
  110. package/dist/cases/inline-form-feedback.md +237 -0
  111. package/dist/cases/invite-member/by-email.d.ts +1 -0
  112. package/dist/cases/invite-member/by-email.jsx +98 -0
  113. package/dist/cases/invite-member/by-link.d.ts +1 -0
  114. package/dist/cases/invite-member/by-link.jsx +122 -0
  115. package/dist/cases/invite-member.md +321 -0
  116. package/dist/cases/load-failure/inline.d.ts +1 -0
  117. package/dist/cases/load-failure/inline.jsx +52 -0
  118. package/dist/cases/load-failure/region.d.ts +1 -0
  119. package/dist/cases/load-failure/region.jsx +34 -0
  120. package/dist/cases/load-failure.md +155 -0
  121. package/dist/cases/log-out-confirm/modal.d.ts +1 -0
  122. package/dist/cases/log-out-confirm/modal.jsx +57 -0
  123. package/dist/cases/log-out-confirm.md +106 -0
  124. package/dist/cases/login-page/centered.jsx +10 -7
  125. package/dist/cases/login-page/email-only.jsx +11 -8
  126. package/dist/cases/login-page/provider-first.jsx +12 -9
  127. package/dist/cases/login-page/split.jsx +11 -8
  128. package/dist/cases/login-page.md +58 -41
  129. package/dist/cases/mention-list/in-composer.d.ts +1 -0
  130. package/dist/cases/mention-list/in-composer.jsx +169 -0
  131. package/dist/cases/mention-list.md +252 -0
  132. package/dist/cases/message-actions/hover-toolbar.d.ts +1 -0
  133. package/dist/cases/message-actions/hover-toolbar.jsx +229 -0
  134. package/dist/cases/message-actions/menu.d.ts +1 -0
  135. package/dist/cases/message-actions/menu.jsx +258 -0
  136. package/dist/cases/message-actions.md +651 -0
  137. package/dist/cases/message-attachments/in-composer.d.ts +1 -0
  138. package/dist/cases/message-attachments/in-composer.jsx +134 -0
  139. package/dist/cases/message-attachments/in-message.d.ts +1 -0
  140. package/dist/cases/message-attachments/in-message.jsx +46 -0
  141. package/dist/cases/message-attachments.md +310 -0
  142. package/dist/cases/message-composer/plain.d.ts +1 -0
  143. package/dist/cases/message-composer/plain.jsx +57 -0
  144. package/dist/cases/message-composer/with-tools.d.ts +1 -0
  145. package/dist/cases/message-composer/with-tools.jsx +182 -0
  146. package/dist/cases/message-composer.md +356 -0
  147. package/dist/cases/message-edit/in-place.d.ts +1 -0
  148. package/dist/cases/message-edit/in-place.jsx +99 -0
  149. package/dist/cases/message-edit.md +179 -0
  150. package/dist/cases/message-reactions/chips.d.ts +1 -0
  151. package/dist/cases/message-reactions/chips.jsx +118 -0
  152. package/dist/cases/message-reactions/quick-pick.d.ts +1 -0
  153. package/dist/cases/message-reactions/quick-pick.jsx +155 -0
  154. package/dist/cases/message-reactions.md +371 -0
  155. package/dist/cases/message-row/grouped.d.ts +1 -0
  156. package/dist/cases/message-row/grouped.jsx +56 -0
  157. package/dist/cases/message-row/person-and-agent.d.ts +1 -0
  158. package/dist/cases/message-row/person-and-agent.jsx +41 -0
  159. package/dist/cases/message-row.md +189 -0
  160. package/dist/cases/not-found-page/full-page.d.ts +1 -0
  161. package/dist/cases/not-found-page/full-page.jsx +16 -0
  162. package/dist/cases/not-found-page/in-shell.d.ts +1 -0
  163. package/dist/cases/not-found-page/in-shell.jsx +36 -0
  164. package/dist/cases/not-found-page.md +98 -0
  165. package/dist/cases/oauth-consent/simple.d.ts +1 -0
  166. package/dist/cases/oauth-consent/simple.jsx +73 -0
  167. package/dist/cases/oauth-consent/with-scope.d.ts +1 -0
  168. package/dist/cases/oauth-consent/with-scope.jsx +89 -0
  169. package/dist/cases/oauth-consent.md +233 -0
  170. package/dist/cases/rename/inline.d.ts +1 -0
  171. package/dist/cases/rename/inline.jsx +58 -0
  172. package/dist/cases/rename/modal.d.ts +1 -0
  173. package/dist/cases/rename/modal.jsx +70 -0
  174. package/dist/cases/rename.md +205 -0
  175. package/dist/cases/reply-feedback/thumbs.d.ts +1 -0
  176. package/dist/cases/reply-feedback/thumbs.jsx +191 -0
  177. package/dist/cases/reply-feedback/with-reason.d.ts +1 -0
  178. package/dist/cases/reply-feedback/with-reason.jsx +221 -0
  179. package/dist/cases/reply-feedback.md +552 -0
  180. package/dist/cases/reply-sources/cards.d.ts +1 -0
  181. package/dist/cases/reply-sources/cards.jsx +83 -0
  182. package/dist/cases/reply-sources/tag-only.d.ts +1 -0
  183. package/dist/cases/reply-sources/tag-only.jsx +45 -0
  184. package/dist/cases/reply-sources.md +247 -0
  185. package/dist/cases/route-loading/full-screen.d.ts +1 -0
  186. package/dist/cases/route-loading/full-screen.jsx +8 -0
  187. package/dist/cases/route-loading/region.d.ts +1 -0
  188. package/dist/cases/route-loading/region.jsx +26 -0
  189. package/dist/cases/route-loading.md +84 -0
  190. package/dist/cases/set-new-password/form.d.ts +1 -0
  191. package/dist/cases/set-new-password/form.jsx +130 -0
  192. package/dist/cases/set-new-password/invalid-link.d.ts +1 -0
  193. package/dist/cases/set-new-password/invalid-link.jsx +50 -0
  194. package/dist/cases/set-new-password.md +247 -0
  195. package/dist/cases/sign-up-page/centered.d.ts +1 -0
  196. package/dist/cases/sign-up-page/centered.jsx +124 -0
  197. package/dist/cases/sign-up-page/provider-first.d.ts +1 -0
  198. package/dist/cases/sign-up-page/provider-first.jsx +124 -0
  199. package/dist/cases/sign-up-page/split.d.ts +1 -0
  200. package/dist/cases/sign-up-page/split.jsx +134 -0
  201. package/dist/cases/sign-up-page.md +478 -0
  202. package/dist/cases/slash-command-list/in-composer.d.ts +1 -0
  203. package/dist/cases/slash-command-list/in-composer.jsx +162 -0
  204. package/dist/cases/slash-command-list.md +247 -0
  205. package/dist/cases/success-feedback.md +35 -0
  206. package/dist/cases/type-to-confirm/inline.d.ts +1 -0
  207. package/dist/cases/type-to-confirm/inline.jsx +69 -0
  208. package/dist/cases/type-to-confirm/modal.d.ts +1 -0
  209. package/dist/cases/type-to-confirm/modal.jsx +73 -0
  210. package/dist/cases/type-to-confirm.md +222 -0
  211. package/dist/cases/typing-and-status/line.d.ts +1 -0
  212. package/dist/cases/typing-and-status/line.jsx +50 -0
  213. package/dist/cases/typing-and-status.md +96 -0
  214. package/dist/cases/unsaved-changes-guard/discard.d.ts +1 -0
  215. package/dist/cases/unsaved-changes-guard/discard.jsx +81 -0
  216. package/dist/cases/unsaved-changes-guard/save-or-discard.d.ts +1 -0
  217. package/dist/cases/unsaved-changes-guard/save-or-discard.jsx +85 -0
  218. package/dist/cases/unsaved-changes-guard.md +239 -0
  219. package/dist/cases/upgrade-prompt/inline.d.ts +1 -0
  220. package/dist/cases/upgrade-prompt/inline.jsx +52 -0
  221. package/dist/cases/upgrade-prompt/modal.d.ts +1 -0
  222. package/dist/cases/upgrade-prompt/modal.jsx +43 -0
  223. package/dist/cases/upgrade-prompt.md +174 -0
  224. package/dist/cases.json +3138 -59
  225. package/dist/components/alert.d.ts +3 -1
  226. package/dist/components/alert.jsx +6 -4
  227. package/dist/components/button.d.ts +3 -2
  228. package/dist/components/button.jsx +9 -7
  229. package/dist/components/composer.d.ts +74 -0
  230. package/dist/components/composer.jsx +122 -0
  231. package/dist/components/emptyBox.d.ts +6 -1
  232. package/dist/components/emptyBox.jsx +4 -2
  233. package/dist/components/fileChip.d.ts +33 -0
  234. package/dist/components/fileChip.jsx +61 -0
  235. package/dist/components/heading.d.ts +2 -2
  236. package/dist/components/iconButton.d.ts +3 -3
  237. package/dist/components/iconButton.jsx +9 -7
  238. package/dist/components/layout.d.ts +7 -1
  239. package/dist/components/layout.jsx +5 -2
  240. package/dist/components/loadingScreen.d.ts +5 -1
  241. package/dist/components/loadingScreen.jsx +4 -2
  242. package/dist/components/menu.d.ts +21 -0
  243. package/dist/components/menu.jsx +27 -3
  244. package/dist/components/menuItem.d.ts +9 -1
  245. package/dist/components/menuItem.jsx +5 -4
  246. package/dist/components/message.d.ts +28 -0
  247. package/dist/components/message.jsx +25 -0
  248. package/dist/components/modal.d.ts +2 -1
  249. package/dist/components/modal.jsx +20 -8
  250. package/dist/components/paragraph.d.ts +3 -1
  251. package/dist/components/paragraph.jsx +2 -2
  252. package/dist/components/popover.d.ts +7 -1
  253. package/dist/components/popover.jsx +35 -9
  254. package/dist/components/radioGroup.d.ts +9 -1
  255. package/dist/components/radioGroup.jsx +20 -9
  256. package/dist/components/select.d.ts +2 -1
  257. package/dist/components/select.jsx +4 -2
  258. package/dist/components/sourceCard.d.ts +23 -0
  259. package/dist/components/sourceCard.jsx +56 -0
  260. package/dist/components/stepList.d.ts +17 -0
  261. package/dist/components/stepList.jsx +79 -0
  262. package/dist/components/tab.jsx +3 -2
  263. package/dist/components/tabsContainer.d.ts +4 -1
  264. package/dist/components/tabsContainer.jsx +7 -3
  265. package/dist/components/tag.d.ts +9 -1
  266. package/dist/components/tag.jsx +6 -4
  267. package/dist/components/textField.d.ts +5 -1
  268. package/dist/components/textField.jsx +7 -3
  269. package/dist/components/textarea.jsx +3 -18
  270. package/dist/components/toaster.d.ts +12 -0
  271. package/dist/components/toaster.jsx +103 -0
  272. package/dist/components/userImage.d.ts +9 -1
  273. package/dist/components/userImage.jsx +10 -3
  274. package/dist/internal/alert.d.ts +4 -0
  275. package/dist/internal/alert.js +6 -0
  276. package/dist/internal/autoGrow.d.ts +11 -0
  277. package/dist/internal/autoGrow.js +28 -0
  278. package/dist/internal/composer.d.ts +16 -0
  279. package/dist/internal/composer.js +18 -0
  280. package/dist/internal/menu.d.ts +6 -0
  281. package/dist/internal/menu.js +31 -0
  282. package/dist/internal/modal.d.ts +2 -0
  283. package/dist/internal/modal.js +21 -0
  284. package/dist/internal/toaster.d.ts +19 -0
  285. package/dist/internal/toaster.js +50 -0
  286. package/dist/native-mapping.json +38 -1
  287. package/dist/stories/Alert.stories.d.ts +1 -0
  288. package/dist/stories/Alert.stories.jsx +16 -0
  289. package/dist/stories/Button.stories.d.ts +1 -0
  290. package/dist/stories/Button.stories.jsx +17 -1
  291. package/dist/stories/Cases.generated.stories.d.ts +82 -0
  292. package/dist/stories/Cases.generated.stories.jsx +164 -0
  293. package/dist/stories/Composer.stories.d.ts +23 -0
  294. package/dist/stories/Composer.stories.jsx +121 -0
  295. package/dist/stories/EmptyBox.stories.d.ts +2 -0
  296. package/dist/stories/EmptyBox.stories.jsx +16 -0
  297. package/dist/stories/FileChip.stories.d.ts +7 -0
  298. package/dist/stories/FileChip.stories.jsx +35 -0
  299. package/dist/stories/Heading.stories.d.ts +6 -0
  300. package/dist/stories/Heading.stories.jsx +10 -0
  301. package/dist/stories/IconButton.stories.d.ts +1 -0
  302. package/dist/stories/IconButton.stories.jsx +18 -1
  303. package/dist/stories/LoadingScreen.stories.d.ts +1 -0
  304. package/dist/stories/LoadingScreen.stories.jsx +8 -0
  305. package/dist/stories/Menu.stories.d.ts +4 -0
  306. package/dist/stories/Menu.stories.jsx +46 -1
  307. package/dist/stories/MenuItem.stories.d.ts +1 -0
  308. package/dist/stories/MenuItem.stories.jsx +8 -0
  309. package/dist/stories/Message.stories.d.ts +10 -0
  310. package/dist/stories/Message.stories.jsx +77 -0
  311. package/dist/stories/Modal.stories.d.ts +2 -0
  312. package/dist/stories/Modal.stories.jsx +36 -0
  313. package/dist/stories/PageComponents.stories.d.ts +1 -0
  314. package/dist/stories/PageComponents.stories.jsx +21 -0
  315. package/dist/stories/RadioGroup.stories.d.ts +3 -0
  316. package/dist/stories/RadioGroup.stories.jsx +54 -1
  317. package/dist/stories/Select.stories.d.ts +1 -0
  318. package/dist/stories/Select.stories.jsx +14 -0
  319. package/dist/stories/SourceCard.stories.d.ts +8 -0
  320. package/dist/stories/SourceCard.stories.jsx +33 -0
  321. package/dist/stories/StepList.stories.d.ts +8 -0
  322. package/dist/stories/StepList.stories.jsx +35 -0
  323. package/dist/stories/TabsContainer.stories.d.ts +1 -0
  324. package/dist/stories/TabsContainer.stories.jsx +12 -0
  325. package/dist/stories/TextField.stories.d.ts +2 -0
  326. package/dist/stories/TextField.stories.jsx +22 -0
  327. package/dist/stories/Toaster.stories.d.ts +6 -0
  328. package/dist/stories/Toaster.stories.jsx +29 -0
  329. package/dist/stories/UserImage.stories.d.ts +2 -0
  330. package/dist/stories/UserImage.stories.jsx +19 -0
  331. package/package.json +4 -3
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ import { Bot, Plug } from 'lucide-react';
3
+ import Message from '../../components/message';
4
+ import UserImage from '../../components/userImage';
5
+ import Tag from '../../components/tag';
6
+ import TimeStamp from '../../components/timeStamp';
7
+ import Heading from '../../components/heading';
8
+ import Paragraph from '../../components/paragraph';
9
+ import { Center, Cluster, Stack } from '../../components/layout';
10
+ var agentName = 'Acme Agent';
11
+ var thread = [
12
+ { from: 'Ben Carter', at: new Date('2025-01-15T11:36:00Z'), text: 'Testing needs two more weeks. It now ends on January 31.' },
13
+ { from: 'Dana Lee', at: new Date('2025-01-15T11:40:00Z'), text: 'Acme Agent, what does that do to the launch date?' },
14
+ ];
15
+ var repliedAt = new Date('2025-01-15T11:41:00Z');
16
+ // The agent read only the messages above, which the person can already see.
17
+ var reply = 'If testing ends on January 31, the launch moves to March 3. That keeps the two weeks Ben asked for.';
18
+ // The agent's marks, as the rule 'An agent says what it is' says.
19
+ function agentMeta(at) {
20
+ return (<>
21
+ <Tag variant="contained" size="small" label="Agent"/>
22
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time"/>
23
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
24
+ </>);
25
+ }
26
+ export default function ReplySourcesTagOnly() {
27
+ return (<Center width="page">
28
+ <Stack gap="large">
29
+ <Heading level={1} size="h5">Launch plan</Heading>
30
+ {/* A real app gives the list that holds the rows role="log". */}
31
+ <Stack gap="small">
32
+ {thread.map(function (m) { return (<Message key={m.from} aria-label={m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}>
33
+ <Paragraph measure="none">{m.text}</Paragraph>
34
+ </Message>); })}
35
+ <Message aria-label={"".concat(agentName, ", agent")} avatar={<UserImage userHandle={agentName} icon={Bot} decorative/>} name={agentName} meta={agentMeta(repliedAt)}
36
+ // One kind of source, already on screen: the tag says where the answer came from, and no cards follow.
37
+ footer={<Cluster>
38
+ <Tag variant="contained" size="small" color="success" icon={Plug} label="From Chat"/>
39
+ </Cluster>}>
40
+ <Paragraph measure="none">{reply}</Paragraph>
41
+ </Message>
42
+ </Stack>
43
+ </Stack>
44
+ </Center>);
45
+ }
@@ -0,0 +1,247 @@
1
+ # Reply sources
2
+
3
+ The agent answered from things it read, and the person may want to check them.
4
+
5
+ **Not built yet:** Scindo cannot hide the sources again once they are all shown, and its button reads 'Show N more', in sentence case. The meta of a card that cannot be opened does not say why.
6
+
7
+ ## Do
8
+
9
+ - Follow the rule 'An agent shows its sources': put the sources in the reply's `footer`, directly under the reply.
10
+ - Name the kinds of source in one `Tag`, in the order they first appear: 'From Chat · Knowledge base'.
11
+ - Show each source as a `SourceCard` with an icon for its kind, its title, and in `meta` its kind and where it lives: 'Chat · #launch · Jan 12'.
12
+ - Lay the cards out in `<Grid columns={2}>` and show the first six.
13
+ - Show the rest with a text-only 'Show N More' Button, with the number of hidden cards. It then reads 'Show Fewer', which hides them again.
14
+ - Make a card the person can open a link with `href`. A source on another site opens in a new tab.
15
+ - Make a card the person cannot open static, with no `href` and no `onClick`, and say why in `meta`: 'Chat · Private channel you are not in'.
16
+ - Keep a static card's look at rest the same as the others'. It has no hover look.
17
+ - Link each card to its own source, such as the message it read. Two cards never share a link.
18
+ - Show only the `Tag` when the reply read only the messages already on screen above it, as the rule allows.
19
+ - Show no sources section when the reply used no sources.
20
+ - Mark the agent's row as the rule 'An agent says what it is' says.
21
+ - Give the list that holds the rows `role="log"`.
22
+
23
+ ## Don't
24
+
25
+ - Do not show sources on a person's message.
26
+ - Do not link a card to any site other than the product or the service the source came from.
27
+ - Do not make a card look clickable when the person cannot open it.
28
+ - Do not show more than six cards before the person asks for the rest.
29
+
30
+ ## Option: Source cards
31
+
32
+ Use when: The reply read things a person can open.
33
+
34
+ Uses: `Button`, `Center`, `Cluster`, `Grid`, `Heading`, `Message`, `Paragraph`, `SourceCard`, `Stack`, `Tag`, `TimeStamp`, `UserImage`
35
+
36
+ ```tsx
37
+ 'use client';
38
+ import { useState } from 'react';
39
+ import { BookOpen, Bot, MessageSquare, Plug } from 'lucide-react';
40
+ import Message from 'oneslash-design-system/components/message';
41
+ import UserImage from 'oneslash-design-system/components/userImage';
42
+ import Tag from 'oneslash-design-system/components/tag';
43
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
44
+ import Heading from 'oneslash-design-system/components/heading';
45
+ import Paragraph from 'oneslash-design-system/components/paragraph';
46
+ import Button from 'oneslash-design-system/components/button';
47
+ import SourceCard from 'oneslash-design-system/components/sourceCard';
48
+ import { Center, Cluster, Grid, Stack } from 'oneslash-design-system/components/layout';
49
+
50
+ const agentName = 'Acme Agent';
51
+
52
+ const request = { from: 'Dana Lee', at: new Date('2025-01-15T11:40:00Z'), text: 'What did we decide about the launch date?' };
53
+ const repliedAt = new Date('2025-01-15T11:41:00Z');
54
+ const reply = 'The launch moved to March 3. Ben asked for two more weeks of testing, and the team agreed in #launch on Jan 12.';
55
+
56
+ type Kind = 'chat' | 'kb';
57
+ // A source with no href is one the person cannot open: its meta says why. Each chat card links to the message it read.
58
+ type Source = { kind: Kind; title: string; where: string; href?: string };
59
+
60
+ const kinds = {
61
+ chat: { label: 'Chat', icon: MessageSquare },
62
+ kb: { label: 'Knowledge base', icon: BookOpen },
63
+ };
64
+
65
+ const sources: Source[] = [
66
+ { kind: 'chat', title: 'Launch date', where: '#launch · Jan 12', href: '/chat/launch/m-1042' },
67
+ { kind: 'kb', title: 'Launch plan 2025', where: 'Acme Design', href: '/docs/launch-plan-2025' },
68
+ { kind: 'chat', title: 'Testing schedule', where: '#qa · Jan 10', href: '/chat/qa/m-0981' },
69
+ { kind: 'kb', title: 'Release checklist', where: 'Acme Design', href: '/docs/release-checklist' },
70
+ { kind: 'chat', title: 'Budget for the launch', where: 'Private channel you are not in' },
71
+ { kind: 'kb', title: 'Press kit guide', where: 'Acme Marketing', href: '/docs/press-kit-guide' },
72
+ { kind: 'chat', title: 'Beta feedback', where: '#beta · Jan 8', href: '/chat/beta/m-0917' },
73
+ { kind: 'kb', title: 'Pricing for the new plans', where: 'Acme Design', href: '/docs/pricing' },
74
+ { kind: 'chat', title: 'Launch day roles', where: '#launch · Jan 14', href: '/chat/launch/m-1107' },
75
+ { kind: 'kb', title: 'Support playbook', where: 'Acme Support', href: '/docs/support-playbook' },
76
+ ];
77
+
78
+ const visible = 6;
79
+
80
+ // 'From Chat · Knowledge base': each kind once, in the order it first appears.
81
+ function kindsTag(list: Source[]) {
82
+ const labels: string[] = [];
83
+ list.forEach((s) => {
84
+ if (!labels.includes(kinds[s.kind].label)) labels.push(kinds[s.kind].label);
85
+ });
86
+ return `From ${labels.join(' · ')}`;
87
+ }
88
+
89
+ // The agent's marks, as the rule 'An agent says what it is' says.
90
+ function agentMeta(at: Date) {
91
+ return (
92
+ <>
93
+ <Tag variant="contained" size="small" label="Agent" />
94
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time" />
95
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
96
+ </>
97
+ );
98
+ }
99
+
100
+ export default function ReplySourcesCards() {
101
+ const [expanded, setExpanded] = useState(false);
102
+ const shown = expanded ? sources : sources.slice(0, visible);
103
+ const more = sources.length - visible;
104
+
105
+ return (
106
+ <Center width="page">
107
+ <Stack gap="large">
108
+ <Heading level={1} size="h5">Launch plan</Heading>
109
+ {/* A real app gives the list that holds the rows role="log". */}
110
+ <Stack gap="small">
111
+ <Message
112
+ aria-label={request.from}
113
+ avatar={<UserImage userHandle={request.from} decorative />}
114
+ name={request.from}
115
+ meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time" />}
116
+ >
117
+ <Paragraph measure="none">{request.text}</Paragraph>
118
+ </Message>
119
+ <Message
120
+ aria-label={`${agentName}, agent`}
121
+ avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
122
+ name={agentName}
123
+ meta={agentMeta(repliedAt)}
124
+ // A reply that used no sources has no footer at all.
125
+ footer={
126
+ <Stack gap="medium">
127
+ <Cluster>
128
+ <Tag variant="contained" size="small" color="success" icon={Plug} label={kindsTag(sources)} />
129
+ </Cluster>
130
+ <Grid columns={2} gap="medium">
131
+ {shown.map((s) => (
132
+ // A source in the product is a path; one on another site is an https:// URL and opens in a new tab.
133
+ <SourceCard
134
+ key={`${s.kind}:${s.title}`}
135
+ icon={kinds[s.kind].icon}
136
+ title={s.title}
137
+ meta={`${kinds[s.kind].label} · ${s.where}`}
138
+ href={s.href}
139
+ />
140
+ ))}
141
+ </Grid>
142
+ {more > 0 && (
143
+ <Cluster>
144
+ <Button
145
+ size="small"
146
+ type="textOnly"
147
+ state="enabled"
148
+ label={expanded ? 'Show Fewer' : `Show ${more} More`}
149
+ aria-expanded={expanded}
150
+ onClickButton={() => setExpanded((e) => !e)}
151
+ />
152
+ </Cluster>
153
+ )}
154
+ </Stack>
155
+ }
156
+ >
157
+ <Paragraph measure="none">{reply}</Paragraph>
158
+ </Message>
159
+ </Stack>
160
+ </Stack>
161
+ </Center>
162
+ );
163
+ }
164
+ ```
165
+
166
+ ## Option: Tag only
167
+
168
+ Use when: The reply read only the messages already on screen above it.
169
+
170
+ Uses: `Center`, `Cluster`, `Heading`, `Message`, `Paragraph`, `Stack`, `Tag`, `TimeStamp`, `UserImage`
171
+
172
+ ```tsx
173
+ 'use client';
174
+ import { Bot, Plug } from 'lucide-react';
175
+ import Message from 'oneslash-design-system/components/message';
176
+ import UserImage from 'oneslash-design-system/components/userImage';
177
+ import Tag from 'oneslash-design-system/components/tag';
178
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
179
+ import Heading from 'oneslash-design-system/components/heading';
180
+ import Paragraph from 'oneslash-design-system/components/paragraph';
181
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
182
+
183
+ const agentName = 'Acme Agent';
184
+
185
+ const thread = [
186
+ { from: 'Ben Carter', at: new Date('2025-01-15T11:36:00Z'), text: 'Testing needs two more weeks. It now ends on January 31.' },
187
+ { from: 'Dana Lee', at: new Date('2025-01-15T11:40:00Z'), text: 'Acme Agent, what does that do to the launch date?' },
188
+ ];
189
+ const repliedAt = new Date('2025-01-15T11:41:00Z');
190
+ // The agent read only the messages above, which the person can already see.
191
+ const reply = 'If testing ends on January 31, the launch moves to March 3. That keeps the two weeks Ben asked for.';
192
+
193
+ // The agent's marks, as the rule 'An agent says what it is' says.
194
+ function agentMeta(at: Date) {
195
+ return (
196
+ <>
197
+ <Tag variant="contained" size="small" label="Agent" />
198
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time" />
199
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
200
+ </>
201
+ );
202
+ }
203
+
204
+ export default function ReplySourcesTagOnly() {
205
+ return (
206
+ <Center width="page">
207
+ <Stack gap="large">
208
+ <Heading level={1} size="h5">Launch plan</Heading>
209
+ {/* A real app gives the list that holds the rows role="log". */}
210
+ <Stack gap="small">
211
+ {thread.map((m) => (
212
+ <Message
213
+ key={m.from}
214
+ aria-label={m.from}
215
+ avatar={<UserImage userHandle={m.from} decorative />}
216
+ name={m.from}
217
+ meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
218
+ >
219
+ <Paragraph measure="none">{m.text}</Paragraph>
220
+ </Message>
221
+ ))}
222
+ <Message
223
+ aria-label={`${agentName}, agent`}
224
+ avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
225
+ name={agentName}
226
+ meta={agentMeta(repliedAt)}
227
+ // One kind of source, already on screen: the tag says where the answer came from, and no cards follow.
228
+ footer={
229
+ <Cluster>
230
+ <Tag variant="contained" size="small" color="success" icon={Plug} label="From Chat" />
231
+ </Cluster>
232
+ }
233
+ >
234
+ <Paragraph measure="none">{reply}</Paragraph>
235
+ </Message>
236
+ </Stack>
237
+ </Stack>
238
+ </Center>
239
+ );
240
+ }
241
+ ```
242
+
243
+ ## Native
244
+
245
+ On Apple the cards fill as many columns as fit. A card with a link opens it in the browser, and a card with nothing to open cannot be tapped.
246
+
247
+ Seen in: Scindo.
@@ -0,0 +1 @@
1
+ export default function RouteLoadingFullScreen(): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import LoadingScreen from '../../components/loadingScreen';
3
+ import { Center } from '../../components/layout';
4
+ export default function RouteLoadingFullScreen() {
5
+ return (<Center fill>
6
+ <LoadingScreen />
7
+ </Center>);
8
+ }
@@ -0,0 +1 @@
1
+ export default function RouteLoadingRegion(): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+ import Image from '../../components/image';
3
+ import TabsContainer from '../../components/tabsContainer';
4
+ import Tab from '../../components/tab';
5
+ import Surface from '../../components/surface';
6
+ import LoadingScreen from '../../components/loadingScreen';
7
+ import { Cluster, Stack } from '../../components/layout';
8
+ // The product's mark. A real app passes its own file.
9
+ 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";
10
+ // A real app passes the router from its framework, such as Next's useRouter().
11
+ var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
12
+ export default function RouteLoadingRegion() {
13
+ return (<Stack gap="large">
14
+ <Cluster gap="large">
15
+ <Image src={productMark} alt="Acme" width={32} height={32}/>
16
+ <TabsContainer>
17
+ <Tab label="Home" isSelected={false} href="/" router={router} onClickTab={function () { }}/>
18
+ <Tab label="Projects" isSelected href="/projects" router={router} onClickTab={function () { }}/>
19
+ <Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={function () { }}/>
20
+ </TabsContainer>
21
+ </Cluster>
22
+ <Surface minHeight="tall" align="center">
23
+ <LoadingScreen />
24
+ </Surface>
25
+ </Stack>);
26
+ }
@@ -0,0 +1,84 @@
1
+ # Page loading
2
+
3
+ A page or a pane is loading, and there is nothing to show yet.
4
+
5
+ ## Do
6
+
7
+ - Show the shell as soon as it can, and the spinner only where content is loading.
8
+ - Center the spinner in the space that is loading.
9
+ - Replace the spinner with the content as soon as it loads.
10
+ - Name the step in `LoadingScreen`'s `label` when a named step can take longer than about a second, as in 'Login check loading'.
11
+ - Use the same screen as the spinner in 'Login check loading' when nothing can show yet: `LoadingScreen` alone in `Center` with `fill`.
12
+
13
+ ## Don't
14
+
15
+ - Do not write a line that names no step, such as 'Loading…'.
16
+ - Do not cover the navigation with a spinner when only one pane is loading.
17
+ - Do not show the empty text while the list is still loading.
18
+
19
+ ## Option: Full screen
20
+
21
+ Use when: Nothing can show yet, not even the navigation.
22
+
23
+ Uses: `Center`, `LoadingScreen`
24
+
25
+ ```tsx
26
+ 'use client';
27
+ import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
28
+ import { Center } from 'oneslash-design-system/components/layout';
29
+
30
+ export default function RouteLoadingFullScreen() {
31
+ return (
32
+ <Center fill>
33
+ <LoadingScreen />
34
+ </Center>
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## Option: In one pane
40
+
41
+ Use when: The shell shows and one pane loads.
42
+
43
+ Uses: `Cluster`, `Image`, `LoadingScreen`, `Stack`, `Surface`, `Tab`, `TabsContainer`
44
+
45
+ ```tsx
46
+ 'use client';
47
+ import Image from 'oneslash-design-system/components/image';
48
+ import TabsContainer from 'oneslash-design-system/components/tabsContainer';
49
+ import Tab from 'oneslash-design-system/components/tab';
50
+ import Surface from 'oneslash-design-system/components/surface';
51
+ import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
52
+ import { Cluster, Stack } from 'oneslash-design-system/components/layout';
53
+
54
+ // The product's mark. A real app passes its own file.
55
+ const productMark =
56
+ "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";
57
+
58
+ // A real app passes the router from its framework, such as Next's useRouter().
59
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
60
+
61
+ export default function RouteLoadingRegion() {
62
+ return (
63
+ <Stack gap="large">
64
+ <Cluster gap="large">
65
+ <Image src={productMark} alt="Acme" width={32} height={32} />
66
+ <TabsContainer>
67
+ <Tab label="Home" isSelected={false} href="/" router={router} onClickTab={() => {}} />
68
+ <Tab label="Projects" isSelected href="/projects" router={router} onClickTab={() => {}} />
69
+ <Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={() => {}} />
70
+ </TabsContainer>
71
+ </Cluster>
72
+ <Surface minHeight="tall" align="center">
73
+ <LoadingScreen />
74
+ </Surface>
75
+ </Stack>
76
+ );
77
+ }
78
+ ```
79
+
80
+ ## Native
81
+
82
+ On Apple use `ProgressView()` with no label, centered in the pane.
83
+
84
+ Seen in: Commentify, Scindo.
@@ -0,0 +1 @@
1
+ export default function SetNewPasswordForm(): import("react").JSX.Element;
@@ -0,0 +1,130 @@
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 Heading from '../../components/heading';
7
+ import Paragraph from '../../components/paragraph';
8
+ import Form from '../../components/form';
9
+ import Alert from '../../components/alert';
10
+ import TextField from '../../components/textField';
11
+ import Button from '../../components/button';
12
+ import Line from '../../components/line';
13
+ import BrandIcon from '../../components/brandIcon';
14
+ import { Center, Stack } from '../../components/layout';
15
+ // The product's mark. A real app passes its own file.
16
+ 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";
17
+ // A real app passes the router from its framework, such as Next's useRouter().
18
+ var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
19
+ // A real app passes the address of the account the reset link was sent for.
20
+ var address = 'ada@example.com';
21
+ // A small check: some text, an @, then some text.
22
+ function looksLikeEmail(value) {
23
+ return /^[^@\s]+@[^@\s]+$/.test(value);
24
+ }
25
+ export default function SetNewPasswordForm() {
26
+ var _a = useState(false), updated = _a[0], setUpdated = _a[1];
27
+ var _b = useState(''), newPassword = _b[0], setNewPassword = _b[1];
28
+ var _c = useState(''), confirmPassword = _c[0], setConfirmPassword = _c[1];
29
+ var _d = useState(''), newPasswordError = _d[0], setNewPasswordError = _d[1];
30
+ var _e = useState(''), confirmPasswordError = _e[0], setConfirmPasswordError = _e[1];
31
+ var _f = useState(''), notice = _f[0], setNotice = _f[1];
32
+ var _g = useState(address), email = _g[0], setEmail = _g[1];
33
+ var _h = useState(''), password = _h[0], setPassword = _h[1];
34
+ var _j = useState(''), emailError = _j[0], setEmailError = _j[1];
35
+ var _k = useState(''), passwordError = _k[0], setPasswordError = _k[1];
36
+ var _l = useState(''), error = _l[0], setError = _l[1];
37
+ var _m = useState(false), loading = _m[0], setLoading = _m[1];
38
+ var timer = useRef();
39
+ // Stops the request if the example goes away before it ends.
40
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
41
+ function handleUpdate() {
42
+ if (loading)
43
+ return;
44
+ setError('');
45
+ setNewPasswordError('');
46
+ setConfirmPasswordError('');
47
+ if (newPassword.length < 8) {
48
+ setNewPasswordError('Use at least 8 characters.');
49
+ return;
50
+ }
51
+ if (!confirmPassword) {
52
+ setConfirmPasswordError('Enter the new password again.');
53
+ return;
54
+ }
55
+ if (confirmPassword !== newPassword) {
56
+ setConfirmPasswordError('This does not match. Enter the same password as above.');
57
+ return;
58
+ }
59
+ setLoading(true);
60
+ // Stands in for the request to the server.
61
+ // A failed request calls setError with one sentence instead, such as 'Your password was not updated. Try again.'
62
+ timer.current = setTimeout(function () {
63
+ setLoading(false);
64
+ // A real app signs the reset session out and goes to its login page here, which shows the notice.
65
+ // The example shows it in place.
66
+ setNotice('Password updated. Log in with your new password.');
67
+ setUpdated(true);
68
+ }, 1200);
69
+ }
70
+ function handleLogIn() {
71
+ if (loading)
72
+ return;
73
+ setNotice('');
74
+ setError('');
75
+ setEmailError('');
76
+ setPasswordError('');
77
+ if (!email.trim()) {
78
+ setEmailError('Enter your email.');
79
+ return;
80
+ }
81
+ if (!looksLikeEmail(email.trim())) {
82
+ setEmailError('Enter an email address, like name@example.com.');
83
+ return;
84
+ }
85
+ if (!password) {
86
+ setPasswordError('Enter your password.');
87
+ return;
88
+ }
89
+ setLoading(true);
90
+ // Stands in for the request to the server.
91
+ timer.current = setTimeout(function () {
92
+ setLoading(false);
93
+ setError('That email and password do not match.');
94
+ }, 1200);
95
+ }
96
+ if (updated) {
97
+ return (<Center fill>
98
+ <Image src={productMark} alt="Acme" width={40} height={40}/>
99
+ <TabsContainer fill>
100
+ <Tab label="Log In" isSelected onClickTab={function () { }}/>
101
+ <Tab label="Sign Up" isSelected={false} href="/sign-up" router={router} onClickTab={function () { }}/>
102
+ </TabsContainer>
103
+ <Form aria-label="Log in" onSubmit={handleLogIn}>
104
+ {/* 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. */}
105
+ {notice && <Alert type="success" variant="inline" message={notice} autoDismiss={false}/>}
106
+ {error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={function () { return setError(''); }}/>}
107
+ <TextField id="set-new-password-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(''); }}/>
108
+ <TextField id="set-new-password-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(''); }}/>
109
+ <Button size="medium" type="primary" state="enabled" label="Log In" htmlType="submit" loading={loading}/>
110
+ <Button size="medium" type="textOnly" state="enabled" label="Forgot Password?"/>
111
+ </Form>
112
+ <Line label="or"/>
113
+ <Button size="medium" type="secondary" state="enabled" label="Continue with Google" decoIcon={<BrandIcon name="google"/>}/>
114
+ </Center>);
115
+ }
116
+ return (<Center fill>
117
+ <Image src={productMark} alt="Acme" width={40} height={40}/>
118
+ <Stack gap="medium">
119
+ <Heading level={1} size="h5">Set new password</Heading>
120
+ <Paragraph tone="secondary" measure="none">Choose a new password for {address}.</Paragraph>
121
+ </Stack>
122
+ <Form aria-label="Set new password" onSubmit={handleUpdate}>
123
+ {error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={function () { return setError(''); }}/>}
124
+ {/* Editing the new password also clears the message under Confirm password, which may no longer be true. */}
125
+ <TextField id="set-new-password-new" label="New password" type="password" autoComplete="new-password" value={newPassword} disabled={loading} error={Boolean(newPasswordError)} errorText={newPasswordError} helperText="Use at least 8 characters." onChange={function (e) { setNewPassword(e.target.value); setNewPasswordError(''); setConfirmPasswordError(''); }}/>
126
+ <TextField id="set-new-password-confirm" label="Confirm password" type="password" autoComplete="new-password" value={confirmPassword} disabled={loading} error={Boolean(confirmPasswordError)} errorText={confirmPasswordError} onChange={function (e) { setConfirmPassword(e.target.value); setConfirmPasswordError(''); }}/>
127
+ <Button size="medium" type="primary" state="enabled" label="Update Password" htmlType="submit" loading={loading}/>
128
+ </Form>
129
+ </Center>);
130
+ }
@@ -0,0 +1 @@
1
+ export default function SetNewPasswordInvalidLink(): import("react").JSX.Element;
@@ -0,0 +1,50 @@
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 Alert from '../../components/alert';
8
+ import Button from '../../components/button';
9
+ import { Center, Stack } from '../../components/layout';
10
+ // A real app passes the router from its framework, such as Next's useRouter().
11
+ var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
12
+ // A real app passes the address of the account the old link was sent for.
13
+ var address = 'ada@example.com';
14
+ export default function SetNewPasswordInvalidLink() {
15
+ var _a = useState(false), loading = _a[0], setLoading = _a[1];
16
+ var _b = useState(false), sent = _b[0], setSent = _b[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
+ function handleSendNewLink() {
21
+ if (loading)
22
+ return;
23
+ setLoading(true);
24
+ // Stands in for the request to the server.
25
+ // A failed request shows an inline error Alert above the Buttons, such as 'The link was not sent. Try again.'
26
+ timer.current = setTimeout(function () {
27
+ setLoading(false);
28
+ setSent(true);
29
+ }, 1200);
30
+ }
31
+ if (sent) {
32
+ return (<Center width="form" fill>
33
+ <Icon icon={Mail} size="large" color="secondary"/>
34
+ <Stack gap="medium">
35
+ <Heading level={1} size="h5">Check your email</Heading>
36
+ <Paragraph tone="secondary" measure="none">We sent a new link to {address}. Open it to set a new password.</Paragraph>
37
+ </Stack>
38
+ <Button size="medium" type="textOnly" state="enabled" label="Back to Login" onClickButton={function () { return router.push('/login'); }}/>
39
+ </Center>);
40
+ }
41
+ return (<Center width="form" fill>
42
+ <Heading level={1} size="h5">Set new password</Heading>
43
+ {/* The link cannot be used, so the form does not show. The Alert reports a standing condition: it has no close button and stays. */}
44
+ <Alert type="error" variant="inline" message="This link has expired or was already used." autoDismiss={false}/>
45
+ <Stack gap="large">
46
+ <Button size="medium" type="primary" state="enabled" label="Send a New Link" loading={loading} onClickButton={handleSendNewLink}/>
47
+ <Button size="medium" type="textOnly" state={loading ? 'disabled' : 'enabled'} label="Back to Login" onClickButton={function () { return router.push('/login'); }}/>
48
+ </Stack>
49
+ </Center>);
50
+ }