@assistant-ui/react 0.7.90 → 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.
- package/dist/cloud/auiV0.js.map +1 -1
- package/dist/cloud/auiV0.mjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +0 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +0 -3
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +0 -2
- package/dist/internal.mjs.map +1 -1
- package/dist/model-context/ModelContextTypes.d.ts +11 -0
- package/dist/model-context/ModelContextTypes.d.ts.map +1 -1
- package/dist/model-context/ModelContextTypes.js.map +1 -1
- package/dist/model-context/ModelContextTypes.mjs.map +1 -1
- package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +7 -3
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.mjs +7 -3
- package/dist/model-context/makeAssistantVisible.mjs.map +1 -1
- package/dist/primitives/contentPart/index.d.ts +0 -1
- package/dist/primitives/contentPart/index.d.ts.map +1 -1
- package/dist/primitives/contentPart/index.js +0 -3
- package/dist/primitives/contentPart/index.js.map +1 -1
- package/dist/primitives/contentPart/index.mjs +0 -2
- package/dist/primitives/contentPart/index.mjs.map +1 -1
- package/dist/primitives/index.d.ts +0 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +0 -3
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs +0 -2
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/primitives/message/MessageContent.d.ts +1 -2
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +2 -7
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageContent.mjs +2 -7
- package/dist/primitives/message/MessageContent.mjs.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +1 -3
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +1 -3
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js +1 -6
- package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs +1 -6
- package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts +2 -2
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +0 -3
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs +0 -3
- package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
- package/dist/types/AssistantTypes.d.ts +3 -7
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AssistantTypes.js.map +1 -1
- package/dist/types/ContentPartComponentTypes.d.ts +1 -3
- package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
- package/dist/types/ContentPartComponentTypes.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -21
- package/src/cloud/auiV0.ts +1 -1
- package/src/index.ts +0 -1
- package/src/internal.ts +0 -1
- package/src/model-context/ModelContextTypes.ts +19 -0
- package/src/model-context/makeAssistantVisible.tsx +9 -3
- package/src/primitives/contentPart/index.ts +0 -1
- package/src/primitives/index.ts +0 -1
- package/src/primitives/message/MessageContent.tsx +0 -9
- package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +1 -3
- package/src/runtimes/edge/converters/toCoreMessages.ts +11 -14
- package/src/runtimes/edge/converters/toLanguageModelMessages.ts +2 -2
- package/src/runtimes/external-store/ThreadMessageLike.tsx +0 -6
- package/src/types/AssistantTypes.ts +4 -9
- package/src/types/ContentPartComponentTypes.tsx +0 -4
- package/src/types/index.ts +0 -2
- package/dist/primitives/contentPart/ContentPartDisplay.d.ts +0 -9
- package/dist/primitives/contentPart/ContentPartDisplay.d.ts.map +0 -1
- package/dist/primitives/contentPart/ContentPartDisplay.js +0 -37
- package/dist/primitives/contentPart/ContentPartDisplay.js.map +0 -1
- package/dist/primitives/contentPart/ContentPartDisplay.mjs +0 -13
- package/dist/primitives/contentPart/ContentPartDisplay.mjs.map +0 -1
- package/dist/primitives/contentPart/useContentPartDisplay.d.ts +0 -8
- package/dist/primitives/contentPart/useContentPartDisplay.d.ts.map +0 -1
- package/dist/primitives/contentPart/useContentPartDisplay.js +0 -42
- package/dist/primitives/contentPart/useContentPartDisplay.js.map +0 -1
- package/dist/primitives/contentPart/useContentPartDisplay.mjs +0 -18
- package/dist/primitives/contentPart/useContentPartDisplay.mjs.map +0 -1
- package/dist/styles/index.css +0 -1261
- package/dist/styles/index.css.map +0 -1
- package/dist/styles/modal.css +0 -143
- package/dist/styles/modal.css.map +0 -1
- package/dist/styles/tailwindcss/base-components.css +0 -69
- package/dist/styles/tailwindcss/base-components.css.json +0 -48
- package/dist/styles/tailwindcss/modal.css +0 -29
- package/dist/styles/tailwindcss/modal.css.json +0 -26
- package/dist/styles/tailwindcss/thread.css +0 -262
- package/dist/styles/tailwindcss/thread.css.json +0 -183
- package/dist/styles/themes/default.css +0 -64
- package/dist/styles/themes/default.css.json +0 -46
- package/dist/styles/themes/shadcn-extras.css +0 -4
- package/dist/styles/themes/shadcn-extras.css.json +0 -5
- package/dist/tailwindcss/index.d.ts +0 -49
- package/dist/tailwindcss/index.d.ts.map +0 -1
- package/dist/tailwindcss/index.js +0 -189
- package/dist/tailwindcss/index.js.map +0 -1
- package/dist/tailwindcss/index.mjs +0 -181
- package/dist/tailwindcss/index.mjs.map +0 -1
- package/dist/ui/assistant-action-bar.d.ts +0 -24
- package/dist/ui/assistant-action-bar.d.ts.map +0 -1
- package/dist/ui/assistant-action-bar.js +0 -193
- package/dist/ui/assistant-action-bar.js.map +0 -1
- package/dist/ui/assistant-action-bar.mjs +0 -181
- package/dist/ui/assistant-action-bar.mjs.map +0 -1
- package/dist/ui/assistant-message.d.ts +0 -13
- package/dist/ui/assistant-message.d.ts.map +0 -1
- package/dist/ui/assistant-message.js +0 -107
- package/dist/ui/assistant-message.js.map +0 -1
- package/dist/ui/assistant-message.mjs +0 -77
- package/dist/ui/assistant-message.mjs.map +0 -1
- package/dist/ui/assistant-modal.d.ts +0 -23
- package/dist/ui/assistant-modal.d.ts.map +0 -1
- package/dist/ui/assistant-modal.js +0 -126
- package/dist/ui/assistant-modal.js.map +0 -1
- package/dist/ui/assistant-modal.mjs +0 -99
- package/dist/ui/assistant-modal.mjs.map +0 -1
- package/dist/ui/attachment-ui.d.ts +0 -12
- package/dist/ui/attachment-ui.d.ts.map +0 -1
- package/dist/ui/attachment-ui.js +0 -170
- package/dist/ui/attachment-ui.js.map +0 -1
- package/dist/ui/attachment-ui.mjs +0 -160
- package/dist/ui/attachment-ui.mjs.map +0 -1
- package/dist/ui/base/CircleStopIcon.d.ts +0 -3
- package/dist/ui/base/CircleStopIcon.d.ts.map +0 -1
- package/dist/ui/base/CircleStopIcon.js +0 -45
- package/dist/ui/base/CircleStopIcon.js.map +0 -1
- package/dist/ui/base/CircleStopIcon.mjs +0 -20
- package/dist/ui/base/CircleStopIcon.mjs.map +0 -1
- package/dist/ui/base/avatar.d.ts +0 -12
- package/dist/ui/base/avatar.d.ts.map +0 -1
- package/dist/ui/base/avatar.js +0 -69
- package/dist/ui/base/avatar.js.map +0 -1
- package/dist/ui/base/avatar.mjs +0 -31
- package/dist/ui/base/avatar.mjs.map +0 -1
- package/dist/ui/base/button.d.ts +0 -16
- package/dist/ui/base/button.d.ts.map +0 -1
- package/dist/ui/base/button.js +0 -66
- package/dist/ui/base/button.js.map +0 -1
- package/dist/ui/base/button.mjs +0 -40
- package/dist/ui/base/button.mjs.map +0 -1
- package/dist/ui/base/dialog.d.ts +0 -9
- package/dist/ui/base/dialog.d.ts.map +0 -1
- package/dist/ui/base/dialog.js +0 -80
- package/dist/ui/base/dialog.js.map +0 -1
- package/dist/ui/base/dialog.mjs +0 -40
- package/dist/ui/base/dialog.mjs.map +0 -1
- package/dist/ui/base/index.d.ts +0 -6
- package/dist/ui/base/index.d.ts.map +0 -1
- package/dist/ui/base/index.js +0 -55
- package/dist/ui/base/index.js.map +0 -1
- package/dist/ui/base/index.mjs +0 -25
- package/dist/ui/base/index.mjs.map +0 -1
- package/dist/ui/base/tooltip-icon-button.d.ts +0 -17
- package/dist/ui/base/tooltip-icon-button.d.ts.map +0 -1
- package/dist/ui/base/tooltip-icon-button.js +0 -44
- package/dist/ui/base/tooltip-icon-button.js.map +0 -1
- package/dist/ui/base/tooltip-icon-button.mjs +0 -19
- package/dist/ui/base/tooltip-icon-button.mjs.map +0 -1
- package/dist/ui/base/tooltip.d.ts +0 -6
- package/dist/ui/base/tooltip.d.ts.map +0 -1
- package/dist/ui/base/tooltip.js +0 -57
- package/dist/ui/base/tooltip.js.map +0 -1
- package/dist/ui/base/tooltip.mjs +0 -20
- package/dist/ui/base/tooltip.mjs.map +0 -1
- package/dist/ui/branch-picker.d.ts +0 -15
- package/dist/ui/branch-picker.d.ts.map +0 -1
- package/dist/ui/branch-picker.js +0 -89
- package/dist/ui/branch-picker.js.map +0 -1
- package/dist/ui/branch-picker.mjs +0 -69
- package/dist/ui/branch-picker.mjs.map +0 -1
- package/dist/ui/composer.d.ts +0 -25
- package/dist/ui/composer.d.ts.map +0 -1
- package/dist/ui/composer.js +0 -168
- package/dist/ui/composer.js.map +0 -1
- package/dist/ui/composer.mjs +0 -138
- package/dist/ui/composer.mjs.map +0 -1
- package/dist/ui/content-part.d.ts +0 -7
- package/dist/ui/content-part.d.ts.map +0 -1
- package/dist/ui/content-part.js +0 -61
- package/dist/ui/content-part.js.map +0 -1
- package/dist/ui/content-part.mjs +0 -27
- package/dist/ui/content-part.mjs.map +0 -1
- package/dist/ui/edit-composer.d.ts +0 -22
- package/dist/ui/edit-composer.d.ts.map +0 -1
- package/dist/ui/edit-composer.js +0 -77
- package/dist/ui/edit-composer.js.map +0 -1
- package/dist/ui/edit-composer.mjs +0 -57
- package/dist/ui/edit-composer.mjs.map +0 -1
- package/dist/ui/index.d.ts +0 -75
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -86
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/index.mjs +0 -38
- package/dist/ui/index.mjs.map +0 -1
- package/dist/ui/thread-config.d.ts +0 -162
- package/dist/ui/thread-config.d.ts.map +0 -1
- package/dist/ui/thread-config.js +0 -63
- package/dist/ui/thread-config.js.map +0 -1
- package/dist/ui/thread-config.mjs +0 -41
- package/dist/ui/thread-config.mjs.map +0 -1
- package/dist/ui/thread-list-item.d.ts +0 -13
- package/dist/ui/thread-list-item.d.ts.map +0 -1
- package/dist/ui/thread-list-item.js +0 -94
- package/dist/ui/thread-list-item.js.map +0 -1
- package/dist/ui/thread-list-item.mjs +0 -64
- package/dist/ui/thread-list-item.mjs.map +0 -1
- package/dist/ui/thread-list.d.ts +0 -27
- package/dist/ui/thread-list.d.ts.map +0 -1
- package/dist/ui/thread-list.js +0 -91
- package/dist/ui/thread-list.js.map +0 -1
- package/dist/ui/thread-list.mjs +0 -61
- package/dist/ui/thread-list.mjs.map +0 -1
- package/dist/ui/thread-welcome.d.ts +0 -21
- package/dist/ui/thread-welcome.d.ts.map +0 -1
- package/dist/ui/thread-welcome.js +0 -101
- package/dist/ui/thread-welcome.js.map +0 -1
- package/dist/ui/thread-welcome.mjs +0 -81
- package/dist/ui/thread-welcome.mjs.map +0 -1
- package/dist/ui/thread.d.ts +0 -30
- package/dist/ui/thread.d.ts.map +0 -1
- package/dist/ui/thread.js +0 -152
- package/dist/ui/thread.js.map +0 -1
- package/dist/ui/thread.mjs +0 -125
- package/dist/ui/thread.mjs.map +0 -1
- package/dist/ui/user-action-bar.d.ts +0 -16
- package/dist/ui/user-action-bar.d.ts.map +0 -1
- package/dist/ui/user-action-bar.js +0 -63
- package/dist/ui/user-action-bar.js.map +0 -1
- package/dist/ui/user-action-bar.mjs +0 -43
- package/dist/ui/user-action-bar.mjs.map +0 -1
- package/dist/ui/user-message.d.ts +0 -13
- package/dist/ui/user-message.d.ts.map +0 -1
- package/dist/ui/user-message.js +0 -96
- package/dist/ui/user-message.js.map +0 -1
- package/dist/ui/user-message.mjs +0 -65
- package/dist/ui/user-message.mjs.map +0 -1
- package/dist/ui/utils/withDefaults.d.ts +0 -7
- package/dist/ui/utils/withDefaults.d.ts.map +0 -1
- package/dist/ui/utils/withDefaults.js +0 -66
- package/dist/ui/utils/withDefaults.js.map +0 -1
- package/dist/ui/utils/withDefaults.mjs +0 -30
- package/dist/ui/utils/withDefaults.mjs.map +0 -1
- package/src/primitives/contentPart/ContentPartDisplay.tsx +0 -20
- package/src/primitives/contentPart/useContentPartDisplay.tsx +0 -21
- package/src/styles/base.css +0 -37
- package/src/styles/index.css +0 -4
- package/src/styles/modal.css +0 -1
- package/src/styles/tailwindcss/base-components.css +0 -69
- package/src/styles/tailwindcss/modal.css +0 -29
- package/src/styles/tailwindcss/thread.css +0 -262
- package/src/styles/themes/default.css +0 -64
- package/src/styles/themes/shadcn-extras.css +0 -4
- package/src/tailwindcss/index.ts +0 -149
- package/src/ui/assistant-action-bar.tsx +0 -301
- package/src/ui/assistant-message.tsx +0 -96
- package/src/ui/assistant-modal.tsx +0 -146
- package/src/ui/attachment-ui.tsx +0 -211
- package/src/ui/base/CircleStopIcon.tsx +0 -17
- package/src/ui/base/avatar.tsx +0 -41
- package/src/ui/base/button.tsx +0 -42
- package/src/ui/base/dialog.tsx +0 -113
- package/src/ui/base/index.ts +0 -15
- package/src/ui/base/tooltip-icon-button.tsx +0 -29
- package/src/ui/base/tooltip.tsx +0 -22
- package/src/ui/branch-picker.tsx +0 -117
- package/src/ui/composer.tsx +0 -210
- package/src/ui/content-part.tsx +0 -23
- package/src/ui/edit-composer.tsx +0 -98
- package/src/ui/index.ts +0 -98
- package/src/ui/thread-config.tsx +0 -246
- package/src/ui/thread-list-item.tsx +0 -91
- package/src/ui/thread-list.tsx +0 -78
- package/src/ui/thread-welcome.tsx +0 -140
- package/src/ui/thread.tsx +0 -176
- package/src/ui/user-action-bar.tsx +0 -66
- package/src/ui/user-message.tsx +0 -92
- package/src/ui/utils/withDefaults.tsx +0 -35
- package/tailwindcss/README.md +0 -1
- package/tailwindcss/package-lock.json +0 -6
- 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;
|
package/src/ui/thread-list.tsx
DELETED
|
@@ -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;
|
package/src/ui/user-message.tsx
DELETED
|
@@ -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
|
-
};
|
package/tailwindcss/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This directory exists to support subpath imports for TypeScript projects using --moduleResolution node.
|