@wallarm-org/design-system 3.2.0 → 3.3.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/components/AnimatedBackground/blur/BlurBackground.d.ts +6 -0
- package/dist/components/AnimatedBackground/blur/BlurBackground.js +176 -76
- package/dist/components/AnimatedBackground/blur/index.d.ts +1 -1
- package/dist/components/AnimatedBackground/index.d.ts +1 -1
- package/dist/components/ApprovalCard/ApprovalCard.d.ts +13 -0
- package/dist/components/ApprovalCard/ApprovalCard.js +249 -0
- package/dist/components/ApprovalCard/ApprovalCardActions.d.ts +6 -0
- package/dist/components/ApprovalCard/ApprovalCardActions.js +50 -0
- package/dist/components/ApprovalCard/ApprovalCardContent.d.ts +6 -0
- package/dist/components/ApprovalCard/ApprovalCardContent.js +50 -0
- package/dist/components/ApprovalCard/classes.d.ts +10 -0
- package/dist/components/ApprovalCard/classes.js +26 -0
- package/dist/components/ApprovalCard/index.d.ts +3 -0
- package/dist/components/ApprovalCard/index.js +3 -0
- package/dist/components/AssistantMessage/AssistantMessage.d.ts +12 -0
- package/dist/components/AssistantMessage/AssistantMessage.js +66 -0
- package/dist/components/AssistantMessage/AssistantMessageContent.d.ts +10 -0
- package/dist/components/AssistantMessage/AssistantMessageContent.js +50 -0
- package/dist/components/AssistantMessage/AssistantMessageError.d.ts +13 -0
- package/dist/components/AssistantMessage/AssistantMessageError.js +93 -0
- package/dist/components/AssistantMessage/AssistantMessageLoader.d.ts +13 -0
- package/dist/components/AssistantMessage/AssistantMessageLoader.js +88 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdown.d.ts +71 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdown.js +278 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.d.ts +17 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.js +94 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.d.ts +10 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.js +59 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.d.ts +14 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.js +65 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.d.ts +7 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.js +70 -0
- package/dist/components/AssistantMessage/classes.d.ts +38 -0
- package/dist/components/AssistantMessage/classes.js +46 -0
- package/dist/components/AssistantMessage/index.d.ts +9 -0
- package/dist/components/AssistantMessage/index.js +9 -0
- package/dist/components/AssistantMessage/lib/markdown.d.ts +20 -0
- package/dist/components/AssistantMessage/lib/markdown.js +51 -0
- package/dist/components/ChainOfThought/ChainOfThought.d.ts +10 -0
- package/dist/components/ChainOfThought/ChainOfThought.js +66 -0
- package/dist/components/ChainOfThought/ChainOfThoughtStep.d.ts +31 -0
- package/dist/components/ChainOfThought/ChainOfThoughtStep.js +312 -0
- package/dist/components/ChainOfThought/classes.d.ts +20 -0
- package/dist/components/ChainOfThought/classes.js +84 -0
- package/dist/components/ChainOfThought/index.d.ts +2 -0
- package/dist/components/ChainOfThought/index.js +2 -0
- package/dist/components/Chat/Chat.d.ts +12 -0
- package/dist/components/Chat/Chat.js +90 -0
- package/dist/components/Chat/ChatBody.d.ts +12 -0
- package/dist/components/Chat/ChatBody.js +52 -0
- package/dist/components/Chat/ChatFooter.d.ts +7 -0
- package/dist/components/Chat/ChatFooter.js +50 -0
- package/dist/components/Chat/ChatGreeting.d.ts +8 -0
- package/dist/components/Chat/ChatGreeting.js +94 -0
- package/dist/components/Chat/ChatHeader.d.ts +6 -0
- package/dist/components/Chat/ChatHeader.js +50 -0
- package/dist/components/Chat/ChatHeaderActions.d.ts +7 -0
- package/dist/components/Chat/ChatHeaderActions.js +50 -0
- package/dist/components/Chat/ChatHeaderTitle.d.ts +12 -0
- package/dist/components/Chat/ChatHeaderTitle.js +99 -0
- package/dist/components/Chat/ChatSuggestion.d.ts +7 -0
- package/dist/components/Chat/ChatSuggestion.js +56 -0
- package/dist/components/Chat/ChatSuggestions.d.ts +14 -0
- package/dist/components/Chat/ChatSuggestions.js +111 -0
- package/dist/components/Chat/ChatSuggestionsContext.d.ts +7 -0
- package/dist/components/Chat/ChatSuggestionsContext.js +7 -0
- package/dist/components/Chat/ChatTrigger.d.ts +13 -0
- package/dist/components/Chat/ChatTrigger.js +101 -0
- package/dist/components/Chat/classes.d.ts +17 -0
- package/dist/components/Chat/classes.js +44 -0
- package/dist/components/Chat/index.d.ts +10 -0
- package/dist/components/Chat/index.js +10 -0
- package/dist/components/ChatInput/ChatInput.d.ts +30 -0
- package/dist/components/ChatInput/ChatInput.js +230 -0
- package/dist/components/ChatInput/ChatInputContext.d.ts +11 -0
- package/dist/components/ChatInput/ChatInputContext.js +8 -0
- package/dist/components/ChatInput/ChatInputSubmit.d.ts +10 -0
- package/dist/components/ChatInput/ChatInputSubmit.js +175 -0
- package/dist/components/ChatInput/ChatInputTextarea.d.ts +6 -0
- package/dist/components/ChatInput/ChatInputTextarea.js +155 -0
- package/dist/components/ChatInput/classes.d.ts +9 -0
- package/dist/components/ChatInput/classes.js +22 -0
- package/dist/components/ChatInput/index.d.ts +3 -0
- package/dist/components/ChatInput/index.js +3 -0
- package/dist/components/ChatPermissions/ChatPermissions.d.ts +12 -0
- package/dist/components/ChatPermissions/ChatPermissions.js +66 -0
- package/dist/components/ChatPermissions/ChatPermissionsContent.d.ts +7 -0
- package/dist/components/ChatPermissions/ChatPermissionsContent.js +73 -0
- package/dist/components/ChatPermissions/ChatPermissionsContext.d.ts +7 -0
- package/dist/components/ChatPermissions/ChatPermissionsContext.js +8 -0
- package/dist/components/ChatPermissions/ChatPermissionsItem.d.ts +17 -0
- package/dist/components/ChatPermissions/ChatPermissionsItem.js +115 -0
- package/dist/components/ChatPermissions/ChatPermissionsTrigger.d.ts +6 -0
- package/dist/components/ChatPermissions/ChatPermissionsTrigger.js +110 -0
- package/dist/components/ChatPermissions/classes.d.ts +3 -0
- package/dist/components/ChatPermissions/classes.js +5 -0
- package/dist/components/ChatPermissions/index.d.ts +4 -0
- package/dist/components/ChatPermissions/index.js +4 -0
- package/dist/components/Conversation/Conversation.d.ts +19 -0
- package/dist/components/Conversation/Conversation.js +102 -0
- package/dist/components/Conversation/ConversationContent.d.ts +11 -0
- package/dist/components/Conversation/ConversationContent.js +103 -0
- package/dist/components/Conversation/ConversationContext.d.ts +14 -0
- package/dist/components/Conversation/ConversationContext.js +8 -0
- package/dist/components/Conversation/ConversationEmptyState.d.ts +15 -0
- package/dist/components/Conversation/ConversationEmptyState.js +70 -0
- package/dist/components/Conversation/ConversationScrollButton.d.ts +13 -0
- package/dist/components/Conversation/ConversationScrollButton.js +138 -0
- package/dist/components/Conversation/classes.d.ts +13 -0
- package/dist/components/Conversation/classes.js +8 -0
- package/dist/components/Conversation/index.d.ts +4 -0
- package/dist/components/Conversation/index.js +4 -0
- package/dist/components/Conversation/useStickToBottom.d.ts +9 -0
- package/dist/components/Conversation/useStickToBottom.js +203 -0
- package/dist/components/MessageActions/MessageAction.d.ts +18 -0
- package/dist/components/MessageActions/MessageAction.js +109 -0
- package/dist/components/MessageActions/MessageActions.d.ts +12 -0
- package/dist/components/MessageActions/MessageActions.js +74 -0
- package/dist/components/MessageActions/MessageTimestamp.d.ts +7 -0
- package/dist/components/MessageActions/MessageTimestamp.js +50 -0
- package/dist/components/MessageActions/classes.d.ts +5 -0
- package/dist/components/MessageActions/classes.js +15 -0
- package/dist/components/MessageActions/index.d.ts +3 -0
- package/dist/components/MessageActions/index.js +3 -0
- package/dist/components/Popover/PopoverContent.d.ts +2 -1
- package/dist/components/Popover/PopoverContent.js +42 -39
- package/dist/components/UserMessage/UserMessage.d.ts +10 -0
- package/dist/components/UserMessage/UserMessage.js +66 -0
- package/dist/components/UserMessage/UserMessageBubble.d.ts +16 -0
- package/dist/components/UserMessage/UserMessageBubble.js +175 -0
- package/dist/components/UserMessage/UserMessageContext.d.ts +9 -0
- package/dist/components/UserMessage/UserMessageContext.js +4 -0
- package/dist/components/UserMessage/UserMessageShowMore.d.ts +15 -0
- package/dist/components/UserMessage/UserMessageShowMore.js +87 -0
- package/dist/components/UserMessage/classes.d.ts +11 -0
- package/dist/components/UserMessage/classes.js +32 -0
- package/dist/components/UserMessage/index.d.ts +3 -0
- package/dist/components/UserMessage/index.js +3 -0
- package/dist/components/WallyAssistant/WallyAssistant.d.ts +56 -0
- package/dist/components/WallyAssistant/WallyAssistant.js +541 -0
- package/dist/components/WallyAssistant/index.d.ts +10 -0
- package/dist/components/WallyAssistant/index.js +8 -0
- package/dist/components/WallyAssistant/model/deriveChatState.d.ts +33 -0
- package/dist/components/WallyAssistant/model/deriveChatState.js +54 -0
- package/dist/components/WallyAssistant/model/labels.d.ts +43 -0
- package/dist/components/WallyAssistant/model/labels.js +33 -0
- package/dist/components/WallyAssistant/model/model.d.ts +184 -0
- package/dist/components/WallyAssistant/model/model.js +0 -0
- package/dist/components/WallyAssistant/views/ApprovalCardView.d.ts +20 -0
- package/dist/components/WallyAssistant/views/ApprovalCardView.js +274 -0
- package/dist/components/WallyAssistant/views/ChainOfThoughtView.d.ts +18 -0
- package/dist/components/WallyAssistant/views/ChainOfThoughtView.js +301 -0
- package/dist/components/WallyAssistant/views/ChatMessageView.d.ts +15 -0
- package/dist/components/WallyAssistant/views/ChatMessageView.js +372 -0
- package/dist/components/WallyAssistant/views/ChatPartView.d.ts +16 -0
- package/dist/components/WallyAssistant/views/ChatPartView.js +171 -0
- package/dist/components/WallyAssistant/views/ChatViewContext.d.ts +98 -0
- package/dist/components/WallyAssistant/views/ChatViewContext.js +44 -0
- package/dist/components/WallyAssistant/views/ChatViewProvider.d.ts +18 -0
- package/dist/components/WallyAssistant/views/ChatViewProvider.js +96 -0
- package/dist/components/WallyAssistant/views/stepIcons.d.ts +8 -0
- package/dist/components/WallyAssistant/views/stepIcons.js +47 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/metadata/components.json +30786 -15960
- package/dist/theme/components/animated-background.css +6 -1
- package/dist/theme/index.css +1 -0
- package/dist/theme/utilities/shimmer-text.css +27 -0
- package/package.json +3 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { useTestId } from "../../utils/testId.js";
|
|
5
|
+
import { approvalCardContentVariants } from "./classes.js";
|
|
6
|
+
const ApprovalCardContent = (t0)=>{
|
|
7
|
+
const $ = c(12);
|
|
8
|
+
let className;
|
|
9
|
+
let props;
|
|
10
|
+
let ref;
|
|
11
|
+
let testIdProp;
|
|
12
|
+
if ($[0] !== t0) {
|
|
13
|
+
({ ref, className, "data-testid": testIdProp, ...props } = t0);
|
|
14
|
+
$[0] = t0;
|
|
15
|
+
$[1] = className;
|
|
16
|
+
$[2] = props;
|
|
17
|
+
$[3] = ref;
|
|
18
|
+
$[4] = testIdProp;
|
|
19
|
+
} else {
|
|
20
|
+
className = $[1];
|
|
21
|
+
props = $[2];
|
|
22
|
+
ref = $[3];
|
|
23
|
+
testIdProp = $[4];
|
|
24
|
+
}
|
|
25
|
+
const testId = useTestId("content", testIdProp);
|
|
26
|
+
let t1;
|
|
27
|
+
if ($[5] !== className) {
|
|
28
|
+
t1 = cn(approvalCardContentVariants(), className);
|
|
29
|
+
$[5] = className;
|
|
30
|
+
$[6] = t1;
|
|
31
|
+
} else t1 = $[6];
|
|
32
|
+
let t2;
|
|
33
|
+
if ($[7] !== props || $[8] !== ref || $[9] !== t1 || $[10] !== testId) {
|
|
34
|
+
t2 = /*#__PURE__*/ jsx("div", {
|
|
35
|
+
...props,
|
|
36
|
+
ref: ref,
|
|
37
|
+
"data-slot": "approval-card-content",
|
|
38
|
+
"data-testid": testId,
|
|
39
|
+
className: t1
|
|
40
|
+
});
|
|
41
|
+
$[7] = props;
|
|
42
|
+
$[8] = ref;
|
|
43
|
+
$[9] = t1;
|
|
44
|
+
$[10] = testId;
|
|
45
|
+
$[11] = t2;
|
|
46
|
+
} else t2 = $[11];
|
|
47
|
+
return t2;
|
|
48
|
+
};
|
|
49
|
+
ApprovalCardContent.displayName = "ApprovalCardContent";
|
|
50
|
+
export { ApprovalCardContent };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const approvalCardVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const approvalCardCaptionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const approvalCardSurfaceVariants: (props?: ({
|
|
4
|
+
status?: "approved" | "pending" | "rejected" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export declare const approvalCardStatusIconVariants: (props?: ({
|
|
7
|
+
status?: "approved" | "rejected" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export declare const approvalCardContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
|
+
export declare const approvalCardActionsVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
const approvalCardVariants = cva('flex flex-col');
|
|
3
|
+
const approvalCardCaptionVariants = cva("px-16 py-2 font-mono text-xs text-text-secondary [font-feature-settings:'liga'_0]");
|
|
4
|
+
const approvalCardSurfaceVariants = cva('rounded-16 border border-border-primary-light', {
|
|
5
|
+
variants: {
|
|
6
|
+
status: {
|
|
7
|
+
pending: 'bg-bg-surface-2',
|
|
8
|
+
approved: 'flex h-44 items-center gap-8 bg-bg-light-primary px-12 text-sm text-text-secondary',
|
|
9
|
+
rejected: 'flex h-44 items-center gap-8 bg-bg-light-primary px-12 text-sm text-text-secondary'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
status: 'pending'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const approvalCardStatusIconVariants = cva('', {
|
|
17
|
+
variants: {
|
|
18
|
+
status: {
|
|
19
|
+
approved: 'text-icon-success',
|
|
20
|
+
rejected: 'text-icon-danger'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const approvalCardContentVariants = cva('flex flex-col gap-8 px-16 pt-12 text-sm text-text-primary break-words');
|
|
25
|
+
const approvalCardActionsVariants = cva('flex flex-wrap items-center gap-8 px-16 py-12');
|
|
26
|
+
export { approvalCardActionsVariants, approvalCardCaptionVariants, approvalCardContentVariants, approvalCardStatusIconVariants, approvalCardSurfaceVariants, approvalCardVariants };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ApprovalCard, type ApprovalCardProps, type ApprovalCardStatus } from './ApprovalCard.js';
|
|
2
|
+
export { ApprovalCardActions, type ApprovalCardActionsProps } from './ApprovalCardActions.js';
|
|
3
|
+
export { ApprovalCardContent, type ApprovalCardContentProps } from './ApprovalCardContent.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface AssistantMessageProps extends HTMLAttributes<HTMLElement>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLElement>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A message from Wally: an `<article>` named "Wally" that stacks an optional
|
|
8
|
+
* `ChainOfThought`, an optional `ApprovalCard`, the `AssistantMessageContent` and a
|
|
9
|
+
* `MessageActions` row. Set `aria-busy` while the answer streams. Inside a cascade its
|
|
10
|
+
* test id is `<base>--assistant-message`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const AssistantMessage: FC<AssistantMessageProps>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { TestIdProvider, useTestId } from "../../utils/testId.js";
|
|
5
|
+
import { assistantMessageVariants } from "./classes.js";
|
|
6
|
+
const AssistantMessage = (t0)=>{
|
|
7
|
+
const $ = c(17);
|
|
8
|
+
let children;
|
|
9
|
+
let className;
|
|
10
|
+
let props;
|
|
11
|
+
let ref;
|
|
12
|
+
let testIdProp;
|
|
13
|
+
if ($[0] !== t0) {
|
|
14
|
+
({ ref, className, children, "data-testid": testIdProp, ...props } = t0);
|
|
15
|
+
$[0] = t0;
|
|
16
|
+
$[1] = children;
|
|
17
|
+
$[2] = className;
|
|
18
|
+
$[3] = props;
|
|
19
|
+
$[4] = ref;
|
|
20
|
+
$[5] = testIdProp;
|
|
21
|
+
} else {
|
|
22
|
+
children = $[1];
|
|
23
|
+
className = $[2];
|
|
24
|
+
props = $[3];
|
|
25
|
+
ref = $[4];
|
|
26
|
+
testIdProp = $[5];
|
|
27
|
+
}
|
|
28
|
+
const testId = useTestId("assistant-message", testIdProp);
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[6] !== className) {
|
|
31
|
+
t1 = cn(assistantMessageVariants(), className);
|
|
32
|
+
$[6] = className;
|
|
33
|
+
$[7] = t1;
|
|
34
|
+
} else t1 = $[7];
|
|
35
|
+
let t2;
|
|
36
|
+
if ($[8] !== children || $[9] !== testId) {
|
|
37
|
+
t2 = /*#__PURE__*/ jsx(TestIdProvider, {
|
|
38
|
+
value: testId,
|
|
39
|
+
children: children
|
|
40
|
+
});
|
|
41
|
+
$[8] = children;
|
|
42
|
+
$[9] = testId;
|
|
43
|
+
$[10] = t2;
|
|
44
|
+
} else t2 = $[10];
|
|
45
|
+
let t3;
|
|
46
|
+
if ($[11] !== props || $[12] !== ref || $[13] !== t1 || $[14] !== t2 || $[15] !== testId) {
|
|
47
|
+
t3 = /*#__PURE__*/ jsx("article", {
|
|
48
|
+
"aria-label": "Wally",
|
|
49
|
+
...props,
|
|
50
|
+
ref: ref,
|
|
51
|
+
"data-slot": "assistant-message",
|
|
52
|
+
"data-testid": testId,
|
|
53
|
+
className: t1,
|
|
54
|
+
children: t2
|
|
55
|
+
});
|
|
56
|
+
$[11] = props;
|
|
57
|
+
$[12] = ref;
|
|
58
|
+
$[13] = t1;
|
|
59
|
+
$[14] = t2;
|
|
60
|
+
$[15] = testId;
|
|
61
|
+
$[16] = t3;
|
|
62
|
+
} else t3 = $[16];
|
|
63
|
+
return t3;
|
|
64
|
+
};
|
|
65
|
+
AssistantMessage.displayName = "AssistantMessage";
|
|
66
|
+
export { AssistantMessage };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface AssistantMessageContentProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The answer body: spaces and styles markdown blocks (14/24 paragraphs, 16/24 headings, lists).
|
|
8
|
+
* Put `AssistantMessageMarkdown` inside it (WallyAssistant's default), or your own renderer's blocks.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AssistantMessageContent: FC<AssistantMessageContentProps>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { useTestId } from "../../utils/testId.js";
|
|
5
|
+
import { assistantMessageContentVariants } from "./classes.js";
|
|
6
|
+
const AssistantMessageContent = (t0)=>{
|
|
7
|
+
const $ = c(12);
|
|
8
|
+
let className;
|
|
9
|
+
let props;
|
|
10
|
+
let ref;
|
|
11
|
+
let testIdProp;
|
|
12
|
+
if ($[0] !== t0) {
|
|
13
|
+
({ ref, className, "data-testid": testIdProp, ...props } = t0);
|
|
14
|
+
$[0] = t0;
|
|
15
|
+
$[1] = className;
|
|
16
|
+
$[2] = props;
|
|
17
|
+
$[3] = ref;
|
|
18
|
+
$[4] = testIdProp;
|
|
19
|
+
} else {
|
|
20
|
+
className = $[1];
|
|
21
|
+
props = $[2];
|
|
22
|
+
ref = $[3];
|
|
23
|
+
testIdProp = $[4];
|
|
24
|
+
}
|
|
25
|
+
const testId = useTestId("content", testIdProp);
|
|
26
|
+
let t1;
|
|
27
|
+
if ($[5] !== className) {
|
|
28
|
+
t1 = cn(assistantMessageContentVariants(), className);
|
|
29
|
+
$[5] = className;
|
|
30
|
+
$[6] = t1;
|
|
31
|
+
} else t1 = $[6];
|
|
32
|
+
let t2;
|
|
33
|
+
if ($[7] !== props || $[8] !== ref || $[9] !== t1 || $[10] !== testId) {
|
|
34
|
+
t2 = /*#__PURE__*/ jsx("div", {
|
|
35
|
+
...props,
|
|
36
|
+
ref: ref,
|
|
37
|
+
"data-slot": "assistant-message-content",
|
|
38
|
+
"data-testid": testId,
|
|
39
|
+
className: t1
|
|
40
|
+
});
|
|
41
|
+
$[7] = props;
|
|
42
|
+
$[8] = ref;
|
|
43
|
+
$[9] = t1;
|
|
44
|
+
$[10] = testId;
|
|
45
|
+
$[11] = t2;
|
|
46
|
+
} else t2 = $[11];
|
|
47
|
+
return t2;
|
|
48
|
+
};
|
|
49
|
+
AssistantMessageContent.displayName = "AssistantMessageContent";
|
|
50
|
+
export { AssistantMessageContent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface AssistantMessageErrorProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
/** Trailing control, e.g. a Retry Button (yours, so analytics land on it). Rendered inside the error's
|
|
6
|
+
* test-id cascade: read `useTestId('<slot>')` in the action to get `<error>--<slot>` — `Button` doesn't. */
|
|
7
|
+
action?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A failed answer, announced as `role='alert'`: a danger icon, the message and an optional
|
|
11
|
+
* trailing `action` such as Retry. Inside a cascade its test id is `<base>--error`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const AssistantMessageError: FC<AssistantMessageErrorProps>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { OctagonAlert } from "../../icons/index.js";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { TestIdProvider, useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { assistantMessageErrorVariants } from "./classes.js";
|
|
7
|
+
const AssistantMessageError = (t0)=>{
|
|
8
|
+
const $ = c(22);
|
|
9
|
+
let action;
|
|
10
|
+
let children;
|
|
11
|
+
let className;
|
|
12
|
+
let props;
|
|
13
|
+
let ref;
|
|
14
|
+
let testIdProp;
|
|
15
|
+
if ($[0] !== t0) {
|
|
16
|
+
({ ref, className, children, action, "data-testid": testIdProp, ...props } = t0);
|
|
17
|
+
$[0] = t0;
|
|
18
|
+
$[1] = action;
|
|
19
|
+
$[2] = children;
|
|
20
|
+
$[3] = className;
|
|
21
|
+
$[4] = props;
|
|
22
|
+
$[5] = ref;
|
|
23
|
+
$[6] = testIdProp;
|
|
24
|
+
} else {
|
|
25
|
+
action = $[1];
|
|
26
|
+
children = $[2];
|
|
27
|
+
className = $[3];
|
|
28
|
+
props = $[4];
|
|
29
|
+
ref = $[5];
|
|
30
|
+
testIdProp = $[6];
|
|
31
|
+
}
|
|
32
|
+
const testId = useTestId("error", testIdProp);
|
|
33
|
+
let t1;
|
|
34
|
+
if ($[7] !== className) {
|
|
35
|
+
t1 = cn(assistantMessageErrorVariants(), className);
|
|
36
|
+
$[7] = className;
|
|
37
|
+
$[8] = t1;
|
|
38
|
+
} else t1 = $[8];
|
|
39
|
+
let t2;
|
|
40
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
41
|
+
t2 = /*#__PURE__*/ jsx(OctagonAlert, {
|
|
42
|
+
size: "md",
|
|
43
|
+
"aria-hidden": true,
|
|
44
|
+
className: "mt-2 shrink-0 text-icon-danger"
|
|
45
|
+
});
|
|
46
|
+
$[9] = t2;
|
|
47
|
+
} else t2 = $[9];
|
|
48
|
+
let t3;
|
|
49
|
+
if ($[10] !== children) {
|
|
50
|
+
t3 = /*#__PURE__*/ jsx("div", {
|
|
51
|
+
className: "min-w-0 flex-1 break-words",
|
|
52
|
+
children: children
|
|
53
|
+
});
|
|
54
|
+
$[10] = children;
|
|
55
|
+
$[11] = t3;
|
|
56
|
+
} else t3 = $[11];
|
|
57
|
+
let t4;
|
|
58
|
+
if ($[12] !== action || $[13] !== testId) {
|
|
59
|
+
t4 = /*#__PURE__*/ jsx(TestIdProvider, {
|
|
60
|
+
value: testId,
|
|
61
|
+
children: action
|
|
62
|
+
});
|
|
63
|
+
$[12] = action;
|
|
64
|
+
$[13] = testId;
|
|
65
|
+
$[14] = t4;
|
|
66
|
+
} else t4 = $[14];
|
|
67
|
+
let t5;
|
|
68
|
+
if ($[15] !== props || $[16] !== ref || $[17] !== t1 || $[18] !== t3 || $[19] !== t4 || $[20] !== testId) {
|
|
69
|
+
t5 = /*#__PURE__*/ jsxs("div", {
|
|
70
|
+
role: "alert",
|
|
71
|
+
...props,
|
|
72
|
+
ref: ref,
|
|
73
|
+
"data-slot": "assistant-message-error",
|
|
74
|
+
"data-testid": testId,
|
|
75
|
+
className: t1,
|
|
76
|
+
children: [
|
|
77
|
+
t2,
|
|
78
|
+
t3,
|
|
79
|
+
t4
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
$[15] = props;
|
|
83
|
+
$[16] = ref;
|
|
84
|
+
$[17] = t1;
|
|
85
|
+
$[18] = t3;
|
|
86
|
+
$[19] = t4;
|
|
87
|
+
$[20] = testId;
|
|
88
|
+
$[21] = t5;
|
|
89
|
+
} else t5 = $[21];
|
|
90
|
+
return t5;
|
|
91
|
+
};
|
|
92
|
+
AssistantMessageError.displayName = "AssistantMessageError";
|
|
93
|
+
export { AssistantMessageError };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface AssistantMessageLoaderProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
/** Default 'Working...'. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The "Working..." row shown before the first output: a dashed circle and a shimmering label
|
|
10
|
+
* (static under reduced motion), announced as `role='status'`. Inside a cascade its test id is
|
|
11
|
+
* `<base>--loader`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const AssistantMessageLoader: FC<AssistantMessageLoaderProps>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { CircleDashed } from "../../icons/index.js";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { chainOfThoughtIconVariants, chainOfThoughtLabelVariants } from "../ChainOfThought/classes.js";
|
|
7
|
+
import { assistantMessageLoaderVariants } from "./classes.js";
|
|
8
|
+
const AssistantMessageLoader = (t0)=>{
|
|
9
|
+
const $ = c(18);
|
|
10
|
+
let children;
|
|
11
|
+
let className;
|
|
12
|
+
let props;
|
|
13
|
+
let ref;
|
|
14
|
+
let testIdProp;
|
|
15
|
+
if ($[0] !== t0) {
|
|
16
|
+
({ ref, className, children, "data-testid": testIdProp, ...props } = t0);
|
|
17
|
+
$[0] = t0;
|
|
18
|
+
$[1] = children;
|
|
19
|
+
$[2] = className;
|
|
20
|
+
$[3] = props;
|
|
21
|
+
$[4] = ref;
|
|
22
|
+
$[5] = testIdProp;
|
|
23
|
+
} else {
|
|
24
|
+
children = $[1];
|
|
25
|
+
className = $[2];
|
|
26
|
+
props = $[3];
|
|
27
|
+
ref = $[4];
|
|
28
|
+
testIdProp = $[5];
|
|
29
|
+
}
|
|
30
|
+
const testId = useTestId("loader", testIdProp);
|
|
31
|
+
let t1;
|
|
32
|
+
if ($[6] !== className) {
|
|
33
|
+
t1 = cn(assistantMessageLoaderVariants(), className);
|
|
34
|
+
$[6] = className;
|
|
35
|
+
$[7] = t1;
|
|
36
|
+
} else t1 = $[7];
|
|
37
|
+
let t2;
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
|
+
t2 = /*#__PURE__*/ jsx("span", {
|
|
41
|
+
"aria-hidden": true,
|
|
42
|
+
className: chainOfThoughtIconVariants(),
|
|
43
|
+
children: /*#__PURE__*/ jsx(CircleDashed, {})
|
|
44
|
+
});
|
|
45
|
+
t3 = chainOfThoughtLabelVariants({
|
|
46
|
+
status: "running"
|
|
47
|
+
});
|
|
48
|
+
$[8] = t2;
|
|
49
|
+
$[9] = t3;
|
|
50
|
+
} else {
|
|
51
|
+
t2 = $[8];
|
|
52
|
+
t3 = $[9];
|
|
53
|
+
}
|
|
54
|
+
const t4 = children ?? "Working...";
|
|
55
|
+
let t5;
|
|
56
|
+
if ($[10] !== t4) {
|
|
57
|
+
t5 = /*#__PURE__*/ jsx("span", {
|
|
58
|
+
className: t3,
|
|
59
|
+
children: t4
|
|
60
|
+
});
|
|
61
|
+
$[10] = t4;
|
|
62
|
+
$[11] = t5;
|
|
63
|
+
} else t5 = $[11];
|
|
64
|
+
let t6;
|
|
65
|
+
if ($[12] !== props || $[13] !== ref || $[14] !== t1 || $[15] !== t5 || $[16] !== testId) {
|
|
66
|
+
t6 = /*#__PURE__*/ jsxs("div", {
|
|
67
|
+
role: "status",
|
|
68
|
+
...props,
|
|
69
|
+
ref: ref,
|
|
70
|
+
"data-slot": "assistant-message-loader",
|
|
71
|
+
"data-testid": testId,
|
|
72
|
+
className: t1,
|
|
73
|
+
children: [
|
|
74
|
+
t2,
|
|
75
|
+
t5
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
$[12] = props;
|
|
79
|
+
$[13] = ref;
|
|
80
|
+
$[14] = t1;
|
|
81
|
+
$[15] = t5;
|
|
82
|
+
$[16] = testId;
|
|
83
|
+
$[17] = t6;
|
|
84
|
+
} else t6 = $[17];
|
|
85
|
+
return t6;
|
|
86
|
+
};
|
|
87
|
+
AssistantMessageLoader.displayName = "AssistantMessageLoader";
|
|
88
|
+
export { AssistantMessageLoader };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ComponentType, type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type AssistantMessageMarkdownCodeBlockProps } from './AssistantMessageMarkdownCodeBlock.js';
|
|
3
|
+
import { type AssistantMessageMarkdownInlineCodeProps } from './AssistantMessageMarkdownInlineCode.js';
|
|
4
|
+
import { type AssistantMessageMarkdownLinkProps } from './AssistantMessageMarkdownLink.js';
|
|
5
|
+
/** Same literals as `ChatMarkdownProps.variant`. 'approval' renders like 'answer'. */
|
|
6
|
+
export type AssistantMessageMarkdownVariant = 'answer' | 'chain-of-thought' | 'approval';
|
|
7
|
+
type Align = 'left' | 'center' | 'right';
|
|
8
|
+
interface WithChildren {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** One entry per element. The renderer passes only these props; `href` and `src` are already allow-listed. */
|
|
12
|
+
export interface AssistantMessageMarkdownComponents {
|
|
13
|
+
p: ComponentType<WithChildren>;
|
|
14
|
+
h1: ComponentType<WithChildren>;
|
|
15
|
+
h2: ComponentType<WithChildren>;
|
|
16
|
+
h3: ComponentType<WithChildren>;
|
|
17
|
+
h4: ComponentType<WithChildren>;
|
|
18
|
+
h5: ComponentType<WithChildren>;
|
|
19
|
+
h6: ComponentType<WithChildren>;
|
|
20
|
+
strong: ComponentType<WithChildren>;
|
|
21
|
+
em: ComponentType<WithChildren>;
|
|
22
|
+
del: ComponentType<WithChildren>;
|
|
23
|
+
blockquote: ComponentType<WithChildren>;
|
|
24
|
+
ul: ComponentType<WithChildren>;
|
|
25
|
+
ol: ComponentType<WithChildren & {
|
|
26
|
+
start?: number;
|
|
27
|
+
}>;
|
|
28
|
+
/** `checked` is set for GFM task items only. */
|
|
29
|
+
li: ComponentType<WithChildren & {
|
|
30
|
+
checked?: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
hr: ComponentType;
|
|
33
|
+
table: ComponentType<WithChildren>;
|
|
34
|
+
thead: ComponentType<WithChildren>;
|
|
35
|
+
tbody: ComponentType<WithChildren>;
|
|
36
|
+
tr: ComponentType<WithChildren>;
|
|
37
|
+
th: ComponentType<WithChildren & {
|
|
38
|
+
align?: Align;
|
|
39
|
+
}>;
|
|
40
|
+
td: ComponentType<WithChildren & {
|
|
41
|
+
align?: Align;
|
|
42
|
+
}>;
|
|
43
|
+
a: ComponentType<AssistantMessageMarkdownLinkProps>;
|
|
44
|
+
inlineCode: ComponentType<AssistantMessageMarkdownInlineCodeProps>;
|
|
45
|
+
codeBlock: ComponentType<AssistantMessageMarkdownCodeBlockProps>;
|
|
46
|
+
/** Default: the alt text. An untrusted image URL loads on render (tracking pixel, data exfiltration). */
|
|
47
|
+
img: ComponentType<{
|
|
48
|
+
src: string;
|
|
49
|
+
alt: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
export interface AssistantMessageMarkdownProps {
|
|
54
|
+
/** Untrusted GFM: the whole text so far (a snapshot, never a delta). */
|
|
55
|
+
text: string;
|
|
56
|
+
/** The text is still growing: repair the unfinished last block, hold back a half-typed table or an empty fence,
|
|
57
|
+
* keep an open fence unhighlighted. Default false. */
|
|
58
|
+
streaming?: boolean;
|
|
59
|
+
/** Where it renders. 'chain-of-thought': muted, non-copyable inline code and 12px links. Default 'answer'. */
|
|
60
|
+
variant?: AssistantMessageMarkdownVariant;
|
|
61
|
+
/** Element overrides merged over the defaults. Module scope: a new object re-renders every block. */
|
|
62
|
+
components?: Partial<AssistantMessageMarkdownComponents>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Untrusted GFM (an AG-UI `AssistantMessage.content` snapshot) as DS elements. It renders no wrapper: its blocks
|
|
66
|
+
* are direct children of `AssistantMessageContent`, a `ChainOfThoughtStep` body or `ApprovalCardContent`, which
|
|
67
|
+
* space and style them. No raw HTML, http/https/mailto/relative links only, no images. The default
|
|
68
|
+
* `ChatViewConfig.markdown`; its props are a subset of `ChatMarkdownProps`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const AssistantMessageMarkdown: FC<AssistantMessageMarkdownProps>;
|
|
71
|
+
export {};
|