@copilotkit/react-ui 0.17.0-demofixes.2 → 0.17.0-tools.1
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/.turbo/turbo-build.log +115 -119
- package/CHANGELOG.md +4 -16
- package/dist/{chunk-HPFHUPN6.mjs → chunk-FA66IWQ6.mjs} +2 -2
- package/dist/{chunk-K5V5Q2AF.mjs → chunk-KDHWN43O.mjs} +2 -2
- package/dist/{chunk-73OGJ3WL.mjs → chunk-Q7SIB42Y.mjs} +3 -1
- package/dist/chunk-Q7SIB42Y.mjs.map +1 -0
- package/dist/components/chat/Button.mjs +6 -30
- package/dist/components/chat/Button.mjs.map +1 -1
- package/dist/components/chat/Chat.d.ts +5 -1
- package/dist/components/chat/Chat.js +2 -0
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +16 -830
- package/dist/components/chat/Chat.mjs.map +1 -1
- package/dist/components/chat/ChatContext.mjs +7 -214
- package/dist/components/chat/ChatContext.mjs.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +8 -202
- package/dist/components/chat/CodeBlock.mjs.map +1 -1
- package/dist/components/chat/Header.mjs +6 -23
- package/dist/components/chat/Header.mjs.map +1 -1
- package/dist/components/chat/Icons.mjs +14 -218
- package/dist/components/chat/Icons.mjs.map +1 -1
- package/dist/components/chat/Input.mjs +7 -110
- package/dist/components/chat/Input.mjs.map +1 -1
- package/dist/components/chat/Markdown.mjs +7 -253
- package/dist/components/chat/Markdown.mjs.map +1 -1
- package/dist/components/chat/Messages.mjs +9 -329
- package/dist/components/chat/Messages.mjs.map +1 -1
- package/dist/components/chat/Popup.js +2 -0
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +17 -839
- package/dist/components/chat/Popup.mjs.map +1 -1
- package/dist/components/chat/Response.mjs +6 -23
- package/dist/components/chat/Response.mjs.map +1 -1
- package/dist/components/chat/Sidebar.js +2 -0
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +17 -853
- package/dist/components/chat/Sidebar.mjs.map +1 -1
- package/dist/components/chat/Textarea.mjs +4 -48
- package/dist/components/chat/Textarea.mjs.map +1 -1
- package/dist/components/chat/Window.mjs +4 -105
- package/dist/components/chat/Window.mjs.map +1 -1
- package/dist/components/chat/index.js +2 -0
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +22 -860
- package/dist/components/chat/index.mjs.map +1 -1
- package/dist/components/chat/props.mjs +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +23 -860
- package/dist/components/index.mjs.map +1 -1
- package/dist/context/index.mjs +1 -0
- package/dist/hooks/index.mjs +1 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +4 -22
- package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
- package/dist/index.css +9 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -860
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.mjs +3 -20
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/types/index.mjs +1 -0
- package/package.json +6 -6
- package/src/components/chat/Chat.tsx +7 -0
- package/src/css/markdown.css +10 -2
- package/dist/chunk-73OGJ3WL.mjs.map +0 -1
- /package/dist/{chunk-HPFHUPN6.mjs.map → chunk-FA66IWQ6.mjs.map} +0 -0
- /package/dist/{chunk-K5V5Q2AF.mjs.map → chunk-KDHWN43O.mjs.map} +0 -0
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (context === void 0) {
|
|
8
|
-
throw new Error(
|
|
9
|
-
"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
return context;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/components/chat/Header.tsx
|
|
16
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
17
|
-
var Header = ({ setOpen }) => {
|
|
18
|
-
const context = useChatContext();
|
|
19
|
-
return /* @__PURE__ */ jsxs("div", { className: "copilotKitHeader", children: [
|
|
20
|
-
/* @__PURE__ */ jsx2("div", { children: context.labels.title }),
|
|
21
|
-
/* @__PURE__ */ jsx2("button", { onClick: () => setOpen(false), "aria-label": "Close", children: context.icons.headerCloseIcon })
|
|
22
|
-
] });
|
|
23
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
Header
|
|
3
|
+
} from "../../chunk-UWPFPWAW.mjs";
|
|
4
|
+
import "../../chunk-OF66AL5Z.mjs";
|
|
5
|
+
import "../../chunk-7YXG7D47.mjs";
|
|
6
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
24
7
|
export {
|
|
25
8
|
Header
|
|
26
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,221 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/components/chat/Icons.tsx
|
|
34
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
-
var OpenIcon = /* @__PURE__ */ jsx(
|
|
36
|
-
"svg",
|
|
37
|
-
{
|
|
38
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
-
viewBox: "0 0 24 24",
|
|
40
|
-
fill: "currentColor",
|
|
41
|
-
width: "24",
|
|
42
|
-
height: "24",
|
|
43
|
-
children: /* @__PURE__ */ jsx("g", { transform: "translate(24, 0) scale(-1, 1)", children: /* @__PURE__ */ jsx(
|
|
44
|
-
"path",
|
|
45
|
-
{
|
|
46
|
-
fillRule: "evenodd",
|
|
47
|
-
d: "M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z",
|
|
48
|
-
clipRule: "evenodd"
|
|
49
|
-
}
|
|
50
|
-
) })
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
var CloseIcon = /* @__PURE__ */ jsx(
|
|
54
|
-
"svg",
|
|
55
|
-
{
|
|
56
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
57
|
-
fill: "none",
|
|
58
|
-
viewBox: "0 0 24 24",
|
|
59
|
-
strokeWidth: "1.5",
|
|
60
|
-
stroke: "currentColor",
|
|
61
|
-
width: "24",
|
|
62
|
-
height: "24",
|
|
63
|
-
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
var HeaderCloseIcon = /* @__PURE__ */ jsx(
|
|
67
|
-
"svg",
|
|
68
|
-
{
|
|
69
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
70
|
-
fill: "none",
|
|
71
|
-
viewBox: "0 0 24 24",
|
|
72
|
-
strokeWidth: "1.5",
|
|
73
|
-
stroke: "currentColor",
|
|
74
|
-
width: "24",
|
|
75
|
-
height: "24",
|
|
76
|
-
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
var SendIcon = /* @__PURE__ */ jsx(
|
|
80
|
-
"svg",
|
|
81
|
-
{
|
|
82
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
83
|
-
fill: "none",
|
|
84
|
-
viewBox: "0 0 24 24",
|
|
85
|
-
strokeWidth: 1.5,
|
|
86
|
-
stroke: "currentColor",
|
|
87
|
-
width: "24",
|
|
88
|
-
height: "24",
|
|
89
|
-
children: /* @__PURE__ */ jsx(
|
|
90
|
-
"path",
|
|
91
|
-
{
|
|
92
|
-
strokeLinecap: "round",
|
|
93
|
-
strokeLinejoin: "round",
|
|
94
|
-
d: "M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
var SpinnerIcon = /* @__PURE__ */ jsxs(
|
|
100
|
-
"svg",
|
|
101
|
-
{
|
|
102
|
-
style: {
|
|
103
|
-
animation: "copilotKitSpinAnimation 1s linear infinite",
|
|
104
|
-
color: "rgb(107 114 128)"
|
|
105
|
-
},
|
|
106
|
-
width: "24",
|
|
107
|
-
height: "24",
|
|
108
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
109
|
-
fill: "none",
|
|
110
|
-
viewBox: "0 0 24 24",
|
|
111
|
-
children: [
|
|
112
|
-
/* @__PURE__ */ jsx(
|
|
113
|
-
"circle",
|
|
114
|
-
{
|
|
115
|
-
style: { opacity: 0.25 },
|
|
116
|
-
cx: "12",
|
|
117
|
-
cy: "12",
|
|
118
|
-
r: "10",
|
|
119
|
-
stroke: "currentColor",
|
|
120
|
-
strokeWidth: "4"
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
/* @__PURE__ */ jsx(
|
|
124
|
-
"path",
|
|
125
|
-
{
|
|
126
|
-
style: { opacity: 0.75 },
|
|
127
|
-
fill: "currentColor",
|
|
128
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
129
|
-
}
|
|
130
|
-
)
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
var ActivityIcon = /* @__PURE__ */ jsxs(
|
|
135
|
-
"svg",
|
|
136
|
-
{
|
|
137
|
-
style: {
|
|
138
|
-
display: "inline-block",
|
|
139
|
-
marginLeft: "0.25rem",
|
|
140
|
-
marginRight: "0.25rem"
|
|
141
|
-
},
|
|
142
|
-
height: "24",
|
|
143
|
-
width: "24",
|
|
144
|
-
viewBox: "0 0 27 27",
|
|
145
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
-
fill: "currentColor",
|
|
147
|
-
children: [
|
|
148
|
-
/* @__PURE__ */ jsx("circle", { className: "copilotKitActivityDot1", cx: "4", cy: "12", r: "3" }),
|
|
149
|
-
/* @__PURE__ */ jsx("circle", { className: "copilotKitActivityDot1 copilotKitActivityDot2", cx: "12", cy: "12", r: "3" }),
|
|
150
|
-
/* @__PURE__ */ jsx("circle", { className: "copilotKitActivityDot1 copilotKitActivityDot3", cx: "20", cy: "12", r: "3" })
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
function CheckIcon(_a) {
|
|
155
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
156
|
-
return /* @__PURE__ */ jsx(
|
|
157
|
-
"svg",
|
|
158
|
-
__spreadProps(__spreadValues({
|
|
159
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
160
|
-
viewBox: "0 0 256 256",
|
|
161
|
-
fill: "currentColor",
|
|
162
|
-
style: { height: "1rem", width: "1rem" },
|
|
163
|
-
className
|
|
164
|
-
}, props), {
|
|
165
|
-
children: /* @__PURE__ */ jsx("path", { d: "m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" })
|
|
166
|
-
})
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
function DownloadIcon(_a) {
|
|
170
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
171
|
-
return /* @__PURE__ */ jsx(
|
|
172
|
-
"svg",
|
|
173
|
-
__spreadProps(__spreadValues({
|
|
174
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
175
|
-
viewBox: "0 0 256 256",
|
|
176
|
-
fill: "currentColor",
|
|
177
|
-
style: { height: "1rem", width: "1rem" },
|
|
178
|
-
className
|
|
179
|
-
}, props), {
|
|
180
|
-
children: /* @__PURE__ */ jsx("path", { d: "M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" })
|
|
181
|
-
})
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
function CopyIcon(_a) {
|
|
185
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
186
|
-
return /* @__PURE__ */ jsx(
|
|
187
|
-
"svg",
|
|
188
|
-
__spreadProps(__spreadValues({
|
|
189
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
190
|
-
viewBox: "0 0 256 256",
|
|
191
|
-
fill: "currentColor",
|
|
192
|
-
style: { height: "1rem", width: "1rem" },
|
|
193
|
-
className
|
|
194
|
-
}, props), {
|
|
195
|
-
children: /* @__PURE__ */ jsx("path", { d: "M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" })
|
|
196
|
-
})
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
var StopIcon = /* @__PURE__ */ jsx(
|
|
200
|
-
"svg",
|
|
201
|
-
{
|
|
202
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
203
|
-
viewBox: "0 0 256 256",
|
|
204
|
-
fill: "currentColor",
|
|
205
|
-
style: { height: "1rem", width: "1rem" },
|
|
206
|
-
children: /* @__PURE__ */ jsx("path", { d: "M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm24-120h-48a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8Zm-8 48h-32v-32h32Z" })
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
var RegenerateIcon = /* @__PURE__ */ jsx(
|
|
210
|
-
"svg",
|
|
211
|
-
{
|
|
212
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
213
|
-
viewBox: "0 0 256 256",
|
|
214
|
-
fill: "currentColor",
|
|
215
|
-
style: { height: "1rem", width: "1rem" },
|
|
216
|
-
children: /* @__PURE__ */ jsx("path", { d: "M197.67 186.37a8 8 0 0 1 0 11.29C196.58 198.73 170.82 224 128 224c-37.39 0-64.53-22.4-80-39.85V208a8 8 0 0 1-16 0v-48a8 8 0 0 1 8-8h48a8 8 0 0 1 0 16H55.44C67.76 183.35 93 208 128 208c36 0 58.14-21.46 58.36-21.68a8 8 0 0 1 11.31.05ZM216 40a8 8 0 0 0-8 8v23.85C192.53 54.4 165.39 32 128 32c-42.82 0-68.58 25.27-69.66 26.34a8 8 0 0 0 11.3 11.34C69.86 69.46 92 48 128 48c35 0 60.24 24.65 72.56 40H168a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8V48a8 8 0 0 0-8-8Z" })
|
|
217
|
-
}
|
|
218
|
-
);
|
|
1
|
+
import {
|
|
2
|
+
ActivityIcon,
|
|
3
|
+
CheckIcon,
|
|
4
|
+
CloseIcon,
|
|
5
|
+
CopyIcon,
|
|
6
|
+
DownloadIcon,
|
|
7
|
+
HeaderCloseIcon,
|
|
8
|
+
OpenIcon,
|
|
9
|
+
RegenerateIcon,
|
|
10
|
+
SendIcon,
|
|
11
|
+
SpinnerIcon,
|
|
12
|
+
StopIcon
|
|
13
|
+
} from "../../chunk-7YXG7D47.mjs";
|
|
14
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
219
15
|
export {
|
|
220
16
|
ActivityIcon,
|
|
221
17
|
CheckIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,113 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
function useChatContext() {
|
|
9
|
-
const context = React.useContext(ChatContext);
|
|
10
|
-
if (context === void 0) {
|
|
11
|
-
throw new Error(
|
|
12
|
-
"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
return context;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// src/components/chat/Textarea.tsx
|
|
19
|
-
import { useState, useRef, useEffect, forwardRef, useImperativeHandle } from "react";
|
|
20
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
21
|
-
var AutoResizingTextarea = forwardRef(
|
|
22
|
-
({ maxRows = 1, placeholder, value, onChange, onKeyDown, autoFocus }, ref) => {
|
|
23
|
-
const internalTextareaRef = useRef(null);
|
|
24
|
-
const [maxHeight, setMaxHeight] = useState(0);
|
|
25
|
-
useImperativeHandle(ref, () => internalTextareaRef.current);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
const calculateMaxHeight = () => {
|
|
28
|
-
const textarea = internalTextareaRef.current;
|
|
29
|
-
if (textarea) {
|
|
30
|
-
textarea.style.height = "auto";
|
|
31
|
-
const singleRowHeight = textarea.scrollHeight;
|
|
32
|
-
setMaxHeight(singleRowHeight * maxRows);
|
|
33
|
-
if (autoFocus) {
|
|
34
|
-
textarea.focus();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
calculateMaxHeight();
|
|
39
|
-
}, [maxRows]);
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
const textarea = internalTextareaRef.current;
|
|
42
|
-
if (textarea) {
|
|
43
|
-
textarea.style.height = "auto";
|
|
44
|
-
textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
|
|
45
|
-
}
|
|
46
|
-
}, [value, maxHeight]);
|
|
47
|
-
return /* @__PURE__ */ jsx2(
|
|
48
|
-
"textarea",
|
|
49
|
-
{
|
|
50
|
-
ref: internalTextareaRef,
|
|
51
|
-
value,
|
|
52
|
-
onChange,
|
|
53
|
-
onKeyDown,
|
|
54
|
-
placeholder,
|
|
55
|
-
style: {
|
|
56
|
-
overflow: "hidden",
|
|
57
|
-
resize: "none",
|
|
58
|
-
maxHeight: `${maxHeight}px`
|
|
59
|
-
},
|
|
60
|
-
rows: 1
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
var Textarea_default = AutoResizingTextarea;
|
|
66
|
-
|
|
67
|
-
// src/components/chat/Input.tsx
|
|
68
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
69
|
-
var Input = ({ inProgress, onSend, children }) => {
|
|
70
|
-
const context = useChatContext();
|
|
71
|
-
const textareaRef = useRef2(null);
|
|
72
|
-
const handleDivClick = (event) => {
|
|
73
|
-
var _a;
|
|
74
|
-
if (event.target !== event.currentTarget)
|
|
75
|
-
return;
|
|
76
|
-
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
77
|
-
};
|
|
78
|
-
const [text, setText] = useState2("");
|
|
79
|
-
const send = () => {
|
|
80
|
-
var _a;
|
|
81
|
-
if (inProgress)
|
|
82
|
-
return;
|
|
83
|
-
onSend(text);
|
|
84
|
-
setText("");
|
|
85
|
-
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
86
|
-
};
|
|
87
|
-
const icon = inProgress ? context.icons.activityIcon : context.icons.sendIcon;
|
|
88
|
-
const disabled = inProgress || text.length === 0;
|
|
89
|
-
return /* @__PURE__ */ jsxs("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
90
|
-
/* @__PURE__ */ jsx3("span", { children }),
|
|
91
|
-
/* @__PURE__ */ jsx3("button", { className: "copilotKitSendButton", disabled, onClick: send, children: icon }),
|
|
92
|
-
/* @__PURE__ */ jsx3(
|
|
93
|
-
Textarea_default,
|
|
94
|
-
{
|
|
95
|
-
ref: textareaRef,
|
|
96
|
-
placeholder: context.labels.placeholder,
|
|
97
|
-
autoFocus: true,
|
|
98
|
-
maxRows: 5,
|
|
99
|
-
value: text,
|
|
100
|
-
onChange: (event) => setText(event.target.value),
|
|
101
|
-
onKeyDown: (event) => {
|
|
102
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
send();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
)
|
|
109
|
-
] });
|
|
110
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
Input
|
|
3
|
+
} from "../../chunk-NYLOXKYT.mjs";
|
|
4
|
+
import "../../chunk-WM6BS77F.mjs";
|
|
5
|
+
import "../../chunk-OF66AL5Z.mjs";
|
|
6
|
+
import "../../chunk-7YXG7D47.mjs";
|
|
7
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
111
8
|
export {
|
|
112
9
|
Input
|
|
113
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|