@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,115 @@
|
|
|
1
|
+
import { jsx, jsxs } 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 { Switch, SwitchControl, SwitchLabel } from "../Switch/index.js";
|
|
6
|
+
import { chatPermissionsItemDescriptionVariants, chatPermissionsItemVariants } from "./classes.js";
|
|
7
|
+
const ChatPermissionsItem = (t0)=>{
|
|
8
|
+
const $ = c(28);
|
|
9
|
+
let className;
|
|
10
|
+
let description;
|
|
11
|
+
let name;
|
|
12
|
+
let onCheckedChange;
|
|
13
|
+
let rest;
|
|
14
|
+
let testIdProp;
|
|
15
|
+
let title;
|
|
16
|
+
if ($[0] !== t0) {
|
|
17
|
+
({ name, title, description, onCheckedChange, className, "data-testid": testIdProp, ...rest } = t0);
|
|
18
|
+
$[0] = t0;
|
|
19
|
+
$[1] = className;
|
|
20
|
+
$[2] = description;
|
|
21
|
+
$[3] = name;
|
|
22
|
+
$[4] = onCheckedChange;
|
|
23
|
+
$[5] = rest;
|
|
24
|
+
$[6] = testIdProp;
|
|
25
|
+
$[7] = title;
|
|
26
|
+
} else {
|
|
27
|
+
className = $[1];
|
|
28
|
+
description = $[2];
|
|
29
|
+
name = $[3];
|
|
30
|
+
onCheckedChange = $[4];
|
|
31
|
+
rest = $[5];
|
|
32
|
+
testIdProp = $[6];
|
|
33
|
+
title = $[7];
|
|
34
|
+
}
|
|
35
|
+
const testId = useTestId("item", testIdProp);
|
|
36
|
+
let t1;
|
|
37
|
+
if ($[8] !== name || $[9] !== onCheckedChange) {
|
|
38
|
+
t1 = onCheckedChange && ((t2)=>{
|
|
39
|
+
const { checked } = t2;
|
|
40
|
+
return onCheckedChange({
|
|
41
|
+
checked,
|
|
42
|
+
name
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
$[8] = name;
|
|
46
|
+
$[9] = onCheckedChange;
|
|
47
|
+
$[10] = t1;
|
|
48
|
+
} else t1 = $[10];
|
|
49
|
+
let t2;
|
|
50
|
+
if ($[11] !== className) {
|
|
51
|
+
t2 = cn(chatPermissionsItemVariants(), className);
|
|
52
|
+
$[11] = className;
|
|
53
|
+
$[12] = t2;
|
|
54
|
+
} else t2 = $[12];
|
|
55
|
+
let t3;
|
|
56
|
+
if ($[13] !== title) {
|
|
57
|
+
t3 = /*#__PURE__*/ jsx(SwitchLabel, {
|
|
58
|
+
children: title
|
|
59
|
+
});
|
|
60
|
+
$[13] = title;
|
|
61
|
+
$[14] = t3;
|
|
62
|
+
} else t3 = $[14];
|
|
63
|
+
let t4;
|
|
64
|
+
if ($[15] !== description) {
|
|
65
|
+
t4 = null != description && /*#__PURE__*/ jsx("span", {
|
|
66
|
+
className: chatPermissionsItemDescriptionVariants(),
|
|
67
|
+
children: description
|
|
68
|
+
});
|
|
69
|
+
$[15] = description;
|
|
70
|
+
$[16] = t4;
|
|
71
|
+
} else t4 = $[16];
|
|
72
|
+
let t5;
|
|
73
|
+
if ($[17] !== t3 || $[18] !== t4) {
|
|
74
|
+
t5 = /*#__PURE__*/ jsxs("span", {
|
|
75
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
76
|
+
children: [
|
|
77
|
+
t3,
|
|
78
|
+
t4
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
$[17] = t3;
|
|
82
|
+
$[18] = t4;
|
|
83
|
+
$[19] = t5;
|
|
84
|
+
} else t5 = $[19];
|
|
85
|
+
let t6;
|
|
86
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
87
|
+
t6 = /*#__PURE__*/ jsx(SwitchControl, {});
|
|
88
|
+
$[20] = t6;
|
|
89
|
+
} else t6 = $[20];
|
|
90
|
+
let t7;
|
|
91
|
+
if ($[21] !== name || $[22] !== rest || $[23] !== t1 || $[24] !== t2 || $[25] !== t5 || $[26] !== testId) {
|
|
92
|
+
t7 = /*#__PURE__*/ jsxs(Switch, {
|
|
93
|
+
...rest,
|
|
94
|
+
name: name,
|
|
95
|
+
onCheckedChange: t1,
|
|
96
|
+
"data-slot": "chat-permissions-item",
|
|
97
|
+
"data-testid": testId,
|
|
98
|
+
className: t2,
|
|
99
|
+
children: [
|
|
100
|
+
t5,
|
|
101
|
+
t6
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
$[21] = name;
|
|
105
|
+
$[22] = rest;
|
|
106
|
+
$[23] = t1;
|
|
107
|
+
$[24] = t2;
|
|
108
|
+
$[25] = t5;
|
|
109
|
+
$[26] = testId;
|
|
110
|
+
$[27] = t7;
|
|
111
|
+
} else t7 = $[27];
|
|
112
|
+
return t7;
|
|
113
|
+
};
|
|
114
|
+
ChatPermissionsItem.displayName = "ChatPermissionsItem";
|
|
115
|
+
export { ChatPermissionsItem };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, FC, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface ChatPermissionsTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLButtonElement>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ChatPermissionsTrigger: FC<ChatPermissionsTriggerProps>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { usePopoverContext } from "@ark-ui/react/popover";
|
|
4
|
+
import { Settings2 } from "../../icons/index.js";
|
|
5
|
+
import { useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { Button } from "../Button/index.js";
|
|
7
|
+
import { PopoverTrigger } from "../Popover/index.js";
|
|
8
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip/index.js";
|
|
9
|
+
import { useChatPermissionsContext } from "./ChatPermissionsContext.js";
|
|
10
|
+
const DEFAULT_LABEL = "Permission settings";
|
|
11
|
+
const ChatPermissionsTrigger = (t0)=>{
|
|
12
|
+
const $ = c(25);
|
|
13
|
+
let children;
|
|
14
|
+
let ref;
|
|
15
|
+
let rest;
|
|
16
|
+
let t1;
|
|
17
|
+
let testIdProp;
|
|
18
|
+
if ($[0] !== t0) {
|
|
19
|
+
({ ref, children, "aria-label": t1, "data-testid": testIdProp, ...rest } = t0);
|
|
20
|
+
$[0] = t0;
|
|
21
|
+
$[1] = children;
|
|
22
|
+
$[2] = ref;
|
|
23
|
+
$[3] = rest;
|
|
24
|
+
$[4] = t1;
|
|
25
|
+
$[5] = testIdProp;
|
|
26
|
+
} else {
|
|
27
|
+
children = $[1];
|
|
28
|
+
ref = $[2];
|
|
29
|
+
rest = $[3];
|
|
30
|
+
t1 = $[4];
|
|
31
|
+
testIdProp = $[5];
|
|
32
|
+
}
|
|
33
|
+
const ariaLabel = void 0 === t1 ? DEFAULT_LABEL : t1;
|
|
34
|
+
const { triggerId } = useChatPermissionsContext();
|
|
35
|
+
const { open } = usePopoverContext();
|
|
36
|
+
const testId = useTestId("trigger", testIdProp);
|
|
37
|
+
const tooltipTestId = useTestId("tooltip");
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[6] !== triggerId) {
|
|
40
|
+
t2 = {
|
|
41
|
+
trigger: triggerId
|
|
42
|
+
};
|
|
43
|
+
$[6] = triggerId;
|
|
44
|
+
$[7] = t2;
|
|
45
|
+
} else t2 = $[7];
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[8] !== children) {
|
|
48
|
+
t3 = children ?? /*#__PURE__*/ jsx(Settings2, {});
|
|
49
|
+
$[8] = children;
|
|
50
|
+
$[9] = t3;
|
|
51
|
+
} else t3 = $[9];
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[10] !== ariaLabel || $[11] !== ref || $[12] !== rest || $[13] !== t3 || $[14] !== testId || $[15] !== triggerId) {
|
|
54
|
+
t4 = /*#__PURE__*/ jsx(PopoverTrigger, {
|
|
55
|
+
asChild: true,
|
|
56
|
+
children: /*#__PURE__*/ jsx(TooltipTrigger, {
|
|
57
|
+
asChild: true,
|
|
58
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
59
|
+
type: "button",
|
|
60
|
+
...rest,
|
|
61
|
+
ref: ref,
|
|
62
|
+
id: triggerId,
|
|
63
|
+
"data-slot": "chat-permissions-trigger",
|
|
64
|
+
"data-testid": testId,
|
|
65
|
+
variant: "ghost",
|
|
66
|
+
color: "neutral",
|
|
67
|
+
size: "small",
|
|
68
|
+
"aria-label": ariaLabel,
|
|
69
|
+
children: t3
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
$[10] = ariaLabel;
|
|
74
|
+
$[11] = ref;
|
|
75
|
+
$[12] = rest;
|
|
76
|
+
$[13] = t3;
|
|
77
|
+
$[14] = testId;
|
|
78
|
+
$[15] = triggerId;
|
|
79
|
+
$[16] = t4;
|
|
80
|
+
} else t4 = $[16];
|
|
81
|
+
let t5;
|
|
82
|
+
if ($[17] !== ariaLabel || $[18] !== tooltipTestId) {
|
|
83
|
+
t5 = /*#__PURE__*/ jsx(TooltipContent, {
|
|
84
|
+
"data-testid": tooltipTestId,
|
|
85
|
+
children: ariaLabel
|
|
86
|
+
});
|
|
87
|
+
$[17] = ariaLabel;
|
|
88
|
+
$[18] = tooltipTestId;
|
|
89
|
+
$[19] = t5;
|
|
90
|
+
} else t5 = $[19];
|
|
91
|
+
let t6;
|
|
92
|
+
if ($[20] !== open || $[21] !== t2 || $[22] !== t4 || $[23] !== t5) {
|
|
93
|
+
t6 = /*#__PURE__*/ jsxs(Tooltip, {
|
|
94
|
+
disabled: open,
|
|
95
|
+
ids: t2,
|
|
96
|
+
children: [
|
|
97
|
+
t4,
|
|
98
|
+
t5
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
$[20] = open;
|
|
102
|
+
$[21] = t2;
|
|
103
|
+
$[22] = t4;
|
|
104
|
+
$[23] = t5;
|
|
105
|
+
$[24] = t6;
|
|
106
|
+
} else t6 = $[24];
|
|
107
|
+
return t6;
|
|
108
|
+
};
|
|
109
|
+
ChatPermissionsTrigger.displayName = "ChatPermissionsTrigger";
|
|
110
|
+
export { ChatPermissionsTrigger };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const chatPermissionsContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const chatPermissionsItemVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const chatPermissionsItemDescriptionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
const chatPermissionsContentVariants = cva('w-320 gap-1 p-8');
|
|
3
|
+
const chatPermissionsItemVariants = cva('w-full items-start justify-between gap-4 rounded-6 px-8 py-6 hover:bg-states-primary-hover');
|
|
4
|
+
const chatPermissionsItemDescriptionVariants = cva('truncate text-xs text-text-secondary');
|
|
5
|
+
export { chatPermissionsContentVariants, chatPermissionsItemDescriptionVariants, chatPermissionsItemVariants };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ChatPermissions, type ChatPermissionsProps } from './ChatPermissions.js';
|
|
2
|
+
export { ChatPermissionsContent, type ChatPermissionsContentProps } from './ChatPermissionsContent.js';
|
|
3
|
+
export { ChatPermissionsItem, type ChatPermissionsItemCheckedChangeDetails, type ChatPermissionsItemProps, } from './ChatPermissionsItem.js';
|
|
4
|
+
export { ChatPermissionsTrigger, type ChatPermissionsTriggerProps } from './ChatPermissionsTrigger.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type FC, type HTMLAttributes, type Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface ConversationProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
/** Distance in px from the bottom that still counts as "at bottom". Default 70. */
|
|
6
|
+
threshold?: number;
|
|
7
|
+
/**
|
|
8
|
+
* When it changes, re-stick and scroll to the bottom even if the reader scrolled up. Pass the
|
|
9
|
+
* last user message id, so sending always reveals the answer. For a thread switch, remount
|
|
10
|
+
* instead: `key={threadId}`.
|
|
11
|
+
*/
|
|
12
|
+
autoScrollKey?: string | number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Stick-to-bottom for the chat log: takes `ChatBody`'s place between `ChatHeader` and `ChatFooter`
|
|
16
|
+
* and holds a `ConversationContent` (the scroller) and a `ConversationScrollButton`.
|
|
17
|
+
* Transparent in the test-id cascade: inside `<Chat data-testid='chat'>` the log stays `chat--body`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Conversation: FC<ConversationProps>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { TestIdProvider, useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { ConversationContext } from "./ConversationContext.js";
|
|
7
|
+
import { conversationVariants } from "./classes.js";
|
|
8
|
+
import { useStickToBottom } from "./useStickToBottom.js";
|
|
9
|
+
const Conversation = (t0)=>{
|
|
10
|
+
const $ = c(26);
|
|
11
|
+
let autoScrollKey;
|
|
12
|
+
let children;
|
|
13
|
+
let className;
|
|
14
|
+
let props;
|
|
15
|
+
let ref;
|
|
16
|
+
let t1;
|
|
17
|
+
let testIdProp;
|
|
18
|
+
if ($[0] !== t0) {
|
|
19
|
+
({ ref, threshold: t1, autoScrollKey, className, children, "data-testid": testIdProp, ...props } = t0);
|
|
20
|
+
$[0] = t0;
|
|
21
|
+
$[1] = autoScrollKey;
|
|
22
|
+
$[2] = children;
|
|
23
|
+
$[3] = className;
|
|
24
|
+
$[4] = props;
|
|
25
|
+
$[5] = ref;
|
|
26
|
+
$[6] = t1;
|
|
27
|
+
$[7] = testIdProp;
|
|
28
|
+
} else {
|
|
29
|
+
autoScrollKey = $[1];
|
|
30
|
+
children = $[2];
|
|
31
|
+
className = $[3];
|
|
32
|
+
props = $[4];
|
|
33
|
+
ref = $[5];
|
|
34
|
+
t1 = $[6];
|
|
35
|
+
testIdProp = $[7];
|
|
36
|
+
}
|
|
37
|
+
const threshold = void 0 === t1 ? 70 : t1;
|
|
38
|
+
const testId = useTestId(void 0, testIdProp);
|
|
39
|
+
const [scrollEl, setScrollEl] = useState(null);
|
|
40
|
+
const [contentEl, setContentEl] = useState(null);
|
|
41
|
+
const { isAtBottom, scrollToBottom } = useStickToBottom(scrollEl, contentEl, threshold, autoScrollKey);
|
|
42
|
+
let t2;
|
|
43
|
+
if ($[8] !== className) {
|
|
44
|
+
t2 = cn(conversationVariants(), className);
|
|
45
|
+
$[8] = className;
|
|
46
|
+
$[9] = t2;
|
|
47
|
+
} else t2 = $[9];
|
|
48
|
+
let t3;
|
|
49
|
+
if ($[10] !== isAtBottom || $[11] !== scrollEl || $[12] !== scrollToBottom) {
|
|
50
|
+
t3 = {
|
|
51
|
+
isAtBottom,
|
|
52
|
+
scrollToBottom,
|
|
53
|
+
scrollEl,
|
|
54
|
+
setScrollEl,
|
|
55
|
+
setContentEl
|
|
56
|
+
};
|
|
57
|
+
$[10] = isAtBottom;
|
|
58
|
+
$[11] = scrollEl;
|
|
59
|
+
$[12] = scrollToBottom;
|
|
60
|
+
$[13] = t3;
|
|
61
|
+
} else t3 = $[13];
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[14] !== children || $[15] !== testId) {
|
|
64
|
+
t4 = /*#__PURE__*/ jsx(TestIdProvider, {
|
|
65
|
+
value: testId,
|
|
66
|
+
children: children
|
|
67
|
+
});
|
|
68
|
+
$[14] = children;
|
|
69
|
+
$[15] = testId;
|
|
70
|
+
$[16] = t4;
|
|
71
|
+
} else t4 = $[16];
|
|
72
|
+
let t5;
|
|
73
|
+
if ($[17] !== t3 || $[18] !== t4) {
|
|
74
|
+
t5 = /*#__PURE__*/ jsx(ConversationContext.Provider, {
|
|
75
|
+
value: t3,
|
|
76
|
+
children: t4
|
|
77
|
+
});
|
|
78
|
+
$[17] = t3;
|
|
79
|
+
$[18] = t4;
|
|
80
|
+
$[19] = t5;
|
|
81
|
+
} else t5 = $[19];
|
|
82
|
+
let t6;
|
|
83
|
+
if ($[20] !== props || $[21] !== ref || $[22] !== t2 || $[23] !== t5 || $[24] !== testIdProp) {
|
|
84
|
+
t6 = /*#__PURE__*/ jsx("div", {
|
|
85
|
+
...props,
|
|
86
|
+
ref: ref,
|
|
87
|
+
"data-slot": "conversation",
|
|
88
|
+
"data-testid": testIdProp,
|
|
89
|
+
className: t2,
|
|
90
|
+
children: t5
|
|
91
|
+
});
|
|
92
|
+
$[20] = props;
|
|
93
|
+
$[21] = ref;
|
|
94
|
+
$[22] = t2;
|
|
95
|
+
$[23] = t5;
|
|
96
|
+
$[24] = testIdProp;
|
|
97
|
+
$[25] = t6;
|
|
98
|
+
} else t6 = $[25];
|
|
99
|
+
return t6;
|
|
100
|
+
};
|
|
101
|
+
Conversation.displayName = "Conversation";
|
|
102
|
+
export { Conversation };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { type ChatBodyProps } from '../Chat/ChatBody.js';
|
|
3
|
+
/**
|
|
4
|
+
* The scroller: renders the built `ChatBody` (role=log; `ref`, `className`, `aria-*`, `tabIndex`
|
|
5
|
+
* land on it) around an inner measured column.
|
|
6
|
+
*/
|
|
7
|
+
export interface ConversationContentProps extends ChatBodyProps {
|
|
8
|
+
/** Classes for the inner column (`flex flex-col`, no gap — v1 §3.1). */
|
|
9
|
+
contentClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const ConversationContent: FC<ConversationContentProps>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { mergeRefs } from "../../utils/mergeRefs.js";
|
|
5
|
+
import { useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { ChatBody } from "../Chat/ChatBody.js";
|
|
7
|
+
import { useConversationInternal } from "./ConversationContext.js";
|
|
8
|
+
import { conversationContentVariants, conversationEndVariants, conversationScrollerVariants } from "./classes.js";
|
|
9
|
+
const ConversationContent = (t0)=>{
|
|
10
|
+
const $ = c(26);
|
|
11
|
+
let children;
|
|
12
|
+
let className;
|
|
13
|
+
let contentClassName;
|
|
14
|
+
let props;
|
|
15
|
+
let ref;
|
|
16
|
+
if ($[0] !== t0) {
|
|
17
|
+
({ ref, className, contentClassName, children, ...props } = t0);
|
|
18
|
+
$[0] = t0;
|
|
19
|
+
$[1] = children;
|
|
20
|
+
$[2] = className;
|
|
21
|
+
$[3] = contentClassName;
|
|
22
|
+
$[4] = props;
|
|
23
|
+
$[5] = ref;
|
|
24
|
+
} else {
|
|
25
|
+
children = $[1];
|
|
26
|
+
className = $[2];
|
|
27
|
+
contentClassName = $[3];
|
|
28
|
+
props = $[4];
|
|
29
|
+
ref = $[5];
|
|
30
|
+
}
|
|
31
|
+
const { setScrollEl, setContentEl } = useConversationInternal("ConversationContent");
|
|
32
|
+
const endTestId = useTestId("end");
|
|
33
|
+
let t1;
|
|
34
|
+
if ($[6] !== ref || $[7] !== setScrollEl) {
|
|
35
|
+
t1 = mergeRefs(ref, setScrollEl);
|
|
36
|
+
$[6] = ref;
|
|
37
|
+
$[7] = setScrollEl;
|
|
38
|
+
$[8] = t1;
|
|
39
|
+
} else t1 = $[8];
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[9] !== className) {
|
|
42
|
+
t2 = cn(conversationScrollerVariants(), className);
|
|
43
|
+
$[9] = className;
|
|
44
|
+
$[10] = t2;
|
|
45
|
+
} else t2 = $[10];
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[11] !== contentClassName) {
|
|
48
|
+
t3 = cn(conversationContentVariants(), contentClassName);
|
|
49
|
+
$[11] = contentClassName;
|
|
50
|
+
$[12] = t3;
|
|
51
|
+
} else t3 = $[12];
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[13] !== children || $[14] !== setContentEl || $[15] !== t3) {
|
|
54
|
+
t4 = /*#__PURE__*/ jsx("div", {
|
|
55
|
+
ref: setContentEl,
|
|
56
|
+
"data-slot": "conversation-content",
|
|
57
|
+
className: t3,
|
|
58
|
+
children: children
|
|
59
|
+
});
|
|
60
|
+
$[13] = children;
|
|
61
|
+
$[14] = setContentEl;
|
|
62
|
+
$[15] = t3;
|
|
63
|
+
$[16] = t4;
|
|
64
|
+
} else t4 = $[16];
|
|
65
|
+
let t5;
|
|
66
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
67
|
+
t5 = conversationEndVariants();
|
|
68
|
+
$[17] = t5;
|
|
69
|
+
} else t5 = $[17];
|
|
70
|
+
let t6;
|
|
71
|
+
if ($[18] !== endTestId) {
|
|
72
|
+
t6 = /*#__PURE__*/ jsx("span", {
|
|
73
|
+
tabIndex: -1,
|
|
74
|
+
"data-slot": "conversation-end",
|
|
75
|
+
"data-testid": endTestId,
|
|
76
|
+
className: t5
|
|
77
|
+
});
|
|
78
|
+
$[18] = endTestId;
|
|
79
|
+
$[19] = t6;
|
|
80
|
+
} else t6 = $[19];
|
|
81
|
+
let t7;
|
|
82
|
+
if ($[20] !== props || $[21] !== t1 || $[22] !== t2 || $[23] !== t4 || $[24] !== t6) {
|
|
83
|
+
t7 = /*#__PURE__*/ jsxs(ChatBody, {
|
|
84
|
+
tabIndex: -1,
|
|
85
|
+
...props,
|
|
86
|
+
ref: t1,
|
|
87
|
+
className: t2,
|
|
88
|
+
children: [
|
|
89
|
+
t4,
|
|
90
|
+
t6
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
$[20] = props;
|
|
94
|
+
$[21] = t1;
|
|
95
|
+
$[22] = t2;
|
|
96
|
+
$[23] = t4;
|
|
97
|
+
$[24] = t6;
|
|
98
|
+
$[25] = t7;
|
|
99
|
+
} else t7 = $[25];
|
|
100
|
+
return t7;
|
|
101
|
+
};
|
|
102
|
+
ConversationContent.displayName = "ConversationContent";
|
|
103
|
+
export { ConversationContent };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ConversationContextValue {
|
|
2
|
+
isAtBottom: boolean;
|
|
3
|
+
/** Re-sticks and scrolls: 'smooth' glides (rAF, follows growth), else or under reduced motion jumps. */
|
|
4
|
+
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
5
|
+
}
|
|
6
|
+
/** Internal: the parts also need the scroll element and the callback refs. */
|
|
7
|
+
interface ConversationInternalValue extends ConversationContextValue {
|
|
8
|
+
scrollEl: HTMLElement | null;
|
|
9
|
+
setScrollEl: (node: HTMLElement | null) => void;
|
|
10
|
+
setContentEl: (node: HTMLElement | null) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const ConversationContext: import("react").Context<ConversationInternalValue | null>;
|
|
13
|
+
export declare const useConversationInternal: (part: string) => ConversationInternalValue;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const ConversationContext = createContext(null);
|
|
3
|
+
const useConversationInternal = (part)=>{
|
|
4
|
+
const context = useContext(ConversationContext);
|
|
5
|
+
if (!context) throw new Error(`${part} must be rendered inside <Conversation>`);
|
|
6
|
+
return context;
|
|
7
|
+
};
|
|
8
|
+
export { ConversationContext, useConversationInternal };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface ConversationEmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
/** Greeting heading. Default 'How can I help you today?'. */
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/** Under the heading, e.g. `<ChatSuggestions placement='greeting'>`. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The greeting for an empty conversation. Render it inside `ConversationContent`: it is not
|
|
12
|
+
* centered, `ChatGreeting`'s top padding assumes the log's. To replace the greeting entirely,
|
|
13
|
+
* render your own node instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ConversationEmptyState: FC<ConversationEmptyStateProps>;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { ChatGreeting } from "../Chat/ChatGreeting.js";
|
|
6
|
+
import { conversationEmptyStateVariants } from "./classes.js";
|
|
7
|
+
const ConversationEmptyState = (t0)=>{
|
|
8
|
+
const $ = c(18);
|
|
9
|
+
let children;
|
|
10
|
+
let className;
|
|
11
|
+
let props;
|
|
12
|
+
let ref;
|
|
13
|
+
let t1;
|
|
14
|
+
let testIdProp;
|
|
15
|
+
if ($[0] !== t0) {
|
|
16
|
+
({ ref, title: t1, className, children, "data-testid": testIdProp, ...props } = t0);
|
|
17
|
+
$[0] = t0;
|
|
18
|
+
$[1] = children;
|
|
19
|
+
$[2] = className;
|
|
20
|
+
$[3] = props;
|
|
21
|
+
$[4] = ref;
|
|
22
|
+
$[5] = t1;
|
|
23
|
+
$[6] = testIdProp;
|
|
24
|
+
} else {
|
|
25
|
+
children = $[1];
|
|
26
|
+
className = $[2];
|
|
27
|
+
props = $[3];
|
|
28
|
+
ref = $[4];
|
|
29
|
+
t1 = $[5];
|
|
30
|
+
testIdProp = $[6];
|
|
31
|
+
}
|
|
32
|
+
const title = void 0 === t1 ? "How can I help you today?" : t1;
|
|
33
|
+
const testId = useTestId("empty-state", testIdProp);
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[7] !== className) {
|
|
36
|
+
t2 = cn(conversationEmptyStateVariants(), className);
|
|
37
|
+
$[7] = className;
|
|
38
|
+
$[8] = t2;
|
|
39
|
+
} else t2 = $[8];
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[9] !== children || $[10] !== title) {
|
|
42
|
+
t3 = /*#__PURE__*/ jsx(ChatGreeting, {
|
|
43
|
+
title: title,
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
46
|
+
$[9] = children;
|
|
47
|
+
$[10] = title;
|
|
48
|
+
$[11] = t3;
|
|
49
|
+
} else t3 = $[11];
|
|
50
|
+
let t4;
|
|
51
|
+
if ($[12] !== props || $[13] !== ref || $[14] !== t2 || $[15] !== t3 || $[16] !== testId) {
|
|
52
|
+
t4 = /*#__PURE__*/ jsx("div", {
|
|
53
|
+
...props,
|
|
54
|
+
ref: ref,
|
|
55
|
+
"data-slot": "conversation-empty-state",
|
|
56
|
+
"data-testid": testId,
|
|
57
|
+
className: t2,
|
|
58
|
+
children: t3
|
|
59
|
+
});
|
|
60
|
+
$[12] = props;
|
|
61
|
+
$[13] = ref;
|
|
62
|
+
$[14] = t2;
|
|
63
|
+
$[15] = t3;
|
|
64
|
+
$[16] = testId;
|
|
65
|
+
$[17] = t4;
|
|
66
|
+
} else t4 = $[17];
|
|
67
|
+
return t4;
|
|
68
|
+
};
|
|
69
|
+
ConversationEmptyState.displayName = "ConversationEmptyState";
|
|
70
|
+
export { ConversationEmptyState };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type FC, type Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface ConversationScrollButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLButtonElement>;
|
|
5
|
+
/** Accessible name and tooltip. Default 'Scroll to latest message'. */
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The scroll-to-latest button: shown only while the reader is scrolled up. A click scrolls to the
|
|
10
|
+
* bottom and hands focus to the end of the log. The stock small icon-only Button (outline, neutral),
|
|
11
|
+
* floated at the bottom centre — not customised.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ConversationScrollButton: FC<ConversationScrollButtonProps>;
|