@cossistant/react 0.0.1

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 (372) hide show
  1. package/_virtual/rolldown_runtime.js +13 -0
  2. package/conversation.d.ts +312 -0
  3. package/conversation.d.ts.map +1 -0
  4. package/hooks/index.d.ts +23 -0
  5. package/hooks/index.js +24 -0
  6. package/hooks/private/store/use-conversations-store.d.ts +13 -0
  7. package/hooks/private/store/use-conversations-store.d.ts.map +1 -0
  8. package/hooks/private/store/use-conversations-store.js +34 -0
  9. package/hooks/private/store/use-conversations-store.js.map +1 -0
  10. package/hooks/private/store/use-store-selector.d.ts +10 -0
  11. package/hooks/private/store/use-store-selector.d.ts.map +1 -0
  12. package/hooks/private/store/use-store-selector.js +17 -0
  13. package/hooks/private/store/use-store-selector.js.map +1 -0
  14. package/hooks/private/store/use-website-store.d.ts +18 -0
  15. package/hooks/private/store/use-website-store.d.ts.map +1 -0
  16. package/hooks/private/store/use-website-store.js +39 -0
  17. package/hooks/private/store/use-website-store.js.map +1 -0
  18. package/hooks/private/use-client-query.d.ts +25 -0
  19. package/hooks/private/use-client-query.d.ts.map +1 -0
  20. package/hooks/private/use-client-query.js +122 -0
  21. package/hooks/private/use-client-query.js.map +1 -0
  22. package/hooks/private/use-default-messages.d.ts +18 -0
  23. package/hooks/private/use-default-messages.d.ts.map +1 -0
  24. package/hooks/private/use-default-messages.js +45 -0
  25. package/hooks/private/use-default-messages.js.map +1 -0
  26. package/hooks/private/use-grouped-messages.d.ts +54 -0
  27. package/hooks/private/use-grouped-messages.d.ts.map +1 -0
  28. package/hooks/private/use-grouped-messages.js +157 -0
  29. package/hooks/private/use-grouped-messages.js.map +1 -0
  30. package/hooks/private/use-multimodal-input.d.ts +40 -0
  31. package/hooks/private/use-multimodal-input.d.ts.map +1 -0
  32. package/hooks/private/use-multimodal-input.js +129 -0
  33. package/hooks/private/use-multimodal-input.js.map +1 -0
  34. package/hooks/private/use-rest-client.d.ts +17 -0
  35. package/hooks/private/use-rest-client.d.ts.map +1 -0
  36. package/hooks/private/use-rest-client.js +41 -0
  37. package/hooks/private/use-rest-client.js.map +1 -0
  38. package/hooks/private/use-visitor-typing-reporter.d.ts +19 -0
  39. package/hooks/private/use-visitor-typing-reporter.d.ts.map +1 -0
  40. package/hooks/private/use-visitor-typing-reporter.js +140 -0
  41. package/hooks/private/use-visitor-typing-reporter.js.map +1 -0
  42. package/hooks/use-composer-refocus.d.ts +20 -0
  43. package/hooks/use-composer-refocus.d.ts.map +1 -0
  44. package/hooks/use-composer-refocus.js +32 -0
  45. package/hooks/use-composer-refocus.js.map +1 -0
  46. package/hooks/use-conversation-auto-seen.d.ts +54 -0
  47. package/hooks/use-conversation-auto-seen.d.ts.map +1 -0
  48. package/hooks/use-conversation-auto-seen.js +106 -0
  49. package/hooks/use-conversation-auto-seen.js.map +1 -0
  50. package/hooks/use-conversation-history-page.d.ts +86 -0
  51. package/hooks/use-conversation-history-page.d.ts.map +1 -0
  52. package/hooks/use-conversation-history-page.js +97 -0
  53. package/hooks/use-conversation-history-page.js.map +1 -0
  54. package/hooks/use-conversation-lifecycle.d.ts +80 -0
  55. package/hooks/use-conversation-lifecycle.d.ts.map +1 -0
  56. package/hooks/use-conversation-lifecycle.js +54 -0
  57. package/hooks/use-conversation-lifecycle.js.map +1 -0
  58. package/hooks/use-conversation-page.d.ts +82 -0
  59. package/hooks/use-conversation-page.d.ts.map +1 -0
  60. package/hooks/use-conversation-page.js +138 -0
  61. package/hooks/use-conversation-page.js.map +1 -0
  62. package/hooks/use-conversation-seen.d.ts +17 -0
  63. package/hooks/use-conversation-seen.d.ts.map +1 -0
  64. package/hooks/use-conversation-seen.js +58 -0
  65. package/hooks/use-conversation-seen.js.map +1 -0
  66. package/hooks/use-conversation-timeline-items.d.ts +21 -0
  67. package/hooks/use-conversation-timeline-items.d.ts.map +1 -0
  68. package/hooks/use-conversation-timeline-items.js +87 -0
  69. package/hooks/use-conversation-timeline-items.js.map +1 -0
  70. package/hooks/use-conversation-typing.d.ts +13 -0
  71. package/hooks/use-conversation-typing.d.ts.map +1 -0
  72. package/hooks/use-conversation-typing.js +34 -0
  73. package/hooks/use-conversation-typing.js.map +1 -0
  74. package/hooks/use-conversation.d.ts +18 -0
  75. package/hooks/use-conversation.d.ts.map +1 -0
  76. package/hooks/use-conversation.js +44 -0
  77. package/hooks/use-conversation.js.map +1 -0
  78. package/hooks/use-conversations.d.ts +20 -0
  79. package/hooks/use-conversations.d.ts.map +1 -0
  80. package/hooks/use-conversations.js +68 -0
  81. package/hooks/use-conversations.js.map +1 -0
  82. package/hooks/use-create-conversation.d.ts +30 -0
  83. package/hooks/use-create-conversation.d.ts.map +1 -0
  84. package/hooks/use-create-conversation.js +67 -0
  85. package/hooks/use-create-conversation.js.map +1 -0
  86. package/hooks/use-home-page.d.ts +82 -0
  87. package/hooks/use-home-page.d.ts.map +1 -0
  88. package/hooks/use-home-page.js +89 -0
  89. package/hooks/use-home-page.js.map +1 -0
  90. package/hooks/use-message-composer.d.ts +88 -0
  91. package/hooks/use-message-composer.d.ts.map +1 -0
  92. package/hooks/use-message-composer.js +94 -0
  93. package/hooks/use-message-composer.js.map +1 -0
  94. package/hooks/use-realtime-support.d.ts +25 -0
  95. package/hooks/use-realtime-support.d.ts.map +1 -0
  96. package/hooks/use-realtime-support.js +29 -0
  97. package/hooks/use-realtime-support.js.map +1 -0
  98. package/hooks/use-send-message.d.ts +34 -0
  99. package/hooks/use-send-message.d.ts.map +1 -0
  100. package/hooks/use-send-message.js +118 -0
  101. package/hooks/use-send-message.js.map +1 -0
  102. package/hooks/use-visitor.d.ts +28 -0
  103. package/hooks/use-visitor.d.ts.map +1 -0
  104. package/hooks/use-visitor.js +59 -0
  105. package/hooks/use-visitor.js.map +1 -0
  106. package/hooks/use-window-visibility-focus.d.ts +9 -0
  107. package/hooks/use-window-visibility-focus.d.ts.map +1 -0
  108. package/hooks/use-window-visibility-focus.js +53 -0
  109. package/hooks/use-window-visibility-focus.js.map +1 -0
  110. package/identify-visitor.d.ts +18 -0
  111. package/identify-visitor.d.ts.map +1 -0
  112. package/identify-visitor.js +26 -0
  113. package/identify-visitor.js.map +1 -0
  114. package/index.d.ts +38 -0
  115. package/index.js +38 -0
  116. package/package.json +121 -0
  117. package/primitives/avatar/avatar.d.ts +31 -0
  118. package/primitives/avatar/avatar.d.ts.map +1 -0
  119. package/primitives/avatar/avatar.js +49 -0
  120. package/primitives/avatar/avatar.js.map +1 -0
  121. package/primitives/avatar/fallback.d.ts +24 -0
  122. package/primitives/avatar/fallback.d.ts.map +1 -0
  123. package/primitives/avatar/fallback.js +57 -0
  124. package/primitives/avatar/fallback.js.map +1 -0
  125. package/primitives/avatar/image.d.ts +27 -0
  126. package/primitives/avatar/image.d.ts.map +1 -0
  127. package/primitives/avatar/image.js +58 -0
  128. package/primitives/avatar/image.js.map +1 -0
  129. package/primitives/avatar/index.d.ts +4 -0
  130. package/primitives/avatar/index.js +5 -0
  131. package/primitives/avatar/index.parts.d.ts +4 -0
  132. package/primitives/avatar/index.parts.js +5 -0
  133. package/primitives/bubble.d.ts +28 -0
  134. package/primitives/bubble.d.ts.map +1 -0
  135. package/primitives/bubble.js +43 -0
  136. package/primitives/bubble.js.map +1 -0
  137. package/primitives/button.d.ts +19 -0
  138. package/primitives/button.d.ts.map +1 -0
  139. package/primitives/button.js +27 -0
  140. package/primitives/button.js.map +1 -0
  141. package/primitives/conversation-timeline.d.ts +86 -0
  142. package/primitives/conversation-timeline.d.ts.map +1 -0
  143. package/primitives/conversation-timeline.js +119 -0
  144. package/primitives/conversation-timeline.js.map +1 -0
  145. package/primitives/index.d.ts +20 -0
  146. package/primitives/index.d.ts.map +1 -0
  147. package/primitives/index.js +45 -0
  148. package/primitives/index.js.map +1 -0
  149. package/primitives/index.parts.d.ts +13 -0
  150. package/primitives/index.parts.js +14 -0
  151. package/primitives/multimodal-input.d.ts +53 -0
  152. package/primitives/multimodal-input.d.ts.map +1 -0
  153. package/primitives/multimodal-input.js +106 -0
  154. package/primitives/multimodal-input.js.map +1 -0
  155. package/primitives/timeline-item-group.d.ts +166 -0
  156. package/primitives/timeline-item-group.d.ts.map +1 -0
  157. package/primitives/timeline-item-group.js +204 -0
  158. package/primitives/timeline-item-group.js.map +1 -0
  159. package/primitives/timeline-item.d.ts +75 -0
  160. package/primitives/timeline-item.d.ts.map +1 -0
  161. package/primitives/timeline-item.js +145 -0
  162. package/primitives/timeline-item.js.map +1 -0
  163. package/primitives/window.d.ts +31 -0
  164. package/primitives/window.d.ts.map +1 -0
  165. package/primitives/window.js +58 -0
  166. package/primitives/window.js.map +1 -0
  167. package/provider.d.ts +95 -0
  168. package/provider.d.ts.map +1 -0
  169. package/provider.js +124 -0
  170. package/provider.js.map +1 -0
  171. package/realtime/event-filter.d.ts +8 -0
  172. package/realtime/event-filter.d.ts.map +1 -0
  173. package/realtime/event-filter.js +21 -0
  174. package/realtime/event-filter.js.map +1 -0
  175. package/realtime/index.d.ts +6 -0
  176. package/realtime/index.js +7 -0
  177. package/realtime/provider.d.ts +57 -0
  178. package/realtime/provider.d.ts.map +1 -0
  179. package/realtime/provider.js +351 -0
  180. package/realtime/provider.js.map +1 -0
  181. package/realtime/seen-store.d.ts +23 -0
  182. package/realtime/seen-store.d.ts.map +1 -0
  183. package/realtime/seen-store.js +34 -0
  184. package/realtime/seen-store.js.map +1 -0
  185. package/realtime/support-provider.d.ts +17 -0
  186. package/realtime/support-provider.d.ts.map +1 -0
  187. package/realtime/support-provider.js +54 -0
  188. package/realtime/support-provider.js.map +1 -0
  189. package/realtime/typing-store.d.ts +30 -0
  190. package/realtime/typing-store.d.ts.map +1 -0
  191. package/realtime/typing-store.js +34 -0
  192. package/realtime/typing-store.js.map +1 -0
  193. package/realtime/use-realtime.d.ts +29 -0
  194. package/realtime/use-realtime.d.ts.map +1 -0
  195. package/realtime/use-realtime.js +47 -0
  196. package/realtime/use-realtime.js.map +1 -0
  197. package/realtime-events.d.ts +344 -0
  198. package/realtime-events.d.ts.map +1 -0
  199. package/schemas.d.ts +90 -0
  200. package/schemas.d.ts.map +1 -0
  201. package/support/components/avatar-stack.d.ts +45 -0
  202. package/support/components/avatar-stack.d.ts.map +1 -0
  203. package/support/components/avatar-stack.js +72 -0
  204. package/support/components/avatar-stack.js.map +1 -0
  205. package/support/components/avatar.d.ts +15 -0
  206. package/support/components/avatar.d.ts.map +1 -0
  207. package/support/components/avatar.js +23 -0
  208. package/support/components/avatar.js.map +1 -0
  209. package/support/components/bubble.d.ts +10 -0
  210. package/support/components/bubble.d.ts.map +1 -0
  211. package/support/components/bubble.js +95 -0
  212. package/support/components/bubble.js.map +1 -0
  213. package/support/components/button.d.ts +20 -0
  214. package/support/components/button.d.ts.map +1 -0
  215. package/support/components/button.js +41 -0
  216. package/support/components/button.js.map +1 -0
  217. package/support/components/container.d.ts +14 -0
  218. package/support/components/container.d.ts.map +1 -0
  219. package/support/components/container.js +115 -0
  220. package/support/components/container.js.map +1 -0
  221. package/support/components/conversation-button-link.d.ts +34 -0
  222. package/support/components/conversation-button-link.d.ts.map +1 -0
  223. package/support/components/conversation-button-link.js +195 -0
  224. package/support/components/conversation-button-link.js.map +1 -0
  225. package/support/components/conversation-event.d.ts +14 -0
  226. package/support/components/conversation-event.d.ts.map +1 -0
  227. package/support/components/conversation-event.js +76 -0
  228. package/support/components/conversation-event.js.map +1 -0
  229. package/support/components/conversation-timeline.d.ts +17 -0
  230. package/support/components/conversation-timeline.d.ts.map +1 -0
  231. package/support/components/conversation-timeline.js +95 -0
  232. package/support/components/conversation-timeline.js.map +1 -0
  233. package/support/components/cossistant-branding.d.ts +12 -0
  234. package/support/components/cossistant-branding.d.ts.map +1 -0
  235. package/support/components/cossistant-branding.js +22 -0
  236. package/support/components/cossistant-branding.js.map +1 -0
  237. package/support/components/header.d.ts +11 -0
  238. package/support/components/header.d.ts.map +1 -0
  239. package/support/components/header.js +43 -0
  240. package/support/components/header.js.map +1 -0
  241. package/support/components/icons.d.ts +21 -0
  242. package/support/components/icons.d.ts.map +1 -0
  243. package/support/components/icons.js +131 -0
  244. package/support/components/icons.js.map +1 -0
  245. package/support/components/index.d.ts +11 -0
  246. package/support/components/index.js +12 -0
  247. package/support/components/multimodal-input.d.ts +28 -0
  248. package/support/components/multimodal-input.d.ts.map +1 -0
  249. package/support/components/multimodal-input.js +138 -0
  250. package/support/components/multimodal-input.js.map +1 -0
  251. package/support/components/navigation-tab.d.ts +7 -0
  252. package/support/components/navigation-tab.d.ts.map +1 -0
  253. package/support/components/navigation-tab.js +40 -0
  254. package/support/components/navigation-tab.js.map +1 -0
  255. package/support/components/support-content.d.ts +22 -0
  256. package/support/components/support-content.d.ts.map +1 -0
  257. package/support/components/support-content.js +50 -0
  258. package/support/components/support-content.js.map +1 -0
  259. package/support/components/text-effect.d.ts +49 -0
  260. package/support/components/text-effect.d.ts.map +1 -0
  261. package/support/components/text-effect.js +221 -0
  262. package/support/components/text-effect.js.map +1 -0
  263. package/support/components/timeline-message-group.d.ts +16 -0
  264. package/support/components/timeline-message-group.d.ts.map +1 -0
  265. package/support/components/timeline-message-group.js +117 -0
  266. package/support/components/timeline-message-group.js.map +1 -0
  267. package/support/components/timeline-message-item.d.ts +17 -0
  268. package/support/components/timeline-message-item.d.ts.map +1 -0
  269. package/support/components/timeline-message-item.js +42 -0
  270. package/support/components/timeline-message-item.js.map +1 -0
  271. package/support/components/typing-indicator.d.ts +26 -0
  272. package/support/components/typing-indicator.d.ts.map +1 -0
  273. package/support/components/typing-indicator.js +37 -0
  274. package/support/components/typing-indicator.js.map +1 -0
  275. package/support/components/watermark.d.ts +8 -0
  276. package/support/components/watermark.d.ts.map +1 -0
  277. package/support/components/watermark.js +34 -0
  278. package/support/components/watermark.js.map +1 -0
  279. package/support/context/config.d.ts +32 -0
  280. package/support/context/config.d.ts.map +1 -0
  281. package/support/context/config.js +27 -0
  282. package/support/context/config.js.map +1 -0
  283. package/support/context/websocket.d.ts +22 -0
  284. package/support/context/websocket.d.ts.map +1 -0
  285. package/support/context/websocket.js +113 -0
  286. package/support/context/websocket.js.map +1 -0
  287. package/support/index.d.ts +39 -0
  288. package/support/index.d.ts.map +1 -0
  289. package/support/index.js +43 -0
  290. package/support/index.js.map +1 -0
  291. package/support/pages/articles.d.ts +7 -0
  292. package/support/pages/articles.d.ts.map +1 -0
  293. package/support/pages/articles.js +39 -0
  294. package/support/pages/articles.js.map +1 -0
  295. package/support/pages/conversation-history.d.ts +18 -0
  296. package/support/pages/conversation-history.d.ts.map +1 -0
  297. package/support/pages/conversation-history.js +120 -0
  298. package/support/pages/conversation-history.js.map +1 -0
  299. package/support/pages/conversation.d.ts +32 -0
  300. package/support/pages/conversation.d.ts.map +1 -0
  301. package/support/pages/conversation.js +92 -0
  302. package/support/pages/conversation.js.map +1 -0
  303. package/support/pages/home.d.ts +20 -0
  304. package/support/pages/home.d.ts.map +1 -0
  305. package/support/pages/home.js +184 -0
  306. package/support/pages/home.js.map +1 -0
  307. package/support/router.d.ts +14 -0
  308. package/support/router.d.ts.map +1 -0
  309. package/support/router.js +31 -0
  310. package/support/router.js.map +1 -0
  311. package/support/store/index.d.ts +2 -0
  312. package/support/store/index.js +3 -0
  313. package/support/store/support-store.d.ts +42 -0
  314. package/support/store/support-store.d.ts.map +1 -0
  315. package/support/store/support-store.js +66 -0
  316. package/support/store/support-store.js.map +1 -0
  317. package/support/support-CMoDLQoC.css +408 -0
  318. package/support/support-CMoDLQoC.css.map +1 -0
  319. package/support/support.js +1 -0
  320. package/support/text/index.d.ts +35 -0
  321. package/support/text/index.d.ts.map +1 -0
  322. package/support/text/index.js +71 -0
  323. package/support/text/index.js.map +1 -0
  324. package/support/text/locales/en.d.ts +7 -0
  325. package/support/text/locales/en.d.ts.map +1 -0
  326. package/support/text/locales/en.js +65 -0
  327. package/support/text/locales/en.js.map +1 -0
  328. package/support/text/locales/es.d.ts +7 -0
  329. package/support/text/locales/es.d.ts.map +1 -0
  330. package/support/text/locales/es.js +64 -0
  331. package/support/text/locales/es.js.map +1 -0
  332. package/support/text/locales/fr.d.ts +7 -0
  333. package/support/text/locales/fr.d.ts.map +1 -0
  334. package/support/text/locales/fr.js +64 -0
  335. package/support/text/locales/fr.js.map +1 -0
  336. package/support/text/locales/keys.d.ts +216 -0
  337. package/support/text/locales/keys.d.ts.map +1 -0
  338. package/support/text/locales/keys.js +54 -0
  339. package/support/text/locales/keys.js.map +1 -0
  340. package/support/text/runtime.d.ts +17 -0
  341. package/support/text/runtime.d.ts.map +1 -0
  342. package/support/text/runtime.js +156 -0
  343. package/support/text/runtime.js.map +1 -0
  344. package/support/utils/index.d.ts +7 -0
  345. package/support/utils/index.d.ts.map +1 -0
  346. package/support/utils/index.js +11 -0
  347. package/support/utils/index.js.map +1 -0
  348. package/support/utils/time.d.ts +5 -0
  349. package/support/utils/time.d.ts.map +1 -0
  350. package/support/utils/time.js +28 -0
  351. package/support/utils/time.js.map +1 -0
  352. package/support-config.d.ts +20 -0
  353. package/support-config.d.ts.map +1 -0
  354. package/support-config.js +25 -0
  355. package/support-config.js.map +1 -0
  356. package/support.css +2 -0
  357. package/timeline-item.d.ts +133 -0
  358. package/timeline-item.d.ts.map +1 -0
  359. package/utils/id.d.ts +6 -0
  360. package/utils/id.d.ts.map +1 -0
  361. package/utils/id.js +13 -0
  362. package/utils/id.js.map +1 -0
  363. package/utils/index.d.ts +3 -0
  364. package/utils/index.js +4 -0
  365. package/utils/text.d.ts +5 -0
  366. package/utils/text.d.ts.map +1 -0
  367. package/utils/text.js +9 -0
  368. package/utils/text.js.map +1 -0
  369. package/utils/use-render-element.d.ts +22 -0
  370. package/utils/use-render-element.d.ts.map +1 -0
  371. package/utils/use-render-element.js +35 -0
  372. package/utils/use-render-element.js.map +1 -0
@@ -0,0 +1,19 @@
1
+ import * as React$1 from "react";
2
+
3
+ //#region src/primitives/button.d.ts
4
+ type ButtonProps = React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
5
+ asChild?: boolean;
6
+ className?: string;
7
+ };
8
+ /**
9
+ * Thin wrapper over a `<button>` that supports `asChild` composition so the
10
+ * primitives can be slotted into external design systems without losing
11
+ * semantics.
12
+ */
13
+ declare const Button: React$1.ForwardRefExoticComponent<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
14
+ asChild?: boolean;
15
+ className?: string;
16
+ } & React$1.RefAttributes<HTMLButtonElement>>;
17
+ //#endregion
18
+ export { Button, ButtonProps };
19
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","names":[],"sources":["../../src/primitives/button.tsx"],"sourcesContent":[],"mappings":";;;KAGY,WAAA,GAAc,OAAA,CAAM,qBAAqB;;EAAzC,SAAA,CAAA,EAAA,MAAW;CAAA;;;;AAUvB;;AAAmB,cAAN,MAAM,EAAA,OAAA,CAAA,yBAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,iBAAA,CAAA,GAAA;SAAA,CAAA,EAAA,OAAA"}
@@ -0,0 +1,27 @@
1
+ import { useRenderElement } from "../utils/use-render-element.js";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/primitives/button.tsx
5
+ /**
6
+ * Thin wrapper over a `<button>` that supports `asChild` composition so the
7
+ * primitives can be slotted into external design systems without losing
8
+ * semantics.
9
+ */
10
+ const Button = (() => {
11
+ const Component = React$1.forwardRef(({ className, asChild = false,...props }, ref) => useRenderElement("button", {
12
+ className,
13
+ asChild
14
+ }, {
15
+ ref,
16
+ props: {
17
+ type: "button",
18
+ ...props
19
+ }
20
+ }));
21
+ Component.displayName = "Button";
22
+ return Component;
23
+ })();
24
+
25
+ //#endregion
26
+ export { Button };
27
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","names":["React"],"sources":["../../src/primitives/button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Thin wrapper over a `<button>` that supports `asChild` composition so the\n * primitives can be slotted into external design systems without losing\n * semantics.\n */\nexport const Button = (() => {\n\tconst Component = React.forwardRef<HTMLButtonElement, ButtonProps>(\n\t\t({ className, asChild = false, ...props }, ref) =>\n\t\t\tuseRenderElement(\n\t\t\t\t\"button\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\t...props,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t)\n\t);\n\n\tComponent.displayName = \"Button\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;AAaA,MAAa,gBAAgB;CAC5B,MAAM,YAAYA,QAAM,YACtB,EAAE,WAAW,UAAU,MAAO,GAAG,SAAS,QAC1C,iBACC,UACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,GAAG;GACH;EACD,CACD,CACF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -0,0 +1,86 @@
1
+ import { TimelineItem } from "../timeline-item.js";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/primitives/conversation-timeline.d.ts
5
+
6
+ /**
7
+ * High-level state of the timeline handed to render-prop children so they can show
8
+ * skeletons, empty states or pagination affordances.
9
+ */
10
+ type ConversationTimelineRenderProps = {
11
+ itemCount: number;
12
+ isLoading?: boolean;
13
+ hasMore?: boolean;
14
+ isEmpty: boolean;
15
+ };
16
+ type ConversationTimelineProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
17
+ children?: React$1.ReactNode | ((props: ConversationTimelineRenderProps) => React$1.ReactNode);
18
+ asChild?: boolean;
19
+ className?: string;
20
+ items?: TimelineItem[];
21
+ isLoading?: boolean;
22
+ hasMore?: boolean;
23
+ autoScroll?: boolean;
24
+ onScrollEnd?: () => void;
25
+ onScrollStart?: () => void;
26
+ };
27
+ /**
28
+ * Scrollable conversation timeline that wires auto-scroll behaviour, live-region semantics and
29
+ * pagination callbacks for displaying timeline items (messages, events, etc.).
30
+ */
31
+ declare const ConversationTimeline: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
32
+ children?: React$1.ReactNode | ((props: ConversationTimelineRenderProps) => React$1.ReactNode);
33
+ asChild?: boolean;
34
+ className?: string;
35
+ items?: TimelineItem[];
36
+ isLoading?: boolean;
37
+ hasMore?: boolean;
38
+ autoScroll?: boolean;
39
+ onScrollEnd?: () => void;
40
+ onScrollStart?: () => void;
41
+ } & React$1.RefAttributes<HTMLDivElement>>;
42
+ type ConversationTimelineContainerProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
43
+ children?: React$1.ReactNode;
44
+ asChild?: boolean;
45
+ className?: string;
46
+ };
47
+ /**
48
+ * Wrapper around the scrollable timeline giving consumers an easy hook to add
49
+ * padding, backgrounds or transitions without touching the core timeline logic.
50
+ */
51
+ declare const ConversationTimelineContainer: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
52
+ children?: React$1.ReactNode;
53
+ asChild?: boolean;
54
+ className?: string;
55
+ } & React$1.RefAttributes<HTMLDivElement>>;
56
+ type ConversationTimelineLoadingProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
57
+ children?: React$1.ReactNode;
58
+ asChild?: boolean;
59
+ className?: string;
60
+ };
61
+ /**
62
+ * Accessible status region for loading more timeline items. Lets host apps render
63
+ * skeletons or shimmer states without reimplementing ARIA wiring.
64
+ */
65
+ declare const ConversationTimelineLoading: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
66
+ children?: React$1.ReactNode;
67
+ asChild?: boolean;
68
+ className?: string;
69
+ } & React$1.RefAttributes<HTMLDivElement>>;
70
+ type ConversationTimelineEmptyProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
71
+ children?: React$1.ReactNode;
72
+ asChild?: boolean;
73
+ className?: string;
74
+ };
75
+ /**
76
+ * Placeholder state rendered when no timeline items are present. Uses a polite status
77
+ * region so screen readers announce the empty state.
78
+ */
79
+ declare const ConversationTimelineEmpty: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
80
+ children?: React$1.ReactNode;
81
+ asChild?: boolean;
82
+ className?: string;
83
+ } & React$1.RefAttributes<HTMLDivElement>>;
84
+ //#endregion
85
+ export { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineContainerProps, ConversationTimelineEmpty, ConversationTimelineEmptyProps, ConversationTimelineLoading, ConversationTimelineLoadingProps, ConversationTimelineProps, ConversationTimelineRenderProps };
86
+ //# sourceMappingURL=conversation-timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-timeline.d.ts","names":[],"sources":["../../src/primitives/conversation-timeline.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAQA;AAOA;AAAqC,KAPzB,+BAAA,GAOyB;WACf,EAAA,MAAA;WAArB,CAAA,EAAM,OAAA;SADiC,CAAA,EAAA,OAAA;SAKpC,EAAA,OAAM;;AACuC,KANrC,yBAAA,GAA4B,IAMe,CALtD,OAAA,CAAM,cAKgD,CALjC,cAKiC,CAAA,EAAA,UAAA,CAAA,GAAA;UAG9C,CAAA,EAJL,OAAA,CAAM,SAID,GAAA,CAAA,CAAA,KAAA,EAHI,+BAGJ,EAAA,GAHwC,OAAA,CAAM,SAG9C,CAAA;EAAgB,OAAA,CAAA,EAAA,OAAA;EAYZ,SAAA,CAAA,EAAA,MAAA;EAwGT,KAAA,CAAA,EApHK,YAoHL,EAAA;WAxG6B,CAAA,EAAA,OAAA;SAAA,CAAA,EAAA,OAAA;YAAA,CAAA,EAAA,OAAA;aAhBvB,CAAA,EAAA,GAAA,GAAA,IAAA;eACG,CAAA,EAAA,GAAA,GAAA,IAAA;;;;;;AAeoB,cAApB,oBAAoB,EAAA,OAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,OAAA,CAAA,cAAA,CAAA,cAAA,CAAA,EAAA,UAAA,CAAA,GAAA;EA0GrB,QAAA,CAAA,EA1HR,OAAA,CAAM,SA0HE,GAAA,CAAA,CAAA,KAAA,EAzHC,+BAyHiC,EAAA,GAzHG,OAAA,CAAM,SAyHT,CAAA;EAAA,OAAA,CAAA,EAAA,OAAA;WACxB,CAAA,EAAA,MAAA;OAArB,CAAA,EAvHQ,YAuHF,EAAA;WAD0C,CAAA,EAAA,OAAA;SAIrC,CAAA,EAAA,OAAM;EAAS,UAAA,CAAA,EAAA,OAAA;EASd,WAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAuBT,aAAA,CAAA,EAAA,GAAA,GAAA,IAAA;yBAvBsC,eAAA,CAAA,CAAA;AAAA,KAb9B,kCAAA,GAAqC,IAaP,CAZzC,OAAA,CAAM,cAYmC,CAZpB,cAYoB,CAAA,EAAA,UAAA,CAAA,GAAA;UAAA,CAAA,EAT9B,OAAA,CAAM,SASwB;SAT9B,CAAA,EAAA,OAAM;;;;;AAkClB;;AACsB,cA1BT,6BA0BS,EA1BoB,OAAA,CAAA,yBA0BpB,CA1BoB,IA0BpB,CA1BoB,OAAA,CAAA,cA0BpB,CA1BoB,cA0BpB,CAAA,EAAA,UAAA,CAAA,GAAA;UAArB,CAAA,EAnCW,OAAA,CAAM,SAmCX;SADwC,CAAA,EAAA,OAAA;WAInC,CAAA,EAAM,MAAA;CAAS,wBAAA,eAAA,CAAA,CAAA;AASd,KAbD,gCAAA,GAAmC,IAsC3C,CArCH,OAAA,CAAM,cAqCH,CArCkB,cAqClB,CAAA,EAAA,UAAA,CAAA,GAAA;EAAA,QAAA,CAAA,EAlCQ,OAAA,CAAM,SAkCd;SAzBoC,CAAA,EAAA,OAAA;WAAA,CAAA,EAAA,MAAA;;;;;;AAAA,cAA3B,2BAA2B,EAAA,OAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,OAAA,CAAA,cAAA,CAAA,cAAA,CAAA,EAAA,UAAA,CAAA,GAAA;EA2B5B,QAAA,CAAA,EApCA,OAAA,CAAM,SAoCN;EAA8B,OAAA,CAAA,EAAA,OAAA;WACpB,CAAA,EAAA,MAAA;yBAAf,eAAA,CAAA,CAAA;AADsC,KAAjC,8BAAA,GAAiC,IAAA,CAC5C,OAAA,CAAM,cADsC,CACvB,cADuB,CAAA,EAAA,UAAA,CAAA,GAAA;UAIjC,CAAA,EAAA,OAAA,CAAM,SAAA;EAAS,OAAA,CAAA,EAAA,OAAA;EASd,SAAA,CAAA,EAAA,MAAA;CAyBT;;;;;cAzBS,2BAAyB,OAAA,CAAA,0BAAA,KAAA,OAAA,CAAA,eAAA;aAT1B,OAAA,CAAM;SASoB,CAAA,EAAA,OAAA;EAAA,SAAA,CAAA,EAAA,MAAA"}
@@ -0,0 +1,119 @@
1
+ import { useRenderElement } from "../utils/use-render-element.js";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/primitives/conversation-timeline.tsx
5
+ /**
6
+ * Scrollable conversation timeline that wires auto-scroll behaviour, live-region semantics and
7
+ * pagination callbacks for displaying timeline items (messages, events, etc.).
8
+ */
9
+ const ConversationTimeline = (() => {
10
+ const Component = React$1.forwardRef(({ children, className, asChild = false, items = [], isLoading = false, hasMore = false, autoScroll = true, onScrollEnd, onScrollStart,...props }, ref) => {
11
+ const internalRef = React$1.useRef(null);
12
+ const setRefs = React$1.useCallback((node) => {
13
+ internalRef.current = node;
14
+ if (typeof ref === "function") ref(node);
15
+ else if (ref) ref.current = node;
16
+ }, [ref]);
17
+ const isInitialRender = React$1.useRef(true);
18
+ const previousItemCount = React$1.useRef(items.length);
19
+ const renderProps = {
20
+ itemCount: items.length,
21
+ isLoading,
22
+ hasMore,
23
+ isEmpty: items.length === 0
24
+ };
25
+ const content = typeof children === "function" ? children(renderProps) : children;
26
+ React$1.useEffect(() => {
27
+ if (autoScroll && internalRef.current) {
28
+ if (items.length > previousItemCount.current || isInitialRender.current) internalRef.current.scrollTop = internalRef.current.scrollHeight;
29
+ previousItemCount.current = items.length;
30
+ isInitialRender.current = false;
31
+ }
32
+ }, [items.length, autoScroll]);
33
+ const handleScroll = React$1.useCallback((e) => {
34
+ const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
35
+ if (scrollTop === 0 && onScrollStart) onScrollStart();
36
+ if (scrollTop + clientHeight >= scrollHeight - 10 && onScrollEnd) onScrollEnd();
37
+ }, [onScrollStart, onScrollEnd]);
38
+ return useRenderElement("div", {
39
+ className,
40
+ asChild
41
+ }, {
42
+ ref: setRefs,
43
+ state: renderProps,
44
+ props: {
45
+ role: "log",
46
+ "aria-label": "Conversation timeline",
47
+ "aria-live": "polite",
48
+ "aria-relevant": "additions",
49
+ onScroll: handleScroll,
50
+ ...props,
51
+ children: content
52
+ }
53
+ });
54
+ });
55
+ Component.displayName = "ConversationTimeline";
56
+ return Component;
57
+ })();
58
+ /**
59
+ * Wrapper around the scrollable timeline giving consumers an easy hook to add
60
+ * padding, backgrounds or transitions without touching the core timeline logic.
61
+ */
62
+ const ConversationTimelineContainer = (() => {
63
+ const Component = React$1.forwardRef(({ children, className, asChild = false,...props }, ref) => useRenderElement("div", {
64
+ className,
65
+ asChild
66
+ }, {
67
+ ref,
68
+ props: {
69
+ ...props,
70
+ children
71
+ }
72
+ }));
73
+ Component.displayName = "ConversationTimelineContainer";
74
+ return Component;
75
+ })();
76
+ /**
77
+ * Accessible status region for loading more timeline items. Lets host apps render
78
+ * skeletons or shimmer states without reimplementing ARIA wiring.
79
+ */
80
+ const ConversationTimelineLoading = (() => {
81
+ const Component = React$1.forwardRef(({ children, className, asChild = false,...props }, ref) => useRenderElement("div", {
82
+ className,
83
+ asChild
84
+ }, {
85
+ ref,
86
+ props: {
87
+ role: "status",
88
+ "aria-label": "Loading timeline items",
89
+ ...props,
90
+ children
91
+ }
92
+ }));
93
+ Component.displayName = "ConversationTimelineLoading";
94
+ return Component;
95
+ })();
96
+ /**
97
+ * Placeholder state rendered when no timeline items are present. Uses a polite status
98
+ * region so screen readers announce the empty state.
99
+ */
100
+ const ConversationTimelineEmpty = (() => {
101
+ const Component = React$1.forwardRef(({ children, className, asChild = false,...props }, ref) => useRenderElement("div", {
102
+ className,
103
+ asChild
104
+ }, {
105
+ ref,
106
+ props: {
107
+ role: "status",
108
+ "aria-label": "No timeline items",
109
+ ...props,
110
+ children
111
+ }
112
+ }));
113
+ Component.displayName = "ConversationTimelineEmpty";
114
+ return Component;
115
+ })();
116
+
117
+ //#endregion
118
+ export { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading };
119
+ //# sourceMappingURL=conversation-timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-timeline.js","names":["React","renderProps: ConversationTimelineRenderProps"],"sources":["../../src/primitives/conversation-timeline.tsx"],"sourcesContent":["import type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * High-level state of the timeline handed to render-prop children so they can show\n * skeletons, empty states or pagination affordances.\n */\nexport type ConversationTimelineRenderProps = {\n\titemCount: number;\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tisEmpty: boolean;\n};\n\nexport type ConversationTimelineProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: ConversationTimelineRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems?: TimelineItemType[];\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tautoScroll?: boolean;\n\tonScrollEnd?: () => void;\n\tonScrollStart?: () => void;\n};\n\n/**\n * Scrollable conversation timeline that wires auto-scroll behaviour, live-region semantics and\n * pagination callbacks for displaying timeline items (messages, events, etc.).\n */\nexport const ConversationTimeline = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, ConversationTimelineProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titems = [],\n\t\t\t\tisLoading = false,\n\t\t\t\thasMore = false,\n\t\t\t\tautoScroll = true,\n\t\t\t\tonScrollEnd,\n\t\t\t\tonScrollStart,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst internalRef = React.useRef<HTMLDivElement>(null);\n\t\t\tconst setRefs = React.useCallback(\n\t\t\t\t(node: HTMLDivElement | null) => {\n\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t(ref as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\t\t\tnode;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[ref]\n\t\t\t);\n\n\t\t\tconst isInitialRender = React.useRef(true);\n\t\t\tconst previousItemCount = React.useRef(items.length);\n\n\t\t\tconst renderProps: ConversationTimelineRenderProps = {\n\t\t\t\titemCount: items.length,\n\t\t\t\tisLoading,\n\t\t\t\thasMore,\n\t\t\t\tisEmpty: items.length === 0,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\t// Auto-scroll to bottom when new timeline items are added\n\t\t\tReact.useEffect(() => {\n\t\t\t\tif (autoScroll && internalRef.current) {\n\t\t\t\t\tconst hasNewItems = items.length > previousItemCount.current;\n\n\t\t\t\t\t// Only scroll if there are new items or it's the first render\n\t\t\t\t\tif (hasNewItems || isInitialRender.current) {\n\t\t\t\t\t\tinternalRef.current.scrollTop = internalRef.current.scrollHeight;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Update refs for next render\n\t\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\t\tisInitialRender.current = false;\n\t\t\t\t}\n\t\t\t}, [items.length, autoScroll]);\n\n\t\t\t// Handle scroll events for infinite scrolling\n\t\t\tconst handleScroll = React.useCallback(\n\t\t\t\t(e: React.UIEvent<HTMLDivElement>) => {\n\t\t\t\t\tconst element = e.currentTarget;\n\t\t\t\t\tconst { scrollTop, scrollHeight, clientHeight } = element;\n\n\t\t\t\t\t// Check if scrolled to top\n\t\t\t\t\tif (scrollTop === 0 && onScrollStart) {\n\t\t\t\t\t\tonScrollStart();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check if scrolled to bottom\n\t\t\t\t\tif (scrollTop + clientHeight >= scrollHeight - 10 && onScrollEnd) {\n\t\t\t\t\t\tonScrollEnd();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[onScrollStart, onScrollEnd]\n\t\t\t);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: setRefs,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"log\",\n\t\t\t\t\t\t\"aria-label\": \"Conversation timeline\",\n\t\t\t\t\t\t\"aria-live\": \"polite\",\n\t\t\t\t\t\t\"aria-relevant\": \"additions\",\n\t\t\t\t\t\tonScroll: handleScroll,\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"ConversationTimeline\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineContainerProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Wrapper around the scrollable timeline giving consumers an easy hook to add\n * padding, backgrounds or transitions without touching the core timeline logic.\n */\nexport const ConversationTimelineContainer = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineContainerProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineContainer\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineLoadingProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Accessible status region for loading more timeline items. Lets host apps render\n * skeletons or shimmer states without reimplementing ARIA wiring.\n */\nexport const ConversationTimelineLoading = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineLoadingProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"Loading timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineLoading\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineEmptyProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Placeholder state rendered when no timeline items are present. Uses a polite status\n * region so screen readers announce the empty state.\n */\nexport const ConversationTimelineEmpty = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineEmptyProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"No timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineEmpty\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;AAoCA,MAAa,8BAA8B;CAC1C,MAAM,YAAYA,QAAM,YAEtB,EACC,UACA,WACA,UAAU,OACV,QAAQ,EAAE,EACV,YAAY,OACZ,UAAU,OACV,aAAa,MACb,aACA,cACA,GAAG,SAEJ,QACI;EACJ,MAAM,cAAcA,QAAM,OAAuB,KAAK;EACtD,MAAM,UAAUA,QAAM,aACpB,SAAgC;AAChC,eAAY,UAAU;AACtB,OAAI,OAAO,QAAQ,WAClB,KAAI,KAAK;YACC,IACV,CAAC,IAAsD,UACtD;KAGH,CAAC,IAAI,CACL;EAED,MAAM,kBAAkBA,QAAM,OAAO,KAAK;EAC1C,MAAM,oBAAoBA,QAAM,OAAO,MAAM,OAAO;EAEpD,MAAMC,cAA+C;GACpD,WAAW,MAAM;GACjB;GACA;GACA,SAAS,MAAM,WAAW;GAC1B;EAED,MAAM,UACL,OAAO,aAAa,aAAa,SAAS,YAAY,GAAG;AAG1D,UAAM,gBAAgB;AACrB,OAAI,cAAc,YAAY,SAAS;AAItC,QAHoB,MAAM,SAAS,kBAAkB,WAGlC,gBAAgB,QAClC,aAAY,QAAQ,YAAY,YAAY,QAAQ;AAIrD,sBAAkB,UAAU,MAAM;AAClC,oBAAgB,UAAU;;KAEzB,CAAC,MAAM,QAAQ,WAAW,CAAC;EAG9B,MAAM,eAAeD,QAAM,aACzB,MAAqC;GAErC,MAAM,EAAE,WAAW,cAAc,iBADjB,EAAE;AAIlB,OAAI,cAAc,KAAK,cACtB,gBAAe;AAIhB,OAAI,YAAY,gBAAgB,eAAe,MAAM,YACpD,cAAa;KAGf,CAAC,eAAe,YAAY,CAC5B;AAED,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC,KAAK;GACL,OAAO;GACP,OAAO;IACN,MAAM;IACN,cAAc;IACd,aAAa;IACb,iBAAiB;IACjB,UAAU;IACV,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAeJ,MAAa,uCAAuC;CACnD,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAeJ,MAAa,qCAAqC;CACjD,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAeJ,MAAa,mCAAmC;CAC/C,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -0,0 +1,20 @@
1
+ import { TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType } from "../support/components/typing-indicator.js";
2
+ import { SupportConfig } from "../support-config.js";
3
+ import { Avatar } from "./avatar/avatar.js";
4
+ import { AvatarFallback } from "./avatar/fallback.js";
5
+ import { AvatarImage } from "./avatar/image.js";
6
+ import { SupportBubble } from "./bubble.js";
7
+ import { Button } from "./button.js";
8
+ import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
9
+ import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
10
+ import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
11
+ import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
12
+ import { SupportWindow } from "./window.js";
13
+
14
+ //#region src/primitives/index.d.ts
15
+ declare namespace index_d_exports {
16
+ export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window };
17
+ }
18
+ //#endregion
19
+ export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, index_d_exports };
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/primitives/index.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import { __export } from "../_virtual/rolldown_runtime.js";
2
+ import { SupportConfig } from "../support-config.js";
3
+ import { Avatar } from "./avatar/avatar.js";
4
+ import { AvatarFallback } from "./avatar/fallback.js";
5
+ import { AvatarImage } from "./avatar/image.js";
6
+ import { TypingIndicator } from "../support/components/typing-indicator.js";
7
+ import { SupportBubble } from "./bubble.js";
8
+ import { Button } from "./button.js";
9
+ import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
10
+ import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
11
+ import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
12
+ import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
13
+ import { SupportWindow } from "./window.js";
14
+
15
+ //#region src/primitives/index.ts
16
+ var primitives_exports = /* @__PURE__ */ __export({
17
+ Avatar: () => Avatar,
18
+ AvatarFallback: () => AvatarFallback,
19
+ AvatarImage: () => AvatarImage,
20
+ Bubble: () => SupportBubble,
21
+ Button: () => Button,
22
+ Config: () => SupportConfig,
23
+ ConversationTimeline: () => ConversationTimeline,
24
+ ConversationTimelineContainer: () => ConversationTimelineContainer,
25
+ ConversationTimelineEmpty: () => ConversationTimelineEmpty,
26
+ ConversationTimelineLoading: () => ConversationTimelineLoading,
27
+ FileInput: () => FileInput,
28
+ Input: () => SupportInput,
29
+ MultimodalInput: () => MultimodalInput,
30
+ TimelineItem: () => TimelineItem,
31
+ TimelineItemContent: () => TimelineItemContent,
32
+ TimelineItemGroup: () => TimelineItemGroup,
33
+ TimelineItemGroupAvatar: () => TimelineItemGroupAvatar,
34
+ TimelineItemGroupContent: () => TimelineItemGroupContent,
35
+ TimelineItemGroupHeader: () => TimelineItemGroupHeader,
36
+ TimelineItemGroupReadIndicator: () => TimelineItemGroupReadIndicator,
37
+ TimelineItemGroupSeenIndicator: () => TimelineItemGroupSeenIndicator,
38
+ TimelineItemTimestamp: () => TimelineItemTimestamp,
39
+ TypingIndicator: () => TypingIndicator,
40
+ Window: () => SupportWindow
41
+ });
42
+
43
+ //#endregion
44
+ export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, SupportWindow as Window, primitives_exports };
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * from \"./index.parts\";\n"],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType } from "../support/components/typing-indicator.js";
2
+ import { SupportConfig } from "../support-config.js";
3
+ import { Avatar } from "./avatar/avatar.js";
4
+ import { AvatarFallback } from "./avatar/fallback.js";
5
+ import { AvatarImage } from "./avatar/image.js";
6
+ import { SupportBubble } from "./bubble.js";
7
+ import { Button } from "./button.js";
8
+ import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
9
+ import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
10
+ import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
11
+ import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
12
+ import { SupportWindow } from "./window.js";
13
+ export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, type TypingIndicatorProps, type TypingParticipant, type TypingParticipantType, SupportWindow as Window };
@@ -0,0 +1,14 @@
1
+ import { SupportConfig } from "../support-config.js";
2
+ import { Avatar } from "./avatar/avatar.js";
3
+ import { AvatarFallback } from "./avatar/fallback.js";
4
+ import { AvatarImage } from "./avatar/image.js";
5
+ import { TypingIndicator } from "../support/components/typing-indicator.js";
6
+ import { SupportBubble } from "./bubble.js";
7
+ import { Button } from "./button.js";
8
+ import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
9
+ import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
10
+ import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
11
+ import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
12
+ import { SupportWindow } from "./window.js";
13
+
14
+ export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, SupportWindow as Window };
@@ -0,0 +1,53 @@
1
+ import * as React$1 from "react";
2
+
3
+ //#region src/primitives/multimodal-input.d.ts
4
+ type MultimodalInputProps = Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "onChange"> & {
5
+ value: string;
6
+ onChange: (value: string) => void;
7
+ onSubmit?: () => void;
8
+ onFileSelect?: (files: File[]) => void;
9
+ asChild?: boolean;
10
+ className?: string;
11
+ error?: Error | null;
12
+ disabled?: boolean;
13
+ };
14
+ /**
15
+ * Textarea tailored for support conversations. Handles keyboard submit,
16
+ * clipboard uploads and auto-resizing while remaining composable via
17
+ * `asChild`.
18
+ */
19
+ declare const MultimodalInput: React$1.ForwardRefExoticComponent<Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "onChange"> & {
20
+ value: string;
21
+ onChange: (value: string) => void;
22
+ onSubmit?: () => void;
23
+ onFileSelect?: (files: File[]) => void;
24
+ asChild?: boolean;
25
+ className?: string;
26
+ error?: Error | null;
27
+ disabled?: boolean;
28
+ } & React$1.RefAttributes<HTMLTextAreaElement>>;
29
+ type FileInputProps = React$1.InputHTMLAttributes<HTMLInputElement> & {
30
+ onFileSelect?: (files: File[]) => void;
31
+ asChild?: boolean;
32
+ };
33
+ /**
34
+ * Hidden file selector that feeds uploads back into the multimodal input when
35
+ * chat UIs want an explicit attachment button.
36
+ */
37
+ declare const FileInput: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttributes<HTMLInputElement> & {
38
+ onFileSelect?: (files: File[]) => void;
39
+ asChild?: boolean;
40
+ } & React$1.RefAttributes<HTMLInputElement>>;
41
+ declare const SupportInput: React$1.ForwardRefExoticComponent<Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "onChange"> & {
42
+ value: string;
43
+ onChange: (value: string) => void;
44
+ onSubmit?: () => void;
45
+ onFileSelect?: (files: File[]) => void;
46
+ asChild?: boolean;
47
+ className?: string;
48
+ error?: Error | null;
49
+ disabled?: boolean;
50
+ } & React$1.RefAttributes<HTMLTextAreaElement>>;
51
+ //#endregion
52
+ export { FileInput, FileInputProps, MultimodalInput, MultimodalInputProps, SupportInput };
53
+ //# sourceMappingURL=multimodal-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multimodal-input.d.ts","names":[],"sources":["../../src/primitives/multimodal-input.tsx"],"sourcesContent":[],"mappings":";;;KAGY,oBAAA,GAAuB,KAClC,OAAA,CAAM,uBAAuB;;EADlB,QAAA,EAAA,CAAA,KAAA,EAAA,MAAoB,EAAA,GAAA,IAAA;EAAA,QAAA,CAAA,EAAA,GAAA,GAAA,IAAA;cACF,CAAA,EAAA,CAAA,KAAA,EAMN,IANM,EAAA,EAAA,GAAA,IAAA;SAA7B,CAAA,EAAA,OAAM;WAD4B,CAAA,EAAA,MAAA;OAOX,CAAA,EAGf,KAHe,GAAA,IAAA;UAGf,CAAA,EAAA,OAAA;CAAK;AASd;;;;;AAZwB,cAYX,eAZW,EAYI,OAAA,CAAA,yBAZJ,CAYI,IAZJ,CAYI,OAAA,CAAA,sBAZJ,CAYI,mBAZJ,CAAA,EAAA,OAAA,GAAA,UAAA,CAAA,GAAA;OAGf,EAAA,MAAA;;;cASmB,CAAA,EAAA,CAAA,KAAA,EAZJ,IAYI,EAAA,EAAA,GAAA,IAAA;EAAA,OAAA,CAAA,EAAA,OAAA;EA4GhB,SAAA,CAAA,EAAA,MAAc;EAAA,KAAA,CAAA,EArHjB,KAqHiB,GAAA,IAAA;UAA6B,CAAA,EAAA,OAAA;yBAApB,oBAAA,CAAA,CAAA;AACX,KADZ,cAAA,GAAiB,OAAA,CAAM,mBACX,CAD+B,gBAC/B,CAAA,GAAA;EAAI,YAAA,CAAA,EAAA,CAAA,KAAA,EAAJ,IAAI,EAAA,EAAA,GAAA,IAAA;EAQf,OAAA,CAAA,EAAA,OAkCT;CAAA;;;;;cAlCS,WAAS,OAAA,CAAA,0BAAA,OAAA,CAAA,oBAAA;cAAA,CAAA,EAAA,CAAA,KAAA,EARE,IAQF,EAAA,EAAA,GAAA,IAAA;EAAA,OAAA,CAAA,EAAA,OAAA;AAqCtB,CAAA,wBAA2C,iBAAA,CAAA,CAAA;AAAA,cAA9B,YAA8B,EAAlB,OAAA,CAAA,yBAAkB,CAAlB,IAAkB,CAAlB,OAAA,CAAA,sBAAkB,CAAlB,mBAAkB,CAAA,EAAA,OAAA,GAAA,UAAA,CAAA,GAAA;OAAlB,EAAA,MAAA;UAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,IAAA;UAAA,CAAA,EAAA,GAAA,GAAA,IAAA;cAtKD,CAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,EAAA,GAAA,IAAA;SAGf,CAAA,EAAA,OAAA;;UAAA;UAmKgB,CAAA,EAAA,OAAA;CAAA,wBAAA,oBAAA,CAAA,CAAA"}
@@ -0,0 +1,106 @@
1
+ import { useRenderElement } from "../utils/use-render-element.js";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/primitives/multimodal-input.tsx
5
+ /**
6
+ * Textarea tailored for support conversations. Handles keyboard submit,
7
+ * clipboard uploads and auto-resizing while remaining composable via
8
+ * `asChild`.
9
+ */
10
+ const MultimodalInput = (() => {
11
+ const Component = React$1.forwardRef(({ value, onChange, onSubmit, onFileSelect, className, asChild = false, error, disabled,...props }, ref) => {
12
+ const innerRef = React$1.useRef(null);
13
+ React$1.useImperativeHandle(ref, () => innerRef.current);
14
+ const handleChange = (e) => {
15
+ onChange(e.target.value);
16
+ };
17
+ const handleKeyDown = (e) => {
18
+ if (e.key === "Enter" && !e.shiftKey) {
19
+ e.preventDefault();
20
+ onSubmit?.();
21
+ }
22
+ props.onKeyDown?.(e);
23
+ };
24
+ const handlePaste = (e) => {
25
+ const items = Array.from(e.clipboardData.items);
26
+ const files = [];
27
+ for (const item of items) if (item.kind === "file") {
28
+ const file = item.getAsFile();
29
+ if (file) files.push(file);
30
+ }
31
+ if (files.length > 0 && onFileSelect) {
32
+ e.preventDefault();
33
+ onFileSelect(files);
34
+ }
35
+ props.onPaste?.(e);
36
+ };
37
+ React$1.useLayoutEffect(() => {
38
+ const el = innerRef.current;
39
+ if (!el) return;
40
+ el.style.height = "auto";
41
+ const originalOverflow = el.style.overflow;
42
+ el.style.overflow = "hidden";
43
+ el.style.height = `${el.scrollHeight}px`;
44
+ el.style.overflow = originalOverflow;
45
+ }, [value]);
46
+ return useRenderElement("textarea", {
47
+ className,
48
+ asChild
49
+ }, {
50
+ ref: innerRef,
51
+ props: {
52
+ ...props,
53
+ value,
54
+ rows: 1,
55
+ onChange: handleChange,
56
+ onKeyDown: handleKeyDown,
57
+ onPaste: handlePaste,
58
+ disabled,
59
+ "aria-invalid": error ? "true" : void 0,
60
+ "aria-describedby": error ? "multimodal-input-error" : void 0,
61
+ style: {
62
+ ...props.style,
63
+ minHeight: "1.5rem",
64
+ overflow: "hidden"
65
+ }
66
+ }
67
+ });
68
+ });
69
+ Component.displayName = "MultimodalInput";
70
+ return Component;
71
+ })();
72
+ /**
73
+ * Hidden file selector that feeds uploads back into the multimodal input when
74
+ * chat UIs want an explicit attachment button.
75
+ */
76
+ const FileInput = (() => {
77
+ const Component = React$1.forwardRef(({ onFileSelect, asChild = false, className,...props }, ref) => {
78
+ const handleChange = (e) => {
79
+ const files = Array.from(e.target.files || []);
80
+ if (files.length > 0 && onFileSelect) {
81
+ onFileSelect(files);
82
+ e.target.value = "";
83
+ }
84
+ props.onChange?.(e);
85
+ };
86
+ return useRenderElement("input", {
87
+ className,
88
+ asChild
89
+ }, {
90
+ ref,
91
+ props: {
92
+ ...props,
93
+ type: "file",
94
+ multiple: true,
95
+ onChange: handleChange
96
+ }
97
+ });
98
+ });
99
+ Component.displayName = "FileInput";
100
+ return Component;
101
+ })();
102
+ const SupportInput = MultimodalInput;
103
+
104
+ //#endregion
105
+ export { FileInput, MultimodalInput, SupportInput };
106
+ //# sourceMappingURL=multimodal-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multimodal-input.js","names":["React","files: File[]"],"sources":["../../src/primitives/multimodal-input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\nexport type MultimodalInputProps = Omit<\n\tReact.TextareaHTMLAttributes<HTMLTextAreaElement>,\n\t\"value\" | \"onChange\"\n> & {\n\tvalue: string;\n\tonChange: (value: string) => void;\n\tonSubmit?: () => void;\n\tonFileSelect?: (files: File[]) => void;\n\tasChild?: boolean;\n\tclassName?: string;\n\terror?: Error | null;\n\tdisabled?: boolean;\n};\n\n/**\n * Textarea tailored for support conversations. Handles keyboard submit,\n * clipboard uploads and auto-resizing while remaining composable via\n * `asChild`.\n */\nexport const MultimodalInput = (() => {\n\tconst Component = React.forwardRef<HTMLTextAreaElement, MultimodalInputProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tvalue,\n\t\t\t\tonChange,\n\t\t\t\tonSubmit,\n\t\t\t\tonFileSelect,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\terror,\n\t\t\t\tdisabled,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst innerRef = React.useRef<HTMLTextAreaElement | null>(null);\n\n\t\t\tReact.useImperativeHandle(\n\t\t\t\tref,\n\t\t\t\t() => innerRef.current as HTMLTextAreaElement\n\t\t\t);\n\n\t\t\tconst handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n\t\t\t\tonChange(e.target.value);\n\t\t\t};\n\n\t\t\tconst handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\t\tif (e.key === \"Enter\" && !e.shiftKey) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tonSubmit?.();\n\t\t\t\t}\n\t\t\t\tprops.onKeyDown?.(e);\n\t\t\t};\n\n\t\t\t// Handle paste events for images\n\t\t\tconst handlePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {\n\t\t\t\tconst items = Array.from(e.clipboardData.items);\n\t\t\t\tconst files: File[] = [];\n\n\t\t\t\tfor (const item of items) {\n\t\t\t\t\tif (item.kind === \"file\") {\n\t\t\t\t\t\tconst file = item.getAsFile();\n\t\t\t\t\t\tif (file) {\n\t\t\t\t\t\t\tfiles.push(file);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (files.length > 0 && onFileSelect) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tonFileSelect(files);\n\t\t\t\t}\n\n\t\t\t\tprops.onPaste?.(e);\n\t\t\t};\n\n\t\t\t// Auto-resize\n\t\t\tReact.useLayoutEffect(() => {\n\t\t\t\tconst el = innerRef.current;\n\t\t\t\tif (!el) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Reset height to auto to get the correct scrollHeight\n\t\t\t\tel.style.height = \"auto\";\n\t\t\t\t// Ensure overflow is visible during measurement\n\t\t\t\tconst originalOverflow = el.style.overflow;\n\t\t\t\tel.style.overflow = \"hidden\";\n\t\t\t\t// Set the new height\n\t\t\t\tel.style.height = `${el.scrollHeight}px`;\n\t\t\t\t// Restore original overflow\n\t\t\t\tel.style.overflow = originalOverflow;\n\t\t\t}, [value]);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"textarea\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: innerRef,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\trows: 1,\n\t\t\t\t\t\tonChange: handleChange,\n\t\t\t\t\t\tonKeyDown: handleKeyDown,\n\t\t\t\t\t\tonPaste: handlePaste,\n\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\"aria-invalid\": error ? \"true\" : undefined,\n\t\t\t\t\t\t\"aria-describedby\": error ? \"multimodal-input-error\" : undefined,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...props.style,\n\t\t\t\t\t\t\tminHeight: \"1.5rem\",\n\t\t\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"MultimodalInput\";\n\treturn Component;\n})();\n\n// File input component for multimodal input\nexport type FileInputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n\tonFileSelect?: (files: File[]) => void;\n\tasChild?: boolean;\n};\n\n/**\n * Hidden file selector that feeds uploads back into the multimodal input when\n * chat UIs want an explicit attachment button.\n */\nexport const FileInput = (() => {\n\tconst Component = React.forwardRef<HTMLInputElement, FileInputProps>(\n\t\t({ onFileSelect, asChild = false, className, ...props }, ref) => {\n\t\t\tconst handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\t\tconst files = Array.from(e.target.files || []);\n\t\t\t\tif (files.length > 0 && onFileSelect) {\n\t\t\t\t\tonFileSelect(files);\n\t\t\t\t\t// Reset input to allow selecting the same file again\n\t\t\t\t\te.target.value = \"\";\n\t\t\t\t}\n\t\t\t\tprops.onChange?.(e);\n\t\t\t};\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"input\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\ttype: \"file\",\n\t\t\t\t\t\tmultiple: true,\n\t\t\t\t\t\tonChange: handleChange,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"FileInput\";\n\treturn Component;\n})();\n\n// Export the old name for backward compatibility\nexport const SupportInput = MultimodalInput;\n"],"mappings":";;;;;;;;;AAsBA,MAAa,yBAAyB;CACrC,MAAM,YAAYA,QAAM,YAEtB,EACC,OACA,UACA,UACA,cACA,WACA,UAAU,OACV,OACA,SACA,GAAG,SAEJ,QACI;EACJ,MAAM,WAAWA,QAAM,OAAmC,KAAK;AAE/D,UAAM,oBACL,WACM,SAAS,QACf;EAED,MAAM,gBAAgB,MAA8C;AACnE,YAAS,EAAE,OAAO,MAAM;;EAGzB,MAAM,iBAAiB,MAAgD;AACtE,OAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,UAAU;AACrC,MAAE,gBAAgB;AAClB,gBAAY;;AAEb,SAAM,YAAY,EAAE;;EAIrB,MAAM,eAAe,MAAiD;GACrE,MAAM,QAAQ,MAAM,KAAK,EAAE,cAAc,MAAM;GAC/C,MAAMC,QAAgB,EAAE;AAExB,QAAK,MAAM,QAAQ,MAClB,KAAI,KAAK,SAAS,QAAQ;IACzB,MAAM,OAAO,KAAK,WAAW;AAC7B,QAAI,KACH,OAAM,KAAK,KAAK;;AAKnB,OAAI,MAAM,SAAS,KAAK,cAAc;AACrC,MAAE,gBAAgB;AAClB,iBAAa,MAAM;;AAGpB,SAAM,UAAU,EAAE;;AAInB,UAAM,sBAAsB;GAC3B,MAAM,KAAK,SAAS;AACpB,OAAI,CAAC,GACJ;AAGD,MAAG,MAAM,SAAS;GAElB,MAAM,mBAAmB,GAAG,MAAM;AAClC,MAAG,MAAM,WAAW;AAEpB,MAAG,MAAM,SAAS,GAAG,GAAG,aAAa;AAErC,MAAG,MAAM,WAAW;KAClB,CAAC,MAAM,CAAC;AAEX,SAAO,iBACN,YACA;GACC;GACA;GACA,EACD;GACC,KAAK;GACL,OAAO;IACN,GAAG;IACH;IACA,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;IACT;IACA,gBAAgB,QAAQ,SAAS;IACjC,oBAAoB,QAAQ,2BAA2B;IACvD,OAAO;KACN,GAAG,MAAM;KACT,WAAW;KACX,UAAU;KACV;IACD;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAYJ,MAAa,mBAAmB;CAC/B,MAAM,YAAYD,QAAM,YACtB,EAAE,cAAc,UAAU,OAAO,UAAW,GAAG,SAAS,QAAQ;EAChE,MAAM,gBAAgB,MAA2C;GAChE,MAAM,QAAQ,MAAM,KAAK,EAAE,OAAO,SAAS,EAAE,CAAC;AAC9C,OAAI,MAAM,SAAS,KAAK,cAAc;AACrC,iBAAa,MAAM;AAEnB,MAAE,OAAO,QAAQ;;AAElB,SAAM,WAAW,EAAE;;AAGpB,SAAO,iBACN,SACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,MAAM;IACN,UAAU;IACV,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;AAGJ,MAAa,eAAe"}