rift-ds 1.9.0 → 1.11.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 (377) hide show
  1. package/README.md +3 -3
  2. package/behaviors/useFocusScope.d.ts +12 -6
  3. package/behaviors/useFocusScope.js +12 -2
  4. package/behaviors/useLayer.d.ts +39 -15
  5. package/behaviors/useLayer.js +23 -11
  6. package/bin/templates/chat/app/api/chat/route.ts +3 -0
  7. package/chat/AssistantTurn.d.ts +18 -1
  8. package/chat/AssistantTurn.js +25 -5
  9. package/chat/ChatAgentPane.d.ts +22 -4
  10. package/chat/ChatAgentPane.js +20 -6
  11. package/chat/ChatArtifactPane.d.ts +16 -1
  12. package/chat/ChatArtifactPane.js +12 -10
  13. package/chat/ChatLauncher.d.ts +12 -5
  14. package/chat/ChatLauncher.js +3 -1
  15. package/chat/ChatProvider.d.ts +5 -4
  16. package/chat/ChatProvider.js +1 -1
  17. package/chat/ChatTabs.d.ts +6 -1
  18. package/chat/ChatTabs.js +3 -2
  19. package/chat/ChatThreads.d.ts +19 -4
  20. package/chat/ChatThreads.js +22 -3
  21. package/chat/ChatWidget.css +5 -4
  22. package/chat/ChatWidget.d.ts +119 -5
  23. package/chat/ChatWidget.js +159 -70
  24. package/chat/DemoWelcome.js +17 -5
  25. package/chat/FollowupSuggestions.d.ts +10 -4
  26. package/chat/FollowupSuggestions.js +13 -5
  27. package/chat/ResponseActions.d.ts +14 -0
  28. package/chat/ResponseActions.js +15 -6
  29. package/chat/TurnQuestion.d.ts +24 -0
  30. package/chat/TurnQuestion.js +46 -0
  31. package/chat/demo-card-components.js +2 -1
  32. package/chat/demo-script.js +256 -50
  33. package/chat/followups.d.ts +2 -2
  34. package/chat/followups.js +1 -0
  35. package/chat/index.d.ts +3 -2
  36. package/chat/index.js +11 -0
  37. package/chat/queries.d.ts +2 -2
  38. package/chat/queries.js +3 -2
  39. package/chat/questions.d.ts +97 -0
  40. package/chat/questions.js +140 -0
  41. package/chat/registry.json.d.ts +3 -2
  42. package/chat/registry.json.js +1 -1
  43. package/chat/server.d.ts +19 -0
  44. package/chat/server.js +45 -1
  45. package/chat/sim.d.ts +12 -1
  46. package/chat/sim.js +19 -3
  47. package/chat/threads.d.ts +17 -0
  48. package/chat/threads.js +22 -14
  49. package/chat/types.d.ts +58 -1
  50. package/chat/types.js +1 -0
  51. package/chat/useChat.d.ts +24 -3
  52. package/chat/useChat.js +42 -4
  53. package/components/Accordion/Accordion.d.ts +18 -3
  54. package/components/Accordion/Accordion.js +71 -69
  55. package/components/AgentPlan/AgentPlan.d.ts +16 -0
  56. package/components/AgentPlan/AgentPlan.js +8 -3
  57. package/components/AgentRail/AgentRail.d.ts +24 -4
  58. package/components/AgentRail/AgentRail.js +13 -6
  59. package/components/AgentStatus/AgentStatus.css +1 -0
  60. package/components/AiButton/AiButton.css +3 -1
  61. package/components/AiButton/AiButton.d.ts +7 -1
  62. package/components/AiButton/AiButton.js +6 -3
  63. package/components/Alert/Alert.d.ts +15 -4
  64. package/components/Alert/Alert.js +46 -40
  65. package/components/AlertDialog/AlertDialog.css +1 -1
  66. package/components/AlertDialog/AlertDialog.d.ts +21 -5
  67. package/components/AlertDialog/AlertDialog.js +34 -15
  68. package/components/AnchorNav/AnchorNav.css +1 -1
  69. package/components/AnchorNav/AnchorNav.d.ts +4 -1
  70. package/components/AnchorNav/AnchorNav.js +8 -8
  71. package/components/AppLayout/AppLayout.d.ts +10 -2
  72. package/components/AppLayout/AppLayout.js +55 -42
  73. package/components/AppSidebar/AppSidebar.css +9 -9
  74. package/components/AppSidebar/AppSidebar.d.ts +27 -2
  75. package/components/AppSidebar/AppSidebar.js +30 -15
  76. package/components/ArtifactPanel/ArtifactPanel.d.ts +3 -0
  77. package/components/ArtifactPanel/ArtifactPanel.js +6 -5
  78. package/components/Attachment/Attachment.css +4 -1
  79. package/components/Attachment/AttachmentGroup.d.ts +6 -0
  80. package/components/Attachment/AttachmentGroup.js +10 -1
  81. package/components/Attachment/AttachmentTile.d.ts +2 -0
  82. package/components/Attachment/AttachmentTile.js +3 -2
  83. package/components/Attachment/AttachmentViewer.js +4 -4
  84. package/components/Attachment/fileTypes.d.ts +8 -0
  85. package/components/Avatar/Avatar.css +3 -3
  86. package/components/Avatar/Avatar.d.ts +11 -3
  87. package/components/Avatar/Avatar.js +56 -51
  88. package/components/AvatarGroup/AvatarGroup.css +3 -3
  89. package/components/AvatarGroup/AvatarGroup.d.ts +6 -3
  90. package/components/AvatarGroup/AvatarGroup.js +5 -2
  91. package/components/Badge/Badge.d.ts +9 -2
  92. package/components/Badge/Badge.js +10 -10
  93. package/components/Banner/Banner.d.ts +2 -0
  94. package/components/Banner/Banner.js +2 -1
  95. package/components/BentoTile/BentoTile.css +527 -0
  96. package/components/BentoTile/BentoTile.d.ts +64 -0
  97. package/components/BentoTile/BentoTile.js +303 -0
  98. package/components/BentoTile/BentoTileArt.d.ts +28 -0
  99. package/components/BentoTile/BentoTileArt.js +19 -0
  100. package/components/BottomNav/BottomNav.css +3 -3
  101. package/components/BottomNav/BottomNav.d.ts +6 -0
  102. package/components/BottomNav/BottomNav.js +3 -1
  103. package/components/Breadcrumb/Breadcrumb.d.ts +16 -5
  104. package/components/Breadcrumb/Breadcrumb.js +32 -33
  105. package/components/Button/Button.css +123 -20
  106. package/components/Button/Button.d.ts +18 -3
  107. package/components/Button/Button.js +19 -2
  108. package/components/ButtonGroup/ButtonGroup.d.ts +17 -3
  109. package/components/ButtonGroup/ButtonGroup.js +24 -24
  110. package/components/CardStack/CardStack.d.ts +5 -0
  111. package/components/CardStack/CardStack.js +3 -7
  112. package/components/Carousel/Carousel.d.ts +33 -3
  113. package/components/Carousel/Carousel.js +178 -137
  114. package/components/Chart/AreaChart.d.ts +11 -3
  115. package/components/Chart/AreaChart.js +20 -11
  116. package/components/Chart/BarChart.d.ts +11 -3
  117. package/components/Chart/BarChart.js +19 -9
  118. package/components/Chart/Chart.css +1 -0
  119. package/components/Chart/ComboChart.d.ts +11 -3
  120. package/components/Chart/ComboChart.js +21 -11
  121. package/components/Chart/LineChart.d.ts +11 -3
  122. package/components/Chart/LineChart.js +19 -10
  123. package/components/Chart/PieChart.d.ts +11 -3
  124. package/components/Chart/PieChart.js +18 -9
  125. package/components/Chart/RadarChart.d.ts +11 -3
  126. package/components/Chart/RadarChart.js +20 -11
  127. package/components/Chart/RadialChart.d.ts +11 -3
  128. package/components/Chart/RadialChart.js +18 -9
  129. package/components/Chart/ScatterChart.d.ts +11 -3
  130. package/components/Chart/ScatterChart.js +23 -11
  131. package/components/Chart/StackedBarChart.d.ts +11 -3
  132. package/components/Chart/StackedBarChart.js +19 -10
  133. package/components/Chart/Treemap.d.ts +13 -3
  134. package/components/Chart/Treemap.js +23 -13
  135. package/components/Chart/palette.d.ts +9 -0
  136. package/components/Chart/palette.js +8 -1
  137. package/components/Chart/useChartAnimation.d.ts +42 -0
  138. package/components/Chart/useChartAnimation.js +32 -0
  139. package/components/ChatMessage/ChatMessage.css +1 -0
  140. package/components/ChatThread/ChatThread.css +21 -0
  141. package/components/ChatThread/ChatThread.d.ts +12 -1
  142. package/components/ChatThread/ChatThread.js +48 -1
  143. package/components/Checkbox/Checkbox.d.ts +12 -2
  144. package/components/Checkbox/Checkbox.js +13 -3
  145. package/components/Chip/Chip.css +24 -1
  146. package/components/Chip/Chip.d.ts +28 -7
  147. package/components/Chip/Chip.js +80 -64
  148. package/components/CircularButton/CircularButton.css +127 -1
  149. package/components/CircularButton/CircularButton.d.ts +18 -4
  150. package/components/CircularButton/CircularButton.js +14 -2
  151. package/components/CodeBlock/CodeBlock.d.ts +24 -3
  152. package/components/CodeBlock/CodeBlock.js +93 -80
  153. package/components/CodeDiff/CodeDiff.d.ts +30 -4
  154. package/components/CodeDiff/CodeDiff.js +64 -20
  155. package/components/ColorPicker/ColorPicker.css +1 -1
  156. package/components/ColorPicker/ColorPicker.d.ts +18 -0
  157. package/components/ColorPicker/ColorPicker.js +27 -21
  158. package/components/ColourSwatch/ColourSwatch.css +1 -1
  159. package/components/Combobox/Combobox.css +2 -1
  160. package/components/Combobox/Combobox.d.ts +26 -8
  161. package/components/Combobox/Combobox.js +30 -17
  162. package/components/CommandPalette/CommandPalette.css +13 -1
  163. package/components/CommandPalette/CommandPalette.d.ts +27 -4
  164. package/components/CommandPalette/CommandPalette.js +108 -70
  165. package/components/Composer/Composer.css +2 -1
  166. package/components/Composer/Composer.d.ts +10 -0
  167. package/components/Composer/Composer.js +7 -0
  168. package/components/ContactCard/ContactCard.css +1 -1
  169. package/components/ContactCard/ContactCard.d.ts +34 -5
  170. package/components/ContactCard/ContactCard.js +72 -58
  171. package/components/ContextMenu/ContextMenu.css +4 -4
  172. package/components/ContextMenu/ContextMenu.js +7 -10
  173. package/components/ContributionGraph/ContributionGraph.d.ts +37 -3
  174. package/components/ContributionGraph/ContributionGraph.js +32 -31
  175. package/components/DataTable/DataTable.d.ts +29 -0
  176. package/components/DataTable/DataTable.js +15 -10
  177. package/components/DateInput/DateInput.js +2 -2
  178. package/components/DatePicker/DatePicker.css +19 -4
  179. package/components/DatePicker/DatePicker.d.ts +31 -0
  180. package/components/DatePicker/DatePicker.js +145 -61
  181. package/components/Dialog/Dialog.css +1 -1
  182. package/components/Dialog/Dialog.d.ts +2 -0
  183. package/components/Dialog/Dialog.js +4 -3
  184. package/components/Divider/Divider.d.ts +10 -2
  185. package/components/Divider/Divider.js +56 -25
  186. package/components/DocumentChip/DocumentChip.d.ts +3 -1
  187. package/components/DocumentChip/DocumentChip.js +3 -2
  188. package/components/Drawer/Drawer.css +2 -1
  189. package/components/Drawer/Drawer.d.ts +2 -0
  190. package/components/Drawer/Drawer.js +4 -3
  191. package/components/Dropdown/Dropdown.css +1 -1
  192. package/components/Dropdown/Dropdown.d.ts +9 -2
  193. package/components/Dropdown/Dropdown.js +26 -16
  194. package/components/DropdownMenu/DropdownMenu.css +5 -5
  195. package/components/DropdownMenu/DropdownMenu.d.ts +13 -4
  196. package/components/DropdownMenu/DropdownMenu.js +41 -22
  197. package/components/EmptyState/EmptyState.d.ts +12 -4
  198. package/components/EmptyState/EmptyState.js +30 -26
  199. package/components/EntityCard/EntityCard.d.ts +7 -2
  200. package/components/EntityCard/EntityCard.js +19 -21
  201. package/components/EventCalendar/EventCalendar.d.ts +28 -0
  202. package/components/EventCalendar/EventCalendar.js +29 -27
  203. package/components/Figure/Figure.d.ts +14 -5
  204. package/components/Figure/Figure.js +19 -21
  205. package/components/FileInput/FileInput.d.ts +6 -0
  206. package/components/FileInput/FileInput.js +9 -9
  207. package/components/FilterBar/FilterBar.css +3 -3
  208. package/components/FilterBar/FilterBar.d.ts +6 -1
  209. package/components/FilterBar/FilterBar.js +15 -11
  210. package/components/FunnelChart/FunnelChart.d.ts +13 -1
  211. package/components/FunnelChart/FunnelChart.js +8 -1
  212. package/components/GanttChart/GanttChart.css +1 -1
  213. package/components/GanttChart/GanttChart.d.ts +19 -2
  214. package/components/GanttChart/GanttChart.js +17 -8
  215. package/components/Gauge/Gauge.d.ts +4 -1
  216. package/components/Globe/Globe.css +23 -0
  217. package/components/Globe/Globe.d.ts +19 -2
  218. package/components/Globe/Globe.js +66 -19
  219. package/components/HoverCard/HoverCard.css +1 -1
  220. package/components/HoverCard/HoverCard.d.ts +4 -1
  221. package/components/HoverCard/HoverCard.js +26 -15
  222. package/components/ImageCompare/ImageCompare.d.ts +4 -0
  223. package/components/ImageCompare/ImageCompare.js +4 -2
  224. package/components/Input/Input.js +2 -2
  225. package/components/Inspector/Inspector.css +55 -38
  226. package/components/Inspector/InspectorDropdown.d.ts +6 -1
  227. package/components/Inspector/InspectorDropdown.js +2 -0
  228. package/components/Inspector/InspectorSegmentedControl.d.ts +4 -3
  229. package/components/Inspector/InspectorSegmentedControl.js +63 -11
  230. package/components/Inspector/InspectorToggleSwitch.d.ts +4 -3
  231. package/components/Inspector/InspectorToggleSwitch.js +35 -2
  232. package/components/Instructions/Instructions.css +1 -1
  233. package/components/Instructions/Instructions.d.ts +16 -5
  234. package/components/Instructions/Instructions.js +31 -26
  235. package/components/InterruptCard/InterruptCard.d.ts +13 -2
  236. package/components/InterruptCard/InterruptCard.js +9 -7
  237. package/components/Lightbox/Lightbox.css +1 -1
  238. package/components/Lightbox/Lightbox.d.ts +8 -0
  239. package/components/Lightbox/Lightbox.js +10 -6
  240. package/components/LinkList/LinkList.css +2 -2
  241. package/components/LinkList/LinkList.d.ts +11 -2
  242. package/components/LinkList/LinkList.js +40 -36
  243. package/components/Mention/Mention.d.ts +4 -1
  244. package/components/MessageActions/MessageActions.css +8 -0
  245. package/components/MessageActions/MessageActions.d.ts +2 -0
  246. package/components/MessageActions/MessageActions.js +2 -1
  247. package/components/MessageCard/MessageCard.d.ts +4 -1
  248. package/components/Meter/Meter.d.ts +5 -1
  249. package/components/ModelPicker/ModelPicker.css +2 -2
  250. package/components/ModelPicker/ModelPicker.d.ts +12 -1
  251. package/components/ModelPicker/ModelPicker.js +27 -16
  252. package/components/MotionSwatch/MotionSwatch.d.ts +3 -1
  253. package/components/MotionSwatch/MotionSwatch.js +2 -1
  254. package/components/Nav/Nav.d.ts +2 -2
  255. package/components/Nav/Nav.js +17 -21
  256. package/components/NavList/NavList.d.ts +4 -0
  257. package/components/NavList/NavList.js +3 -1
  258. package/components/NotificationCenter/NotificationCenter.css +1 -1
  259. package/components/NotificationCenter/NotificationCenter.d.ts +48 -5
  260. package/components/NotificationCenter/NotificationCenter.js +32 -15
  261. package/components/NumberInput/NumberInput.d.ts +4 -0
  262. package/components/NumberInput/NumberInput.js +4 -2
  263. package/components/Pagination/Pagination.d.ts +33 -7
  264. package/components/Pagination/Pagination.js +67 -55
  265. package/components/PinInput/PinInput.d.ts +6 -0
  266. package/components/PinInput/PinInput.js +3 -1
  267. package/components/Popover/Popover.css +1 -1
  268. package/components/Popover/Popover.d.ts +21 -5
  269. package/components/Popover/Popover.js +102 -97
  270. package/components/ProgressBar/ProgressBar.d.ts +10 -3
  271. package/components/ProgressBar/ProgressBar.js +34 -22
  272. package/components/PromptSuggestions/PromptSuggestions.css +67 -0
  273. package/components/PromptSuggestions/PromptSuggestions.d.ts +10 -0
  274. package/components/PromptSuggestions/PromptSuggestions.js +41 -26
  275. package/components/QuestionCard/QuestionCard.css +358 -0
  276. package/components/QuestionCard/QuestionCard.d.ts +138 -0
  277. package/components/QuestionCard/QuestionCard.js +378 -0
  278. package/components/Quote/Quote.d.ts +8 -3
  279. package/components/Quote/Quote.js +18 -21
  280. package/components/RadioButton/RadioButton.d.ts +6 -1
  281. package/components/RadioButton/RadioButton.js +7 -2
  282. package/components/Rating/Rating.d.ts +6 -0
  283. package/components/Rating/Rating.js +4 -2
  284. package/components/Reasoning/Reasoning.css +1 -0
  285. package/components/Reasoning/Reasoning.d.ts +7 -1
  286. package/components/Reasoning/Reasoning.js +4 -1
  287. package/components/RichDropdown/RichDropdown.css +1 -1
  288. package/components/RichDropdown/RichDropdown.d.ts +3 -1
  289. package/components/RichDropdown/RichDropdown.js +20 -15
  290. package/components/SectionTitle/SectionTitle.d.ts +15 -3
  291. package/components/SectionTitle/SectionTitle.js +15 -17
  292. package/components/SegmentedControl/SegmentedControl.css +3 -2
  293. package/components/SegmentedControl/SegmentedControl.d.ts +49 -7
  294. package/components/SegmentedControl/SegmentedControl.js +248 -223
  295. package/components/SelectionCard/SelectionCard.d.ts +7 -1
  296. package/components/SelectionCard/SelectionCard.js +16 -2
  297. package/components/ShaderField/ShaderField.js +2 -1
  298. package/components/ShaderField/useShaderField.js +3 -2
  299. package/components/SidebarPanel/SidebarPanel.d.ts +6 -1
  300. package/components/SidebarPanel/SidebarPanel.js +2 -1
  301. package/components/Skeleton/Skeleton.d.ts +12 -3
  302. package/components/Skeleton/Skeleton.js +53 -19
  303. package/components/Slider/Slider.d.ts +11 -2
  304. package/components/Slider/Slider.js +11 -6
  305. package/components/SourceChip/SourceChip.css +1 -1
  306. package/components/SourceChip/SourceChip.d.ts +5 -2
  307. package/components/SourceChip/SourceChip.js +14 -13
  308. package/components/SourceTrail/SourceTrail.d.ts +15 -0
  309. package/components/SourceTrail/SourceTrail.js +10 -4
  310. package/components/Sparkline/Sparkline.d.ts +4 -3
  311. package/components/Sparkline/Sparkline.js +2 -1
  312. package/components/Spinner/Spinner.d.ts +21 -4
  313. package/components/Spinner/Spinner.js +38 -37
  314. package/components/SplitButton/SplitButton.d.ts +10 -1
  315. package/components/SplitButton/SplitButton.js +13 -3
  316. package/components/Stat/Stat.d.ts +7 -2
  317. package/components/Stat/Stat.js +30 -25
  318. package/components/StatusDot/StatusDot.css +1 -0
  319. package/components/Stepper/Stepper.css +13 -0
  320. package/components/Stepper/Stepper.d.ts +6 -0
  321. package/components/Stepper/Stepper.js +2 -0
  322. package/components/StreamingText/StreamingText.d.ts +4 -4
  323. package/components/StreamingText/StreamingText.js +3 -2
  324. package/components/Tabs/Tabs.d.ts +41 -6
  325. package/components/Tabs/Tabs.js +99 -69
  326. package/components/TagInput/TagInput.d.ts +2 -0
  327. package/components/TagInput/TagInput.js +7 -2
  328. package/components/Textarea/Textarea.d.ts +6 -1
  329. package/components/Textarea/Textarea.js +11 -5
  330. package/components/ThreadPanel/ThreadPanel.css +1 -1
  331. package/components/ThreadPanel/ThreadPanel.d.ts +11 -4
  332. package/components/ThreadPanel/ThreadPanel.js +3 -1
  333. package/components/ThreadTabs/ThreadTabs.d.ts +7 -2
  334. package/components/ThreadTabs/ThreadTabs.js +1 -1
  335. package/components/TimePicker/TimePicker.css +1 -1
  336. package/components/TimePicker/TimePicker.d.ts +14 -1
  337. package/components/TimePicker/TimePicker.js +22 -17
  338. package/components/Timeline/Timeline.css +2 -2
  339. package/components/Timeline/Timeline.d.ts +11 -2
  340. package/components/Timeline/Timeline.js +37 -26
  341. package/components/Toast/Toast.css +2 -2
  342. package/components/Toast/Toast.d.ts +24 -6
  343. package/components/Toast/Toast.js +50 -41
  344. package/components/ToggleGroup/ToggleGroup.css +3 -2
  345. package/components/ToggleGroup/ToggleGroup.d.ts +26 -4
  346. package/components/ToggleGroup/ToggleGroup.js +12 -5
  347. package/components/ToggleSwitch/ToggleSwitch.d.ts +6 -1
  348. package/components/ToggleSwitch/ToggleSwitch.js +7 -2
  349. package/components/ToolCall/ToolCall.js +1 -1
  350. package/components/Tooltip/Tooltip.css +5 -5
  351. package/components/Tooltip/Tooltip.d.ts +15 -4
  352. package/components/Tooltip/Tooltip.js +80 -61
  353. package/components/TopAppBar/TopAppBar.css +1 -1
  354. package/components/TopAppBar/TopAppBar.d.ts +9 -1
  355. package/components/TopAppBar/TopAppBar.js +3 -1
  356. package/components/TypographySwatch/TypographySwatch.css +1 -1
  357. package/components/UsageCard/UsageCard.d.ts +4 -1
  358. package/components/Waveform/Waveform.css +1 -0
  359. package/components/Waveform/Waveform.d.ts +1 -1
  360. package/components/WorldMap/WorldMap.d.ts +12 -0
  361. package/components/WorldMap/WorldMap.js +11 -5
  362. package/components/registry.json +44 -19
  363. package/components/registry.json.d.ts +44 -19
  364. package/components/registry.json.js +1 -1
  365. package/index.d.ts +3 -0
  366. package/index.js +7 -0
  367. package/package.json +5 -1
  368. package/tokens/breakpoints.d.ts +60 -0
  369. package/tokens/breakpoints.js +92 -0
  370. package/tokens/motion.d.ts +14 -0
  371. package/tokens/motion.js +15 -1
  372. package/tokens/registry.d.ts +1 -1
  373. package/tokens/registry.json +21 -0
  374. package/tokens/registry.json.d.ts +21 -0
  375. package/tokens/registry.json.js +1 -1
  376. package/tokens/tokens-dark.css +7 -0
  377. package/tokens/tokens-light.css +41 -0
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
- import { useSyncExternalStore, useRef, useEffect, useState, useId, useMemo } from "react";
3
+ import { useMemo, useRef, useEffect, useSyncExternalStore, useState, useId } from "react";
4
4
  import { AttachmentDropZone } from "../components/Attachment/AttachmentDropZone.js";
5
5
  import { AttachmentGroup } from "../components/Attachment/AttachmentGroup.js";
6
6
  import { useAttachments } from "../components/Attachment/useAttachments.js";
@@ -22,16 +22,22 @@ import { ChatArtifactPane } from "./ChatArtifactPane.js";
22
22
  import { ChatTabs } from "./ChatTabs.js";
23
23
  import { ChatThreads } from "./ChatThreads.js";
24
24
  import { useChatWidget, ArtifactSeatContext } from "./context.js";
25
- import { subscribeClock, readGreeting, serverGreeting } from "./greeting.js";
25
+ import { DEFAULT_GREETING_COPY, subscribeClock, greetingFor, serverGreeting } from "./greeting.js";
26
26
  import { CHAT_PLACEMENTS, chatPlacement } from "./placement.js";
27
27
  import { ASIDE_WITH_THREADS_MIN_WIDTH, ARTIFACT_MIN_COLUMN_WIDTH, THREADS_RAIL_MIN_WIDTH, ASIDE_RAIL_MIN_WIDTH } from "./queries.js";
28
28
  import { fitsChip } from "./suggestions.js";
29
29
  import { TurnCard } from "./TurnContent.js";
30
+ import { isBlockingQuestion } from "./questions.js";
31
+ import { ReplyBody } from "./TurnQuestion.js";
32
+ import { ResponseActionsLabelsContext } from "./ResponseActions.js";
33
+ import { FollowupSuggestionsLabelContext } from "./FollowupSuggestions.js";
30
34
  import "./ChatWidget.css";
31
35
  const DEFAULT_MAX_ATTACHMENTS = 10;
32
36
  const DEFAULT_MAX_ATTACHMENT_BYTES = 50 * 1024 * 1024;
33
37
  const LONG_PASTE_CHARS = 1200;
34
38
  const formatBytes = (bytes) => bytes >= 1024 * 1024 * 1024 ? `${Math.round(bytes / (1024 * 1024 * 1024))} GB` : `${Math.round(bytes / (1024 * 1024))} MB`;
39
+ const defaultAttachHint = (maxSize, maxFiles) => `Up to ${maxSize} each · ${maxFiles} files max`;
40
+ const defaultContextNote = (title) => `Looking at “${title}”`;
35
41
  const withAgentMark = (profile, title) => profile.avatar || profile.avatarSrc ? profile : { ...profile, avatar: /* @__PURE__ */ jsx(PixelAvatar, { name: title, size: "lg", label: title }) };
36
42
  function ChatWidget({
37
43
  fullscreenEnabled = true,
@@ -40,7 +46,9 @@ function ChatWidget({
40
46
  compact = false,
41
47
  phone = false,
42
48
  title = "Assistant",
49
+ flow = "top-down",
43
50
  placeholder = "Ask anything",
51
+ questionsPlaceholder = "Answer the questions above, or skip them",
44
52
  showStarters = true,
45
53
  logo = null,
46
54
  tagline = "How can I help you today?",
@@ -61,11 +69,74 @@ function ChatWidget({
61
69
  agent,
62
70
  artifacts = false,
63
71
  contextLabel,
72
+ contextNote = defaultContextNote,
73
+ attachHint: attachHintText = defaultAttachHint,
74
+ greetings,
75
+ placementLabels,
76
+ agentStatus = "Connected",
77
+ artifactPanelTitle = "Artifacts",
78
+ artifactEmptyTitle = "Nothing here yet",
79
+ artifactEmptyDescription = "What the chat makes for you, like a dashboard or a page, opens in this panel.",
64
80
  widgets,
65
81
  widgetsLayout = "fit",
66
82
  widgetsWidth = "column",
67
- disclaimer = "Answers may be wrong."
83
+ disclaimer = "Answers may be wrong.",
84
+ startersLabel = "Conversation starters",
85
+ newChatLabel = "New chat",
86
+ showAgentLabel = "Show the agent panel",
87
+ hideAgentLabel = "Hide the agent panel",
88
+ closeAgentLabel = "Close the agent panel",
89
+ showArtifactLabel = "Show the artifact panel",
90
+ hideArtifactLabel = "Hide the artifact panel",
91
+ closeArtifactLabel = "Close the artifact panel",
92
+ placementLabel = "Chat position",
93
+ enterFullscreenLabel = "Enter full screen",
94
+ exitFullscreenLabel = "Exit full screen",
95
+ closeLabel = "Close chat",
96
+ openThreadsLabel = "Open the chat history",
97
+ closeThreadsLabel = "Close the chat history",
98
+ modelPickerLabel = "Choose a model",
99
+ sendLabel = "Send",
100
+ copyResponseLabel = "Copy response",
101
+ copiedResponseLabel = "Copied",
102
+ copiedAnnouncementLabel = "Copied to clipboard",
103
+ goodResponseLabel = "Good response",
104
+ badResponseLabel = "Bad response",
105
+ followupsLabel = "Follow-up questions",
106
+ pastedTextLabel,
107
+ reasoningLabel,
108
+ tabsProps,
109
+ composerLabels,
110
+ attachmentDropZoneLabels,
111
+ attachmentGroupLabels,
112
+ chatThreadLabels,
113
+ modelPickerLabels,
114
+ artifactPanelLabels,
115
+ agentRailLabels,
116
+ questionCardLabels,
117
+ questionSummaryLabels,
118
+ codeBlockLabels,
119
+ promptSuggestionsLabels
68
120
  }) {
121
+ const responseActionsLabels = useMemo(
122
+ () => ({
123
+ copy: copyResponseLabel,
124
+ copied: copiedResponseLabel,
125
+ copiedAnnouncement: copiedAnnouncementLabel,
126
+ good: goodResponseLabel,
127
+ bad: badResponseLabel
128
+ }),
129
+ [copyResponseLabel, copiedResponseLabel, copiedAnnouncementLabel, goodResponseLabel, badResponseLabel]
130
+ );
131
+ const turnLabels = useMemo(
132
+ () => ({
133
+ codeBlock: codeBlockLabels,
134
+ reasoning: reasoningLabel,
135
+ questionCard: questionCardLabels,
136
+ promptSuggestions: promptSuggestionsLabels
137
+ }),
138
+ [codeBlockLabels, reasoningLabel, questionCardLabels, promptSuggestionsLabels]
139
+ );
69
140
  const {
70
141
  turns,
71
142
  live,
@@ -91,6 +162,14 @@ function ChatWidget({
91
162
  openArtifact,
92
163
  closeArtifact
93
164
  } = useChatWidget();
165
+ const questionsOpen = isBlockingQuestion(turns[turns.length - 1], live !== null);
166
+ const questionsWereOpen = useRef(questionsOpen);
167
+ useEffect(() => {
168
+ if (questionsWereOpen.current && !questionsOpen) {
169
+ composerRef.current?.focus({ preventScroll: true });
170
+ }
171
+ questionsWereOpen.current = questionsOpen;
172
+ }, [questionsOpen]);
94
173
  const lockedValues = modelPolicy?.locked ?? [];
95
174
  const pick = chosenModel && !lockedValues.includes(chosenModel) ? chosenModel : null;
96
175
  const pickerValue = pick ?? modelPolicy?.default ?? defaultModel ?? models?.[0]?.value;
@@ -100,7 +179,12 @@ function ChatWidget({
100
179
  description: lockedValues.includes(option.value) ? lockedModelDescription : option.description,
101
180
  disabled: lockedValues.includes(option.value)
102
181
  }));
103
- const greeting = useSyncExternalStore(subscribeClock, readGreeting, serverGreeting);
182
+ const greetingCopy = { ...DEFAULT_GREETING_COPY, ...greetings };
183
+ const greeting = useSyncExternalStore(
184
+ subscribeClock,
185
+ () => greetingFor((/* @__PURE__ */ new Date()).getHours(), greetingCopy),
186
+ serverGreeting
187
+ );
104
188
  const starters = (startersInput ?? []).filter((starter) => fitsChip(starter.label));
105
189
  const composerRef = useRef(null);
106
190
  const focusComposer = () => composerRef.current?.focus({ preventScroll: true });
@@ -108,7 +192,7 @@ function ChatWidget({
108
192
  if (open) focusComposer();
109
193
  }, [open]);
110
194
  const queue = useAttachments({ maxCount: maxAttachments, maxSize: maxAttachmentBytes });
111
- const attachHint = `Up to ${formatBytes(maxAttachmentBytes)} each · ${maxAttachments} files max`;
195
+ const attachHint = attachHintText(formatBytes(maxAttachmentBytes), maxAttachments, maxAttachmentBytes);
112
196
  const handleSubmit = (value) => {
113
197
  if (fileAttachments && queue.items.length > 0) {
114
198
  const ready = queue.items.filter((item) => item.status === "ready");
@@ -136,13 +220,15 @@ function ChatWidget({
136
220
  const renderAside = aside ?? (agent ? (ctx) => /* @__PURE__ */ jsx(
137
221
  ChatAgentPane,
138
222
  {
139
- profile: withAgentMark(agent.profile ?? { name: title, status: "Connected" }, title),
223
+ profile: withAgentMark(agent.profile ?? { name: title, status: agentStatus }, title),
140
224
  tabs: agent.tabs,
225
+ closeLabel: closeAgentLabel,
226
+ agentRailLabels,
141
227
  overlay: ctx.overlay,
142
228
  onClose: ctx.close
143
229
  }
144
230
  ) : void 0);
145
- const tabsNode = tabs === true ? /* @__PURE__ */ jsx(ChatTabs, {}) : tabs || null;
231
+ const tabsNode = tabs === true ? /* @__PURE__ */ jsx(ChatTabs, { ...tabsProps }) : tabs || null;
146
232
  const hasRails = Boolean(renderThreads || renderAside || artifacts);
147
233
  const [threadsOpen, setThreadsOpen] = useState(false);
148
234
  const [asideOpen, setAsideOpen] = useState(Boolean(agent?.defaultOpen));
@@ -280,7 +366,7 @@ function ChatWidget({
280
366
  PromptSuggestions,
281
367
  {
282
368
  layout: "stack",
283
- ariaLabel: "Conversation starters",
369
+ ariaLabel: startersLabel,
284
370
  pending: startersThinking,
285
371
  entrance: startersEntrance,
286
372
  suggestions: starters,
@@ -301,7 +387,7 @@ function ChatWidget({
301
387
  {
302
388
  icon: "edit_square",
303
389
  variant: "tertiary",
304
- ariaLabel: "New chat",
390
+ ariaLabel: newChatLabel,
305
391
  tooltipPosition: "bottom",
306
392
  onClick: () => {
307
393
  reset();
@@ -316,7 +402,7 @@ function ChatWidget({
316
402
  icon: /* @__PURE__ */ jsx(PixelAvatar, { name: title, size: "sm" }),
317
403
  variant: "tertiary",
318
404
  className: asideShown ? "ds-chat-widget__agent-toggle--on" : void 0,
319
- ariaLabel: asideShown ? "Hide the agent panel" : "Show the agent panel",
405
+ ariaLabel: asideShown ? hideAgentLabel : showAgentLabel,
320
406
  tooltipPosition: "bottom",
321
407
  "aria-expanded": asideShown,
322
408
  "aria-controls": asideShown ? asideId : void 0,
@@ -329,7 +415,7 @@ function ChatWidget({
329
415
  icon: artifactShown ? "right_panel_close" : "right_panel_open",
330
416
  variant: "tertiary",
331
417
  className: artifactShown ? "ds-chat-widget__agent-toggle--on" : void 0,
332
- ariaLabel: artifactShown ? "Hide the artifact panel" : "Show the artifact panel",
418
+ ariaLabel: artifactShown ? hideArtifactLabel : showArtifactLabel,
333
419
  tooltipPosition: "bottom",
334
420
  "aria-expanded": artifactShown,
335
421
  "aria-controls": artifactShown ? artifactId : void 0,
@@ -340,51 +426,40 @@ function ChatWidget({
340
426
  }
341
427
  }
342
428
  ),
343
- placementEnabled && /* @__PURE__ */ jsx(
344
- "span",
429
+ placementEnabled && /* @__PURE__ */ jsx("span", { className: "ds-chat-widget__placement-menu", children: /* @__PURE__ */ jsx(
430
+ DropdownMenu,
345
431
  {
346
- className: "ds-chat-widget__placement-menu",
347
- onKeyDown: (event) => {
348
- if (event.key === "Escape" && event.currentTarget.querySelector('[aria-expanded="true"]')) {
349
- event.stopPropagation();
432
+ align: "end",
433
+ trigger: /* @__PURE__ */ jsx(
434
+ CircularButton,
435
+ {
436
+ icon: chatPlacement(placement).icon,
437
+ variant: "tertiary",
438
+ ariaLabel: placementLabel,
439
+ tooltipPosition: "bottom",
440
+ disabled: isFull
350
441
  }
351
- },
352
- children: /* @__PURE__ */ jsx(
353
- DropdownMenu,
442
+ ),
443
+ items: [
354
444
  {
355
- align: "end",
356
- trigger: /* @__PURE__ */ jsx(
357
- CircularButton,
358
- {
359
- icon: chatPlacement(placement).icon,
360
- variant: "tertiary",
361
- ariaLabel: "Chat position",
362
- tooltipPosition: "bottom",
363
- disabled: isFull
364
- }
365
- ),
366
- items: [
367
- {
368
- type: "group",
369
- label: "Chat position",
370
- items: CHAT_PLACEMENTS.map(({ id, label, icon }) => ({
371
- label,
372
- icon,
373
- selected: placement === id,
374
- onClick: () => setPlacement(id)
375
- }))
376
- }
377
- ]
445
+ type: "group",
446
+ label: placementLabel,
447
+ items: CHAT_PLACEMENTS.map(({ id, label, icon }) => ({
448
+ label: placementLabels?.[id] ?? label,
449
+ icon,
450
+ selected: placement === id,
451
+ onClick: () => setPlacement(id)
452
+ }))
378
453
  }
379
- )
454
+ ]
380
455
  }
381
- ),
456
+ ) }),
382
457
  fullscreenEnabled && /* @__PURE__ */ jsx(
383
458
  CircularButton,
384
459
  {
385
460
  icon: isFull ? "close_fullscreen" : "open_in_full",
386
461
  variant: "tertiary",
387
- ariaLabel: isFull ? "Exit full screen" : "Enter full screen",
462
+ ariaLabel: isFull ? exitFullscreenLabel : enterFullscreenLabel,
388
463
  tooltipPosition: "bottom",
389
464
  onClick: () => setView(isFull ? "panel" : "full")
390
465
  }
@@ -394,14 +469,14 @@ function ChatWidget({
394
469
  {
395
470
  icon: "close",
396
471
  variant: "tertiary",
397
- ariaLabel: "Close chat",
472
+ ariaLabel: closeLabel,
398
473
  tooltipPosition: "bottom",
399
474
  onClick: () => setOpen(false)
400
475
  }
401
476
  )
402
477
  ] });
403
478
  const ChatRoot = fileAttachments ? AttachmentDropZone : "div";
404
- const dropProps = fileAttachments ? { onFilesSelected: queue.add, hint: attachHint } : {};
479
+ const dropProps = fileAttachments ? { ...attachmentDropZoneLabels, onFilesSelected: queue.add, hint: attachHint } : {};
405
480
  const [rootScrolling, setRootScrolling] = useState(false);
406
481
  const rootSettleTimer = useRef(void 0);
407
482
  const handleRootScroll = () => {
@@ -424,6 +499,7 @@ function ChatWidget({
424
499
  onScroll: handleRootScroll,
425
500
  "data-lifted-actions": trailingInline || void 0,
426
501
  onKeyDown: (e) => {
502
+ if (e.key === "Escape" && e.defaultPrevented) return;
427
503
  if (e.key === "Escape" && (threadsOpen || asideShown && !asideWide || artifactShown && !asideWide)) {
428
504
  e.stopPropagation();
429
505
  if (threadsOpen) closeThreads();
@@ -454,7 +530,7 @@ function ChatWidget({
454
530
  {
455
531
  icon: "menu",
456
532
  variant: "tertiary",
457
- ariaLabel: "Open the chat history",
533
+ ariaLabel: openThreadsLabel,
458
534
  tooltipPosition: "bottom",
459
535
  onClick: () => setThreadsOpen(true)
460
536
  }
@@ -478,7 +554,7 @@ function ChatWidget({
478
554
  ),
479
555
  tabsNode && /* @__PURE__ */ jsx("div", { className: "ds-chat-widget__tabs-row", children: tabsNode }),
480
556
  /* @__PURE__ */ jsxs("div", { className: "ds-chat-widget__body", children: [
481
- /* @__PURE__ */ jsx(ArtifactSeatContext.Provider, { value: artifacts, children: /* @__PURE__ */ jsx(ChatThread, { className: "ds-chat-widget__thread", children: [
557
+ /* @__PURE__ */ jsx(ArtifactSeatContext.Provider, { value: artifacts, children: /* @__PURE__ */ jsx(ResponseActionsLabelsContext.Provider, { value: responseActionsLabels, children: /* @__PURE__ */ jsx(FollowupSuggestionsLabelContext.Provider, { value: followupsLabel, children: /* @__PURE__ */ jsx(ChatThread, { ...chatThreadLabels, className: "ds-chat-widget__thread", flow, children: [
482
558
  ...turns.map(
483
559
  (turn) => turn.bare ? (
484
560
  /* Conversation furniture (a day marker): the injected
@@ -491,18 +567,18 @@ function ChatWidget({
491
567
  ChatMessage,
492
568
  {
493
569
  role: "user",
494
- attachments: turn.attachments ? /* @__PURE__ */ jsx(AttachmentGroup, { align: "end", items: turn.attachments }) : /* @__PURE__ */ jsxs(Fragment, { children: [
570
+ attachments: turn.attachments ? /* @__PURE__ */ jsx(AttachmentGroup, { ...attachmentGroupLabels, align: "end", items: turn.attachments }) : /* @__PURE__ */ jsxs(Fragment, { children: [
495
571
  turn.content,
496
572
  turn.card && /* @__PURE__ */ jsx(TurnCard, { card: turn.card })
497
573
  ] }),
498
- children: mentions && turn.text ? /* @__PURE__ */ jsx(MentionText, { text: turn.text, sources: mentions }) : turn.text
574
+ children: turn.reply ? /* @__PURE__ */ jsx(ReplyBody, { reply: turn.reply, text: turn.text, missingLabel: questionSummaryLabels?.missingLabel }) : mentions && turn.text ? /* @__PURE__ */ jsx(MentionText, { text: turn.text, sources: mentions }) : turn.text
499
575
  },
500
576
  turn.id
501
577
  )
502
- ) : /* @__PURE__ */ jsx(AssistantTurn, { turn }, turn.id)
578
+ ) : /* @__PURE__ */ jsx(AssistantTurn, { turn, labels: turnLabels }, turn.id)
503
579
  ),
504
- ...live ? [/* @__PURE__ */ jsx(AssistantTurn, { live }, live.id)] : []
505
- ] }) }),
580
+ ...live ? [/* @__PURE__ */ jsx(AssistantTurn, { live, labels: turnLabels }, live.id)] : []
581
+ ] }) }) }) }),
506
582
  isEmpty && /* @__PURE__ */ jsx("div", { className: "ds-chat-widget__welcome", children: /* @__PURE__ */ jsxs("div", { className: "ds-chat-widget__greeting", children: [
507
583
  /* @__PURE__ */ jsx("p", { className: "ds-chat-widget__hello", children: greeting }),
508
584
  /* @__PURE__ */ jsx("p", { className: "ds-chat-widget__ask", children: tagline })
@@ -514,20 +590,18 @@ function ChatWidget({
514
590
  /* @__PURE__ */ jsx("footer", { className: "ds-chat-widget__footer", children: /* @__PURE__ */ jsx("div", { className: "ds-chat-widget__composer", children: /* @__PURE__ */ jsx(
515
591
  Composer,
516
592
  {
593
+ ...composerLabels,
517
594
  ref: composerRef,
518
- placeholder,
519
- sendLabel: "Send",
595
+ placeholder: questionsOpen ? questionsPlaceholder : placeholder,
596
+ disabled: questionsOpen,
597
+ sendLabel,
520
598
  aiGlow: true,
521
599
  value: draft,
522
600
  onValueChange: setDraft,
523
601
  onSubmit: handleSubmit,
524
602
  streaming,
525
603
  onStop: stop,
526
- context: contextLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
527
- "Looking at “",
528
- contextLabel,
529
- "”"
530
- ] }) : void 0,
604
+ context: contextLabel ? contextNote(contextLabel) : void 0,
531
605
  contextIcon: "description",
532
606
  contextPlacement: "above",
533
607
  mentions,
@@ -536,7 +610,7 @@ function ChatWidget({
536
610
  onFilesSelected: queue.add,
537
611
  onFileRemove: queue.remove,
538
612
  pasteThreshold: LONG_PASTE_CHARS,
539
- onPasteAsAttachment: (text) => queue.addText(text)
613
+ onPasteAsAttachment: (text) => queue.addText(text, pastedTextLabel)
540
614
  } : {},
541
615
  actions: (
542
616
  /* A host can slot its own leading actions. The default is the
@@ -547,11 +621,12 @@ function ChatWidget({
547
621
  composerActions ?? (pickerModels.length > 0 ? /* @__PURE__ */ jsx(
548
622
  ModelPicker,
549
623
  {
624
+ ...modelPickerLabels,
550
625
  models: pickerModels,
551
626
  value: pickerValue,
552
627
  onValueChange: setChosenModel,
553
628
  placement: "top",
554
- "aria-label": "Choose a model"
629
+ "aria-label": modelPickerLabel
555
630
  }
556
631
  ) : void 0)
557
632
  )
@@ -582,7 +657,7 @@ function ChatWidget({
582
657
  "data-artifact-resizing": artifactResizing || void 0,
583
658
  style: artifactWidth !== null ? { "--ds-chat-artifact-width": `${artifactWidth}px` } : void 0,
584
659
  onKeyDown: (event) => {
585
- if (event.key === "Escape" && artifactExpanded) {
660
+ if (event.key === "Escape" && artifactExpanded && !event.defaultPrevented) {
586
661
  event.stopPropagation();
587
662
  setArtifactExpanded(false);
588
663
  }
@@ -625,7 +700,11 @@ function ChatWidget({
625
700
  artifact: heldArtifact,
626
701
  expanded: artifactExpanded,
627
702
  onExpandedChange: setArtifactExpanded,
628
- onClose: closeArtifactPanel
703
+ onClose: closeArtifactPanel,
704
+ artifactPanelLabels,
705
+ emptyPanelTitle: artifactPanelTitle,
706
+ emptyTitle: artifactEmptyTitle,
707
+ emptyDescription: artifactEmptyDescription
629
708
  }
630
709
  ) })
631
710
  }
@@ -640,7 +719,7 @@ function ChatWidget({
640
719
  {
641
720
  type: "button",
642
721
  className: "ds-chat-widget__rail-scrim",
643
- "aria-label": "Close the artifact panel",
722
+ "aria-label": closeArtifactLabel,
644
723
  tabIndex: artifactShown ? 0 : -1,
645
724
  onClick: closeArtifactPanel
646
725
  }
@@ -652,7 +731,17 @@ function ChatWidget({
652
731
  id: artifactId,
653
732
  children: [
654
733
  /* @__PURE__ */ jsx("span", { className: "ds-chat-widget__aside-grabber", "aria-hidden": "true" }),
655
- /* @__PURE__ */ jsx("div", { className: "ds-chat-widget__aside-sheet-body", children: /* @__PURE__ */ jsx(ChatArtifactPane, { artifact: heldArtifact, onClose: closeArtifactPanel }) })
734
+ /* @__PURE__ */ jsx("div", { className: "ds-chat-widget__aside-sheet-body", children: /* @__PURE__ */ jsx(
735
+ ChatArtifactPane,
736
+ {
737
+ artifact: heldArtifact,
738
+ onClose: closeArtifactPanel,
739
+ artifactPanelLabels,
740
+ emptyPanelTitle: artifactPanelTitle,
741
+ emptyTitle: artifactEmptyTitle,
742
+ emptyDescription: artifactEmptyDescription
743
+ }
744
+ ) })
656
745
  ]
657
746
  }
658
747
  )
@@ -669,7 +758,7 @@ function ChatWidget({
669
758
  {
670
759
  type: "button",
671
760
  className: "ds-chat-widget__rail-scrim",
672
- "aria-label": "Close the chat history",
761
+ "aria-label": closeThreadsLabel,
673
762
  tabIndex: threadsOpen ? 0 : -1,
674
763
  onClick: closeThreads
675
764
  }
@@ -688,7 +777,7 @@ function ChatWidget({
688
777
  {
689
778
  type: "button",
690
779
  className: "ds-chat-widget__rail-scrim",
691
- "aria-label": "Close the agent panel",
780
+ "aria-label": closeAgentLabel,
692
781
  tabIndex: asideShown ? 0 : -1,
693
782
  onClick: closeAside
694
783
  }
@@ -61,7 +61,7 @@ function DemoBoard({ onAsk }) {
61
61
  /* @__PURE__ */ jsx(WidgetRow, { title: "How is the trial going?", meta: "Ask", onClick: () => onAsk("How is the trial going?") })
62
62
  ] }),
63
63
  /* @__PURE__ */ jsx(Widget, { title: "Projects", count: BOARD_PROJECTS.length, children: BOARD_PROJECTS.map(([name, state, when]) => /* @__PURE__ */ jsx(WidgetRow, { leading: /* @__PURE__ */ jsx(PixelAvatar, { name }), title: name, description: state, meta: when }, name)) }),
64
- /* @__PURE__ */ jsxs(Widget, { title: "To do", count: 4, children: [
64
+ /* @__PURE__ */ jsxs(Widget, { title: "To do", count: 5, children: [
65
65
  /* @__PURE__ */ jsxs(WidgetGroup, { label: "Waiting on you", children: [
66
66
  /* @__PURE__ */ jsx(
67
67
  WidgetRow,
@@ -70,7 +70,7 @@ function DemoBoard({ onAsk }) {
70
70
  title: "Invite the other three",
71
71
  description: "2 of 5 seats filled",
72
72
  meta: "Today",
73
- onClick: () => onAsk("Go ahead and invite the other three")
73
+ onClick: () => onAsk("Invite my team to a workspace")
74
74
  }
75
75
  ),
76
76
  /* @__PURE__ */ jsx(
@@ -80,7 +80,17 @@ function DemoBoard({ onAsk }) {
80
80
  title: "Choose a plan",
81
81
  description: "Trial ends in 9 days",
82
82
  meta: "Oct 19",
83
- onClick: () => onAsk("Which plan fits a team of five?")
83
+ onClick: () => onAsk("Help me pick a plan")
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsx(
87
+ WidgetRow,
88
+ {
89
+ leading: /* @__PURE__ */ jsx(StatusDot, { variant: "info", size: "sm", "aria-hidden": "true" }),
90
+ title: "Plan the launch kickoff",
91
+ description: "A date, who comes, and how",
92
+ meta: "Oct 21",
93
+ onClick: () => onAsk("Plan our launch kickoff")
84
94
  }
85
95
  )
86
96
  ] }),
@@ -91,7 +101,8 @@ function DemoBoard({ onAsk }) {
91
101
  leading: /* @__PURE__ */ jsx(StatusDot, { variant: "positive", size: "sm", "aria-hidden": "true" }),
92
102
  title: "Shared calendar",
93
103
  description: "Synced an hour ago",
94
- meta: "On"
104
+ meta: "On",
105
+ onClick: () => onAsk("Find a time we can all meet")
95
106
  }
96
107
  ),
97
108
  /* @__PURE__ */ jsx(
@@ -100,7 +111,8 @@ function DemoBoard({ onAsk }) {
100
111
  leading: /* @__PURE__ */ jsx(StatusDot, { variant: "neutral", size: "sm", "aria-hidden": "true" }),
101
112
  title: "Mention notifications",
102
113
  description: "Quiet hours, 6pm to 8am",
103
- meta: "Paused"
114
+ meta: "Paused",
115
+ onClick: () => onAsk("Set up notifications for me")
104
116
  }
105
117
  )
106
118
  ] })
@@ -1,18 +1,20 @@
1
+ export declare const FollowupSuggestionsLabelContext: import('react').Context<string>;
1
2
  /**
2
3
  * The follow-up questions under a finished answer. Deliberately the same
3
4
  * component, layout and scale as the welcome screen's conversation starters:
4
5
  * one pattern for "here is something you could ask", whether the conversation
5
6
  * has started or not. The only difference is where the questions come from.
6
7
  *
7
- * Tapping one sends it as the next message. A tap while a response is already
8
- * streaming is ignored by `send`, the same as pressing enter in the composer
9
- * would be.
8
+ * Tapping one sends it as the next message and keeps the row as the record
9
+ * of that choice: the chip checked, the rest dimmed and inert. A tap while a
10
+ * response is already streaming is ignored by `send`, the same as pressing
11
+ * enter in the composer would be, and leaves the row as it was.
10
12
  *
11
13
  * While the questions are still being generated, `pending` shows the row's
12
14
  * shimmer placeholders in their place: a real loading state, unlike the
13
15
  * welcome starters' staged one.
14
16
  */
15
- export declare function FollowupSuggestions({ turnId, suggestions, pending, entrance, }: {
17
+ export declare function FollowupSuggestions({ turnId, suggestions, pending, entrance, chosen, chosenLabel, }: {
16
18
  /** The turn these belong to; makes each suggestion's id unique in the thread. */
17
19
  turnId: string;
18
20
  suggestions: string[];
@@ -20,4 +22,8 @@ export declare function FollowupSuggestions({ turnId, suggestions, pending, entr
20
22
  pending?: boolean;
21
23
  /** Play the chips' staggered pop-in. Off for rows remounted by a reopen, whose suggestions already arrived once. */
22
24
  entrance?: boolean;
25
+ /** The label already sent from this row, which keeps the row as a record. */
26
+ chosen?: string;
27
+ /** Visually hidden text read after the sent suggestion. Defaults to PromptSuggestions' "(chosen)". */
28
+ chosenLabel?: string;
23
29
  }): import("react").JSX.Element;
@@ -1,14 +1,19 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext } from "react";
3
4
  import { PromptSuggestions } from "../components/PromptSuggestions/PromptSuggestions.js";
4
5
  import { useChatWidget } from "./context.js";
6
+ const FollowupSuggestionsLabelContext = createContext("Follow-up questions");
5
7
  function FollowupSuggestions({
6
8
  turnId,
7
9
  suggestions,
8
10
  pending = false,
9
- entrance = true
11
+ entrance = true,
12
+ chosen,
13
+ chosenLabel
10
14
  }) {
11
- const { send } = useChatWidget();
15
+ const { chooseFollowup } = useChatWidget();
16
+ const rowLabel = useContext(FollowupSuggestionsLabelContext);
12
17
  const items = suggestions.map((label, index) => ({
13
18
  id: `${turnId}-followup-${index}`,
14
19
  label
@@ -18,17 +23,20 @@ function FollowupSuggestions({
18
23
  {
19
24
  className: "ds-chat-widget__followups",
20
25
  layout: "stack",
21
- ariaLabel: "Follow-up questions",
26
+ ariaLabel: rowLabel,
27
+ chosenLabel,
22
28
  pending,
23
29
  entrance,
24
30
  suggestions: items,
31
+ value: chosen !== void 0 ? items.find((item) => item.label === chosen)?.id : void 0,
25
32
  onValueChange: (id) => {
26
33
  const item = items.find((candidate) => candidate.id === id);
27
- if (item) send(item.label);
34
+ if (item) chooseFollowup(turnId, item.label);
28
35
  }
29
36
  }
30
37
  );
31
38
  }
32
39
  export {
33
- FollowupSuggestions
40
+ FollowupSuggestions,
41
+ FollowupSuggestionsLabelContext
34
42
  };
@@ -1,4 +1,18 @@
1
1
  import { ChatTurn } from './types';
2
+ /** The row's accessible names and its copy announcement, set from ChatWidget's label props. */
3
+ export interface ResponseActionsLabels {
4
+ /** The copy button's name. */
5
+ copy: string;
6
+ /** The copy button's name once the copy has landed. */
7
+ copied: string;
8
+ /** What the polite live region says once the copy has landed. */
9
+ copiedAnnouncement: string;
10
+ /** The thumbs-up button's name. */
11
+ good: string;
12
+ /** The thumbs-down button's name. */
13
+ bad: string;
14
+ }
15
+ export declare const ResponseActionsLabelsContext: import('react').Context<ResponseActionsLabels>;
2
16
  /**
3
17
  * The row under a committed assistant turn: copy, and, when the server
4
18
  * logged the exchange and the provider has somewhere to send a verdict,