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,211 @@
1
+ # Delete confirm
2
+
3
+ A person asks to delete or remove something, and it cannot be undone.
4
+
5
+ **Not built yet:** Commentify's Delete project confirm is not danger-colored and asks a question in its body. Scindo on the web confirms removing a saved card in place, but asks 'Are you sure?' and labels its Buttons 'Confirm' and 'No'.
6
+
7
+ ## Do
8
+
9
+ - Follow the rule 'A confirm says exactly what will happen' for the Modal: `size="small"`, 'Cancel' first, then the action with `color="danger"`.
10
+ - Name the thing and what goes with it: "This deletes 'Q3 plan' and its 12 tasks."
11
+ - Turn the row's Buttons into 'Cancel' and a danger 'Remove' in place for the inline confirm. The rest of the row stays as it is.
12
+ - Give each row's Buttons an `aria-label` that starts with the visible label and names the thing, such as 'Remove Dana Lee' and 'Cancel removing Dana Lee'.
13
+ - Name the thing in the label so a screen reader knows which row a Button acts on.
14
+ - Keep one row confirming at a time. Starting a confirm on another row cancels the first.
15
+ - Show a toast that names the thing once it is gone.
16
+
17
+ ## Don't
18
+
19
+ - Do not ask for a confirm when the action is easy to undo.
20
+ - Do not remove a row on the first click of its Button.
21
+ - Do not open a Modal for a row in a long list when the inline confirm keeps the place.
22
+ - Do not ask a question in place of the action, such as 'Are you sure?'.
23
+
24
+ ## Option: Confirm in a Modal
25
+
26
+ Use when: The default, for any delete or remove that cannot be undone.
27
+
28
+ Uses: `Button`, `Center`, `Cluster`, `Heading`, `List`, `Modal`, `Paragraph`, `Stack`, `Surface`, `Toaster`, `dismissToast`, `toast`
29
+
30
+ ```tsx
31
+ 'use client';
32
+ import { useEffect, useRef, useState } from 'react';
33
+ import Toaster, { toast, dismissToast } from 'oneslash-design-system/components/toaster';
34
+ import Modal from 'oneslash-design-system/components/modal';
35
+ import Surface from 'oneslash-design-system/components/surface';
36
+ import Heading from 'oneslash-design-system/components/heading';
37
+ import Paragraph from 'oneslash-design-system/components/paragraph';
38
+ import List from 'oneslash-design-system/components/list';
39
+ import Button from 'oneslash-design-system/components/button';
40
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
41
+
42
+ const otherProjects = ['Website refresh', 'Hiring plan', 'Office move'];
43
+
44
+ export default function ConfirmDestructiveActionModal() {
45
+ // Opens on the confirm, as if the person just chose Delete Project.
46
+ const [open, setOpen] = useState(true);
47
+ const [deleting, setDeleting] = useState(false);
48
+ const [deleted, setDeleted] = useState(false);
49
+ const timer = useRef<ReturnType<typeof setTimeout>>();
50
+ const toastIds = useRef<string[]>([]);
51
+
52
+ // On unmount it stops the request and closes every toast it opened.
53
+ useEffect(() => () => {
54
+ clearTimeout(timer.current);
55
+ toastIds.current.forEach((id) => dismissToast(id));
56
+ toastIds.current = [];
57
+ }, []);
58
+
59
+ // Escape, a click outside and Cancel all close it, except while the request runs.
60
+ function handleClose() {
61
+ if (deleting) return;
62
+ setOpen(false);
63
+ }
64
+
65
+ function handleDelete() {
66
+ if (deleting) return;
67
+ setDeleting(true);
68
+ // Stands in for the request to the server.
69
+ timer.current = setTimeout(() => {
70
+ setDeleting(false);
71
+ setOpen(false);
72
+ setDeleted(true);
73
+ toastIds.current.push(toast({ type: 'success', message: "Project 'Q3 plan' deleted." }));
74
+ }, 1200);
75
+ }
76
+
77
+ return (
78
+ <Center width="page">
79
+ {/* A real app mounts one Toaster near its root. */}
80
+ <Toaster />
81
+ {deleted ? (
82
+ <Stack gap="large">
83
+ <Heading level={2} size="h5">Projects</Heading>
84
+ <Surface padding="large">
85
+ <List items={otherProjects} size="body1" />
86
+ </Surface>
87
+ </Stack>
88
+ ) : (
89
+ <Stack gap="medium">
90
+ <Heading level={2} size="h5">Q3 plan</Heading>
91
+ <Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
92
+ <Cluster>
93
+ <Button size="small" type="secondary" color="danger" state="enabled" label="Delete Project" onClickButton={() => setOpen(true)} />
94
+ </Cluster>
95
+ </Stack>
96
+ )}
97
+ <Modal
98
+ isOpen={open}
99
+ size="small"
100
+ title="Delete Project"
101
+ onClose={handleClose}
102
+ actions={
103
+ <>
104
+ <Button size="small" type="tertiary" state={deleting ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose} />
105
+ <Button size="small" type="primary" color="danger" state="enabled" label="Delete" loading={deleting} onClickButton={handleDelete} />
106
+ </>
107
+ }
108
+ >
109
+ <Paragraph measure="none">This deletes &apos;Q3 plan&apos; and its 12 tasks.</Paragraph>
110
+ <Paragraph tone="secondary" size="body2" measure="none">Files attached to the tasks stay in Files.</Paragraph>
111
+ </Modal>
112
+ </Center>
113
+ );
114
+ }
115
+ ```
116
+
117
+ ## Option: Confirm in the row
118
+
119
+ Use when: The action is on a row inside a dense list, and a Modal would lose the place.
120
+
121
+ Uses: `Button`, `Center`, `Cluster`, `Heading`, `Paragraph`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Toaster`, `dismissToast`, `toast`
122
+
123
+ ```tsx
124
+ 'use client';
125
+ import { useEffect, useRef, useState } from 'react';
126
+ import Toaster, { toast, dismissToast } from 'oneslash-design-system/components/toaster';
127
+ import Heading from 'oneslash-design-system/components/heading';
128
+ import Paragraph from 'oneslash-design-system/components/paragraph';
129
+ import TableContainer from 'oneslash-design-system/components/tableContainer';
130
+ import TableRow from 'oneslash-design-system/components/tableRow';
131
+ import TableCell from 'oneslash-design-system/components/tableCell';
132
+ import Button from 'oneslash-design-system/components/button';
133
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
134
+
135
+ const people = [
136
+ { id: 'dana', name: 'Dana Lee', email: 'dana@example.com', role: 'Admin' },
137
+ { id: 'omar', name: 'Omar Haddad', email: 'omar@example.com', role: 'Member' },
138
+ { id: 'mei', name: 'Mei Tanaka', email: 'mei@example.com', role: 'Member' },
139
+ { id: 'luis', name: 'Luis Ortega', email: 'luis@example.com', role: 'Guest' },
140
+ { id: 'ada', name: 'Ada Brooks', email: 'ada@example.com', role: 'Member' },
141
+ ];
142
+
143
+ export default function ConfirmDestructiveActionInline() {
144
+ const [members, setMembers] = useState(people);
145
+ // Opens with one row confirming, as if the person just chose Remove on it.
146
+ const [confirming, setConfirming] = useState<string | null>('omar');
147
+ const [removing, setRemoving] = useState(false);
148
+ const timer = useRef<ReturnType<typeof setTimeout>>();
149
+ const toastIds = useRef<string[]>([]);
150
+
151
+ // On unmount it stops the request and closes every toast it opened.
152
+ useEffect(() => () => {
153
+ clearTimeout(timer.current);
154
+ toastIds.current.forEach((id) => dismissToast(id));
155
+ toastIds.current = [];
156
+ }, []);
157
+
158
+ function handleRemove(id: string, name: string) {
159
+ if (removing) return;
160
+ setRemoving(true);
161
+ // Stands in for the request to the server.
162
+ timer.current = setTimeout(() => {
163
+ setRemoving(false);
164
+ setConfirming(null);
165
+ setMembers((list) => list.filter((m) => m.id !== id));
166
+ toastIds.current.push(toast({ type: 'success', message: `${name} removed from Acme Design.` }));
167
+ }, 1200);
168
+ }
169
+
170
+ return (
171
+ <Center width="page">
172
+ {/* A real app mounts one Toaster near its root. */}
173
+ <Toaster />
174
+ <Stack gap="large">
175
+ <Stack gap="small">
176
+ <Heading level={2} size="h5">Members</Heading>
177
+ <Paragraph tone="secondary" size="body2" measure="none">People who can open Acme Design.</Paragraph>
178
+ </Stack>
179
+ <TableContainer>
180
+ {members.map((m) => (
181
+ <TableRow key={m.id}>
182
+ <TableCell>{m.name}</TableCell>
183
+ <TableCell>{m.email}</TableCell>
184
+ <TableCell width="100px">{m.role}</TableCell>
185
+ {/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
186
+ <TableCell width="168px">
187
+ {confirming === m.id ? (
188
+ <Cluster gap="small">
189
+ <Button size="small" type="tertiary" state={removing ? 'disabled' : 'enabled'} label="Cancel" aria-label={`Cancel removing ${m.name}`} onClickButton={() => setConfirming(null)} />
190
+ <Button size="small" type="primary" color="danger" state="enabled" label="Remove" aria-label={`Remove ${m.name}`} loading={removing} onClickButton={() => handleRemove(m.id, m.name)} />
191
+ </Cluster>
192
+ ) : (
193
+ <Cluster gap="small">
194
+ <Button size="small" type="tertiary" state={removing ? 'disabled' : 'enabled'} label="Remove" aria-label={`Remove ${m.name}`} onClickButton={() => setConfirming(m.id)} />
195
+ </Cluster>
196
+ )}
197
+ </TableCell>
198
+ </TableRow>
199
+ ))}
200
+ </TableContainer>
201
+ </Stack>
202
+ </Center>
203
+ );
204
+ }
205
+ ```
206
+
207
+ ## Native
208
+
209
+ On Apple use a system `confirmationDialog` or `.alert`, with the action in the `.destructive` role and 'Cancel' in the `.cancel` role.
210
+
211
+ Seen in: Commentify, Scindo.
@@ -0,0 +1,36 @@
1
+ # A confirm says exactly what will happen
2
+
3
+ An action a person takes themselves needs their yes before it happens. An action the agent wants to take follows the rule 'An agent asks before a risky action', a card in the conversation, not this one.
4
+
5
+ ## Answer
6
+
7
+ A confirm is a Modal with `size="small"`. Its title names the action in Title Case, such as 'Delete Project'. The body says in one or two sentences what will happen and what is kept. Two Buttons sit in the Modal's `actions`. 'Cancel' comes first, a `<Button type="tertiary" size="small">`. Then comes the action, a `<Button type="primary" size="small">` labelled in Title Case with the same verb as the title. When the action destroys or removes something, the action Button also has `color="danger"`. One case differs: 'Unsaved changes'. Its guard may have three Buttons, 'Cancel', "Don't Save" and 'Save', in that order. When it has two, its safe Button reads 'Keep Editing'. Escape and a click outside the Modal mean Cancel. While the request runs, the action Button is `loading` and keeps its label, and 'Cancel' is `state="disabled"`. The Modal stays open. It still calls `onClose` on Escape or a click outside, and the page ignores that call until the request ends. If the request fails, the Modal stays open and shows an inline error Alert at the top of its body, as the rule 'A form error shows next to the problem' says. When the action works, the Modal closes. If the thing is still on screen, the change shows where it is. If the thing is gone, a toast names it, as the rule 'Success shows where the person is looking' says.
8
+
9
+ **Not built yet:** No Commentify confirm Modal uses `color="danger"`, and two of them label Cancel 'No'. Scindo on the web makes Cancel a secondary Button in some confirms and a tertiary one in others. It leaves its Delete Task and Remove Member confirms uncolored. Scindo on the web revokes an API key, and Commentify revokes an agent client, with no confirm.
10
+
11
+ ## Why
12
+
13
+ A confirm is the last chance to stop a mistake. It has to say exactly what will happen, and the safe choice has to be easy to find.
14
+
15
+ ## Do
16
+
17
+ - Name the thing in the body: "This deletes 'Q3 plan' and its 12 tasks."
18
+ - Say what is kept: 'Files in the repository are not changed.'
19
+ - Give the title and the action the same verb, in Title Case: 'Delete Project' has a 'Delete' Button.
20
+ - Disable 'Cancel' and ignore `onClose` while the request runs.
21
+ - Close the Modal when the action works. Show the change where the thing is, or a toast that names it if the thing is gone.
22
+
23
+ ## Don't
24
+
25
+ - Do not label Cancel 'No' or 'Close'.
26
+ - Do not label the action 'Yes, Delete', 'Confirm' or 'OK'.
27
+ - Do not title the Modal 'Confirm Deletion' or 'Sure?'.
28
+ - Do not change the action's label while it is loading, such as to 'Deleting…'.
29
+ - Do not replace the Modal body with a spinner, or close the Modal, while the request runs.
30
+ - Do not ask for a confirm when the action is easy to undo.
31
+
32
+ ## Native
33
+
34
+ On Apple use a system `confirmationDialog` or `.alert`, with the action in the `.destructive` role when it destroys or removes something. Never build a sheet by hand for a confirm.
35
+
36
+ Seen in: Commentify, Scindo.
@@ -0,0 +1 @@
1
+ export default function ConversationStartersChips(): import("react").JSX.Element;
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useEffect, useRef, useState } from 'react';
12
+ import Message from '../../components/message';
13
+ import UserImage from '../../components/userImage';
14
+ import TimeStamp from '../../components/timeStamp';
15
+ import Heading from '../../components/heading';
16
+ import Paragraph from '../../components/paragraph';
17
+ import Composer from '../../components/composer';
18
+ import EmptyBox from '../../components/emptyBox';
19
+ import Tag from '../../components/tag';
20
+ import { Center, Cluster, Stack } from '../../components/layout';
21
+ // A real app reads this from the session.
22
+ var me = 'Dana Lee';
23
+ var agentName = 'Acme Agent';
24
+ // Things to ask, in the person's words.
25
+ var starters = [
26
+ 'Summarize the launch plan',
27
+ 'Draft the launch email',
28
+ 'List what is still open',
29
+ 'Check the pricing page for mistakes',
30
+ ];
31
+ export default function ConversationStartersChips() {
32
+ var _a = useState([]), thread = _a[0], setThread = _a[1];
33
+ var _b = useState(''), text = _b[0], setText = _b[1];
34
+ // Set when a starter fills the field; the effect below focuses it with the caret at the end.
35
+ var _c = useState(0), filled = _c[0], setFilled = _c[1];
36
+ var field = useRef(null);
37
+ useEffect(function () {
38
+ if (!filled || !field.current)
39
+ return;
40
+ var end = field.current.value.length;
41
+ field.current.focus();
42
+ field.current.setSelectionRange(end, end);
43
+ }, [filled]);
44
+ // Fills the field and does not send: the person can change it first.
45
+ function fillWith(starter) {
46
+ setText(starter);
47
+ setFilled(function (n) { return n + 1; });
48
+ }
49
+ function send() {
50
+ // A real app sends the message to the agent here and shows it at once.
51
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: "m".concat(rows.length + 1), from: me, at: new Date(), text: text.trim() }], false); });
52
+ setText('');
53
+ }
54
+ return (<Center width="page">
55
+ <Stack gap="large">
56
+ <Heading level={1} size="h5">{"Ask ".concat(agentName)}</Heading>
57
+ {thread.length === 0 ? (<EmptyBox size="large" icon="MessageCircle" text="No messages yet" secondText={"Ask ".concat(agentName, " about the launch, or start with one of these.")} action={<Cluster gap="small">
58
+ {starters.map(function (s) { return (<Tag key={s} variant="contained" size="small" label={s} toggle={false} onClick={function () { return fillWith(s); }}/>); })}
59
+ </Cluster>}/>) : (
60
+ // A real app gives the list that holds the rows role="log".
61
+ <Stack gap="small">
62
+ {thread.map(function (m) { return (<Message key={m.id} aria-label={m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}>
63
+ <Paragraph measure="none">{m.text}</Paragraph>
64
+ </Message>); })}
65
+ </Stack>)}
66
+ <Composer ref={field} id="conversation-starters-chips-message" aria-label="Message" placeholder={"Message ".concat(agentName)} value={text} onChange={setText} onSubmit={send}/>
67
+ </Stack>
68
+ </Center>);
69
+ }
@@ -0,0 +1 @@
1
+ export default function ConversationStartersNone(): import("react").JSX.Element;
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useState } from 'react';
12
+ import Message from '../../components/message';
13
+ import UserImage from '../../components/userImage';
14
+ import TimeStamp from '../../components/timeStamp';
15
+ import Heading from '../../components/heading';
16
+ import Paragraph from '../../components/paragraph';
17
+ import Composer from '../../components/composer';
18
+ import EmptyBox from '../../components/emptyBox';
19
+ import { Center, Stack } from '../../components/layout';
20
+ // A real app reads this from the session.
21
+ var me = 'Dana Lee';
22
+ export default function ConversationStartersNone() {
23
+ var _a = useState([]), thread = _a[0], setThread = _a[1];
24
+ var _b = useState(''), text = _b[0], setText = _b[1];
25
+ function send() {
26
+ // A real app sends the message to the server here and shows it at once.
27
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: "m".concat(rows.length + 1), from: me, at: new Date(), text: text.trim() }], false); });
28
+ setText('');
29
+ }
30
+ return (<Center width="page">
31
+ <Stack gap="large">
32
+ <Heading level={1} size="h5">Launch plan</Heading>
33
+ {thread.length === 0 ? (
34
+ // A thread between people: no starters, and secondText says what to do.
35
+ <EmptyBox size="large" icon="MessageCircle" text="No messages yet" secondText="Send the first message to the team in Launch plan."/>) : (
36
+ // A real app gives the list that holds the rows role="log".
37
+ <Stack gap="small">
38
+ {thread.map(function (m) { return (<Message key={m.id} aria-label={m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}>
39
+ <Paragraph measure="none">{m.text}</Paragraph>
40
+ </Message>); })}
41
+ </Stack>)}
42
+ <Composer id="conversation-starters-none-message" aria-label="Message" placeholder="Message the team" value={text} onChange={setText} onSubmit={send}/>
43
+ </Stack>
44
+ </Center>);
45
+ }
@@ -0,0 +1,208 @@
1
+ # Conversation starters
2
+
3
+ A thread has no messages yet, and the person may not know what to write first.
4
+
5
+ **Not built yet:** Scindo on the web shows its starters as `Tag`s under the `EmptyBox`, not as its `action`. It shows them in threads between people too, and puts '@Agent' before the text.
6
+
7
+ ## Do
8
+
9
+ - Show the empty thread as the rule 'An empty list says what will fill it' says. Use `EmptyBox` with `size="large"`, the `text` 'No messages yet', and a `secondText` that says what to do.
10
+ - Pass the starters as the `action`: a `Cluster` of three or four clickable `Tag`s, each a short thing to ask in the person's words.
11
+ - Pass `toggle={false}` to each starter `Tag`, so it is a plain button and not a toggle.
12
+ - Use `Tag`, not Button: a starter is a phrase the person might say, and a Button label is in Title Case.
13
+ - Fill the Composer with the starter and focus it, with the caret at the end. Do not send it: the person reads it and can change it first.
14
+ - Say who reads the message in the placeholder: 'Message Acme Agent'.
15
+ - Hide the starters once the thread has a message.
16
+ - Write the starters for the place: in a task, ask about the plan; in a channel, ask about what the team discussed.
17
+
18
+ ## Don't
19
+
20
+ - Do not send a starter on a click.
21
+ - Do not show starters in a thread between people. Say what to do in `secondText` instead.
22
+ - Do not offer more than four starters.
23
+ - Do not write starters in the system's words, such as 'Run summary'.
24
+
25
+ ## Option: Things to ask
26
+
27
+ Use when: A conversation with the agent: three or four things to ask it.
28
+
29
+ Uses: `Center`, `Cluster`, `Composer`, `EmptyBox`, `Heading`, `Message`, `Paragraph`, `Stack`, `Tag`, `TimeStamp`, `UserImage`
30
+
31
+ ```tsx
32
+ 'use client';
33
+ import { useEffect, useRef, useState } from 'react';
34
+ import Message from 'oneslash-design-system/components/message';
35
+ import UserImage from 'oneslash-design-system/components/userImage';
36
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
37
+ import Heading from 'oneslash-design-system/components/heading';
38
+ import Paragraph from 'oneslash-design-system/components/paragraph';
39
+ import Composer from 'oneslash-design-system/components/composer';
40
+ import EmptyBox from 'oneslash-design-system/components/emptyBox';
41
+ import Tag from 'oneslash-design-system/components/tag';
42
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
43
+
44
+ // A real app reads this from the session.
45
+ const me = 'Dana Lee';
46
+ const agentName = 'Acme Agent';
47
+
48
+ // Things to ask, in the person's words.
49
+ const starters = [
50
+ 'Summarize the launch plan',
51
+ 'Draft the launch email',
52
+ 'List what is still open',
53
+ 'Check the pricing page for mistakes',
54
+ ];
55
+
56
+ type Row = { id: string; from: string; at: Date; text: string };
57
+
58
+ export default function ConversationStartersChips() {
59
+ const [thread, setThread] = useState<Row[]>([]);
60
+ const [text, setText] = useState('');
61
+ // Set when a starter fills the field; the effect below focuses it with the caret at the end.
62
+ const [filled, setFilled] = useState(0);
63
+ const field = useRef<HTMLTextAreaElement>(null);
64
+
65
+ useEffect(() => {
66
+ if (!filled || !field.current) return;
67
+ const end = field.current.value.length;
68
+ field.current.focus();
69
+ field.current.setSelectionRange(end, end);
70
+ }, [filled]);
71
+
72
+ // Fills the field and does not send: the person can change it first.
73
+ function fillWith(starter: string) {
74
+ setText(starter);
75
+ setFilled((n) => n + 1);
76
+ }
77
+
78
+ function send() {
79
+ // A real app sends the message to the agent here and shows it at once.
80
+ setThread((rows) => [...rows, { id: `m${rows.length + 1}`, from: me, at: new Date(), text: text.trim() }]);
81
+ setText('');
82
+ }
83
+
84
+ return (
85
+ <Center width="page">
86
+ <Stack gap="large">
87
+ <Heading level={1} size="h5">{`Ask ${agentName}`}</Heading>
88
+ {thread.length === 0 ? (
89
+ <EmptyBox
90
+ size="large"
91
+ icon="MessageCircle"
92
+ text="No messages yet"
93
+ secondText={`Ask ${agentName} about the launch, or start with one of these.`}
94
+ action={
95
+ <Cluster gap="small">
96
+ {starters.map((s) => (
97
+ <Tag key={s} variant="contained" size="small" label={s} toggle={false} onClick={() => fillWith(s)} />
98
+ ))}
99
+ </Cluster>
100
+ }
101
+ />
102
+ ) : (
103
+ // A real app gives the list that holds the rows role="log".
104
+ <Stack gap="small">
105
+ {thread.map((m) => (
106
+ <Message
107
+ key={m.id}
108
+ aria-label={m.from}
109
+ avatar={<UserImage userHandle={m.from} decorative />}
110
+ name={m.from}
111
+ meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
112
+ >
113
+ <Paragraph measure="none">{m.text}</Paragraph>
114
+ </Message>
115
+ ))}
116
+ </Stack>
117
+ )}
118
+ <Composer
119
+ ref={field}
120
+ id="conversation-starters-chips-message"
121
+ aria-label="Message"
122
+ placeholder={`Message ${agentName}`}
123
+ value={text}
124
+ onChange={setText}
125
+ onSubmit={send}
126
+ />
127
+ </Stack>
128
+ </Center>
129
+ );
130
+ }
131
+ ```
132
+
133
+ ## Option: No starters
134
+
135
+ Use when: A thread between people, where the agent is not the one asked.
136
+
137
+ Uses: `Center`, `Composer`, `EmptyBox`, `Heading`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `UserImage`
138
+
139
+ ```tsx
140
+ 'use client';
141
+ import { useState } from 'react';
142
+ import Message from 'oneslash-design-system/components/message';
143
+ import UserImage from 'oneslash-design-system/components/userImage';
144
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
145
+ import Heading from 'oneslash-design-system/components/heading';
146
+ import Paragraph from 'oneslash-design-system/components/paragraph';
147
+ import Composer from 'oneslash-design-system/components/composer';
148
+ import EmptyBox from 'oneslash-design-system/components/emptyBox';
149
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
150
+
151
+ // A real app reads this from the session.
152
+ const me = 'Dana Lee';
153
+
154
+ type Row = { id: string; from: string; at: Date; text: string };
155
+
156
+ export default function ConversationStartersNone() {
157
+ const [thread, setThread] = useState<Row[]>([]);
158
+ const [text, setText] = useState('');
159
+
160
+ function send() {
161
+ // A real app sends the message to the server here and shows it at once.
162
+ setThread((rows) => [...rows, { id: `m${rows.length + 1}`, from: me, at: new Date(), text: text.trim() }]);
163
+ setText('');
164
+ }
165
+
166
+ return (
167
+ <Center width="page">
168
+ <Stack gap="large">
169
+ <Heading level={1} size="h5">Launch plan</Heading>
170
+ {thread.length === 0 ? (
171
+ // A thread between people: no starters, and secondText says what to do.
172
+ <EmptyBox
173
+ size="large"
174
+ icon="MessageCircle"
175
+ text="No messages yet"
176
+ secondText="Send the first message to the team in Launch plan."
177
+ />
178
+ ) : (
179
+ // A real app gives the list that holds the rows role="log".
180
+ <Stack gap="small">
181
+ {thread.map((m) => (
182
+ <Message
183
+ key={m.id}
184
+ aria-label={m.from}
185
+ avatar={<UserImage userHandle={m.from} decorative />}
186
+ name={m.from}
187
+ meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
188
+ >
189
+ <Paragraph measure="none">{m.text}</Paragraph>
190
+ </Message>
191
+ ))}
192
+ </Stack>
193
+ )}
194
+ <Composer
195
+ id="conversation-starters-none-message"
196
+ aria-label="Message"
197
+ placeholder="Message the team"
198
+ value={text}
199
+ onChange={setText}
200
+ onSubmit={send}
201
+ />
202
+ </Stack>
203
+ </Center>
204
+ );
205
+ }
206
+ ```
207
+
208
+ Seen in: Scindo.
@@ -0,0 +1 @@
1
+ export default function CreateModalQuick(): import("react").JSX.Element;
@@ -0,0 +1,80 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useEffect, useRef, useState } from 'react';
12
+ import Modal from '../../components/modal';
13
+ import Surface from '../../components/surface';
14
+ import Heading from '../../components/heading';
15
+ import List from '../../components/list';
16
+ import Form from '../../components/form';
17
+ import TextField from '../../components/textField';
18
+ import Button from '../../components/button';
19
+ import { Center, Cluster, Stack } from '../../components/layout';
20
+ export default function CreateModalQuick() {
21
+ var _a = useState(['Website refresh', 'Hiring plan', 'Office move']), projects = _a[0], setProjects = _a[1];
22
+ // Opens on the Modal, as if the person just chose Create Project.
23
+ var _b = useState(true), open = _b[0], setOpen = _b[1];
24
+ var _c = useState('Q4 budget'), name = _c[0], setName = _c[1];
25
+ var _d = useState(''), nameError = _d[0], setNameError = _d[1];
26
+ var _e = useState(false), creating = _e[0], setCreating = _e[1];
27
+ var timer = useRef();
28
+ // Stops the request if the example goes away before it ends.
29
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
30
+ var next = name.trim();
31
+ function handleOpen() {
32
+ setName('');
33
+ setNameError('');
34
+ setOpen(true);
35
+ }
36
+ // Escape, a click outside and Cancel all close it, except while the request runs.
37
+ function handleClose() {
38
+ if (creating)
39
+ return;
40
+ setOpen(false);
41
+ }
42
+ function handleCreate() {
43
+ if (creating || next === '')
44
+ return;
45
+ setNameError('');
46
+ setCreating(true);
47
+ // Stands in for the request to the server.
48
+ timer.current = setTimeout(function () {
49
+ setCreating(false);
50
+ // The server already has these names. Type one to see the request fail.
51
+ if (projects.some(function (p) { return p.toLowerCase() === next.toLowerCase(); })) {
52
+ setNameError("A project named '".concat(next, "' already exists. Choose another name."));
53
+ return;
54
+ }
55
+ setProjects(function (list) { return __spreadArray([next], list, true); });
56
+ setOpen(false);
57
+ }, 1200);
58
+ }
59
+ return (<Center width="page">
60
+ <Stack gap="large">
61
+ <Cluster>
62
+ <Heading level={1} size="h5">Projects</Heading>
63
+ <Button size="small" type="primary" state="enabled" label="Create Project" decoIcon="Plus" onClickButton={handleOpen}/>
64
+ </Cluster>
65
+ {/* The new project shows at the top of the list, so no toast is needed. */}
66
+ <Surface padding="large">
67
+ <List items={projects} size="body1"/>
68
+ </Surface>
69
+ </Stack>
70
+ <Modal isOpen={open} size="small" initialFocus="body" title="Create Project" onClose={handleClose} actions={<>
71
+ <Button size="small" type="tertiary" state={creating ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
72
+ <Button size="small" type="primary" state={next === '' ? 'disabled' : 'enabled'} label="Create" loading={creating} onClickButton={handleCreate}/>
73
+ </>}>
74
+ {/* The Form lets Enter in the field create too. */}
75
+ <Form aria-label="Create project" onSubmit={handleCreate}>
76
+ <TextField id="create-modal-name" label="Project name" placeholder="Q4 budget" value={name} disabled={creating} error={Boolean(nameError)} errorText={nameError} onChange={function (e) { setName(e.target.value); setNameError(''); }}/>
77
+ </Form>
78
+ </Modal>
79
+ </Center>);
80
+ }
@@ -0,0 +1 @@
1
+ export default function CreateModalWithSettings(): import("react").JSX.Element;