@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,91 +0,0 @@
1
- "use client";
2
-
3
- import { ComponentPropsWithoutRef, forwardRef, type FC } from "react";
4
- import { ArchiveIcon } from "lucide-react";
5
-
6
- import { withDefaults } from "./utils/withDefaults";
7
- import { TooltipIconButton } from "./base/tooltip-icon-button";
8
- import { ThreadListItemPrimitive } from "../primitives";
9
- import { useThreadConfig } from "./thread-config";
10
- import classNames from "classnames";
11
-
12
- const ThreadListItem: FC = () => {
13
- return (
14
- <ThreadListItemRoot>
15
- <ThreadListItemTrigger>
16
- <ThreadListItemTitle />
17
- </ThreadListItemTrigger>
18
- <ThreadListItemArchive />
19
- </ThreadListItemRoot>
20
- );
21
- };
22
-
23
- const ThreadListItemRoot = withDefaults(ThreadListItemPrimitive.Root, {
24
- className: "aui-thread-list-item",
25
- });
26
-
27
- ThreadListItemRoot.displayName = "ThreadListItemRoot";
28
-
29
- const ThreadListItemTrigger = withDefaults(ThreadListItemPrimitive.Trigger, {
30
- className: "aui-thread-list-item-trigger",
31
- });
32
-
33
- namespace ThreadListItemPrimitiveTitle {
34
- export type Element = HTMLParagraphElement;
35
- export type Props = ComponentPropsWithoutRef<"p">;
36
- }
37
-
38
- const ThreadListItemTitle = forwardRef<
39
- ThreadListItemPrimitiveTitle.Element,
40
- ThreadListItemPrimitiveTitle.Props
41
- >(({ className, ...props }, ref) => {
42
- const config = useThreadConfig();
43
- const fallback =
44
- config.strings?.threadList?.item?.title?.fallback ?? "New Chat";
45
-
46
- return (
47
- <p
48
- ref={ref}
49
- className={classNames("aui-thread-list-item-title", className)}
50
- {...props}
51
- >
52
- <ThreadListItemPrimitive.Title fallback={fallback} />
53
- </p>
54
- );
55
- });
56
-
57
- ThreadListItemTitle.displayName = "ThreadListItemTitle";
58
-
59
- const ThreadListItemArchive = forwardRef<
60
- HTMLButtonElement,
61
- Partial<TooltipIconButton.Props>
62
- >(({ className, ...props }, ref) => {
63
- const config = useThreadConfig();
64
- const tooltip =
65
- config.strings?.threadList?.item?.archive?.tooltip ?? "Archive thread";
66
-
67
- return (
68
- <ThreadListItemPrimitive.Archive asChild>
69
- <TooltipIconButton
70
- ref={ref}
71
- className={classNames("aui-thread-list-item-archive", className)}
72
- variant="ghost"
73
- tooltip={tooltip}
74
- {...props}
75
- >
76
- <ArchiveIcon />
77
- </TooltipIconButton>
78
- </ThreadListItemPrimitive.Archive>
79
- );
80
- });
81
-
82
- ThreadListItemArchive.displayName = "ThreadListItemArchive";
83
-
84
- const exports = {
85
- Root: ThreadListItemRoot,
86
- Title: ThreadListItemTitle,
87
- Archive: ThreadListItemArchive,
88
- };
89
-
90
- export default Object.assign(ThreadListItem, exports) as typeof ThreadListItem &
91
- typeof exports;
@@ -1,78 +0,0 @@
1
- "use client";
2
-
3
- import { forwardRef, type FC } from "react";
4
- import { PlusIcon } from "lucide-react";
5
-
6
- import { withDefaults } from "./utils/withDefaults";
7
- import { ThreadListPrimitive } from "../primitives";
8
- import ThreadListItem from "./thread-list-item";
9
- import { useThreadConfig } from "./thread-config";
10
- import { Button, ButtonProps } from "./base";
11
-
12
- const ThreadList: FC = () => {
13
- return (
14
- <ThreadListRoot>
15
- <ThreadListNew />
16
- <ThreadListItems />
17
- </ThreadListRoot>
18
- );
19
- };
20
-
21
- const ThreadListRoot = withDefaults(ThreadListPrimitive.Root, {
22
- className: "aui-root aui-thread-list-root",
23
- });
24
- ThreadListRoot.displayName = "ThreadListRoot";
25
-
26
- const ThreadListNew = forwardRef<
27
- HTMLButtonElement,
28
- ThreadListPrimitive.New.Props & ButtonProps
29
- >((props, ref) => {
30
- const config = useThreadConfig();
31
- const label = config.strings?.threadList?.new?.label ?? "New Thread";
32
-
33
- return (
34
- <ThreadListPrimitive.New asChild>
35
- <Button
36
- ref={ref}
37
- className="aui-thread-list-new"
38
- variant="ghost"
39
- {...props}
40
- >
41
- <PlusIcon />
42
- {label}
43
- </Button>
44
- </ThreadListPrimitive.New>
45
- );
46
- });
47
- ThreadListNew.displayName = "ThreadListNew";
48
-
49
- namespace ThreadListItems {
50
- export type Props = {
51
- /**
52
- * Optional custom components to override default thread list items
53
- */
54
- components?: Partial<ThreadListPrimitive.Items.Props["components"]>;
55
- };
56
- }
57
-
58
- const ThreadListItems: FC<ThreadListItems.Props> = ({ components }) => {
59
- return (
60
- <ThreadListPrimitive.Items
61
- components={{
62
- ...components,
63
- ThreadListItem: components?.ThreadListItem ?? ThreadListItem,
64
- }}
65
- />
66
- );
67
- };
68
-
69
- ThreadListItems.displayName = "ThreadListItems";
70
-
71
- const exports = {
72
- Root: ThreadListRoot,
73
- New: ThreadListNew,
74
- Items: ThreadListItems,
75
- };
76
-
77
- export default Object.assign(ThreadList, exports) as typeof ThreadList &
78
- typeof exports;
@@ -1,140 +0,0 @@
1
- "use client";
2
-
3
- import { ComponentPropsWithoutRef, forwardRef, type FC } from "react";
4
- import { withDefaults } from "./utils/withDefaults";
5
- import { Avatar } from "./base/avatar";
6
- import { SuggestionConfig, useThreadConfig } from "./thread-config";
7
- import { ThreadPrimitive } from "../primitives";
8
- import { useThread } from "../context";
9
-
10
- const ThreadWelcome: FC = () => {
11
- return (
12
- <ThreadWelcomeRoot>
13
- <ThreadWelcomeCenter>
14
- <ThreadWelcomeAvatar />
15
- <ThreadWelcomeMessage />
16
- </ThreadWelcomeCenter>
17
- <ThreadWelcomeSuggestions />
18
- </ThreadWelcomeRoot>
19
- );
20
- };
21
-
22
- ThreadWelcome.displayName = "ThreadWelcome";
23
-
24
- const ThreadWelcomeRootStyled = withDefaults("div", {
25
- className: "aui-thread-welcome-root",
26
- });
27
-
28
- const ThreadWelcomeCenter = withDefaults("div", {
29
- className: "aui-thread-welcome-center",
30
- });
31
-
32
- namespace ThreadWelcomeRoot {
33
- export type Element = HTMLDivElement;
34
- export type Props = ComponentPropsWithoutRef<"div">;
35
- }
36
-
37
- const ThreadWelcomeRoot = forwardRef<
38
- ThreadWelcomeRoot.Element,
39
- ThreadWelcomeRoot.Props
40
- >((props, ref) => {
41
- return (
42
- <ThreadPrimitive.Empty>
43
- <ThreadWelcomeRootStyled {...props} ref={ref} />
44
- </ThreadPrimitive.Empty>
45
- );
46
- });
47
-
48
- ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
49
-
50
- const ThreadWelcomeAvatar: FC = () => {
51
- const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
52
- return <Avatar {...avatar} />;
53
- };
54
-
55
- const ThreadWelcomeMessageStyled = withDefaults("p", {
56
- className: "aui-thread-welcome-message",
57
- });
58
-
59
- namespace ThreadWelcomeMessage {
60
- export type Element = HTMLParagraphElement;
61
- export type Props = Omit<
62
- ComponentPropsWithoutRef<typeof ThreadWelcomeMessageStyled>,
63
- "children"
64
- > & { message?: string | undefined };
65
- }
66
-
67
- const ThreadWelcomeMessage = forwardRef<
68
- ThreadWelcomeMessage.Element,
69
- ThreadWelcomeMessage.Props
70
- >(({ message: messageProp, ...rest }, ref) => {
71
- const {
72
- welcome: { message } = {},
73
- strings: {
74
- welcome: { message: defaultMessage = "How can I help you today?" } = {},
75
- } = {},
76
- } = useThreadConfig();
77
- return (
78
- <ThreadWelcomeMessageStyled {...rest} ref={ref}>
79
- {messageProp ?? message ?? defaultMessage}
80
- </ThreadWelcomeMessageStyled>
81
- );
82
- });
83
-
84
- ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
85
-
86
- const ThreadWelcomeSuggestionContainer = withDefaults("div", {
87
- className: "aui-thread-welcome-suggestions",
88
- });
89
-
90
- const ThreadWelcomeSuggestionStyled = withDefaults(ThreadPrimitive.Suggestion, {
91
- className: "aui-thread-welcome-suggestion",
92
- });
93
-
94
- export namespace ThreadWelcomeSuggestion {
95
- export type Props = {
96
- suggestion: SuggestionConfig;
97
- };
98
- }
99
-
100
- const ThreadWelcomeSuggestion: FC<ThreadWelcomeSuggestion.Props> = ({
101
- suggestion: { text, prompt },
102
- }) => {
103
- return (
104
- <ThreadWelcomeSuggestionStyled prompt={prompt} method="replace" autoSend>
105
- <span className="aui-thread-welcome-suggestion-text">
106
- {text ?? prompt}
107
- </span>
108
- </ThreadWelcomeSuggestionStyled>
109
- );
110
- };
111
-
112
- const ThreadWelcomeSuggestions: FC = () => {
113
- const suggestions2 = useThread((t) => t.suggestions);
114
- const { welcome: { suggestions } = {} } = useThreadConfig();
115
-
116
- const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
117
-
118
- return (
119
- <ThreadWelcomeSuggestionContainer>
120
- {finalSuggestions?.map((suggestion, idx) => {
121
- const key = `${suggestion.prompt}-${idx}`;
122
- return <ThreadWelcomeSuggestion key={key} suggestion={suggestion} />;
123
- })}
124
- </ThreadWelcomeSuggestionContainer>
125
- );
126
- };
127
-
128
- ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
129
-
130
- const exports = {
131
- Root: ThreadWelcomeRoot,
132
- Center: ThreadWelcomeCenter,
133
- Avatar: ThreadWelcomeAvatar,
134
- Message: ThreadWelcomeMessage,
135
- Suggestions: ThreadWelcomeSuggestions,
136
- Suggestion: ThreadWelcomeSuggestion,
137
- };
138
-
139
- export default Object.assign(ThreadWelcome, exports) as typeof ThreadWelcome &
140
- typeof exports;
package/src/ui/thread.tsx DELETED
@@ -1,176 +0,0 @@
1
- "use client";
2
-
3
- import { ComponentType, forwardRef, type FC } from "react";
4
- import { ArrowDownIcon } from "lucide-react";
5
-
6
- import { withDefaults } from "./utils/withDefaults";
7
- import Composer from "./composer";
8
- import ThreadWelcome from "./thread-welcome";
9
- import { TooltipIconButton } from "./base/tooltip-icon-button";
10
- import AssistantMessage from "./assistant-message";
11
- import UserMessage from "./user-message";
12
- import EditComposer from "./edit-composer";
13
- import {
14
- ThreadConfig,
15
- ThreadConfigProvider,
16
- ThreadConfigProviderProps,
17
- useThreadConfig,
18
- } from "./thread-config";
19
- import { ThreadPrimitive } from "../primitives";
20
- import { useThread } from "../context";
21
-
22
- const Thread: FC<ThreadConfig> = (config) => {
23
- const {
24
- components: {
25
- Composer: ComposerComponent = Composer,
26
- ThreadWelcome: ThreadWelcomeComponent = ThreadWelcome,
27
- MessagesFooter,
28
- ...messageComponents
29
- } = {},
30
- } = config;
31
- return (
32
- <ThreadRoot config={config}>
33
- <ThreadViewport>
34
- <ThreadWelcomeComponent />
35
- <ThreadMessages
36
- MessagesFooter={MessagesFooter}
37
- components={messageComponents}
38
- />
39
- <ThreadFollowupSuggestions />
40
- <ThreadViewportFooter>
41
- <ThreadScrollToBottom />
42
- <ComposerComponent />
43
- </ThreadViewportFooter>
44
- </ThreadViewport>
45
- </ThreadRoot>
46
- );
47
- };
48
-
49
- namespace ThreadRoot {
50
- export type Element = HTMLDivElement;
51
- export type Props = ThreadPrimitive.Root.Props & ThreadConfigProviderProps;
52
- }
53
-
54
- const ThreadRootStyled = withDefaults(ThreadPrimitive.Root, {
55
- className: "aui-root aui-thread-root",
56
- });
57
-
58
- const ThreadRoot = forwardRef<ThreadRoot.Element, ThreadRoot.Props>(
59
- ({ config, ...props }, ref) => {
60
- return (
61
- <ThreadConfigProvider config={config}>
62
- <ThreadRootStyled {...props} ref={ref} />
63
- </ThreadConfigProvider>
64
- );
65
- },
66
- );
67
-
68
- ThreadRoot.displayName = "ThreadRoot";
69
-
70
- const ThreadViewport = withDefaults(ThreadPrimitive.Viewport, {
71
- className: "aui-thread-viewport",
72
- });
73
-
74
- ThreadViewport.displayName = "ThreadViewport";
75
-
76
- const ThreadViewportFooter = withDefaults("div", {
77
- className: "aui-thread-viewport-footer",
78
- });
79
-
80
- ThreadViewportFooter.displayName = "ThreadViewportFooter";
81
-
82
- const ThreadMessages: FC<{
83
- unstable_flexGrowDiv?: boolean;
84
- components?: Partial<ThreadPrimitive.Messages.Props["components"]>;
85
- MessagesFooter?: ComponentType | undefined;
86
- }> = ({
87
- components,
88
- MessagesFooter,
89
- unstable_flexGrowDiv: flexGrowDiv = true,
90
- ...rest
91
- }) => {
92
- return (
93
- <>
94
- <ThreadPrimitive.Messages
95
- components={{
96
- ...components,
97
- UserMessage: components?.UserMessage ?? UserMessage,
98
- AssistantMessage: components?.AssistantMessage ?? AssistantMessage,
99
- EditComposer: components?.EditComposer ?? EditComposer,
100
- }}
101
- {...rest}
102
- />
103
- {MessagesFooter && <MessagesFooter />}
104
- {flexGrowDiv && (
105
- <ThreadPrimitive.If empty={false}>
106
- <div style={{ flexGrow: 1 }} />
107
- </ThreadPrimitive.If>
108
- )}
109
- </>
110
- );
111
- };
112
-
113
- ThreadMessages.displayName = "ThreadMessages";
114
-
115
- const ThreadFollowupSuggestions: FC = () => {
116
- const suggestions = useThread((t) => t.suggestions);
117
-
118
- return (
119
- <ThreadPrimitive.If empty={false} running={false}>
120
- <div className="aui-thread-followup-suggestions">
121
- {suggestions?.map((suggestion, idx) => (
122
- <ThreadPrimitive.Suggestion
123
- key={idx}
124
- className="aui-thread-followup-suggestion"
125
- prompt={suggestion.prompt}
126
- method="replace"
127
- autoSend
128
- >
129
- {suggestion.prompt}
130
- </ThreadPrimitive.Suggestion>
131
- ))}
132
- </div>
133
- </ThreadPrimitive.If>
134
- );
135
- };
136
-
137
- const ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
138
- variant: "outline",
139
- className: "aui-thread-scroll-to-bottom",
140
- });
141
-
142
- namespace ThreadScrollToBottom {
143
- export type Element = HTMLButtonElement;
144
- export type Props = Partial<TooltipIconButton.Props>;
145
- }
146
-
147
- const ThreadScrollToBottom = forwardRef<
148
- ThreadScrollToBottom.Element,
149
- ThreadScrollToBottom.Props
150
- >((props, ref) => {
151
- const {
152
- strings: {
153
- thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {},
154
- } = {},
155
- } = useThreadConfig();
156
- return (
157
- <ThreadPrimitive.ScrollToBottom asChild>
158
- <ThreadScrollToBottomIconButton tooltip={tooltip} {...props} ref={ref}>
159
- {props.children ?? <ArrowDownIcon />}
160
- </ThreadScrollToBottomIconButton>
161
- </ThreadPrimitive.ScrollToBottom>
162
- );
163
- });
164
-
165
- ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
166
-
167
- const exports = {
168
- Root: ThreadRoot,
169
- Viewport: ThreadViewport,
170
- Messages: ThreadMessages,
171
- FollowupSuggestions: ThreadFollowupSuggestions,
172
- ScrollToBottom: ThreadScrollToBottom,
173
- ViewportFooter: ThreadViewportFooter,
174
- };
175
-
176
- export default Object.assign(Thread, exports) as typeof Thread & typeof exports;
@@ -1,66 +0,0 @@
1
- "use client";
2
-
3
- import { forwardRef, type FC } from "react";
4
- import { PencilIcon } from "lucide-react";
5
-
6
- import { TooltipIconButton } from "./base/tooltip-icon-button";
7
- import { withDefaults } from "./utils/withDefaults";
8
- import { useThreadConfig } from "./thread-config";
9
- import { useThread } from "../context";
10
- import { ActionBarPrimitive } from "../primitives";
11
-
12
- const useAllowEdit = (ensureCapability = false) => {
13
- const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
14
- const editSupported = useThread((t) => t.capabilities.edit);
15
- return allowEdit && (!ensureCapability || editSupported);
16
- };
17
-
18
- const UserActionBar: FC = () => {
19
- const allowEdit = useAllowEdit(true);
20
- if (!allowEdit) return null;
21
- return (
22
- <UserActionBarRoot hideWhenRunning autohide="not-last">
23
- <UserActionBarEdit />
24
- </UserActionBarRoot>
25
- );
26
- };
27
-
28
- UserActionBar.displayName = "UserActionBar";
29
-
30
- const UserActionBarRoot = withDefaults(ActionBarPrimitive.Root, {
31
- className: "aui-user-action-bar-root",
32
- });
33
-
34
- UserActionBarRoot.displayName = "UserActionBarRoot";
35
-
36
- namespace UserActionBarEdit {
37
- export type Element = ActionBarPrimitive.Edit.Element;
38
- export type Props = Partial<TooltipIconButton.Props>;
39
- }
40
-
41
- const UserActionBarEdit = forwardRef<
42
- UserActionBarEdit.Element,
43
- UserActionBarEdit.Props
44
- >((props, ref) => {
45
- const {
46
- strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {},
47
- } = useThreadConfig();
48
- const allowEdit = useAllowEdit();
49
- return (
50
- <ActionBarPrimitive.Edit disabled={!allowEdit} asChild>
51
- <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>
52
- {props.children ?? <PencilIcon />}
53
- </TooltipIconButton>
54
- </ActionBarPrimitive.Edit>
55
- );
56
- });
57
-
58
- UserActionBarEdit.displayName = "UserActionBarEdit";
59
-
60
- const exports = {
61
- Root: UserActionBarRoot,
62
- Edit: UserActionBarEdit,
63
- };
64
-
65
- export default Object.assign(UserActionBar, exports) as typeof UserActionBar &
66
- typeof exports;
@@ -1,92 +0,0 @@
1
- import { ComponentPropsWithoutRef, forwardRef, type FC } from "react";
2
-
3
- import BranchPicker from "./branch-picker";
4
- import { withDefaults } from "./utils/withDefaults";
5
- import UserActionBar from "./user-action-bar";
6
- import ContentPart from "./content-part";
7
- import { MessagePrimitive } from "../primitives";
8
- import Attachment from "./attachment-ui";
9
-
10
- const UserMessage: FC = () => {
11
- return (
12
- <UserMessageRoot>
13
- <UserMessageAttachments />
14
- {/* TODO this is temporary until we place the UserActionBar in a better place */}
15
- <MessagePrimitive.If hasContent>
16
- <UserActionBar />
17
- <UserMessageContent />
18
- </MessagePrimitive.If>
19
- <BranchPicker />
20
- </UserMessageRoot>
21
- );
22
- };
23
-
24
- UserMessage.displayName = "UserMessage";
25
-
26
- const UserMessageRoot = withDefaults(MessagePrimitive.Root, {
27
- className: "aui-user-message-root",
28
- });
29
-
30
- UserMessageRoot.displayName = "UserMessageRoot";
31
-
32
- const UserMessageContentWrapper = withDefaults("div", {
33
- className: "aui-user-message-content",
34
- });
35
-
36
- namespace UserMessageContent {
37
- export type Element = HTMLDivElement;
38
- export type Props = MessagePrimitive.Content.Props &
39
- ComponentPropsWithoutRef<"div">;
40
- }
41
-
42
- const UserMessageContent = forwardRef<
43
- UserMessageContent.Element,
44
- UserMessageContent.Props
45
- >(({ components, ...props }, ref) => {
46
- return (
47
- <UserMessageContentWrapper {...props} ref={ref}>
48
- <MessagePrimitive.Content
49
- components={{
50
- ...components,
51
- Text: components?.Text ?? ContentPart.Text,
52
- }}
53
- />
54
- </UserMessageContentWrapper>
55
- );
56
- });
57
-
58
- UserMessageContent.displayName = "UserMessageContent";
59
-
60
- const UserMessageAttachmentsContainer = withDefaults("div", {
61
- className: "aui-user-message-attachments",
62
- });
63
-
64
- namespace UserMessageAttachments {
65
- export type Props = Partial<MessagePrimitive.Attachments.Props>;
66
- }
67
-
68
- const UserMessageAttachments: FC<UserMessageAttachments.Props> = ({
69
- components,
70
- }) => {
71
- return (
72
- <MessagePrimitive.If hasAttachments>
73
- <UserMessageAttachmentsContainer>
74
- <MessagePrimitive.Attachments
75
- components={{
76
- ...components,
77
- Attachment: components?.Attachment ?? Attachment,
78
- }}
79
- />
80
- </UserMessageAttachmentsContainer>
81
- </MessagePrimitive.If>
82
- );
83
- };
84
-
85
- const exports = {
86
- Root: UserMessageRoot,
87
- Content: UserMessageContent,
88
- Attachments: UserMessageAttachments,
89
- };
90
-
91
- export default Object.assign(UserMessage, exports) as typeof UserMessage &
92
- typeof exports;
@@ -1,35 +0,0 @@
1
- import { ComponentPropsWithoutRef, ElementType, forwardRef } from "react";
2
- import classNames from "classnames";
3
- import { ComponentRef } from "react";
4
-
5
- export const withDefaultProps =
6
- <TProps extends { className?: string }>({
7
- className,
8
- ...defaultProps
9
- }: Partial<TProps>) =>
10
- ({ className: classNameProp, ...props }: TProps) => {
11
- return {
12
- className: classNames(className, classNameProp),
13
- ...defaultProps,
14
- ...props,
15
- } as TProps;
16
- };
17
-
18
- export const withDefaults = <TComponent extends ElementType>(
19
- Component: TComponent,
20
- defaultProps: Partial<ComponentPropsWithoutRef<TComponent>>,
21
- ) => {
22
- type TComponentProps = typeof defaultProps;
23
- const getProps = withDefaultProps<TComponentProps>(defaultProps);
24
- const WithDefaults = forwardRef<ComponentRef<TComponent>, TComponentProps>(
25
- (props, ref) => {
26
- const ComponentAsAny = Component as any;
27
- return <ComponentAsAny {...getProps(props as any)} ref={ref} />;
28
- },
29
- );
30
- WithDefaults.displayName =
31
- "withDefaults(" +
32
- (typeof Component === "string" ? Component : Component.displayName) +
33
- ")";
34
- return WithDefaults;
35
- };
@@ -1 +0,0 @@
1
- This directory exists to support subpath imports for TypeScript projects using --moduleResolution node.
@@ -1,6 +0,0 @@
1
- {
2
- "name": "tailwindcss",
3
- "lockfileVersion": 3,
4
- "requires": true,
5
- "packages": {}
6
- }
@@ -1,5 +0,0 @@
1
- {
2
- "main": "../dist/tailwindcss/index.js",
3
- "module": "../dist/tailwindcss/index.mjs",
4
- "types": "../dist/tailwindcss/index.d.ts"
5
- }