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,79 @@
1
+ import React from 'react';
2
+ import { Check, Circle, Minus, X } from 'lucide-react';
3
+ import { LoadingSmall } from './loadingScreen';
4
+ var words = {
5
+ waiting: 'Waiting',
6
+ running: 'Running',
7
+ done: 'Done',
8
+ failed: 'Failed',
9
+ cancelled: 'Cancelled',
10
+ };
11
+ // Mark colors; a running mark takes its color from the text, so it shows in dark too.
12
+ var markColors = {
13
+ waiting: 'text-fg-secondary',
14
+ running: 'text-fg-primary',
15
+ done: 'text-success-text',
16
+ failed: 'text-error-text',
17
+ cancelled: 'text-fg-secondary',
18
+ };
19
+ var labelColors = {
20
+ waiting: 'text-fg-secondary',
21
+ running: 'text-fg-primary',
22
+ done: 'text-fg-primary',
23
+ failed: 'text-fg-primary',
24
+ cancelled: 'text-fg-secondary',
25
+ };
26
+ // Steps with a status each: an agent's progress, a plan, an import. An ordered list.
27
+ // A screen reader hears the status, then the label ("Done: Read file"); with `numbered` it hears
28
+ // the position too ("Step 2, Running: Read file"). Each status has its own shape and word, so
29
+ // color is never the only cue. The mark box is as tall as the first text line (24px), so a
30
+ // wrapped label keeps the mark at its first line. There is no line between steps in this version.
31
+ // `numbered` draws a number column before the mark; the drawn number is hidden from assistive tech
32
+ // and the hidden text carries the position, so it is not read twice. A waiting numbered step shows
33
+ // its number and no circle, and its label is primary text: a plan waiting for approval is not disabled.
34
+ // It is read as "Step 1: Read file", with no status word, since it draws none: an approved plan is not read as waiting.
35
+ // There is no live region: a caller that updates the list while an agent works wraps it in
36
+ // `role="status"` or `aria-live="polite"` itself.
37
+ export default function StepList(_a) {
38
+ var steps = _a.steps, _b = _a.numbered, numbered = _b === void 0 ? false : _b, ariaLabel = _a["aria-label"];
39
+ if (steps.length === 0)
40
+ return null;
41
+ var mark = function (status) {
42
+ switch (status) {
43
+ case 'running':
44
+ // The spinner's own "Loading" status is hidden: the row says "Running".
45
+ return <div aria-hidden="true"><LoadingSmall size="tiny"/></div>;
46
+ case 'done':
47
+ return <Check className="size-4" strokeWidth={2} aria-hidden/>;
48
+ case 'failed':
49
+ return <X className="size-4" strokeWidth={2} aria-hidden/>;
50
+ case 'cancelled':
51
+ return <Minus className="size-4" strokeWidth={2} aria-hidden/>;
52
+ default:
53
+ return <Circle className="size-4" strokeWidth={2} aria-hidden/>;
54
+ }
55
+ };
56
+ return (<ol role="list" aria-label={ariaLabel} className="flex flex-col gap-medium">
57
+ {steps.map(function (step, i) {
58
+ var _a;
59
+ var status = (_a = step.status) !== null && _a !== void 0 ? _a : 'waiting';
60
+ var label = labelColors[status === 'waiting' && numbered ? 'running' : status];
61
+ var spoken = numbered
62
+ ? status === 'waiting' ? "Step ".concat(i + 1, ": ") : "Step ".concat(i + 1, ", ").concat(words[status], ": ")
63
+ : "".concat(words[status], ": ");
64
+ return (<li key={i} aria-current={status === 'running' ? 'step' : undefined} className="flex items-start gap-medium">
65
+ {numbered && (<span aria-hidden="true" className="flex h-6 w-6 flex-shrink-0 items-center justify-center text-body2 text-fg-secondary">{i + 1}</span>)}
66
+ {(!numbered || status !== 'waiting') && (<span aria-hidden="true" className={"flex flex-shrink-0 items-center justify-center w-6 h-6 ".concat(markColors[status])}>
67
+ {mark(status)}
68
+ </span>)}
69
+ <span className="flex flex-col flex-1 min-w-0">
70
+ <span className={"break-words text-body1 ".concat(label)}>
71
+ <span className="sr-only">{spoken}</span>
72
+ {step.label}
73
+ </span>
74
+ {step.detail && <span className="break-words text-body2 text-fg-secondary">{step.detail}</span>}
75
+ </span>
76
+ </li>);
77
+ })}
78
+ </ol>);
79
+ }
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
  import React, { useContext } from 'react';
3
3
  import IconSlot from './iconSlot';
4
- import { TabsContainerContext } from './tabsContainer';
4
+ import { TabsContainerContext, TabsFillContext } from './tabsContainer';
5
5
  import { focusRing, pressFeedbackAny, stateTransition } from './sharedStyles';
6
6
  export default function Tab(_a) {
7
7
  var label = _a.label, secondLabel = _a.secondLabel, href = _a.href, isSelected = _a.isSelected, onClickTab = _a.onClickTab, onClickActionIcon = _a.onClickActionIcon, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon, router = _a.router, _b = _a.size, size = _b === void 0 ? 'medium' : _b;
8
8
  var inContainer = useContext(TabsContainerContext);
9
+ var fill = useContext(TabsFillContext);
9
10
  var handleClick = function () {
10
11
  onClickTab();
11
12
  if (href && router) {
@@ -28,7 +29,7 @@ export default function Tab(_a) {
28
29
  e.preventDefault();
29
30
  handleClick();
30
31
  }
31
- }} className={"\n relative flex items-center space-x-1 rounded-control cursor-pointer justify-start ".concat(stateTransition, " ").concat(pressFeedbackAny, " ").concat(focusRing, "\n ").concat(sizeClasses.tab, "\n ").concat(isSelected
32
+ }} className={"\n relative flex items-center space-x-1 rounded-control cursor-pointer ".concat(fill ? 'flex-1 justify-center' : 'justify-start', " ").concat(stateTransition, " ").concat(pressFeedbackAny, " ").concat(focusRing, "\n ").concat(sizeClasses.tab, "\n ").concat(isSelected
32
33
  ? selectedClasses
33
34
  : 'text-fg-primary hover:bg-background-accent200', "\n ")} onClick={handleClick}>
34
35
  <IconSlot icon={decoIcon} className={sizeClasses.icon}/>
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  interface TabsContainerProps {
3
3
  children: React.ReactNode;
4
+ /** The container is as wide as its parent and every tab takes an equal share, label centered. */
5
+ fill?: boolean;
4
6
  }
5
7
  export declare const TabsContainerContext: React.Context<boolean>;
6
- export default function TabsContainer({ children, }: TabsContainerProps): React.JSX.Element;
8
+ export declare const TabsFillContext: React.Context<boolean>;
9
+ export default function TabsContainer({ children, fill, }: TabsContainerProps): React.JSX.Element;
7
10
  export {};
@@ -4,12 +4,14 @@ import React, { createContext, useEffect, useLayoutEffect, useRef, useState } fr
4
4
  var useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
5
5
  // Lets a Tab know a container draws its selected background (the sliding pill)
6
6
  export var TabsContainerContext = createContext(false);
7
+ // Lets a Tab know every tab in the container takes an equal share of the width
8
+ export var TabsFillContext = createContext(false);
7
9
  export default function TabsContainer(_a) {
8
- var children = _a.children;
10
+ var children = _a.children, _b = _a.fill, fill = _b === void 0 ? false : _b;
9
11
  var tabCount = React.Children.count(children);
10
12
  var containerRef = useRef(null);
11
13
  var selectedRef = useRef(null);
12
- var _b = useState(null), indicator = _b[0], setIndicator = _b[1];
14
+ var _c = useState(null), indicator = _c[0], setIndicator = _c[1];
13
15
  useIsomorphicLayoutEffect(function () {
14
16
  var _a;
15
17
  var container = containerRef.current;
@@ -61,6 +63,7 @@ export default function TabsContainer(_a) {
61
63
  };
62
64
  }, [children]);
63
65
  return (<TabsContainerContext.Provider value={true}>
66
+ <TabsFillContext.Provider value={fill}>
64
67
  <div ref={containerRef} role="tablist" onKeyDown={function (e) {
65
68
  var _a, _b;
66
69
  // Arrow keys move focus to the next tab and select it
@@ -79,7 +82,7 @@ export default function TabsContainer(_a) {
79
82
  e.preventDefault();
80
83
  tabs[next].focus();
81
84
  tabs[next].click();
82
- }} className={"\n relative flex gap-0.5 p-1 rounded-container overflow-x-auto\n ".concat(tabCount > 0 ? 'bg-background-accent100' : 'bg-transparent', "\n ")} style={{
85
+ }} className={"\n relative flex gap-0.5 p-1 rounded-container overflow-x-auto".concat(fill ? ' w-full' : '', "\n ").concat(tabCount > 0 ? 'bg-background-accent100' : 'bg-transparent', "\n ")} style={{
83
86
  scrollbarWidth: 'none',
84
87
  msOverflowStyle: 'none',
85
88
  }}>
@@ -92,5 +95,6 @@ export default function TabsContainer(_a) {
92
95
  }}/>)}
93
96
  {children}
94
97
  </div>
98
+ </TabsFillContext.Provider>
95
99
  </TabsContainerContext.Provider>);
96
100
  }
@@ -15,6 +15,14 @@ interface TagProps {
15
15
  onClick?: React.MouseEventHandler<HTMLDivElement>;
16
16
  /** Only applies to a clickable tag: dims it, drops it from the tab order and ignores clicks */
17
17
  disabled?: boolean;
18
+ /** The tag's name, when the label alone does not say it (a reaction: 'Thumbs up, 3 reactions'). On the button when clickable; a static tag with a name gets `role="img"`. */
19
+ 'aria-label'?: string;
20
+ /**
21
+ * A clickable tag is a toggle by default and reports `aria-pressed`: right for a filter or a reaction.
22
+ * `false` makes it a plain button with no `aria-pressed`, for an action such as a conversation starter.
23
+ * `state="selected"` still gives the selected look then, but it is only a look. No effect without `onClick`.
24
+ */
25
+ toggle?: boolean;
18
26
  }
19
- export default function Tag({ variant, size, state, color, label, secondLabel, iconName, icon, onClick, disabled, }: TagProps): JSX.Element;
27
+ export default function Tag({ variant, size, state, color, label, secondLabel, iconName, icon, onClick, disabled, 'aria-label': ariaLabel, toggle, }: TagProps): React.JSX.Element;
20
28
  export {};
@@ -48,7 +48,7 @@ var colorConfig = {
48
48
  },
49
49
  };
50
50
  export default function Tag(_a) {
51
- var variant = _a.variant, size = _a.size, _b = _a.state, state = _b === void 0 ? 'enabled' : _b, color = _a.color, label = _a.label, secondLabel = _a.secondLabel, iconName = _a.iconName, icon = _a.icon, onClick = _a.onClick, _c = _a.disabled, disabled = _c === void 0 ? false : _c;
51
+ var variant = _a.variant, size = _a.size, _b = _a.state, state = _b === void 0 ? 'enabled' : _b, color = _a.color, label = _a.label, secondLabel = _a.secondLabel, iconName = _a.iconName, icon = _a.icon, onClick = _a.onClick, _c = _a.disabled, disabled = _c === void 0 ? false : _c, ariaLabel = _a["aria-label"], _d = _a.toggle, toggle = _d === void 0 ? true : _d;
52
52
  // Size and padding
53
53
  var sizeClasses = {
54
54
  medium: 'text-body2 px-2 py-1',
@@ -121,12 +121,12 @@ export default function Tag(_a) {
121
121
  var cursorClass = isDisabled ? 'cursor-not-allowed opacity-50' : onClick && !isSelected ? 'cursor-pointer' : '';
122
122
  // inline-flex so a tag wraps its content instead of stretching to its container
123
123
  var baseClasses = "inline-flex items-center gap-1 rounded-full whitespace-nowrap ".concat(stateTransition);
124
- // A clickable tag is a keyboard-reachable toggle button
124
+ // A clickable tag is a keyboard-reachable button, a toggle unless `toggle` is false
125
125
  var interactiveProps = onClick
126
126
  ? {
127
127
  role: 'button',
128
128
  tabIndex: isDisabled ? -1 : 0,
129
- 'aria-pressed': isSelected,
129
+ 'aria-pressed': toggle ? isSelected : undefined,
130
130
  'aria-disabled': isDisabled || undefined,
131
131
  onClick: isDisabled ? undefined : onClick,
132
132
  onKeyDown: function (e) {
@@ -137,7 +137,9 @@ export default function Tag(_a) {
137
137
  },
138
138
  }
139
139
  : {};
140
- return (<div className={"".concat(baseClasses, " ").concat(sizeClasses, " ").concat(bgClasses, " ").concat(fontClasses, " ").concat(borderClasses, " ").concat(hoverClasses, " ").concat(cursorClass, " ").concat(onClick ? focusRing : '', " ").concat(onClick && !isDisabled ? pressFeedbackAny : '')} {...interactiveProps}>
140
+ return (<div className={"".concat(baseClasses, " ").concat(sizeClasses, " ").concat(bgClasses, " ").concat(fontClasses, " ").concat(borderClasses, " ").concat(hoverClasses, " ").concat(cursorClass, " ").concat(onClick ? focusRing : '', " ").concat(onClick && !isDisabled ? pressFeedbackAny : '')} aria-label={ariaLabel}
141
+ // A name on a plain div is not valid; a static tag with a name is an image of its label
142
+ role={!onClick && ariaLabel ? 'img' : undefined} {...interactiveProps}>
141
143
  {variant === 'dot' && (<span className={"w-3 h-3 rounded-full flex-shrink-0 ".concat(dotColor)}/>)}
142
144
  {variant !== 'dot' && <IconSlot icon={icon !== null && icon !== void 0 ? icon : iconName} className={"".concat(size === 'tiny' ? 'w-3 h-3' : 'w-4 h-4', " flex-shrink-0")}/>}
143
145
  <div className="flex flex-col text-center">
@@ -13,9 +13,13 @@ interface TextFieldProps {
13
13
  multiline?: boolean;
14
14
  maxRows?: number;
15
15
  disabled?: boolean;
16
+ /** Passed to the `<input>` or `<textarea>`: the text can be focused and selected but not changed. Keeps the normal colors, unlike `disabled`. `required` has no effect on a read-only field. */
17
+ readOnly?: boolean;
16
18
  error?: boolean;
17
19
  /** Message shown under the field when `error` is true */
18
20
  errorText?: string;
21
+ /** A caption under the field. Tied to the field with `aria-describedby`. While `error` is true the error text replaces it, so the error text should restate the rule. */
22
+ helperText?: string;
19
23
  required?: boolean;
20
24
  size?: 'large' | 'medium' | 'small' | 'tiny';
21
25
  placeholder?: string;
@@ -30,5 +34,5 @@ interface TextFieldProps {
30
34
  /** Passed to the `<input>` or `<textarea>`. Left to the browser's default when not set. */
31
35
  spellCheck?: boolean;
32
36
  }
33
- export default function TextField({ id, label, value, type, onChange, onBlur, onFocus, onKeyDown, onSubmit, autoFocus, multiline, maxRows, disabled, error, errorText, required, size, placeholder, name, autoComplete, tabIndex, maxLength, minLength, spellCheck, }: TextFieldProps): React.JSX.Element;
37
+ export default function TextField({ id, label, value, type, onChange, onBlur, onFocus, onKeyDown, onSubmit, autoFocus, multiline, maxRows, disabled, readOnly, error, errorText, helperText, required, size, placeholder, name, autoComplete, tabIndex, maxLength, minLength, spellCheck, }: TextFieldProps): React.JSX.Element;
34
38
  export {};
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import { stateTransition } from './sharedStyles';
4
4
  export default function TextField(_a) {
5
- var id = _a.id, label = _a.label, value = _a.value, _b = _a.type, type = _b === void 0 ? 'text' : _b, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onKeyDown = _a.onKeyDown, onSubmit = _a.onSubmit, _c = _a.autoFocus, autoFocus = _c === void 0 ? false : _c, _d = _a.multiline, multiline = _d === void 0 ? false : _d, _e = _a.maxRows, maxRows = _e === void 0 ? 6 : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.error, error = _g === void 0 ? false : _g, _h = _a.errorText, errorText = _h === void 0 ? 'This field is required' : _h, _j = _a.required, required = _j === void 0 ? false : _j, _k = _a.size, size = _k === void 0 ? 'medium' : _k, placeholder = _a.placeholder, name = _a.name, _l = _a.autoComplete, autoComplete = _l === void 0 ? 'off' : _l, tabIndex = _a.tabIndex, maxLength = _a.maxLength, minLength = _a.minLength, spellCheck = _a.spellCheck;
5
+ var id = _a.id, label = _a.label, value = _a.value, _b = _a.type, type = _b === void 0 ? 'text' : _b, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onKeyDown = _a.onKeyDown, onSubmit = _a.onSubmit, _c = _a.autoFocus, autoFocus = _c === void 0 ? false : _c, _d = _a.multiline, multiline = _d === void 0 ? false : _d, _e = _a.maxRows, maxRows = _e === void 0 ? 6 : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.errorText, errorText = _j === void 0 ? 'This field is required' : _j, helperText = _a.helperText, _k = _a.required, required = _k === void 0 ? false : _k, _l = _a.size, size = _l === void 0 ? 'medium' : _l, placeholder = _a.placeholder, name = _a.name, _m = _a.autoComplete, autoComplete = _m === void 0 ? 'off' : _m, tabIndex = _a.tabIndex, maxLength = _a.maxLength, minLength = _a.minLength, spellCheck = _a.spellCheck;
6
6
  var handleKeyDown = function (e) {
7
7
  // Ctrl+Enter or Cmd+Enter to submit
8
8
  if ((e.ctrlKey || e.metaKey) && e.key === 'Enter' && onSubmit) {
@@ -35,6 +35,7 @@ export default function TextField(_a) {
35
35
  return "border-fg-disabled\n hover:border-fg-secondary\n focus:outline focus:outline-1 focus:outline-offset-2 focus:outline-fg-primary";
36
36
  };
37
37
  var errorId = "".concat(id, "-error");
38
+ var helperId = "".concat(id, "-helper");
38
39
  // Get inputMode for mobile keyboard optimization
39
40
  var getInputMode = function () {
40
41
  switch (type) {
@@ -55,17 +56,20 @@ export default function TextField(_a) {
55
56
  var containerClasses = "\n ".concat(colorClasses, "\n ").concat(baseClasses, "\n ").concat(sizeClasses, "\n ").concat(getBorderColor(), "\n ");
56
57
  var errorProps = {
57
58
  'aria-invalid': error || undefined,
58
- 'aria-describedby': error ? errorId : undefined,
59
+ 'aria-describedby': error ? errorId : helperText ? helperId : undefined,
59
60
  };
60
61
  return (<div className="flex flex-col w-full">
61
62
  {label && (<label htmlFor={id} className="mb-1 text-body2 text-fg-secondary">
62
63
  {label}{required && <span className="text-error-text ml-0.5">*</span>}
63
64
  </label>)}
64
65
  <div className="relative">
65
- {multiline ? (<textarea id={id} rows={maxRows} className={containerClasses} value={value} onChange={onChange} placeholder={placeholder} onFocus={onFocus} onBlur={onBlur} onKeyDown={handleKeyDown} autoFocus={autoFocus} disabled={disabled} required={required} name={name} autoComplete={autoComplete} tabIndex={tabIndex} maxLength={maxLength} minLength={minLength} spellCheck={spellCheck} {...errorProps}/>) : (<input id={id} type={type} inputMode={getInputMode()} className={containerClasses} value={value} onChange={onChange} placeholder={placeholder} onFocus={onFocus} onBlur={onBlur} onKeyDown={handleKeyDown} autoFocus={autoFocus} disabled={disabled} required={required} name={name} autoComplete={autoComplete} tabIndex={tabIndex} maxLength={maxLength} minLength={minLength} spellCheck={spellCheck} {...errorProps}/>)}
66
+ {multiline ? (<textarea id={id} rows={maxRows} className={containerClasses} value={value} onChange={onChange} placeholder={placeholder} onFocus={onFocus} onBlur={onBlur} onKeyDown={handleKeyDown} autoFocus={autoFocus} disabled={disabled} readOnly={readOnly} required={required} name={name} autoComplete={autoComplete} tabIndex={tabIndex} maxLength={maxLength} minLength={minLength} spellCheck={spellCheck} {...errorProps}/>) : (<input id={id} type={type} inputMode={getInputMode()} className={containerClasses} value={value} onChange={onChange} placeholder={placeholder} onFocus={onFocus} onBlur={onBlur} onKeyDown={handleKeyDown} autoFocus={autoFocus} disabled={disabled} readOnly={readOnly} required={required} name={name} autoComplete={autoComplete} tabIndex={tabIndex} maxLength={maxLength} minLength={minLength} spellCheck={spellCheck} {...errorProps}/>)}
66
67
  </div>
67
68
  {error && (<p id={errorId} className="mt-1 text-error-text text-body2">
68
69
  {errorText}
69
70
  </p>)}
71
+ {!error && helperText && (<p id={helperId} className="mt-1 text-fg-secondary text-body2">
72
+ {helperText}
73
+ </p>)}
70
74
  </div>);
71
75
  }
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import React, { useCallback, useEffect, useRef } from 'react';
3
3
  import { stateTransition } from './sharedStyles';
4
+ import { fitToContent } from '../internal/autoGrow';
4
5
  export default function Textarea(_a) {
5
6
  var id = _a.id, label = _a.label, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onKeyDown = _a.onKeyDown, onCompositionStart = _a.onCompositionStart, onCompositionEnd = _a.onCompositionEnd, onSubmit = _a.onSubmit, _b = _a.autoFocus, autoFocus = _b === void 0 ? false : _b, _c = _a.maxRows, maxRows = _c === void 0 ? 6 : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.error, error = _e === void 0 ? false : _e, _f = _a.errorText, errorText = _f === void 0 ? 'This field is required' : _f, _g = _a.size, size = _g === void 0 ? 'medium' : _g, placeholder = _a.placeholder, name = _a.name, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, tabIndex = _a.tabIndex, maxLength = _a.maxLength, spellCheck = _a.spellCheck;
6
7
  var textareaRef = useRef(null);
@@ -14,24 +15,8 @@ export default function Textarea(_a) {
14
15
  onKeyDown(e);
15
16
  };
16
17
  var adjustHeight = useCallback(function () {
17
- var textarea = textareaRef.current;
18
- if (!textarea)
19
- return;
20
- textarea.style.height = 'auto'; // Reset height to calculate scrollHeight
21
- var style = getComputedStyle(textarea);
22
- var lineHeight = parseFloat(style.lineHeight);
23
- // style.height is border-box, scrollHeight includes padding but not border
24
- var paddingY = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);
25
- var borderY = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
26
- var maxContentHeight = lineHeight * maxRows + paddingY;
27
- var scrollHeight = textarea.scrollHeight;
28
- // Fit the content, capped at maxRows, but at least 1 line
29
- var contentHeight = Math.max(Math.min(scrollHeight, maxContentHeight), lineHeight + paddingY);
30
- textarea.style.height = "".concat(contentHeight + borderY, "px");
31
- // Enable vertical scroll if content exceeds maxRows (hide scrollbar)
32
- textarea.style.overflowY = scrollHeight > maxContentHeight ? 'scroll' : 'hidden';
33
- textarea.style.scrollbarWidth = 'none'; // Firefox
34
- textarea.style.msOverflowStyle = 'none'; // IE/Edge
18
+ if (textareaRef.current)
19
+ fitToContent(textareaRef.current, maxRows);
35
20
  }, [maxRows]);
36
21
  // Also re-measure when the value changes from outside (e.g. cleared after submit)
37
22
  useEffect(function () {
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export type ToastInput = {
3
+ type?: 'success' | 'warning' | 'error' | 'info' | 'default';
4
+ message: string;
5
+ secondMessage?: string;
6
+ /** Milliseconds before the toast closes itself; `null` keeps it until closed. Default 5000, and `null` for errors. A value that is not finite or is above 2^31-1 (what `setTimeout` can hold) counts as `null`. */
7
+ duration?: number | null;
8
+ };
9
+ /** Shows a toast and returns its id. Call it from client code (event handlers and effects), not from a Server Component or a server action. */
10
+ export declare function toast(input: string | ToastInput): string;
11
+ export declare function dismissToast(id: string): void;
12
+ export default function Toaster(): React.JSX.Element | null;
@@ -0,0 +1,103 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ import React, { useEffect, useReducer, useRef, useState, useSyncExternalStore } from 'react';
23
+ import Alert from './alert';
24
+ import { addToast, removeToast, visibleToasts, pauseReducer, isPaused } from '../internal/toaster';
25
+ // Matches Alert's exit transition
26
+ var EXIT_MS = 150;
27
+ var store = { toasts: [], mounts: [] };
28
+ var serverStore = { toasts: [], mounts: [] };
29
+ var listeners = new Set();
30
+ var nextId = 0;
31
+ var setStore = function (next) {
32
+ store = next;
33
+ listeners.forEach(function (l) { return l(); });
34
+ };
35
+ var subscribe = function (listener) {
36
+ listeners.add(listener);
37
+ return function () { return listeners.delete(listener); };
38
+ };
39
+ /** Shows a toast and returns its id. Call it from client code (event handlers and effects), not from a Server Component or a server action. */
40
+ export function toast(input) {
41
+ var id = "toast-".concat(++nextId);
42
+ // During a server render there is no Toaster to show it, and the store would outlive the request
43
+ if (typeof window === 'undefined')
44
+ return id;
45
+ setStore(__assign(__assign({}, store), { toasts: addToast(store.toasts, input, id) }));
46
+ return id;
47
+ }
48
+ export function dismissToast(id) {
49
+ var toasts = removeToast(store.toasts, id);
50
+ if (toasts !== store.toasts)
51
+ setStore(__assign(__assign({}, store), { toasts: toasts }));
52
+ }
53
+ function Toast(_a) {
54
+ var item = _a.item;
55
+ var _b = useState(true), open = _b[0], setOpen = _b[1];
56
+ var _c = useReducer(pauseReducer, { hovered: false, focused: false }), pause = _c[0], dispatch = _c[1];
57
+ var paused = isPaused(pause);
58
+ var remainingMs = useRef(item.duration);
59
+ useEffect(function () {
60
+ if (!open || paused || remainingMs.current === null)
61
+ return;
62
+ var startedAt = Date.now();
63
+ var timer = setTimeout(function () { return setOpen(false); }, remainingMs.current);
64
+ return function () {
65
+ clearTimeout(timer);
66
+ if (remainingMs.current !== null)
67
+ remainingMs.current -= Date.now() - startedAt;
68
+ };
69
+ }, [open, paused]);
70
+ // Let the alert fade out, then take the toast out of the store
71
+ useEffect(function () {
72
+ if (open)
73
+ return;
74
+ var timer = setTimeout(function () { return dismissToast(item.id); }, EXIT_MS);
75
+ return function () { return clearTimeout(timer); };
76
+ }, [open, item.id]);
77
+ return (<div className="pointer-events-auto" onMouseEnter={function () { return dispatch('pointerEnter'); }} onMouseLeave={function () { return dispatch('pointerLeave'); }} onFocus={function () { return dispatch('focus'); }}
78
+ // Focus moving to another element inside the same toast has not left it
79
+ onBlur={function (e) { if (!e.currentTarget.contains(e.relatedTarget))
80
+ dispatch('blur'); }}>
81
+ <Alert variant="inline" showCloseButton autoDismiss={false} open={open} type={item.type} message={item.message} secondMessage={item.secondMessage} onClose={function () { return dismissToast(item.id); }}/>
82
+ </div>);
83
+ }
84
+ // Mount once near the app root. A second Toaster renders nothing.
85
+ export default function Toaster() {
86
+ var _a = useSyncExternalStore(subscribe, function () { return store; }, function () { return serverStore; }), toasts = _a.toasts, mounts = _a.mounts;
87
+ var me = useState(function () { return Symbol('Toaster'); })[0];
88
+ useEffect(function () {
89
+ setStore(__assign(__assign({}, store), { mounts: __spreadArray(__spreadArray([], store.mounts, true), [me], false) }));
90
+ return function () { return setStore(__assign(__assign({}, store), { mounts: store.mounts.filter(function (m) { return m !== me; }) })); };
91
+ }, [me]);
92
+ if (mounts[0] !== me)
93
+ return null;
94
+ var shown = visibleToasts(toasts);
95
+ if (shown.length === 0)
96
+ return null;
97
+ // Above modals; the column lets clicks through beside and between the toasts
98
+ return (<div className="fixed top-4 inset-x-0 z-[var(--os-z-tooltip)] flex justify-center px-4 pointer-events-none">
99
+ <div className="flex flex-col gap-2 w-full max-w-md">
100
+ {shown.map(function (item) { return <Toast key={item.id} item={item}/>; })}
101
+ </div>
102
+ </div>);
103
+ }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type IconSource } from './iconSlot';
2
3
  interface UserImageProps {
3
4
  userHandle: string;
4
5
  userImgUrl?: string;
@@ -7,6 +8,13 @@ interface UserImageProps {
7
8
  size?: number;
8
9
  /** Passed to the `<img>`, e.g. `no-referrer` for hosts that refuse requests carrying a referrer */
9
10
  referrerPolicy?: React.HTMLAttributeReferrerPolicy;
11
+ /** Shows this icon on the panel background in place of a picture or an initial: an agent's avatar. `userHandle` stays its accessible name. A Lucide name, an icon component or an element. */
12
+ icon?: IconSource;
13
+ /**
14
+ * Hides the avatar from assistive tech (`aria-hidden`, no name, an empty `alt` on a picture), for an
15
+ * avatar that sits beside the same name in text, so the name is not read twice. All three forms.
16
+ */
17
+ decorative?: boolean;
10
18
  }
11
- export default function UserImage({ userHandle, userImgUrl, grayscale, size, referrerPolicy, }: UserImageProps): React.JSX.Element;
19
+ export default function UserImage({ userHandle, userImgUrl, grayscale, size, referrerPolicy, icon, decorative, }: UserImageProps): React.JSX.Element;
12
20
  export {};
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  import React from 'react';
14
+ import IconSlot from './iconSlot';
14
15
  function getColorSeed(userHandle) {
15
16
  var words = userHandle.trim().split(/\s+/);
16
17
  var letters = words.map(function (word) { return word.charAt(0).toLowerCase(); });
@@ -33,7 +34,13 @@ function getHash(str) {
33
34
  return hash;
34
35
  }
35
36
  export default function UserImage(_a) {
36
- var userHandle = _a.userHandle, userImgUrl = _a.userImgUrl, _b = _a.grayscale, grayscale = _b === void 0 ? false : _b, size = _a.size, referrerPolicy = _a.referrerPolicy;
37
+ var userHandle = _a.userHandle, userImgUrl = _a.userImgUrl, _b = _a.grayscale, grayscale = _b === void 0 ? false : _b, size = _a.size, referrerPolicy = _a.referrerPolicy, icon = _a.icon, _c = _a.decorative, decorative = _c === void 0 ? false : _c;
38
+ if (icon) {
39
+ var diameter = size !== null && size !== void 0 ? size : 24;
40
+ return (<div role={decorative ? undefined : 'img'} aria-label={decorative ? undefined : userHandle} aria-hidden={decorative || undefined} style={size !== undefined ? { width: size, height: size } : undefined} className="flex items-center justify-center flex-shrink-0 w-6 h-6 rounded-full overflow-hidden bg-secondary-main text-secondary-contrast">
41
+ <IconSlot icon={icon} size={Math.round(diameter / 2)}/>
42
+ </div>);
43
+ }
37
44
  var displayInitial = userHandle.charAt(0).toUpperCase() || 'A';
38
45
  var seed = getColorSeed(userHandle);
39
46
  var hue = Math.abs(getHash(seed)) % 360;
@@ -47,8 +54,8 @@ export default function UserImage(_a) {
47
54
  return (
48
55
  // Per-user hue computed in JS, not a theme token, so the dark: variant stays here (one of the two documented
49
56
  // `dark:` exemptions, see the overlay rings in Menu/Popover/Modal). The dark: variant follows whatever dark variant the app's preset/@theme defines (class-only or OS-aware).
50
- <div style={__assign({ '--light-bg': lightBg, '--dark-bg': darkBg }, (size !== undefined && { width: size, height: size, fontSize: (size * 2) / 3 }))} className="flex items-center justify-center w-6 h-6 rounded-full overflow-hidden bg-[var(--light-bg)] dark:bg-[var(--dark-bg)] text-fg-primary">
51
- {userImgUrl ? (<img src={userImgUrl} alt={userHandle} referrerPolicy={referrerPolicy} className="w-full h-full object-cover rounded-full"/>) : (<span className={"".concat(size === undefined ? 'text-body1' : 'leading-none', " text-fg-primary")}>
57
+ <div aria-hidden={decorative || undefined} style={__assign({ '--light-bg': lightBg, '--dark-bg': darkBg }, (size !== undefined && { width: size, height: size, fontSize: (size * 2) / 3 }))} className="flex items-center justify-center w-6 h-6 rounded-full overflow-hidden bg-[var(--light-bg)] dark:bg-[var(--dark-bg)] text-fg-primary">
58
+ {userImgUrl ? (<img src={userImgUrl} alt={decorative ? '' : userHandle} referrerPolicy={referrerPolicy} className="w-full h-full object-cover rounded-full"/>) : (<span className={"".concat(size === undefined ? 'text-body1' : 'leading-none', " text-fg-primary")}>
52
59
  {displayInitial}
53
60
  </span>)}
54
61
  </div>);
@@ -0,0 +1,4 @@
1
+ export declare function shouldAutoDismiss({ autoDismiss, showCloseButton }: {
2
+ autoDismiss?: boolean;
3
+ showCloseButton?: boolean;
4
+ }): boolean;
@@ -0,0 +1,6 @@
1
+ // Alert's pure helper, kept out of the public API (index.ts and the package exports do not reach internal/)
2
+ // Whether the alert starts its own dismiss timer
3
+ export function shouldAutoDismiss(_a) {
4
+ var autoDismiss = _a.autoDismiss, showCloseButton = _a.showCloseButton;
5
+ return autoDismiss !== null && autoDismiss !== void 0 ? autoDismiss : !showCloseButton;
6
+ }
@@ -0,0 +1,11 @@
1
+ export declare function fitHeight({ scrollHeight, lineHeight, paddingY, borderY, maxRows, }: {
2
+ scrollHeight: number;
3
+ lineHeight: number;
4
+ paddingY: number;
5
+ borderY: number;
6
+ maxRows: number;
7
+ }): {
8
+ height: number;
9
+ scroll: boolean;
10
+ };
11
+ export declare function fitToContent(textarea: HTMLTextAreaElement, maxRows: number): void;
@@ -0,0 +1,28 @@
1
+ // The auto-grow Textarea and Composer share: the text area fits its content, at least one line
2
+ // and at most maxRows, and scrolls past that. Kept out of the public API.
3
+ // The height to set (border-box) and whether the content needs to scroll
4
+ export function fitHeight(_a) {
5
+ var scrollHeight = _a.scrollHeight, lineHeight = _a.lineHeight, paddingY = _a.paddingY, borderY = _a.borderY, maxRows = _a.maxRows;
6
+ var maxContentHeight = lineHeight * maxRows + paddingY;
7
+ // Fit the content, capped at maxRows, but at least 1 line
8
+ var contentHeight = Math.max(Math.min(scrollHeight, maxContentHeight), lineHeight + paddingY);
9
+ return { height: contentHeight + borderY, scroll: scrollHeight > maxContentHeight };
10
+ }
11
+ // Measures the text area and sets its height. Call it from an effect or an event, never at module scope.
12
+ export function fitToContent(textarea, maxRows) {
13
+ textarea.style.height = 'auto'; // Reset height to calculate scrollHeight
14
+ var style = getComputedStyle(textarea);
15
+ // style.height is border-box, scrollHeight includes padding but not border
16
+ var _a = fitHeight({
17
+ scrollHeight: textarea.scrollHeight,
18
+ lineHeight: parseFloat(style.lineHeight),
19
+ paddingY: parseFloat(style.paddingTop) + parseFloat(style.paddingBottom),
20
+ borderY: parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth),
21
+ maxRows: maxRows,
22
+ }), height = _a.height, scroll = _a.scroll;
23
+ textarea.style.height = "".concat(height, "px");
24
+ // Enable vertical scroll if content exceeds maxRows (hide scrollbar)
25
+ textarea.style.overflowY = scroll ? 'scroll' : 'hidden';
26
+ textarea.style.scrollbarWidth = 'none'; // Firefox
27
+ textarea.style.msOverflowStyle = 'none'; // IE/Edge
28
+ }
@@ -0,0 +1,16 @@
1
+ export declare function isComposing({ composing, nativeIsComposing, keyCode }: {
2
+ composing: boolean;
3
+ nativeIsComposing: boolean;
4
+ keyCode: number;
5
+ }): boolean;
6
+ export declare function shouldSubmit({ key, shiftKey, metaKey, ctrlKey, isComposing, canSubmit, disabled, sending, submitOnEnter, }: {
7
+ key: string;
8
+ shiftKey: boolean;
9
+ metaKey: boolean;
10
+ ctrlKey: boolean;
11
+ isComposing: boolean;
12
+ canSubmit: boolean;
13
+ disabled: boolean;
14
+ sending: boolean;
15
+ submitOnEnter: boolean;
16
+ }): boolean;
@@ -0,0 +1,18 @@
1
+ // Composer's pure helpers, kept out of the public API (index.ts and the package exports do not reach internal/)
2
+ // Whether an input method (Korean, Japanese, Chinese) is composing text, so Enter confirms the
3
+ // text and must not send. Any one sign is enough: the composition events, the event's own flag,
4
+ // and keyCode 229, which Safari gives the Enter that ends a composition after compositionend
5
+ // has fired and while isComposing is already false.
6
+ export function isComposing(_a) {
7
+ var composing = _a.composing, nativeIsComposing = _a.nativeIsComposing, keyCode = _a.keyCode;
8
+ return composing || nativeIsComposing || keyCode === 229;
9
+ }
10
+ // Whether this key press sends the message. Cmd+Enter and Ctrl+Enter always do; plain Enter does
11
+ // when `submitOnEnter` is on and Shift is not held. Never while an input method is composing, when
12
+ // there is nothing to send (`canSubmit` false), or while the Composer is disabled or sending.
13
+ export function shouldSubmit(_a) {
14
+ var key = _a.key, shiftKey = _a.shiftKey, metaKey = _a.metaKey, ctrlKey = _a.ctrlKey, isComposing = _a.isComposing, canSubmit = _a.canSubmit, disabled = _a.disabled, sending = _a.sending, submitOnEnter = _a.submitOnEnter;
15
+ if (key !== 'Enter' || isComposing || !canSubmit || disabled || sending)
16
+ return false;
17
+ return metaKey || ctrlKey || (submitOnEnter && !shiftKey);
18
+ }
@@ -0,0 +1,6 @@
1
+ export declare function nextIndex({ key, current, count, labels }: {
2
+ key: string;
3
+ current: number;
4
+ count: number;
5
+ labels: string[];
6
+ }): number;
@@ -0,0 +1,31 @@
1
+ // Menu's pure helper, kept out of the public API (index.ts and the package exports do not reach internal/)
2
+ // The index of the item a key moves focus to in a navigable Menu, or `current` when the key does
3
+ // nothing. ArrowDown and ArrowUp wrap; with no item focused yet (`current` -1) they go to the first
4
+ // and the last. Home and End go to the first and the last. A single character moves to the next
5
+ // item after `current` whose label starts with it, ignoring case and wrapping.
6
+ export function nextIndex(_a) {
7
+ var _b;
8
+ var key = _a.key, current = _a.current, count = _a.count, labels = _a.labels;
9
+ if (count === 0)
10
+ return current;
11
+ switch (key) {
12
+ case 'ArrowDown':
13
+ return current < 0 ? 0 : (current + 1) % count;
14
+ case 'ArrowUp':
15
+ return current < 0 ? count - 1 : (current - 1 + count) % count;
16
+ case 'Home':
17
+ return 0;
18
+ case 'End':
19
+ return count - 1;
20
+ }
21
+ // Space activates an item, so it is not a character to search for
22
+ if (key.length !== 1 || key.trim() === '')
23
+ return current;
24
+ var letter = key.toLowerCase();
25
+ for (var step = 1; step <= count; step++) {
26
+ var index = (current + step + count) % count;
27
+ if (((_b = labels[index]) !== null && _b !== void 0 ? _b : '').trim().toLowerCase().startsWith(letter))
28
+ return index;
29
+ }
30
+ return current;
31
+ }
@@ -0,0 +1,2 @@
1
+ export declare function initialFocusCandidates<T>(panelFocusables: T[], bodyFocusables: T[], initialFocus?: 'first' | 'body'): T[];
2
+ export declare function pickInitialFocus<T>(panelFocusables: T[], bodyFocusables: T[], initialFocus?: 'first' | 'body'): T | undefined;