@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,175 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { ArrowUp, CircleStop } from "../../icons/index.js";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { useTestId } from "../../utils/testId.js";
|
|
7
|
+
import { Button } from "../Button/index.js";
|
|
8
|
+
import { Kbd } from "../Kbd/index.js";
|
|
9
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip/index.js";
|
|
10
|
+
import { useChatInputContext } from "./ChatInputContext.js";
|
|
11
|
+
const ChatInputSubmit = (t0)=>{
|
|
12
|
+
const $ = c(47);
|
|
13
|
+
let className;
|
|
14
|
+
let disabledProp;
|
|
15
|
+
let id;
|
|
16
|
+
let onClick;
|
|
17
|
+
let ref;
|
|
18
|
+
let rest;
|
|
19
|
+
let t1;
|
|
20
|
+
let t2;
|
|
21
|
+
let testIdProp;
|
|
22
|
+
if ($[0] !== t0) {
|
|
23
|
+
({ ref, id, sendLabel: t1, stopLabel: t2, className, disabled: disabledProp, onClick, "data-testid": testIdProp, ...rest } = t0);
|
|
24
|
+
$[0] = t0;
|
|
25
|
+
$[1] = className;
|
|
26
|
+
$[2] = disabledProp;
|
|
27
|
+
$[3] = id;
|
|
28
|
+
$[4] = onClick;
|
|
29
|
+
$[5] = ref;
|
|
30
|
+
$[6] = rest;
|
|
31
|
+
$[7] = t1;
|
|
32
|
+
$[8] = t2;
|
|
33
|
+
$[9] = testIdProp;
|
|
34
|
+
} else {
|
|
35
|
+
className = $[1];
|
|
36
|
+
disabledProp = $[2];
|
|
37
|
+
id = $[3];
|
|
38
|
+
onClick = $[4];
|
|
39
|
+
ref = $[5];
|
|
40
|
+
rest = $[6];
|
|
41
|
+
t1 = $[7];
|
|
42
|
+
t2 = $[8];
|
|
43
|
+
testIdProp = $[9];
|
|
44
|
+
}
|
|
45
|
+
const sendLabel = void 0 === t1 ? "Send" : t1;
|
|
46
|
+
const stopLabel = void 0 === t2 ? "Stop response" : t2;
|
|
47
|
+
const testId = useTestId("submit", testIdProp);
|
|
48
|
+
const { value, isRunning, disabled, onStop } = useChatInputContext();
|
|
49
|
+
const autoId = useId();
|
|
50
|
+
const triggerId = id ?? autoId;
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[10] !== isRunning || $[11] !== onClick || $[12] !== onStop) {
|
|
53
|
+
t3 = (event)=>{
|
|
54
|
+
onClick?.(event);
|
|
55
|
+
if (event.defaultPrevented || !isRunning) return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
onStop?.();
|
|
58
|
+
event.currentTarget.form?.querySelector("textarea")?.focus();
|
|
59
|
+
};
|
|
60
|
+
$[10] = isRunning;
|
|
61
|
+
$[11] = onClick;
|
|
62
|
+
$[12] = onStop;
|
|
63
|
+
$[13] = t3;
|
|
64
|
+
} else t3 = $[13];
|
|
65
|
+
const handleClick = t3;
|
|
66
|
+
const t4 = !isRunning;
|
|
67
|
+
let t5;
|
|
68
|
+
if ($[14] !== triggerId) {
|
|
69
|
+
t5 = {
|
|
70
|
+
trigger: triggerId
|
|
71
|
+
};
|
|
72
|
+
$[14] = triggerId;
|
|
73
|
+
$[15] = t5;
|
|
74
|
+
} else t5 = $[15];
|
|
75
|
+
const t6 = isRunning ? stopLabel : sendLabel;
|
|
76
|
+
const t7 = isRunning ? "button" : "submit";
|
|
77
|
+
const t8 = isRunning ? "secondary" : "primary";
|
|
78
|
+
const t9 = isRunning ? "neutral" : "brand";
|
|
79
|
+
let t10;
|
|
80
|
+
if ($[16] !== disabled || $[17] !== disabledProp || $[18] !== isRunning || $[19] !== value) {
|
|
81
|
+
t10 = disabled || disabledProp || !isRunning && !value.trim();
|
|
82
|
+
$[16] = disabled;
|
|
83
|
+
$[17] = disabledProp;
|
|
84
|
+
$[18] = isRunning;
|
|
85
|
+
$[19] = value;
|
|
86
|
+
$[20] = t10;
|
|
87
|
+
} else t10 = $[20];
|
|
88
|
+
let t11;
|
|
89
|
+
if ($[21] !== className) {
|
|
90
|
+
t11 = cn("ms-auto", className);
|
|
91
|
+
$[21] = className;
|
|
92
|
+
$[22] = t11;
|
|
93
|
+
} else t11 = $[22];
|
|
94
|
+
let t12;
|
|
95
|
+
if ($[23] !== isRunning) {
|
|
96
|
+
t12 = isRunning ? /*#__PURE__*/ jsx(CircleStop, {}) : /*#__PURE__*/ jsx(ArrowUp, {});
|
|
97
|
+
$[23] = isRunning;
|
|
98
|
+
$[24] = t12;
|
|
99
|
+
} else t12 = $[24];
|
|
100
|
+
let t13;
|
|
101
|
+
if ($[25] !== handleClick || $[26] !== ref || $[27] !== rest || $[28] !== t10 || $[29] !== t11 || $[30] !== t12 || $[31] !== t6 || $[32] !== t7 || $[33] !== t8 || $[34] !== t9 || $[35] !== testId || $[36] !== triggerId) {
|
|
102
|
+
t13 = /*#__PURE__*/ jsx(TooltipTrigger, {
|
|
103
|
+
asChild: true,
|
|
104
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
105
|
+
"aria-label": t6,
|
|
106
|
+
...rest,
|
|
107
|
+
ref: ref,
|
|
108
|
+
id: triggerId,
|
|
109
|
+
type: t7,
|
|
110
|
+
variant: t8,
|
|
111
|
+
color: t9,
|
|
112
|
+
size: "small",
|
|
113
|
+
disabled: t10,
|
|
114
|
+
onClick: handleClick,
|
|
115
|
+
"data-slot": "chat-input-submit",
|
|
116
|
+
"data-testid": testId,
|
|
117
|
+
className: t11,
|
|
118
|
+
children: t12
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
$[25] = handleClick;
|
|
122
|
+
$[26] = ref;
|
|
123
|
+
$[27] = rest;
|
|
124
|
+
$[28] = t10;
|
|
125
|
+
$[29] = t11;
|
|
126
|
+
$[30] = t12;
|
|
127
|
+
$[31] = t6;
|
|
128
|
+
$[32] = t7;
|
|
129
|
+
$[33] = t8;
|
|
130
|
+
$[34] = t9;
|
|
131
|
+
$[35] = testId;
|
|
132
|
+
$[36] = triggerId;
|
|
133
|
+
$[37] = t13;
|
|
134
|
+
} else t13 = $[37];
|
|
135
|
+
let t14;
|
|
136
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
137
|
+
t14 = /*#__PURE__*/ jsx(Kbd, {
|
|
138
|
+
children: "Esc"
|
|
139
|
+
});
|
|
140
|
+
$[38] = t14;
|
|
141
|
+
} else t14 = $[38];
|
|
142
|
+
let t15;
|
|
143
|
+
if ($[39] !== stopLabel) {
|
|
144
|
+
t15 = /*#__PURE__*/ jsxs(TooltipContent, {
|
|
145
|
+
children: [
|
|
146
|
+
stopLabel,
|
|
147
|
+
" ",
|
|
148
|
+
t14
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
$[39] = stopLabel;
|
|
152
|
+
$[40] = t15;
|
|
153
|
+
} else t15 = $[40];
|
|
154
|
+
let t16;
|
|
155
|
+
if ($[41] !== t13 || $[42] !== t15 || $[43] !== t4 || $[44] !== t5 || $[45] !== testId) {
|
|
156
|
+
t16 = /*#__PURE__*/ jsxs(Tooltip, {
|
|
157
|
+
disabled: t4,
|
|
158
|
+
ids: t5,
|
|
159
|
+
"data-testid": testId,
|
|
160
|
+
children: [
|
|
161
|
+
t13,
|
|
162
|
+
t15
|
|
163
|
+
]
|
|
164
|
+
});
|
|
165
|
+
$[41] = t13;
|
|
166
|
+
$[42] = t15;
|
|
167
|
+
$[43] = t4;
|
|
168
|
+
$[44] = t5;
|
|
169
|
+
$[45] = testId;
|
|
170
|
+
$[46] = t16;
|
|
171
|
+
} else t16 = $[46];
|
|
172
|
+
return t16;
|
|
173
|
+
};
|
|
174
|
+
ChatInputSubmit.displayName = "ChatInputSubmit";
|
|
175
|
+
export { ChatInputSubmit };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type FC, type Ref, type TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface ChatInputTextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue'>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ChatInputTextarea: FC<ChatInputTextareaProps>;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { useTestId } from "../../utils/testId.js";
|
|
7
|
+
import { useAutoResize } from "../Textarea/useAutoResize.js";
|
|
8
|
+
import { useChatInputContext } from "./ChatInputContext.js";
|
|
9
|
+
import { chatInputTextareaVariants } from "./classes.js";
|
|
10
|
+
const ChatInputTextarea = (t0)=>{
|
|
11
|
+
const $ = c(37);
|
|
12
|
+
let ariaDescribedBy;
|
|
13
|
+
let className;
|
|
14
|
+
let disabledProp;
|
|
15
|
+
let onChange;
|
|
16
|
+
let onKeyDown;
|
|
17
|
+
let ref;
|
|
18
|
+
let rest;
|
|
19
|
+
let testIdProp;
|
|
20
|
+
if ($[0] !== t0) {
|
|
21
|
+
({ ref, className, disabled: disabledProp, onChange, onKeyDown, "aria-describedby": ariaDescribedBy, "data-testid": testIdProp, ...rest } = t0);
|
|
22
|
+
$[0] = t0;
|
|
23
|
+
$[1] = ariaDescribedBy;
|
|
24
|
+
$[2] = className;
|
|
25
|
+
$[3] = disabledProp;
|
|
26
|
+
$[4] = onChange;
|
|
27
|
+
$[5] = onKeyDown;
|
|
28
|
+
$[6] = ref;
|
|
29
|
+
$[7] = rest;
|
|
30
|
+
$[8] = testIdProp;
|
|
31
|
+
} else {
|
|
32
|
+
ariaDescribedBy = $[1];
|
|
33
|
+
className = $[2];
|
|
34
|
+
disabledProp = $[3];
|
|
35
|
+
onChange = $[4];
|
|
36
|
+
onKeyDown = $[5];
|
|
37
|
+
ref = $[6];
|
|
38
|
+
rest = $[7];
|
|
39
|
+
testIdProp = $[8];
|
|
40
|
+
}
|
|
41
|
+
const testId = useTestId("textarea", testIdProp);
|
|
42
|
+
const { value, onValueChange, isRunning, disabled, onStop, disclaimerId } = useChatInputContext();
|
|
43
|
+
const { ref: autoResizeRef } = useAutoResize(true, 1, 8, value);
|
|
44
|
+
let t1;
|
|
45
|
+
if ($[9] !== ariaDescribedBy || $[10] !== disclaimerId) {
|
|
46
|
+
t1 = [
|
|
47
|
+
ariaDescribedBy,
|
|
48
|
+
disclaimerId
|
|
49
|
+
].filter(Boolean).join(" ") || void 0;
|
|
50
|
+
$[9] = ariaDescribedBy;
|
|
51
|
+
$[10] = disclaimerId;
|
|
52
|
+
$[11] = t1;
|
|
53
|
+
} else t1 = $[11];
|
|
54
|
+
const describedBy = t1;
|
|
55
|
+
const nodeRef = useRef(null);
|
|
56
|
+
const claimsEscape = isRunning && !!onStop;
|
|
57
|
+
let t2;
|
|
58
|
+
let t3;
|
|
59
|
+
if ($[12] !== claimsEscape) {
|
|
60
|
+
t2 = ()=>{
|
|
61
|
+
const node = nodeRef.current;
|
|
62
|
+
const view = node?.ownerDocument.defaultView;
|
|
63
|
+
if (!claimsEscape || !node || !view) return;
|
|
64
|
+
const claimEscape = (event)=>{
|
|
65
|
+
if ("Escape" === event.key && !event.isComposing && event.target === node && "true" !== node.getAttribute("aria-expanded")) event.preventDefault();
|
|
66
|
+
};
|
|
67
|
+
view.addEventListener("keydown", claimEscape, true);
|
|
68
|
+
return ()=>view.removeEventListener("keydown", claimEscape, true);
|
|
69
|
+
};
|
|
70
|
+
t3 = [
|
|
71
|
+
claimsEscape
|
|
72
|
+
];
|
|
73
|
+
$[12] = claimsEscape;
|
|
74
|
+
$[13] = t2;
|
|
75
|
+
$[14] = t3;
|
|
76
|
+
} else {
|
|
77
|
+
t2 = $[13];
|
|
78
|
+
t3 = $[14];
|
|
79
|
+
}
|
|
80
|
+
useEffect(t2, t3);
|
|
81
|
+
let t4;
|
|
82
|
+
if ($[15] !== onChange || $[16] !== onValueChange) {
|
|
83
|
+
t4 = (event_0)=>{
|
|
84
|
+
onChange?.(event_0);
|
|
85
|
+
onValueChange(event_0.target.value);
|
|
86
|
+
};
|
|
87
|
+
$[15] = onChange;
|
|
88
|
+
$[16] = onValueChange;
|
|
89
|
+
$[17] = t4;
|
|
90
|
+
} else t4 = $[17];
|
|
91
|
+
const handleChange = t4;
|
|
92
|
+
let t5;
|
|
93
|
+
if ($[18] !== claimsEscape || $[19] !== onKeyDown || $[20] !== onStop) {
|
|
94
|
+
t5 = (event_1)=>{
|
|
95
|
+
onKeyDown?.(event_1);
|
|
96
|
+
if (event_1.nativeEvent.isComposing || 229 === event_1.keyCode) return;
|
|
97
|
+
if ("Escape" === event_1.key) {
|
|
98
|
+
if (claimsEscape && "true" !== event_1.currentTarget.getAttribute("aria-expanded")) onStop?.();
|
|
99
|
+
} else if ("Enter" === event_1.key && !event_1.shiftKey && !event_1.defaultPrevented) {
|
|
100
|
+
event_1.preventDefault();
|
|
101
|
+
event_1.currentTarget.form?.requestSubmit();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
$[18] = claimsEscape;
|
|
105
|
+
$[19] = onKeyDown;
|
|
106
|
+
$[20] = onStop;
|
|
107
|
+
$[21] = t5;
|
|
108
|
+
} else t5 = $[21];
|
|
109
|
+
const handleKeyDown = t5;
|
|
110
|
+
let t6;
|
|
111
|
+
if ($[22] !== autoResizeRef || $[23] !== ref) {
|
|
112
|
+
t6 = composeRefs(autoResizeRef, nodeRef, ref);
|
|
113
|
+
$[22] = autoResizeRef;
|
|
114
|
+
$[23] = ref;
|
|
115
|
+
$[24] = t6;
|
|
116
|
+
} else t6 = $[24];
|
|
117
|
+
const t7 = disabled || disabledProp;
|
|
118
|
+
let t8;
|
|
119
|
+
if ($[25] !== className) {
|
|
120
|
+
t8 = cn(chatInputTextareaVariants(), className);
|
|
121
|
+
$[25] = className;
|
|
122
|
+
$[26] = t8;
|
|
123
|
+
} else t8 = $[26];
|
|
124
|
+
let t9;
|
|
125
|
+
if ($[27] !== describedBy || $[28] !== handleChange || $[29] !== handleKeyDown || $[30] !== rest || $[31] !== t6 || $[32] !== t7 || $[33] !== t8 || $[34] !== testId || $[35] !== value) {
|
|
126
|
+
t9 = /*#__PURE__*/ jsx("textarea", {
|
|
127
|
+
placeholder: "Ask Wally...",
|
|
128
|
+
"aria-label": "Message Wally",
|
|
129
|
+
...rest,
|
|
130
|
+
ref: t6,
|
|
131
|
+
rows: 1,
|
|
132
|
+
value: value,
|
|
133
|
+
disabled: t7,
|
|
134
|
+
"aria-describedby": describedBy,
|
|
135
|
+
onChange: handleChange,
|
|
136
|
+
onKeyDown: handleKeyDown,
|
|
137
|
+
"data-slot": "chat-input-textarea",
|
|
138
|
+
"data-testid": testId,
|
|
139
|
+
className: t8
|
|
140
|
+
});
|
|
141
|
+
$[27] = describedBy;
|
|
142
|
+
$[28] = handleChange;
|
|
143
|
+
$[29] = handleKeyDown;
|
|
144
|
+
$[30] = rest;
|
|
145
|
+
$[31] = t6;
|
|
146
|
+
$[32] = t7;
|
|
147
|
+
$[33] = t8;
|
|
148
|
+
$[34] = testId;
|
|
149
|
+
$[35] = value;
|
|
150
|
+
$[36] = t9;
|
|
151
|
+
} else t9 = $[36];
|
|
152
|
+
return t9;
|
|
153
|
+
};
|
|
154
|
+
ChatInputTextarea.displayName = "ChatInputTextarea";
|
|
155
|
+
export { ChatInputTextarea };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const chatInputVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const chatInputContextVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const chatInputContextChipsVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const chatInputBoxVariants: (props?: ({
|
|
5
|
+
withContext?: boolean | null | undefined;
|
|
6
|
+
disabled?: boolean | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export declare const chatInputTextareaVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
export declare const chatInputDisclaimerVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
const chatInputVariants = cva('flex flex-col gap-4');
|
|
4
|
+
const chatInputContextVariants = cva('flex flex-col rounded-16 border border-border-info bg-bg-light-info');
|
|
5
|
+
const chatInputContextChipsVariants = cva('flex flex-wrap items-center gap-6 px-12 pt-8 pb-6');
|
|
6
|
+
const chatInputBoxVariants = cva(cn('flex flex-wrap items-center gap-x-6 gap-y-24 rounded-16 border border-border-primary px-11 pt-9 pb-11', 'transition-[border-color,box-shadow] motion-reduce:transition-none', 'hover:border-component-border-input-hover', 'has-[textarea:focus]:border-component-border-input-hover has-[textarea:focus]:shadow-none has-[textarea:focus]:ring-3 has-[textarea:focus]:ring-focus-primary'), {
|
|
7
|
+
variants: {
|
|
8
|
+
withContext: {
|
|
9
|
+
false: 'bg-component-input-bg shadow-xs',
|
|
10
|
+
true: '-mx-px -mb-px bg-bg-surface-1 shadow-sm'
|
|
11
|
+
},
|
|
12
|
+
disabled: {
|
|
13
|
+
true: 'pointer-events-none opacity-50'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
withContext: false
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const chatInputTextareaVariants = cva(cn('w-full basis-full resize-none bg-transparent text-sm text-text-primary outline-none', 'placeholder:text-text-secondary disabled:cursor-not-allowed [scrollbar-width:thin]'));
|
|
21
|
+
const chatInputDisclaimerVariants = cva('text-center text-xs text-text-secondary');
|
|
22
|
+
export { chatInputBoxVariants, chatInputContextChipsVariants, chatInputContextVariants, chatInputDisclaimerVariants, chatInputTextareaVariants, chatInputVariants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface ChatPermissionsProps extends TestableProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Root of the per-conversation tool permissions popover. Renders no DOM of its own —
|
|
10
|
+
* it is a `Popover` root that shares one trigger id with the trigger's tooltip.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ChatPermissions: FC<ChatPermissionsProps>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { useTestId } from "../../utils/testId.js";
|
|
5
|
+
import { Popover } from "../Popover/index.js";
|
|
6
|
+
import { ChatPermissionsContext } from "./ChatPermissionsContext.js";
|
|
7
|
+
const ChatPermissions = (t0)=>{
|
|
8
|
+
const $ = c(14);
|
|
9
|
+
const { children, open, onOpenChange, "data-testid": testIdProp } = t0;
|
|
10
|
+
const testId = useTestId("permissions", testIdProp);
|
|
11
|
+
const triggerId = useId();
|
|
12
|
+
let t1;
|
|
13
|
+
if ($[0] !== triggerId) {
|
|
14
|
+
t1 = {
|
|
15
|
+
triggerId
|
|
16
|
+
};
|
|
17
|
+
$[0] = triggerId;
|
|
18
|
+
$[1] = t1;
|
|
19
|
+
} else t1 = $[1];
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[2] !== triggerId) {
|
|
22
|
+
t2 = {
|
|
23
|
+
trigger: triggerId
|
|
24
|
+
};
|
|
25
|
+
$[2] = triggerId;
|
|
26
|
+
$[3] = t2;
|
|
27
|
+
} else t2 = $[3];
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t3 = {
|
|
31
|
+
placement: "top-start",
|
|
32
|
+
gutter: 8
|
|
33
|
+
};
|
|
34
|
+
$[4] = t3;
|
|
35
|
+
} else t3 = $[4];
|
|
36
|
+
let t4;
|
|
37
|
+
if ($[5] !== children || $[6] !== onOpenChange || $[7] !== open || $[8] !== t2 || $[9] !== testId) {
|
|
38
|
+
t4 = /*#__PURE__*/ jsx(Popover, {
|
|
39
|
+
"data-testid": testId,
|
|
40
|
+
ids: t2,
|
|
41
|
+
positioning: t3,
|
|
42
|
+
open: open,
|
|
43
|
+
onOpenChange: onOpenChange,
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
46
|
+
$[5] = children;
|
|
47
|
+
$[6] = onOpenChange;
|
|
48
|
+
$[7] = open;
|
|
49
|
+
$[8] = t2;
|
|
50
|
+
$[9] = testId;
|
|
51
|
+
$[10] = t4;
|
|
52
|
+
} else t4 = $[10];
|
|
53
|
+
let t5;
|
|
54
|
+
if ($[11] !== t1 || $[12] !== t4) {
|
|
55
|
+
t5 = /*#__PURE__*/ jsx(ChatPermissionsContext.Provider, {
|
|
56
|
+
value: t1,
|
|
57
|
+
children: t4
|
|
58
|
+
});
|
|
59
|
+
$[11] = t1;
|
|
60
|
+
$[12] = t4;
|
|
61
|
+
$[13] = t5;
|
|
62
|
+
} else t5 = $[13];
|
|
63
|
+
return t5;
|
|
64
|
+
};
|
|
65
|
+
ChatPermissions.displayName = "ChatPermissions";
|
|
66
|
+
export { ChatPermissions };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type PopoverContentProps } from '../Popover/index.js';
|
|
3
|
+
export interface ChatPermissionsContentProps extends Omit<PopoverContentProps, 'minWidth' | 'maxWidth'> {
|
|
4
|
+
/** Heading above the tool rows; also names the dialog. Pass `null`, `false` or `''` to hide it. */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const ChatPermissionsContent: FC<ChatPermissionsContentProps>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { dropdownMenuLabelVariants } from "../DropdownMenu/classes.js";
|
|
6
|
+
import { PopoverContent } from "../Popover/index.js";
|
|
7
|
+
import { chatPermissionsContentVariants } from "./classes.js";
|
|
8
|
+
const ChatPermissionsContent = (t0)=>{
|
|
9
|
+
const $ = c(17);
|
|
10
|
+
let children;
|
|
11
|
+
let className;
|
|
12
|
+
let rest;
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[0] !== t0) {
|
|
15
|
+
({ label: t1, className, children, ...rest } = t0);
|
|
16
|
+
$[0] = t0;
|
|
17
|
+
$[1] = children;
|
|
18
|
+
$[2] = className;
|
|
19
|
+
$[3] = rest;
|
|
20
|
+
$[4] = t1;
|
|
21
|
+
} else {
|
|
22
|
+
children = $[1];
|
|
23
|
+
className = $[2];
|
|
24
|
+
rest = $[3];
|
|
25
|
+
t1 = $[4];
|
|
26
|
+
}
|
|
27
|
+
const label = void 0 === t1 ? "Always allowed in this conversation" : t1;
|
|
28
|
+
const labelId = useId();
|
|
29
|
+
const hasLabel = null != label && false !== label && "" !== label;
|
|
30
|
+
const t2 = hasLabel ? labelId : void 0;
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[5] !== className) {
|
|
33
|
+
t3 = cn(chatPermissionsContentVariants(), className);
|
|
34
|
+
$[5] = className;
|
|
35
|
+
$[6] = t3;
|
|
36
|
+
} else t3 = $[6];
|
|
37
|
+
let t4;
|
|
38
|
+
if ($[7] !== hasLabel || $[8] !== label || $[9] !== labelId) {
|
|
39
|
+
t4 = hasLabel && /*#__PURE__*/ jsx("p", {
|
|
40
|
+
id: labelId,
|
|
41
|
+
className: dropdownMenuLabelVariants(),
|
|
42
|
+
children: label
|
|
43
|
+
});
|
|
44
|
+
$[7] = hasLabel;
|
|
45
|
+
$[8] = label;
|
|
46
|
+
$[9] = labelId;
|
|
47
|
+
$[10] = t4;
|
|
48
|
+
} else t4 = $[10];
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[11] !== children || $[12] !== rest || $[13] !== t2 || $[14] !== t3 || $[15] !== t4) {
|
|
51
|
+
t5 = /*#__PURE__*/ jsxs(PopoverContent, {
|
|
52
|
+
"aria-labelledby": t2,
|
|
53
|
+
...rest,
|
|
54
|
+
"data-slot": "chat-permissions-content",
|
|
55
|
+
minWidth: "320px",
|
|
56
|
+
maxWidth: "320px",
|
|
57
|
+
className: t3,
|
|
58
|
+
children: [
|
|
59
|
+
t4,
|
|
60
|
+
children
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
$[11] = children;
|
|
64
|
+
$[12] = rest;
|
|
65
|
+
$[13] = t2;
|
|
66
|
+
$[14] = t3;
|
|
67
|
+
$[15] = t4;
|
|
68
|
+
$[16] = t5;
|
|
69
|
+
} else t5 = $[16];
|
|
70
|
+
return t5;
|
|
71
|
+
};
|
|
72
|
+
ChatPermissionsContent.displayName = "ChatPermissionsContent";
|
|
73
|
+
export { ChatPermissionsContent };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ChatPermissionsContextValue {
|
|
2
|
+
/** Shared by the Popover and the Tooltip so both anchor to the one trigger button. */
|
|
3
|
+
triggerId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const ChatPermissionsContext: import("react").Context<ChatPermissionsContextValue | null>;
|
|
6
|
+
export declare const useChatPermissionsContext: () => ChatPermissionsContextValue;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const ChatPermissionsContext = createContext(null);
|
|
3
|
+
const useChatPermissionsContext = ()=>{
|
|
4
|
+
const context = useContext(ChatPermissionsContext);
|
|
5
|
+
if (!context) throw new Error("ChatPermissions parts must be rendered inside <ChatPermissions>");
|
|
6
|
+
return context;
|
|
7
|
+
};
|
|
8
|
+
export { ChatPermissionsContext, useChatPermissionsContext };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type SwitchProps } from '../Switch/index.js';
|
|
3
|
+
export interface ChatPermissionsItemCheckedChangeDetails {
|
|
4
|
+
checked: boolean;
|
|
5
|
+
/** The row's `name`, so one handler can serve the whole list. */
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ChatPermissionsItemProps extends Omit<SwitchProps, 'children' | 'title' | 'name' | 'onCheckedChange'> {
|
|
9
|
+
ref?: Ref<HTMLLabelElement>;
|
|
10
|
+
/** Machine name of the tool, e.g. `propose_add_to_denylist`; echoed back in `onCheckedChange`. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Visible tool name. */
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
onCheckedChange?: (details: ChatPermissionsItemCheckedChangeDetails) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const ChatPermissionsItem: FC<ChatPermissionsItemProps>;
|