@assistant-ui/react 0.7.91 → 0.8.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 (298) hide show
  1. package/dist/cloud/auiV0.js.map +1 -1
  2. package/dist/cloud/auiV0.mjs.map +1 -1
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +0 -1
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/internal.d.ts +0 -1
  10. package/dist/internal.d.ts.map +1 -1
  11. package/dist/internal.js +0 -3
  12. package/dist/internal.js.map +1 -1
  13. package/dist/internal.mjs +0 -2
  14. package/dist/internal.mjs.map +1 -1
  15. package/dist/model-context/ModelContextTypes.d.ts +11 -0
  16. package/dist/model-context/ModelContextTypes.d.ts.map +1 -1
  17. package/dist/model-context/ModelContextTypes.js.map +1 -1
  18. package/dist/model-context/ModelContextTypes.mjs.map +1 -1
  19. package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
  20. package/dist/model-context/makeAssistantVisible.js +4 -2
  21. package/dist/model-context/makeAssistantVisible.js.map +1 -1
  22. package/dist/model-context/makeAssistantVisible.mjs +4 -2
  23. package/dist/model-context/makeAssistantVisible.mjs.map +1 -1
  24. package/dist/primitives/contentPart/index.d.ts +0 -1
  25. package/dist/primitives/contentPart/index.d.ts.map +1 -1
  26. package/dist/primitives/contentPart/index.js +0 -3
  27. package/dist/primitives/contentPart/index.js.map +1 -1
  28. package/dist/primitives/contentPart/index.mjs +0 -2
  29. package/dist/primitives/contentPart/index.mjs.map +1 -1
  30. package/dist/primitives/index.d.ts +0 -1
  31. package/dist/primitives/index.d.ts.map +1 -1
  32. package/dist/primitives/index.js +0 -3
  33. package/dist/primitives/index.js.map +1 -1
  34. package/dist/primitives/index.mjs +0 -2
  35. package/dist/primitives/index.mjs.map +1 -1
  36. package/dist/primitives/message/MessageContent.d.ts +1 -2
  37. package/dist/primitives/message/MessageContent.d.ts.map +1 -1
  38. package/dist/primitives/message/MessageContent.js +2 -7
  39. package/dist/primitives/message/MessageContent.js.map +1 -1
  40. package/dist/primitives/message/MessageContent.mjs +2 -7
  41. package/dist/primitives/message/MessageContent.mjs.map +1 -1
  42. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
  43. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +1 -3
  44. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
  45. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +1 -3
  46. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
  47. package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
  48. package/dist/runtimes/edge/converters/toCoreMessages.js +1 -6
  49. package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
  50. package/dist/runtimes/edge/converters/toCoreMessages.mjs +1 -6
  51. package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
  52. package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
  53. package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
  54. package/dist/runtimes/external-store/ThreadMessageLike.d.ts +2 -2
  55. package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
  56. package/dist/runtimes/external-store/ThreadMessageLike.js +0 -3
  57. package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
  58. package/dist/runtimes/external-store/ThreadMessageLike.mjs +0 -3
  59. package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
  60. package/dist/types/AssistantTypes.d.ts +3 -7
  61. package/dist/types/AssistantTypes.d.ts.map +1 -1
  62. package/dist/types/AssistantTypes.js.map +1 -1
  63. package/dist/types/ContentPartComponentTypes.d.ts +1 -3
  64. package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
  65. package/dist/types/ContentPartComponentTypes.js.map +1 -1
  66. package/dist/types/index.d.ts +1 -1
  67. package/dist/types/index.d.ts.map +1 -1
  68. package/dist/types/index.js.map +1 -1
  69. package/package.json +1 -21
  70. package/src/cloud/auiV0.ts +1 -1
  71. package/src/index.ts +0 -1
  72. package/src/internal.ts +0 -1
  73. package/src/model-context/ModelContextTypes.ts +19 -0
  74. package/src/model-context/makeAssistantVisible.tsx +4 -2
  75. package/src/primitives/contentPart/index.ts +0 -1
  76. package/src/primitives/index.ts +0 -1
  77. package/src/primitives/message/MessageContent.tsx +0 -9
  78. package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +1 -3
  79. package/src/runtimes/edge/converters/toCoreMessages.ts +11 -14
  80. package/src/runtimes/edge/converters/toLanguageModelMessages.ts +2 -2
  81. package/src/runtimes/external-store/ThreadMessageLike.tsx +0 -6
  82. package/src/types/AssistantTypes.ts +4 -9
  83. package/src/types/ContentPartComponentTypes.tsx +0 -4
  84. package/src/types/index.ts +0 -2
  85. package/dist/primitives/contentPart/ContentPartDisplay.d.ts +0 -9
  86. package/dist/primitives/contentPart/ContentPartDisplay.d.ts.map +0 -1
  87. package/dist/primitives/contentPart/ContentPartDisplay.js +0 -37
  88. package/dist/primitives/contentPart/ContentPartDisplay.js.map +0 -1
  89. package/dist/primitives/contentPart/ContentPartDisplay.mjs +0 -13
  90. package/dist/primitives/contentPart/ContentPartDisplay.mjs.map +0 -1
  91. package/dist/primitives/contentPart/useContentPartDisplay.d.ts +0 -8
  92. package/dist/primitives/contentPart/useContentPartDisplay.d.ts.map +0 -1
  93. package/dist/primitives/contentPart/useContentPartDisplay.js +0 -42
  94. package/dist/primitives/contentPart/useContentPartDisplay.js.map +0 -1
  95. package/dist/primitives/contentPart/useContentPartDisplay.mjs +0 -18
  96. package/dist/primitives/contentPart/useContentPartDisplay.mjs.map +0 -1
  97. package/dist/styles/index.css +0 -1261
  98. package/dist/styles/index.css.map +0 -1
  99. package/dist/styles/modal.css +0 -143
  100. package/dist/styles/modal.css.map +0 -1
  101. package/dist/styles/tailwindcss/base-components.css +0 -69
  102. package/dist/styles/tailwindcss/base-components.css.json +0 -48
  103. package/dist/styles/tailwindcss/modal.css +0 -29
  104. package/dist/styles/tailwindcss/modal.css.json +0 -26
  105. package/dist/styles/tailwindcss/thread.css +0 -262
  106. package/dist/styles/tailwindcss/thread.css.json +0 -183
  107. package/dist/styles/themes/default.css +0 -64
  108. package/dist/styles/themes/default.css.json +0 -46
  109. package/dist/styles/themes/shadcn-extras.css +0 -4
  110. package/dist/styles/themes/shadcn-extras.css.json +0 -5
  111. package/dist/tailwindcss/index.d.ts +0 -49
  112. package/dist/tailwindcss/index.d.ts.map +0 -1
  113. package/dist/tailwindcss/index.js +0 -189
  114. package/dist/tailwindcss/index.js.map +0 -1
  115. package/dist/tailwindcss/index.mjs +0 -181
  116. package/dist/tailwindcss/index.mjs.map +0 -1
  117. package/dist/ui/assistant-action-bar.d.ts +0 -24
  118. package/dist/ui/assistant-action-bar.d.ts.map +0 -1
  119. package/dist/ui/assistant-action-bar.js +0 -193
  120. package/dist/ui/assistant-action-bar.js.map +0 -1
  121. package/dist/ui/assistant-action-bar.mjs +0 -181
  122. package/dist/ui/assistant-action-bar.mjs.map +0 -1
  123. package/dist/ui/assistant-message.d.ts +0 -13
  124. package/dist/ui/assistant-message.d.ts.map +0 -1
  125. package/dist/ui/assistant-message.js +0 -107
  126. package/dist/ui/assistant-message.js.map +0 -1
  127. package/dist/ui/assistant-message.mjs +0 -77
  128. package/dist/ui/assistant-message.mjs.map +0 -1
  129. package/dist/ui/assistant-modal.d.ts +0 -23
  130. package/dist/ui/assistant-modal.d.ts.map +0 -1
  131. package/dist/ui/assistant-modal.js +0 -126
  132. package/dist/ui/assistant-modal.js.map +0 -1
  133. package/dist/ui/assistant-modal.mjs +0 -99
  134. package/dist/ui/assistant-modal.mjs.map +0 -1
  135. package/dist/ui/attachment-ui.d.ts +0 -12
  136. package/dist/ui/attachment-ui.d.ts.map +0 -1
  137. package/dist/ui/attachment-ui.js +0 -170
  138. package/dist/ui/attachment-ui.js.map +0 -1
  139. package/dist/ui/attachment-ui.mjs +0 -160
  140. package/dist/ui/attachment-ui.mjs.map +0 -1
  141. package/dist/ui/base/CircleStopIcon.d.ts +0 -3
  142. package/dist/ui/base/CircleStopIcon.d.ts.map +0 -1
  143. package/dist/ui/base/CircleStopIcon.js +0 -45
  144. package/dist/ui/base/CircleStopIcon.js.map +0 -1
  145. package/dist/ui/base/CircleStopIcon.mjs +0 -20
  146. package/dist/ui/base/CircleStopIcon.mjs.map +0 -1
  147. package/dist/ui/base/avatar.d.ts +0 -12
  148. package/dist/ui/base/avatar.d.ts.map +0 -1
  149. package/dist/ui/base/avatar.js +0 -69
  150. package/dist/ui/base/avatar.js.map +0 -1
  151. package/dist/ui/base/avatar.mjs +0 -31
  152. package/dist/ui/base/avatar.mjs.map +0 -1
  153. package/dist/ui/base/button.d.ts +0 -16
  154. package/dist/ui/base/button.d.ts.map +0 -1
  155. package/dist/ui/base/button.js +0 -66
  156. package/dist/ui/base/button.js.map +0 -1
  157. package/dist/ui/base/button.mjs +0 -40
  158. package/dist/ui/base/button.mjs.map +0 -1
  159. package/dist/ui/base/dialog.d.ts +0 -9
  160. package/dist/ui/base/dialog.d.ts.map +0 -1
  161. package/dist/ui/base/dialog.js +0 -80
  162. package/dist/ui/base/dialog.js.map +0 -1
  163. package/dist/ui/base/dialog.mjs +0 -40
  164. package/dist/ui/base/dialog.mjs.map +0 -1
  165. package/dist/ui/base/index.d.ts +0 -6
  166. package/dist/ui/base/index.d.ts.map +0 -1
  167. package/dist/ui/base/index.js +0 -55
  168. package/dist/ui/base/index.js.map +0 -1
  169. package/dist/ui/base/index.mjs +0 -25
  170. package/dist/ui/base/index.mjs.map +0 -1
  171. package/dist/ui/base/tooltip-icon-button.d.ts +0 -17
  172. package/dist/ui/base/tooltip-icon-button.d.ts.map +0 -1
  173. package/dist/ui/base/tooltip-icon-button.js +0 -44
  174. package/dist/ui/base/tooltip-icon-button.js.map +0 -1
  175. package/dist/ui/base/tooltip-icon-button.mjs +0 -19
  176. package/dist/ui/base/tooltip-icon-button.mjs.map +0 -1
  177. package/dist/ui/base/tooltip.d.ts +0 -6
  178. package/dist/ui/base/tooltip.d.ts.map +0 -1
  179. package/dist/ui/base/tooltip.js +0 -57
  180. package/dist/ui/base/tooltip.js.map +0 -1
  181. package/dist/ui/base/tooltip.mjs +0 -20
  182. package/dist/ui/base/tooltip.mjs.map +0 -1
  183. package/dist/ui/branch-picker.d.ts +0 -15
  184. package/dist/ui/branch-picker.d.ts.map +0 -1
  185. package/dist/ui/branch-picker.js +0 -89
  186. package/dist/ui/branch-picker.js.map +0 -1
  187. package/dist/ui/branch-picker.mjs +0 -69
  188. package/dist/ui/branch-picker.mjs.map +0 -1
  189. package/dist/ui/composer.d.ts +0 -25
  190. package/dist/ui/composer.d.ts.map +0 -1
  191. package/dist/ui/composer.js +0 -168
  192. package/dist/ui/composer.js.map +0 -1
  193. package/dist/ui/composer.mjs +0 -138
  194. package/dist/ui/composer.mjs.map +0 -1
  195. package/dist/ui/content-part.d.ts +0 -7
  196. package/dist/ui/content-part.d.ts.map +0 -1
  197. package/dist/ui/content-part.js +0 -61
  198. package/dist/ui/content-part.js.map +0 -1
  199. package/dist/ui/content-part.mjs +0 -27
  200. package/dist/ui/content-part.mjs.map +0 -1
  201. package/dist/ui/edit-composer.d.ts +0 -22
  202. package/dist/ui/edit-composer.d.ts.map +0 -1
  203. package/dist/ui/edit-composer.js +0 -77
  204. package/dist/ui/edit-composer.js.map +0 -1
  205. package/dist/ui/edit-composer.mjs +0 -57
  206. package/dist/ui/edit-composer.mjs.map +0 -1
  207. package/dist/ui/index.d.ts +0 -75
  208. package/dist/ui/index.d.ts.map +0 -1
  209. package/dist/ui/index.js +0 -86
  210. package/dist/ui/index.js.map +0 -1
  211. package/dist/ui/index.mjs +0 -38
  212. package/dist/ui/index.mjs.map +0 -1
  213. package/dist/ui/thread-config.d.ts +0 -162
  214. package/dist/ui/thread-config.d.ts.map +0 -1
  215. package/dist/ui/thread-config.js +0 -63
  216. package/dist/ui/thread-config.js.map +0 -1
  217. package/dist/ui/thread-config.mjs +0 -41
  218. package/dist/ui/thread-config.mjs.map +0 -1
  219. package/dist/ui/thread-list-item.d.ts +0 -13
  220. package/dist/ui/thread-list-item.d.ts.map +0 -1
  221. package/dist/ui/thread-list-item.js +0 -94
  222. package/dist/ui/thread-list-item.js.map +0 -1
  223. package/dist/ui/thread-list-item.mjs +0 -64
  224. package/dist/ui/thread-list-item.mjs.map +0 -1
  225. package/dist/ui/thread-list.d.ts +0 -27
  226. package/dist/ui/thread-list.d.ts.map +0 -1
  227. package/dist/ui/thread-list.js +0 -91
  228. package/dist/ui/thread-list.js.map +0 -1
  229. package/dist/ui/thread-list.mjs +0 -61
  230. package/dist/ui/thread-list.mjs.map +0 -1
  231. package/dist/ui/thread-welcome.d.ts +0 -21
  232. package/dist/ui/thread-welcome.d.ts.map +0 -1
  233. package/dist/ui/thread-welcome.js +0 -101
  234. package/dist/ui/thread-welcome.js.map +0 -1
  235. package/dist/ui/thread-welcome.mjs +0 -81
  236. package/dist/ui/thread-welcome.mjs.map +0 -1
  237. package/dist/ui/thread.d.ts +0 -30
  238. package/dist/ui/thread.d.ts.map +0 -1
  239. package/dist/ui/thread.js +0 -152
  240. package/dist/ui/thread.js.map +0 -1
  241. package/dist/ui/thread.mjs +0 -125
  242. package/dist/ui/thread.mjs.map +0 -1
  243. package/dist/ui/user-action-bar.d.ts +0 -16
  244. package/dist/ui/user-action-bar.d.ts.map +0 -1
  245. package/dist/ui/user-action-bar.js +0 -63
  246. package/dist/ui/user-action-bar.js.map +0 -1
  247. package/dist/ui/user-action-bar.mjs +0 -43
  248. package/dist/ui/user-action-bar.mjs.map +0 -1
  249. package/dist/ui/user-message.d.ts +0 -13
  250. package/dist/ui/user-message.d.ts.map +0 -1
  251. package/dist/ui/user-message.js +0 -96
  252. package/dist/ui/user-message.js.map +0 -1
  253. package/dist/ui/user-message.mjs +0 -65
  254. package/dist/ui/user-message.mjs.map +0 -1
  255. package/dist/ui/utils/withDefaults.d.ts +0 -7
  256. package/dist/ui/utils/withDefaults.d.ts.map +0 -1
  257. package/dist/ui/utils/withDefaults.js +0 -66
  258. package/dist/ui/utils/withDefaults.js.map +0 -1
  259. package/dist/ui/utils/withDefaults.mjs +0 -30
  260. package/dist/ui/utils/withDefaults.mjs.map +0 -1
  261. package/src/primitives/contentPart/ContentPartDisplay.tsx +0 -20
  262. package/src/primitives/contentPart/useContentPartDisplay.tsx +0 -21
  263. package/src/styles/base.css +0 -37
  264. package/src/styles/index.css +0 -4
  265. package/src/styles/modal.css +0 -1
  266. package/src/styles/tailwindcss/base-components.css +0 -69
  267. package/src/styles/tailwindcss/modal.css +0 -29
  268. package/src/styles/tailwindcss/thread.css +0 -262
  269. package/src/styles/themes/default.css +0 -64
  270. package/src/styles/themes/shadcn-extras.css +0 -4
  271. package/src/tailwindcss/index.ts +0 -149
  272. package/src/ui/assistant-action-bar.tsx +0 -301
  273. package/src/ui/assistant-message.tsx +0 -96
  274. package/src/ui/assistant-modal.tsx +0 -146
  275. package/src/ui/attachment-ui.tsx +0 -211
  276. package/src/ui/base/CircleStopIcon.tsx +0 -17
  277. package/src/ui/base/avatar.tsx +0 -41
  278. package/src/ui/base/button.tsx +0 -42
  279. package/src/ui/base/dialog.tsx +0 -113
  280. package/src/ui/base/index.ts +0 -15
  281. package/src/ui/base/tooltip-icon-button.tsx +0 -29
  282. package/src/ui/base/tooltip.tsx +0 -22
  283. package/src/ui/branch-picker.tsx +0 -117
  284. package/src/ui/composer.tsx +0 -210
  285. package/src/ui/content-part.tsx +0 -23
  286. package/src/ui/edit-composer.tsx +0 -98
  287. package/src/ui/index.ts +0 -98
  288. package/src/ui/thread-config.tsx +0 -246
  289. package/src/ui/thread-list-item.tsx +0 -91
  290. package/src/ui/thread-list.tsx +0 -78
  291. package/src/ui/thread-welcome.tsx +0 -140
  292. package/src/ui/thread.tsx +0 -176
  293. package/src/ui/user-action-bar.tsx +0 -66
  294. package/src/ui/user-message.tsx +0 -92
  295. package/src/ui/utils/withDefaults.tsx +0 -35
  296. package/tailwindcss/README.md +0 -1
  297. package/tailwindcss/package-lock.json +0 -6
  298. package/tailwindcss/package.json +0 -5
@@ -1,125 +0,0 @@
1
- "use client";
2
-
3
- // src/ui/thread.tsx
4
- import { forwardRef } from "react";
5
- import { ArrowDownIcon } from "lucide-react";
6
- import { withDefaults } from "./utils/withDefaults.mjs";
7
- import Composer from "./composer.mjs";
8
- import ThreadWelcome from "./thread-welcome.mjs";
9
- import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
10
- import AssistantMessage from "./assistant-message.mjs";
11
- import UserMessage from "./user-message.mjs";
12
- import EditComposer from "./edit-composer.mjs";
13
- import {
14
- ThreadConfigProvider,
15
- useThreadConfig
16
- } from "./thread-config.mjs";
17
- import { ThreadPrimitive } from "../primitives/index.mjs";
18
- import { useThread } from "../context/index.mjs";
19
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
20
- var Thread = (config) => {
21
- const {
22
- components: {
23
- Composer: ComposerComponent = Composer,
24
- ThreadWelcome: ThreadWelcomeComponent = ThreadWelcome,
25
- MessagesFooter,
26
- ...messageComponents
27
- } = {}
28
- } = config;
29
- return /* @__PURE__ */ jsx(ThreadRoot, { config, children: /* @__PURE__ */ jsxs(ThreadViewport, { children: [
30
- /* @__PURE__ */ jsx(ThreadWelcomeComponent, {}),
31
- /* @__PURE__ */ jsx(
32
- ThreadMessages,
33
- {
34
- MessagesFooter,
35
- components: messageComponents
36
- }
37
- ),
38
- /* @__PURE__ */ jsx(ThreadFollowupSuggestions, {}),
39
- /* @__PURE__ */ jsxs(ThreadViewportFooter, { children: [
40
- /* @__PURE__ */ jsx(ThreadScrollToBottom, {}),
41
- /* @__PURE__ */ jsx(ComposerComponent, {})
42
- ] })
43
- ] }) });
44
- };
45
- var ThreadRootStyled = withDefaults(ThreadPrimitive.Root, {
46
- className: "aui-root aui-thread-root"
47
- });
48
- var ThreadRoot = forwardRef(
49
- ({ config, ...props }, ref) => {
50
- return /* @__PURE__ */ jsx(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx(ThreadRootStyled, { ...props, ref }) });
51
- }
52
- );
53
- ThreadRoot.displayName = "ThreadRoot";
54
- var ThreadViewport = withDefaults(ThreadPrimitive.Viewport, {
55
- className: "aui-thread-viewport"
56
- });
57
- ThreadViewport.displayName = "ThreadViewport";
58
- var ThreadViewportFooter = withDefaults("div", {
59
- className: "aui-thread-viewport-footer"
60
- });
61
- ThreadViewportFooter.displayName = "ThreadViewportFooter";
62
- var ThreadMessages = ({
63
- components,
64
- MessagesFooter,
65
- unstable_flexGrowDiv: flexGrowDiv = true,
66
- ...rest
67
- }) => {
68
- return /* @__PURE__ */ jsxs(Fragment, { children: [
69
- /* @__PURE__ */ jsx(
70
- ThreadPrimitive.Messages,
71
- {
72
- components: {
73
- ...components,
74
- UserMessage: components?.UserMessage ?? UserMessage,
75
- AssistantMessage: components?.AssistantMessage ?? AssistantMessage,
76
- EditComposer: components?.EditComposer ?? EditComposer
77
- },
78
- ...rest
79
- }
80
- ),
81
- MessagesFooter && /* @__PURE__ */ jsx(MessagesFooter, {}),
82
- flexGrowDiv && /* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } }) })
83
- ] });
84
- };
85
- ThreadMessages.displayName = "ThreadMessages";
86
- var ThreadFollowupSuggestions = () => {
87
- const suggestions = useThread((t) => t.suggestions);
88
- return /* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, running: false, children: /* @__PURE__ */ jsx("div", { className: "aui-thread-followup-suggestions", children: suggestions?.map((suggestion, idx) => /* @__PURE__ */ jsx(
89
- ThreadPrimitive.Suggestion,
90
- {
91
- className: "aui-thread-followup-suggestion",
92
- prompt: suggestion.prompt,
93
- method: "replace",
94
- autoSend: true,
95
- children: suggestion.prompt
96
- },
97
- idx
98
- )) }) });
99
- };
100
- var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
101
- variant: "outline",
102
- className: "aui-thread-scroll-to-bottom"
103
- });
104
- var ThreadScrollToBottom = forwardRef((props, ref) => {
105
- const {
106
- strings: {
107
- thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
108
- } = {}
109
- } = useThreadConfig();
110
- return /* @__PURE__ */ jsx(ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx(ArrowDownIcon, {}) }) });
111
- });
112
- ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
113
- var exports = {
114
- Root: ThreadRoot,
115
- Viewport: ThreadViewport,
116
- Messages: ThreadMessages,
117
- FollowupSuggestions: ThreadFollowupSuggestions,
118
- ScrollToBottom: ThreadScrollToBottom,
119
- ViewportFooter: ThreadViewportFooter
120
- };
121
- var thread_default = Object.assign(Thread, exports);
122
- export {
123
- thread_default as default
124
- };
125
- //# sourceMappingURL=thread.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ui/thread.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, forwardRef, type FC } from \"react\";\nimport { ArrowDownIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport Composer from \"./composer\";\nimport ThreadWelcome from \"./thread-welcome\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport AssistantMessage from \"./assistant-message\";\nimport UserMessage from \"./user-message\";\nimport EditComposer from \"./edit-composer\";\nimport {\n ThreadConfig,\n ThreadConfigProvider,\n ThreadConfigProviderProps,\n useThreadConfig,\n} from \"./thread-config\";\nimport { ThreadPrimitive } from \"../primitives\";\nimport { useThread } from \"../context\";\n\nconst Thread: FC<ThreadConfig> = (config) => {\n const {\n components: {\n Composer: ComposerComponent = Composer,\n ThreadWelcome: ThreadWelcomeComponent = ThreadWelcome,\n MessagesFooter,\n ...messageComponents\n } = {},\n } = config;\n return (\n <ThreadRoot config={config}>\n <ThreadViewport>\n <ThreadWelcomeComponent />\n <ThreadMessages\n MessagesFooter={MessagesFooter}\n components={messageComponents}\n />\n <ThreadFollowupSuggestions />\n <ThreadViewportFooter>\n <ThreadScrollToBottom />\n <ComposerComponent />\n </ThreadViewportFooter>\n </ThreadViewport>\n </ThreadRoot>\n );\n};\n\nnamespace ThreadRoot {\n export type Element = HTMLDivElement;\n export type Props = ThreadPrimitive.Root.Props & ThreadConfigProviderProps;\n}\n\nconst ThreadRootStyled = withDefaults(ThreadPrimitive.Root, {\n className: \"aui-root aui-thread-root\",\n});\n\nconst ThreadRoot = forwardRef<ThreadRoot.Element, ThreadRoot.Props>(\n ({ config, ...props }, ref) => {\n return (\n <ThreadConfigProvider config={config}>\n <ThreadRootStyled {...props} ref={ref} />\n </ThreadConfigProvider>\n );\n },\n);\n\nThreadRoot.displayName = \"ThreadRoot\";\n\nconst ThreadViewport = withDefaults(ThreadPrimitive.Viewport, {\n className: \"aui-thread-viewport\",\n});\n\nThreadViewport.displayName = \"ThreadViewport\";\n\nconst ThreadViewportFooter = withDefaults(\"div\", {\n className: \"aui-thread-viewport-footer\",\n});\n\nThreadViewportFooter.displayName = \"ThreadViewportFooter\";\n\nconst ThreadMessages: FC<{\n unstable_flexGrowDiv?: boolean;\n components?: Partial<ThreadPrimitive.Messages.Props[\"components\"]>;\n MessagesFooter?: ComponentType | undefined;\n}> = ({\n components,\n MessagesFooter,\n unstable_flexGrowDiv: flexGrowDiv = true,\n ...rest\n}) => {\n return (\n <>\n <ThreadPrimitive.Messages\n components={{\n ...components,\n UserMessage: components?.UserMessage ?? UserMessage,\n AssistantMessage: components?.AssistantMessage ?? AssistantMessage,\n EditComposer: components?.EditComposer ?? EditComposer,\n }}\n {...rest}\n />\n {MessagesFooter && <MessagesFooter />}\n {flexGrowDiv && (\n <ThreadPrimitive.If empty={false}>\n <div style={{ flexGrow: 1 }} />\n </ThreadPrimitive.If>\n )}\n </>\n );\n};\n\nThreadMessages.displayName = \"ThreadMessages\";\n\nconst ThreadFollowupSuggestions: FC = () => {\n const suggestions = useThread((t) => t.suggestions);\n\n return (\n <ThreadPrimitive.If empty={false} running={false}>\n <div className=\"aui-thread-followup-suggestions\">\n {suggestions?.map((suggestion, idx) => (\n <ThreadPrimitive.Suggestion\n key={idx}\n className=\"aui-thread-followup-suggestion\"\n prompt={suggestion.prompt}\n method=\"replace\"\n autoSend\n >\n {suggestion.prompt}\n </ThreadPrimitive.Suggestion>\n ))}\n </div>\n </ThreadPrimitive.If>\n );\n};\n\nconst ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {\n variant: \"outline\",\n className: \"aui-thread-scroll-to-bottom\",\n});\n\nnamespace ThreadScrollToBottom {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ThreadScrollToBottom = forwardRef<\n ThreadScrollToBottom.Element,\n ThreadScrollToBottom.Props\n>((props, ref) => {\n const {\n strings: {\n thread: { scrollToBottom: { tooltip = \"Scroll to bottom\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n return (\n <ThreadPrimitive.ScrollToBottom asChild>\n <ThreadScrollToBottomIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ArrowDownIcon />}\n </ThreadScrollToBottomIconButton>\n </ThreadPrimitive.ScrollToBottom>\n );\n});\n\nThreadScrollToBottom.displayName = \"ThreadScrollToBottom\";\n\nconst exports = {\n Root: ThreadRoot,\n Viewport: ThreadViewport,\n Messages: ThreadMessages,\n FollowupSuggestions: ThreadFollowupSuggestions,\n ScrollToBottom: ThreadScrollToBottom,\n ViewportFooter: ThreadViewportFooter,\n};\n\nexport default Object.assign(Thread, exports) as typeof Thread & typeof exports;\n"],"mappings":";;;AAEA,SAAwB,kBAA2B;AACnD,SAAS,qBAAqB;AAE9B,SAAS,oBAAoB;AAC7B,OAAO,cAAc;AACrB,OAAO,mBAAmB;AAC1B,SAAS,yBAAyB;AAClC,OAAO,sBAAsB;AAC7B,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAclB,SA2DJ,UA3DI,KAMA,YANA;AAZR,IAAM,SAA2B,CAAC,WAAW;AAC3C,QAAM;AAAA,IACJ,YAAY;AAAA,MACV,UAAU,oBAAoB;AAAA,MAC9B,eAAe,yBAAyB;AAAA,MACxC;AAAA,MACA,GAAG;AAAA,IACL,IAAI,CAAC;AAAA,EACP,IAAI;AACJ,SACE,oBAAC,cAAW,QACV,+BAAC,kBACC;AAAA,wBAAC,0BAAuB;AAAA,IACxB;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,YAAY;AAAA;AAAA,IACd;AAAA,IACA,oBAAC,6BAA0B;AAAA,IAC3B,qBAAC,wBACC;AAAA,0BAAC,wBAAqB;AAAA,MACtB,oBAAC,qBAAkB;AAAA,OACrB;AAAA,KACF,GACF;AAEJ;AAOA,IAAM,mBAAmB,aAAa,gBAAgB,MAAM;AAAA,EAC1D,WAAW;AACb,CAAC;AAED,IAAM,aAAa;AAAA,EACjB,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ;AAC7B,WACE,oBAAC,wBAAqB,QACpB,8BAAC,oBAAkB,GAAG,OAAO,KAAU,GACzC;AAAA,EAEJ;AACF;AAEA,WAAW,cAAc;AAEzB,IAAM,iBAAiB,aAAa,gBAAgB,UAAU;AAAA,EAC5D,WAAW;AACb,CAAC;AAED,eAAe,cAAc;AAE7B,IAAM,uBAAuB,aAAa,OAAO;AAAA,EAC/C,WAAW;AACb,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,iBAID,CAAC;AAAA,EACJ;AAAA,EACA;AAAA,EACA,sBAAsB,cAAc;AAAA,EACpC,GAAG;AACL,MAAM;AACJ,SACE,iCACE;AAAA;AAAA,MAAC,gBAAgB;AAAA,MAAhB;AAAA,QACC,YAAY;AAAA,UACV,GAAG;AAAA,UACH,aAAa,YAAY,eAAe;AAAA,UACxC,kBAAkB,YAAY,oBAAoB;AAAA,UAClD,cAAc,YAAY,gBAAgB;AAAA,QAC5C;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,IACC,kBAAkB,oBAAC,kBAAe;AAAA,IAClC,eACC,oBAAC,gBAAgB,IAAhB,EAAmB,OAAO,OACzB,8BAAC,SAAI,OAAO,EAAE,UAAU,EAAE,GAAG,GAC/B;AAAA,KAEJ;AAEJ;AAEA,eAAe,cAAc;AAE7B,IAAM,4BAAgC,MAAM;AAC1C,QAAM,cAAc,UAAU,CAAC,MAAM,EAAE,WAAW;AAElD,SACE,oBAAC,gBAAgB,IAAhB,EAAmB,OAAO,OAAO,SAAS,OACzC,8BAAC,SAAI,WAAU,mCACZ,uBAAa,IAAI,CAAC,YAAY,QAC7B;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MAEC,WAAU;AAAA,MACV,QAAQ,WAAW;AAAA,MACnB,QAAO;AAAA,MACP,UAAQ;AAAA,MAEP,qBAAW;AAAA;AAAA,IANP;AAAA,EAOP,CACD,GACH,GACF;AAEJ;AAEA,IAAM,iCAAiC,aAAa,mBAAmB;AAAA,EACrE,SAAS;AAAA,EACT,WAAW;AACb,CAAC;AAOD,IAAM,uBAAuB,WAG3B,CAAC,OAAO,QAAQ;AAChB,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,QAAQ,EAAE,gBAAgB,EAAE,UAAU,mBAAmB,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,IACvE,IAAI,CAAC;AAAA,EACP,IAAI,gBAAgB;AACpB,SACE,oBAAC,gBAAgB,gBAAhB,EAA+B,SAAO,MACrC,8BAAC,kCAA+B,SAAmB,GAAG,OAAO,KAC1D,gBAAM,YAAY,oBAAC,iBAAc,GACpC,GACF;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,gBAAgB;AAClB;AAEA,IAAO,iBAAQ,OAAO,OAAO,QAAQ,OAAO;","names":[]}
@@ -1,16 +0,0 @@
1
- import { type FC } from "react";
2
- import { TooltipIconButton } from "./base/tooltip-icon-button";
3
- declare const UserActionBar: FC;
4
- declare const exports: {
5
- Root: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
6
- asChild?: boolean;
7
- }, "ref"> & {
8
- hideWhenRunning?: boolean | undefined;
9
- autohide?: "always" | "not-last" | "never" | undefined;
10
- autohideFloat?: "always" | "single-branch" | "never" | undefined;
11
- } & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
12
- Edit: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
13
- };
14
- declare const _default: typeof UserActionBar & typeof exports;
15
- export default _default;
16
- //# sourceMappingURL=user-action-bar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-action-bar.d.ts","sourceRoot":"","sources":["../../src/ui/user-action-bar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAY/D,QAAA,MAAM,aAAa,EAAE,EAQpB,CAAC;AAkCF,QAAA,MAAM,OAAO;;;;;;;;;CAGZ,CAAC;wBAEsD,OAAO,aAAa,GAC1E,OAAO,OAAO;AADhB,wBACiB"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/ui/user-action-bar.tsx
22
- var user_action_bar_exports = {};
23
- __export(user_action_bar_exports, {
24
- default: () => user_action_bar_default
25
- });
26
- module.exports = __toCommonJS(user_action_bar_exports);
27
- var import_react = require("react");
28
- var import_lucide_react = require("lucide-react");
29
- var import_tooltip_icon_button = require("./base/tooltip-icon-button.js");
30
- var import_withDefaults = require("./utils/withDefaults.js");
31
- var import_thread_config = require("./thread-config.js");
32
- var import_context = require("../context/index.js");
33
- var import_primitives = require("../primitives/index.js");
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var useAllowEdit = (ensureCapability = false) => {
36
- const { userMessage: { allowEdit = true } = {} } = (0, import_thread_config.useThreadConfig)();
37
- const editSupported = (0, import_context.useThread)((t) => t.capabilities.edit);
38
- return allowEdit && (!ensureCapability || editSupported);
39
- };
40
- var UserActionBar = () => {
41
- const allowEdit = useAllowEdit(true);
42
- if (!allowEdit) return null;
43
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserActionBarEdit, {}) });
44
- };
45
- UserActionBar.displayName = "UserActionBar";
46
- var UserActionBarRoot = (0, import_withDefaults.withDefaults)(import_primitives.ActionBarPrimitive.Root, {
47
- className: "aui-user-action-bar-root"
48
- });
49
- UserActionBarRoot.displayName = "UserActionBarRoot";
50
- var UserActionBarEdit = (0, import_react.forwardRef)((props, ref) => {
51
- const {
52
- strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
53
- } = (0, import_thread_config.useThreadConfig)();
54
- const allowEdit = useAllowEdit();
55
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.ActionBarPrimitive.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tooltip_icon_button.TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.PencilIcon, {}) }) });
56
- });
57
- UserActionBarEdit.displayName = "UserActionBarEdit";
58
- var exports2 = {
59
- Root: UserActionBarRoot,
60
- Edit: UserActionBarEdit
61
- };
62
- var user_action_bar_default = Object.assign(UserActionBar, exports2);
63
- //# sourceMappingURL=user-action-bar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ui/user-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { PencilIcon } from \"lucide-react\";\n\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { useThread } from \"../context\";\nimport { ActionBarPrimitive } from \"../primitives\";\n\nconst useAllowEdit = (ensureCapability = false) => {\n const { userMessage: { allowEdit = true } = {} } = useThreadConfig();\n const editSupported = useThread((t) => t.capabilities.edit);\n return allowEdit && (!ensureCapability || editSupported);\n};\n\nconst UserActionBar: FC = () => {\n const allowEdit = useAllowEdit(true);\n if (!allowEdit) return null;\n return (\n <UserActionBarRoot hideWhenRunning autohide=\"not-last\">\n <UserActionBarEdit />\n </UserActionBarRoot>\n );\n};\n\nUserActionBar.displayName = \"UserActionBar\";\n\nconst UserActionBarRoot = withDefaults(ActionBarPrimitive.Root, {\n className: \"aui-user-action-bar-root\",\n});\n\nUserActionBarRoot.displayName = \"UserActionBarRoot\";\n\nnamespace UserActionBarEdit {\n export type Element = ActionBarPrimitive.Edit.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst UserActionBarEdit = forwardRef<\n UserActionBarEdit.Element,\n UserActionBarEdit.Props\n>((props, ref) => {\n const {\n strings: { userMessage: { edit: { tooltip = \"Edit\" } = {} } = {} } = {},\n } = useThreadConfig();\n const allowEdit = useAllowEdit();\n return (\n <ActionBarPrimitive.Edit disabled={!allowEdit} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <PencilIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Edit>\n );\n});\n\nUserActionBarEdit.displayName = \"UserActionBarEdit\";\n\nconst exports = {\n Root: UserActionBarRoot,\n Edit: UserActionBarEdit,\n};\n\nexport default Object.assign(UserActionBar, exports) as typeof UserActionBar &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoC;AACpC,0BAA2B;AAE3B,iCAAkC;AAClC,0BAA6B;AAC7B,2BAAgC;AAChC,qBAA0B;AAC1B,wBAAmC;AAa7B;AAXN,IAAM,eAAe,CAAC,mBAAmB,UAAU;AACjD,QAAM,EAAE,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC,EAAE,QAAI,sCAAgB;AACnE,QAAM,oBAAgB,0BAAU,CAAC,MAAM,EAAE,aAAa,IAAI;AAC1D,SAAO,cAAc,CAAC,oBAAoB;AAC5C;AAEA,IAAM,gBAAoB,MAAM;AAC9B,QAAM,YAAY,aAAa,IAAI;AACnC,MAAI,CAAC,UAAW,QAAO;AACvB,SACE,4CAAC,qBAAkB,iBAAe,MAAC,UAAS,YAC1C,sDAAC,qBAAkB,GACrB;AAEJ;AAEA,cAAc,cAAc;AAE5B,IAAM,wBAAoB,kCAAa,qCAAmB,MAAM;AAAA,EAC9D,WAAW;AACb,CAAC;AAED,kBAAkB,cAAc;AAOhC,IAAM,wBAAoB,yBAGxB,CAAC,OAAO,QAAQ;AAChB,QAAM;AAAA,IACJ,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,OAAO,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACxE,QAAI,sCAAgB;AACpB,QAAM,YAAY,aAAa;AAC/B,SACE,4CAAC,qCAAmB,MAAnB,EAAwB,UAAU,CAAC,WAAW,SAAO,MACpD,sDAAC,gDAAkB,SAAmB,GAAG,OAAO,KAC7C,gBAAM,YAAY,4CAAC,kCAAW,GACjC,GACF;AAEJ,CAAC;AAED,kBAAkB,cAAc;AAEhC,IAAMA,WAAU;AAAA,EACd,MAAM;AAAA,EACN,MAAM;AACR;AAEA,IAAO,0BAAQ,OAAO,OAAO,eAAeA,QAAO;","names":["exports"]}
@@ -1,43 +0,0 @@
1
- "use client";
2
-
3
- // src/ui/user-action-bar.tsx
4
- import { forwardRef } from "react";
5
- import { PencilIcon } from "lucide-react";
6
- import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
7
- import { withDefaults } from "./utils/withDefaults.mjs";
8
- import { useThreadConfig } from "./thread-config.mjs";
9
- import { useThread } from "../context/index.mjs";
10
- import { ActionBarPrimitive } from "../primitives/index.mjs";
11
- import { jsx } from "react/jsx-runtime";
12
- var useAllowEdit = (ensureCapability = false) => {
13
- const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
14
- const editSupported = useThread((t) => t.capabilities.edit);
15
- return allowEdit && (!ensureCapability || editSupported);
16
- };
17
- var UserActionBar = () => {
18
- const allowEdit = useAllowEdit(true);
19
- if (!allowEdit) return null;
20
- return /* @__PURE__ */ jsx(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx(UserActionBarEdit, {}) });
21
- };
22
- UserActionBar.displayName = "UserActionBar";
23
- var UserActionBarRoot = withDefaults(ActionBarPrimitive.Root, {
24
- className: "aui-user-action-bar-root"
25
- });
26
- UserActionBarRoot.displayName = "UserActionBarRoot";
27
- var UserActionBarEdit = forwardRef((props, ref) => {
28
- const {
29
- strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
30
- } = useThreadConfig();
31
- const allowEdit = useAllowEdit();
32
- return /* @__PURE__ */ jsx(ActionBarPrimitive.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx(PencilIcon, {}) }) });
33
- });
34
- UserActionBarEdit.displayName = "UserActionBarEdit";
35
- var exports = {
36
- Root: UserActionBarRoot,
37
- Edit: UserActionBarEdit
38
- };
39
- var user_action_bar_default = Object.assign(UserActionBar, exports);
40
- export {
41
- user_action_bar_default as default
42
- };
43
- //# sourceMappingURL=user-action-bar.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ui/user-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { PencilIcon } from \"lucide-react\";\n\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { useThread } from \"../context\";\nimport { ActionBarPrimitive } from \"../primitives\";\n\nconst useAllowEdit = (ensureCapability = false) => {\n const { userMessage: { allowEdit = true } = {} } = useThreadConfig();\n const editSupported = useThread((t) => t.capabilities.edit);\n return allowEdit && (!ensureCapability || editSupported);\n};\n\nconst UserActionBar: FC = () => {\n const allowEdit = useAllowEdit(true);\n if (!allowEdit) return null;\n return (\n <UserActionBarRoot hideWhenRunning autohide=\"not-last\">\n <UserActionBarEdit />\n </UserActionBarRoot>\n );\n};\n\nUserActionBar.displayName = \"UserActionBar\";\n\nconst UserActionBarRoot = withDefaults(ActionBarPrimitive.Root, {\n className: \"aui-user-action-bar-root\",\n});\n\nUserActionBarRoot.displayName = \"UserActionBarRoot\";\n\nnamespace UserActionBarEdit {\n export type Element = ActionBarPrimitive.Edit.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst UserActionBarEdit = forwardRef<\n UserActionBarEdit.Element,\n UserActionBarEdit.Props\n>((props, ref) => {\n const {\n strings: { userMessage: { edit: { tooltip = \"Edit\" } = {} } = {} } = {},\n } = useThreadConfig();\n const allowEdit = useAllowEdit();\n return (\n <ActionBarPrimitive.Edit disabled={!allowEdit} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <PencilIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Edit>\n );\n});\n\nUserActionBarEdit.displayName = \"UserActionBarEdit\";\n\nconst exports = {\n Root: UserActionBarRoot,\n Edit: UserActionBarEdit,\n};\n\nexport default Object.assign(UserActionBar, exports) as typeof UserActionBar &\n typeof exports;\n"],"mappings":";;;AAEA,SAAS,kBAA2B;AACpC,SAAS,kBAAkB;AAE3B,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AAa7B;AAXN,IAAM,eAAe,CAAC,mBAAmB,UAAU;AACjD,QAAM,EAAE,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC,EAAE,IAAI,gBAAgB;AACnE,QAAM,gBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,IAAI;AAC1D,SAAO,cAAc,CAAC,oBAAoB;AAC5C;AAEA,IAAM,gBAAoB,MAAM;AAC9B,QAAM,YAAY,aAAa,IAAI;AACnC,MAAI,CAAC,UAAW,QAAO;AACvB,SACE,oBAAC,qBAAkB,iBAAe,MAAC,UAAS,YAC1C,8BAAC,qBAAkB,GACrB;AAEJ;AAEA,cAAc,cAAc;AAE5B,IAAM,oBAAoB,aAAa,mBAAmB,MAAM;AAAA,EAC9D,WAAW;AACb,CAAC;AAED,kBAAkB,cAAc;AAOhC,IAAM,oBAAoB,WAGxB,CAAC,OAAO,QAAQ;AAChB,QAAM;AAAA,IACJ,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,OAAO,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACxE,IAAI,gBAAgB;AACpB,QAAM,YAAY,aAAa;AAC/B,SACE,oBAAC,mBAAmB,MAAnB,EAAwB,UAAU,CAAC,WAAW,SAAO,MACpD,8BAAC,qBAAkB,SAAmB,GAAG,OAAO,KAC7C,gBAAM,YAAY,oBAAC,cAAW,GACjC,GACF;AAEJ,CAAC;AAED,kBAAkB,cAAc;AAEhC,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,MAAM;AACR;AAEA,IAAO,0BAAQ,OAAO,OAAO,eAAe,OAAO;","names":[]}
@@ -1,13 +0,0 @@
1
- import { type FC } from "react";
2
- import { MessagePrimitive } from "../primitives";
3
- declare const UserMessage: FC;
4
- declare const exports: {
5
- Root: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
6
- asChild?: boolean;
7
- }, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
8
- Content: import("react").ForwardRefExoticComponent<MessagePrimitive.Content.Props & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
9
- Attachments: FC<Partial<MessagePrimitive.Attachments.Props>>;
10
- };
11
- declare const _default: typeof UserMessage & typeof exports;
12
- export default _default;
13
- //# sourceMappingURL=user-message.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-message.d.ts","sourceRoot":"","sources":["../../src/ui/user-message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,QAAA,MAAM,WAAW,EAAE,EAYlB,CAAC;AA+DF,QAAA,MAAM,OAAO;;;;;;CAIZ,CAAC;wBAEoD,OAAO,WAAW,GACtE,OAAO,OAAO;AADhB,wBACiB"}
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/ui/user-message.tsx
31
- var user_message_exports = {};
32
- __export(user_message_exports, {
33
- default: () => user_message_default
34
- });
35
- module.exports = __toCommonJS(user_message_exports);
36
- var import_react = require("react");
37
- var import_branch_picker = __toESM(require("./branch-picker.js"));
38
- var import_withDefaults = require("./utils/withDefaults.js");
39
- var import_user_action_bar = __toESM(require("./user-action-bar.js"));
40
- var import_content_part = __toESM(require("./content-part.js"));
41
- var import_primitives = require("../primitives/index.js");
42
- var import_attachment_ui = __toESM(require("./attachment-ui.js"));
43
- var import_jsx_runtime = require("react/jsx-runtime");
44
- var UserMessage = () => {
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(UserMessageRoot, { children: [
46
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserMessageAttachments, {}),
47
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_primitives.MessagePrimitive.If, { hasContent: true, children: [
48
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_user_action_bar.default, {}),
49
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserMessageContent, {})
50
- ] }),
51
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_branch_picker.default, {})
52
- ] });
53
- };
54
- UserMessage.displayName = "UserMessage";
55
- var UserMessageRoot = (0, import_withDefaults.withDefaults)(import_primitives.MessagePrimitive.Root, {
56
- className: "aui-user-message-root"
57
- });
58
- UserMessageRoot.displayName = "UserMessageRoot";
59
- var UserMessageContentWrapper = (0, import_withDefaults.withDefaults)("div", {
60
- className: "aui-user-message-content"
61
- });
62
- var UserMessageContent = (0, import_react.forwardRef)(({ components, ...props }, ref) => {
63
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
64
- import_primitives.MessagePrimitive.Content,
65
- {
66
- components: {
67
- ...components,
68
- Text: components?.Text ?? import_content_part.default.Text
69
- }
70
- }
71
- ) });
72
- });
73
- UserMessageContent.displayName = "UserMessageContent";
74
- var UserMessageAttachmentsContainer = (0, import_withDefaults.withDefaults)("div", {
75
- className: "aui-user-message-attachments"
76
- });
77
- var UserMessageAttachments = ({
78
- components
79
- }) => {
80
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.MessagePrimitive.If, { hasAttachments: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
- import_primitives.MessagePrimitive.Attachments,
82
- {
83
- components: {
84
- ...components,
85
- Attachment: components?.Attachment ?? import_attachment_ui.default
86
- }
87
- }
88
- ) }) });
89
- };
90
- var exports2 = {
91
- Root: UserMessageRoot,
92
- Content: UserMessageContent,
93
- Attachments: UserMessageAttachments
94
- };
95
- var user_message_default = Object.assign(UserMessage, exports2);
96
- //# sourceMappingURL=user-message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ui/user-message.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\n\nimport BranchPicker from \"./branch-picker\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport UserActionBar from \"./user-action-bar\";\nimport ContentPart from \"./content-part\";\nimport { MessagePrimitive } from \"../primitives\";\nimport Attachment from \"./attachment-ui\";\n\nconst UserMessage: FC = () => {\n return (\n <UserMessageRoot>\n <UserMessageAttachments />\n {/* TODO this is temporary until we place the UserActionBar in a better place */}\n <MessagePrimitive.If hasContent>\n <UserActionBar />\n <UserMessageContent />\n </MessagePrimitive.If>\n <BranchPicker />\n </UserMessageRoot>\n );\n};\n\nUserMessage.displayName = \"UserMessage\";\n\nconst UserMessageRoot = withDefaults(MessagePrimitive.Root, {\n className: \"aui-user-message-root\",\n});\n\nUserMessageRoot.displayName = \"UserMessageRoot\";\n\nconst UserMessageContentWrapper = withDefaults(\"div\", {\n className: \"aui-user-message-content\",\n});\n\nnamespace UserMessageContent {\n export type Element = HTMLDivElement;\n export type Props = MessagePrimitive.Content.Props &\n ComponentPropsWithoutRef<\"div\">;\n}\n\nconst UserMessageContent = forwardRef<\n UserMessageContent.Element,\n UserMessageContent.Props\n>(({ components, ...props }, ref) => {\n return (\n <UserMessageContentWrapper {...props} ref={ref}>\n <MessagePrimitive.Content\n components={{\n ...components,\n Text: components?.Text ?? ContentPart.Text,\n }}\n />\n </UserMessageContentWrapper>\n );\n});\n\nUserMessageContent.displayName = \"UserMessageContent\";\n\nconst UserMessageAttachmentsContainer = withDefaults(\"div\", {\n className: \"aui-user-message-attachments\",\n});\n\nnamespace UserMessageAttachments {\n export type Props = Partial<MessagePrimitive.Attachments.Props>;\n}\n\nconst UserMessageAttachments: FC<UserMessageAttachments.Props> = ({\n components,\n}) => {\n return (\n <MessagePrimitive.If hasAttachments>\n <UserMessageAttachmentsContainer>\n <MessagePrimitive.Attachments\n components={{\n ...components,\n Attachment: components?.Attachment ?? Attachment,\n }}\n />\n </UserMessageAttachmentsContainer>\n </MessagePrimitive.If>\n );\n};\n\nconst exports = {\n Root: UserMessageRoot,\n Content: UserMessageContent,\n Attachments: UserMessageAttachments,\n};\n\nexport default Object.assign(UserMessage, exports) as typeof UserMessage &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8D;AAE9D,2BAAyB;AACzB,0BAA6B;AAC7B,6BAA0B;AAC1B,0BAAwB;AACxB,wBAAiC;AACjC,2BAAuB;AAKjB;AAHN,IAAM,cAAkB,MAAM;AAC5B,SACE,6CAAC,mBACC;AAAA,gDAAC,0BAAuB;AAAA,IAExB,6CAAC,mCAAiB,IAAjB,EAAoB,YAAU,MAC7B;AAAA,kDAAC,uBAAAA,SAAA,EAAc;AAAA,MACf,4CAAC,sBAAmB;AAAA,OACtB;AAAA,IACA,4CAAC,qBAAAC,SAAA,EAAa;AAAA,KAChB;AAEJ;AAEA,YAAY,cAAc;AAE1B,IAAM,sBAAkB,kCAAa,mCAAiB,MAAM;AAAA,EAC1D,WAAW;AACb,CAAC;AAED,gBAAgB,cAAc;AAE9B,IAAM,gCAA4B,kCAAa,OAAO;AAAA,EACpD,WAAW;AACb,CAAC;AAQD,IAAM,yBAAqB,yBAGzB,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,QAAQ;AACnC,SACE,4CAAC,6BAA2B,GAAG,OAAO,KACpC;AAAA,IAAC,mCAAiB;AAAA,IAAjB;AAAA,MACC,YAAY;AAAA,QACV,GAAG;AAAA,QACH,MAAM,YAAY,QAAQ,oBAAAC,QAAY;AAAA,MACxC;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;AAED,mBAAmB,cAAc;AAEjC,IAAM,sCAAkC,kCAAa,OAAO;AAAA,EAC1D,WAAW;AACb,CAAC;AAMD,IAAM,yBAA2D,CAAC;AAAA,EAChE;AACF,MAAM;AACJ,SACE,4CAAC,mCAAiB,IAAjB,EAAoB,gBAAc,MACjC,sDAAC,mCACC;AAAA,IAAC,mCAAiB;AAAA,IAAjB;AAAA,MACC,YAAY;AAAA,QACV,GAAG;AAAA,QACH,YAAY,YAAY,cAAc,qBAAAC;AAAA,MACxC;AAAA;AAAA,EACF,GACF,GACF;AAEJ;AAEA,IAAMC,WAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AACf;AAEA,IAAO,uBAAQ,OAAO,OAAO,aAAaA,QAAO;","names":["UserActionBar","BranchPicker","ContentPart","Attachment","exports"]}
@@ -1,65 +0,0 @@
1
- // src/ui/user-message.tsx
2
- import { forwardRef } from "react";
3
- import BranchPicker from "./branch-picker.mjs";
4
- import { withDefaults } from "./utils/withDefaults.mjs";
5
- import UserActionBar from "./user-action-bar.mjs";
6
- import ContentPart from "./content-part.mjs";
7
- import { MessagePrimitive } from "../primitives/index.mjs";
8
- import Attachment from "./attachment-ui.mjs";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var UserMessage = () => {
11
- return /* @__PURE__ */ jsxs(UserMessageRoot, { children: [
12
- /* @__PURE__ */ jsx(UserMessageAttachments, {}),
13
- /* @__PURE__ */ jsxs(MessagePrimitive.If, { hasContent: true, children: [
14
- /* @__PURE__ */ jsx(UserActionBar, {}),
15
- /* @__PURE__ */ jsx(UserMessageContent, {})
16
- ] }),
17
- /* @__PURE__ */ jsx(BranchPicker, {})
18
- ] });
19
- };
20
- UserMessage.displayName = "UserMessage";
21
- var UserMessageRoot = withDefaults(MessagePrimitive.Root, {
22
- className: "aui-user-message-root"
23
- });
24
- UserMessageRoot.displayName = "UserMessageRoot";
25
- var UserMessageContentWrapper = withDefaults("div", {
26
- className: "aui-user-message-content"
27
- });
28
- var UserMessageContent = forwardRef(({ components, ...props }, ref) => {
29
- return /* @__PURE__ */ jsx(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx(
30
- MessagePrimitive.Content,
31
- {
32
- components: {
33
- ...components,
34
- Text: components?.Text ?? ContentPart.Text
35
- }
36
- }
37
- ) });
38
- });
39
- UserMessageContent.displayName = "UserMessageContent";
40
- var UserMessageAttachmentsContainer = withDefaults("div", {
41
- className: "aui-user-message-attachments"
42
- });
43
- var UserMessageAttachments = ({
44
- components
45
- }) => {
46
- return /* @__PURE__ */ jsx(MessagePrimitive.If, { hasAttachments: true, children: /* @__PURE__ */ jsx(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx(
47
- MessagePrimitive.Attachments,
48
- {
49
- components: {
50
- ...components,
51
- Attachment: components?.Attachment ?? Attachment
52
- }
53
- }
54
- ) }) });
55
- };
56
- var exports = {
57
- Root: UserMessageRoot,
58
- Content: UserMessageContent,
59
- Attachments: UserMessageAttachments
60
- };
61
- var user_message_default = Object.assign(UserMessage, exports);
62
- export {
63
- user_message_default as default
64
- };
65
- //# sourceMappingURL=user-message.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ui/user-message.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\n\nimport BranchPicker from \"./branch-picker\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport UserActionBar from \"./user-action-bar\";\nimport ContentPart from \"./content-part\";\nimport { MessagePrimitive } from \"../primitives\";\nimport Attachment from \"./attachment-ui\";\n\nconst UserMessage: FC = () => {\n return (\n <UserMessageRoot>\n <UserMessageAttachments />\n {/* TODO this is temporary until we place the UserActionBar in a better place */}\n <MessagePrimitive.If hasContent>\n <UserActionBar />\n <UserMessageContent />\n </MessagePrimitive.If>\n <BranchPicker />\n </UserMessageRoot>\n );\n};\n\nUserMessage.displayName = \"UserMessage\";\n\nconst UserMessageRoot = withDefaults(MessagePrimitive.Root, {\n className: \"aui-user-message-root\",\n});\n\nUserMessageRoot.displayName = \"UserMessageRoot\";\n\nconst UserMessageContentWrapper = withDefaults(\"div\", {\n className: \"aui-user-message-content\",\n});\n\nnamespace UserMessageContent {\n export type Element = HTMLDivElement;\n export type Props = MessagePrimitive.Content.Props &\n ComponentPropsWithoutRef<\"div\">;\n}\n\nconst UserMessageContent = forwardRef<\n UserMessageContent.Element,\n UserMessageContent.Props\n>(({ components, ...props }, ref) => {\n return (\n <UserMessageContentWrapper {...props} ref={ref}>\n <MessagePrimitive.Content\n components={{\n ...components,\n Text: components?.Text ?? ContentPart.Text,\n }}\n />\n </UserMessageContentWrapper>\n );\n});\n\nUserMessageContent.displayName = \"UserMessageContent\";\n\nconst UserMessageAttachmentsContainer = withDefaults(\"div\", {\n className: \"aui-user-message-attachments\",\n});\n\nnamespace UserMessageAttachments {\n export type Props = Partial<MessagePrimitive.Attachments.Props>;\n}\n\nconst UserMessageAttachments: FC<UserMessageAttachments.Props> = ({\n components,\n}) => {\n return (\n <MessagePrimitive.If hasAttachments>\n <UserMessageAttachmentsContainer>\n <MessagePrimitive.Attachments\n components={{\n ...components,\n Attachment: components?.Attachment ?? Attachment,\n }}\n />\n </UserMessageAttachmentsContainer>\n </MessagePrimitive.If>\n );\n};\n\nconst exports = {\n Root: UserMessageRoot,\n Content: UserMessageContent,\n Attachments: UserMessageAttachments,\n};\n\nexport default Object.assign(UserMessage, exports) as typeof UserMessage &\n typeof exports;\n"],"mappings":";AAAA,SAAmC,kBAA2B;AAE9D,OAAO,kBAAkB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,mBAAmB;AAC1B,OAAO,iBAAiB;AACxB,SAAS,wBAAwB;AACjC,OAAO,gBAAgB;AAKjB,cAEA,YAFA;AAHN,IAAM,cAAkB,MAAM;AAC5B,SACE,qBAAC,mBACC;AAAA,wBAAC,0BAAuB;AAAA,IAExB,qBAAC,iBAAiB,IAAjB,EAAoB,YAAU,MAC7B;AAAA,0BAAC,iBAAc;AAAA,MACf,oBAAC,sBAAmB;AAAA,OACtB;AAAA,IACA,oBAAC,gBAAa;AAAA,KAChB;AAEJ;AAEA,YAAY,cAAc;AAE1B,IAAM,kBAAkB,aAAa,iBAAiB,MAAM;AAAA,EAC1D,WAAW;AACb,CAAC;AAED,gBAAgB,cAAc;AAE9B,IAAM,4BAA4B,aAAa,OAAO;AAAA,EACpD,WAAW;AACb,CAAC;AAQD,IAAM,qBAAqB,WAGzB,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,QAAQ;AACnC,SACE,oBAAC,6BAA2B,GAAG,OAAO,KACpC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACC,YAAY;AAAA,QACV,GAAG;AAAA,QACH,MAAM,YAAY,QAAQ,YAAY;AAAA,MACxC;AAAA;AAAA,EACF,GACF;AAEJ,CAAC;AAED,mBAAmB,cAAc;AAEjC,IAAM,kCAAkC,aAAa,OAAO;AAAA,EAC1D,WAAW;AACb,CAAC;AAMD,IAAM,yBAA2D,CAAC;AAAA,EAChE;AACF,MAAM;AACJ,SACE,oBAAC,iBAAiB,IAAjB,EAAoB,gBAAc,MACjC,8BAAC,mCACC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACC,YAAY;AAAA,QACV,GAAG;AAAA,QACH,YAAY,YAAY,cAAc;AAAA,MACxC;AAAA;AAAA,EACF,GACF,GACF;AAEJ;AAEA,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AACf;AAEA,IAAO,uBAAQ,OAAO,OAAO,aAAa,OAAO;","names":[]}
@@ -1,7 +0,0 @@
1
- import { ComponentPropsWithoutRef, ElementType } from "react";
2
- import { ComponentRef } from "react";
3
- export declare const withDefaultProps: <TProps extends {
4
- className?: string;
5
- }>({ className, ...defaultProps }: Partial<TProps>) => ({ className: classNameProp, ...props }: TProps) => TProps;
6
- export declare const withDefaults: <TComponent extends ElementType>(Component: TComponent, defaultProps: Partial<ComponentPropsWithoutRef<TComponent>>) => import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Partial<ComponentPropsWithoutRef<TComponent>>> & import("react").RefAttributes<ComponentRef<TComponent>>>;
7
- //# sourceMappingURL=withDefaults.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"withDefaults.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/withDefaults.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAc,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,eAAO,MAAM,gBAAgB,GAC1B,MAAM,SAAS;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kCAGnC,OAAO,CAAC,MAAM,CAAC,8CACuB,MAAM,KAKxC,MACN,CAAC;AAEJ,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,WAAW,aAC9C,UAAU,gBACP,OAAO,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,wLAe5D,CAAC"}
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/ui/utils/withDefaults.tsx
31
- var withDefaults_exports = {};
32
- __export(withDefaults_exports, {
33
- withDefaultProps: () => withDefaultProps,
34
- withDefaults: () => withDefaults
35
- });
36
- module.exports = __toCommonJS(withDefaults_exports);
37
- var import_react = require("react");
38
- var import_classnames = __toESM(require("classnames"));
39
- var import_jsx_runtime = require("react/jsx-runtime");
40
- var withDefaultProps = ({
41
- className,
42
- ...defaultProps
43
- }) => ({ className: classNameProp, ...props }) => {
44
- return {
45
- className: (0, import_classnames.default)(className, classNameProp),
46
- ...defaultProps,
47
- ...props
48
- };
49
- };
50
- var withDefaults = (Component, defaultProps) => {
51
- const getProps = withDefaultProps(defaultProps);
52
- const WithDefaults = (0, import_react.forwardRef)(
53
- (props, ref) => {
54
- const ComponentAsAny = Component;
55
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComponentAsAny, { ...getProps(props), ref });
56
- }
57
- );
58
- WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
59
- return WithDefaults;
60
- };
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- withDefaultProps,
64
- withDefaults
65
- });
66
- //# sourceMappingURL=withDefaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/ui/utils/withDefaults.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ElementType, forwardRef } from \"react\";\nimport classNames from \"classnames\";\nimport { ComponentRef } from \"react\";\n\nexport const withDefaultProps =\n <TProps extends { className?: string }>({\n className,\n ...defaultProps\n }: Partial<TProps>) =>\n ({ className: classNameProp, ...props }: TProps) => {\n return {\n className: classNames(className, classNameProp),\n ...defaultProps,\n ...props,\n } as TProps;\n };\n\nexport const withDefaults = <TComponent extends ElementType>(\n Component: TComponent,\n defaultProps: Partial<ComponentPropsWithoutRef<TComponent>>,\n) => {\n type TComponentProps = typeof defaultProps;\n const getProps = withDefaultProps<TComponentProps>(defaultProps);\n const WithDefaults = forwardRef<ComponentRef<TComponent>, TComponentProps>(\n (props, ref) => {\n const ComponentAsAny = Component as any;\n return <ComponentAsAny {...getProps(props as any)} ref={ref} />;\n },\n );\n WithDefaults.displayName =\n \"withDefaults(\" +\n (typeof Component === \"string\" ? Component : Component.displayName) +\n \")\";\n return WithDefaults;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkE;AAClE,wBAAuB;AAyBV;AAtBN,IAAM,mBACX,CAAwC;AAAA,EACtC;AAAA,EACA,GAAG;AACL,MACA,CAAC,EAAE,WAAW,eAAe,GAAG,MAAM,MAAc;AAClD,SAAO;AAAA,IACL,eAAW,kBAAAA,SAAW,WAAW,aAAa;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEK,IAAM,eAAe,CAC1B,WACA,iBACG;AAEH,QAAM,WAAW,iBAAkC,YAAY;AAC/D,QAAM,mBAAe;AAAA,IACnB,CAAC,OAAO,QAAQ;AACd,YAAM,iBAAiB;AACvB,aAAO,4CAAC,kBAAgB,GAAG,SAAS,KAAY,GAAG,KAAU;AAAA,IAC/D;AAAA,EACF;AACA,eAAa,cACX,mBACC,OAAO,cAAc,WAAW,YAAY,UAAU,eACvD;AACF,SAAO;AACT;","names":["classNames"]}
@@ -1,30 +0,0 @@
1
- // src/ui/utils/withDefaults.tsx
2
- import { forwardRef } from "react";
3
- import classNames from "classnames";
4
- import { jsx } from "react/jsx-runtime";
5
- var withDefaultProps = ({
6
- className,
7
- ...defaultProps
8
- }) => ({ className: classNameProp, ...props }) => {
9
- return {
10
- className: classNames(className, classNameProp),
11
- ...defaultProps,
12
- ...props
13
- };
14
- };
15
- var withDefaults = (Component, defaultProps) => {
16
- const getProps = withDefaultProps(defaultProps);
17
- const WithDefaults = forwardRef(
18
- (props, ref) => {
19
- const ComponentAsAny = Component;
20
- return /* @__PURE__ */ jsx(ComponentAsAny, { ...getProps(props), ref });
21
- }
22
- );
23
- WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
24
- return WithDefaults;
25
- };
26
- export {
27
- withDefaultProps,
28
- withDefaults
29
- };
30
- //# sourceMappingURL=withDefaults.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/ui/utils/withDefaults.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ElementType, forwardRef } from \"react\";\nimport classNames from \"classnames\";\nimport { ComponentRef } from \"react\";\n\nexport const withDefaultProps =\n <TProps extends { className?: string }>({\n className,\n ...defaultProps\n }: Partial<TProps>) =>\n ({ className: classNameProp, ...props }: TProps) => {\n return {\n className: classNames(className, classNameProp),\n ...defaultProps,\n ...props,\n } as TProps;\n };\n\nexport const withDefaults = <TComponent extends ElementType>(\n Component: TComponent,\n defaultProps: Partial<ComponentPropsWithoutRef<TComponent>>,\n) => {\n type TComponentProps = typeof defaultProps;\n const getProps = withDefaultProps<TComponentProps>(defaultProps);\n const WithDefaults = forwardRef<ComponentRef<TComponent>, TComponentProps>(\n (props, ref) => {\n const ComponentAsAny = Component as any;\n return <ComponentAsAny {...getProps(props as any)} ref={ref} />;\n },\n );\n WithDefaults.displayName =\n \"withDefaults(\" +\n (typeof Component === \"string\" ? Component : Component.displayName) +\n \")\";\n return WithDefaults;\n};\n"],"mappings":";AAAA,SAAgD,kBAAkB;AAClE,OAAO,gBAAgB;AAyBV;AAtBN,IAAM,mBACX,CAAwC;AAAA,EACtC;AAAA,EACA,GAAG;AACL,MACA,CAAC,EAAE,WAAW,eAAe,GAAG,MAAM,MAAc;AAClD,SAAO;AAAA,IACL,WAAW,WAAW,WAAW,aAAa;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEK,IAAM,eAAe,CAC1B,WACA,iBACG;AAEH,QAAM,WAAW,iBAAkC,YAAY;AAC/D,QAAM,eAAe;AAAA,IACnB,CAAC,OAAO,QAAQ;AACd,YAAM,iBAAiB;AACvB,aAAO,oBAAC,kBAAgB,GAAG,SAAS,KAAY,GAAG,KAAU;AAAA,IAC/D;AAAA,EACF;AACA,eAAa,cACX,mBACC,OAAO,cAAc,WAAW,YAAY,UAAU,eACvD;AACF,SAAO;AACT;","names":[]}
@@ -1,20 +0,0 @@
1
- "use client";
2
-
3
- import type { FC } from "react";
4
- import { useContentPartDisplay } from "./useContentPartDisplay";
5
-
6
- export namespace ContentPartPrimitiveDisplay {
7
- export type Props = Record<string, never>;
8
- }
9
-
10
- /**
11
- * @deprecated UI content parts are deprecated and will be removed in the next major version.
12
- */
13
- export const ContentPartPrimitiveDisplay: FC<
14
- ContentPartPrimitiveDisplay.Props
15
- > = () => {
16
- const { display } = useContentPartDisplay();
17
- return display ?? null;
18
- };
19
-
20
- ContentPartPrimitiveDisplay.displayName = "ContentPartPrimitive.Display";