@copilotkit/react-core 1.56.3 → 1.56.4-canary.1777529757
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/{copilotkit-By2G6-Zx.cjs → copilotkit-BAkj3zUc.cjs} +119 -104
- package/dist/copilotkit-BAkj3zUc.cjs.map +1 -0
- package/dist/{copilotkit-PzJlPKcU.mjs → copilotkit-DAatqMh2.mjs} +119 -104
- package/dist/copilotkit-DAatqMh2.mjs.map +1 -0
- package/dist/copilotkit-DFaI4j2r.d.mts.map +1 -1
- package/dist/copilotkit-Dg4r4Gi_.d.cts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +121 -106
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/src/v2/components/chat/CopilotChatAttachmentQueue.tsx +7 -114
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.tsx +26 -6
- package/src/v2/components/chat/CopilotChatUserMessage.tsx +2 -2
- package/src/v2/components/chat/CopilotChatView.tsx +68 -85
- package/src/v2/components/chat/Lightbox.tsx +103 -0
- package/src/v2/components/chat/__tests__/CopilotChat.suggestionsAlways.test.tsx +189 -0
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +193 -57
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.tsx +264 -0
- package/dist/copilotkit-By2G6-Zx.cjs.map +0 -1
- package/dist/copilotkit-PzJlPKcU.mjs.map +0 -1
|
@@ -45,8 +45,8 @@ let zod = require("zod");
|
|
|
45
45
|
let _lit_labs_react = require("@lit-labs/react");
|
|
46
46
|
let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
|
|
47
47
|
let zod_to_json_schema = require("zod-to-json-schema");
|
|
48
|
-
let _tanstack_react_virtual = require("@tanstack/react-virtual");
|
|
49
48
|
let react_dom = require("react-dom");
|
|
49
|
+
let _tanstack_react_virtual = require("@tanstack/react-virtual");
|
|
50
50
|
let use_stick_to_bottom = require("use-stick-to-bottom");
|
|
51
51
|
let react_markdown = require("react-markdown");
|
|
52
52
|
react_markdown = __toESM(react_markdown);
|
|
@@ -5036,20 +5036,101 @@ CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantM
|
|
|
5036
5036
|
CopilotChatAssistantMessage.RegenerateButton.displayName = "CopilotChatAssistantMessage.RegenerateButton";
|
|
5037
5037
|
var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
|
|
5038
5038
|
|
|
5039
|
+
//#endregion
|
|
5040
|
+
//#region src/v2/components/chat/Lightbox.tsx
|
|
5041
|
+
function Lightbox({ onClose, children }) {
|
|
5042
|
+
(0, react.useEffect)(() => {
|
|
5043
|
+
const handleKey = (e) => {
|
|
5044
|
+
if (e.key === "Escape") onClose();
|
|
5045
|
+
};
|
|
5046
|
+
document.addEventListener("keydown", handleKey);
|
|
5047
|
+
return () => document.removeEventListener("keydown", handleKey);
|
|
5048
|
+
}, [onClose]);
|
|
5049
|
+
if (typeof document === "undefined") return null;
|
|
5050
|
+
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5051
|
+
className: "cpk:fixed cpk:inset-0 cpk:z-[9999] cpk:flex cpk:items-center cpk:justify-center cpk:bg-black/80 cpk:animate-fade-in",
|
|
5052
|
+
onClick: onClose,
|
|
5053
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
5054
|
+
onClick: onClose,
|
|
5055
|
+
className: "cpk:absolute cpk:top-4 cpk:right-4 cpk:text-white cpk:bg-white/10 cpk:hover:bg-white/20 cpk:rounded-full cpk:w-10 cpk:h-10 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer cpk:border-none cpk:z-10",
|
|
5056
|
+
"aria-label": "Close preview",
|
|
5057
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "cpk:w-5 cpk:h-5" })
|
|
5058
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5059
|
+
onClick: (e) => e.stopPropagation(),
|
|
5060
|
+
children
|
|
5061
|
+
})]
|
|
5062
|
+
}), document.body);
|
|
5063
|
+
}
|
|
5064
|
+
/**
|
|
5065
|
+
* Hook that manages lightbox open/close and uses the View Transition API to
|
|
5066
|
+
* morph the thumbnail into fullscreen content.
|
|
5067
|
+
*
|
|
5068
|
+
* The trick: `view-transition-name` must live on exactly ONE element at a time.
|
|
5069
|
+
* - Old state (thumbnail visible): name is on the thumbnail.
|
|
5070
|
+
* - New state (lightbox visible): name moves to the lightbox content.
|
|
5071
|
+
* `flushSync` ensures React commits the DOM change synchronously inside the
|
|
5072
|
+
* `startViewTransition` callback so the API can snapshot old → new correctly.
|
|
5073
|
+
*/
|
|
5074
|
+
function useLightbox() {
|
|
5075
|
+
const thumbnailRef = (0, react.useRef)(null);
|
|
5076
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
5077
|
+
const vtName = (0, react.useId)();
|
|
5078
|
+
return {
|
|
5079
|
+
thumbnailRef,
|
|
5080
|
+
vtName,
|
|
5081
|
+
open,
|
|
5082
|
+
openLightbox: (0, react.useCallback)(() => {
|
|
5083
|
+
const thumb = thumbnailRef.current;
|
|
5084
|
+
const doc = document;
|
|
5085
|
+
if (doc.startViewTransition && thumb) {
|
|
5086
|
+
thumb.style.viewTransitionName = vtName;
|
|
5087
|
+
doc.startViewTransition(() => {
|
|
5088
|
+
thumb.style.viewTransitionName = "";
|
|
5089
|
+
(0, react_dom.flushSync)(() => setOpen(true));
|
|
5090
|
+
});
|
|
5091
|
+
} else setOpen(true);
|
|
5092
|
+
}, [vtName]),
|
|
5093
|
+
closeLightbox: (0, react.useCallback)(() => {
|
|
5094
|
+
const thumb = thumbnailRef.current;
|
|
5095
|
+
const doc = document;
|
|
5096
|
+
if (doc.startViewTransition && thumb) doc.startViewTransition(() => {
|
|
5097
|
+
(0, react_dom.flushSync)(() => setOpen(false));
|
|
5098
|
+
thumb.style.viewTransitionName = vtName;
|
|
5099
|
+
}).finished.then(() => {
|
|
5100
|
+
thumb.style.viewTransitionName = "";
|
|
5101
|
+
}).catch(() => {
|
|
5102
|
+
thumb.style.viewTransitionName = "";
|
|
5103
|
+
});
|
|
5104
|
+
else setOpen(false);
|
|
5105
|
+
}, [vtName])
|
|
5106
|
+
};
|
|
5107
|
+
}
|
|
5108
|
+
|
|
5039
5109
|
//#endregion
|
|
5040
5110
|
//#region src/v2/components/chat/CopilotChatAttachmentRenderer.tsx
|
|
5041
5111
|
const ImageAttachment = (0, react.memo)(function ImageAttachment({ src, className }) {
|
|
5042
5112
|
const [error, setError] = (0, react.useState)(false);
|
|
5113
|
+
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
5043
5114
|
if (error) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5044
5115
|
className: cn("cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:rounded-lg cpk:bg-muted cpk:p-4 cpk:text-sm cpk:text-muted-foreground", className),
|
|
5045
5116
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Failed to load image" })
|
|
5046
5117
|
});
|
|
5047
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
5118
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
5119
|
+
ref: thumbnailRef,
|
|
5048
5120
|
src,
|
|
5049
5121
|
alt: "Image attachment",
|
|
5050
|
-
className: cn("cpk:max-w-
|
|
5122
|
+
className: cn("cpk:max-w-[80px] cpk:max-h-[80px] cpk:w-auto cpk:h-auto cpk:rounded-xl cpk:object-cover cpk:cursor-pointer cpk:bg-muted", className),
|
|
5123
|
+
onClick: openLightbox,
|
|
5051
5124
|
onError: () => setError(true)
|
|
5052
|
-
})
|
|
5125
|
+
}), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Lightbox, {
|
|
5126
|
+
onClose: closeLightbox,
|
|
5127
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
5128
|
+
style: { viewTransitionName: vtName },
|
|
5129
|
+
src,
|
|
5130
|
+
alt: "Image attachment",
|
|
5131
|
+
className: "cpk:max-w-[90vw] cpk:max-h-[90vh] cpk:object-contain cpk:rounded-lg"
|
|
5132
|
+
})
|
|
5133
|
+
})] });
|
|
5053
5134
|
});
|
|
5054
5135
|
const AudioAttachment = (0, react.memo)(function AudioAttachment({ src, filename, className }) {
|
|
5055
5136
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -5174,15 +5255,15 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
5174
5255
|
"data-message-id": message.id,
|
|
5175
5256
|
...props,
|
|
5176
5257
|
children: [
|
|
5177
|
-
BoundMessageRenderer,
|
|
5178
5258
|
mediaParts.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5179
|
-
className: "cpk:flex cpk:flex-
|
|
5259
|
+
className: "cpk:flex cpk:flex-row cpk:flex-wrap cpk:justify-end cpk:gap-2 cpk:mb-2",
|
|
5180
5260
|
children: mediaParts.map((part, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatAttachmentRenderer, {
|
|
5181
5261
|
type: part.type,
|
|
5182
5262
|
source: part.source,
|
|
5183
5263
|
filename: getFilename(part)
|
|
5184
5264
|
}, index))
|
|
5185
5265
|
}),
|
|
5266
|
+
BoundMessageRenderer,
|
|
5186
5267
|
BoundToolbar
|
|
5187
5268
|
]
|
|
5188
5269
|
});
|
|
@@ -5851,6 +5932,7 @@ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
|
|
|
5851
5932
|
const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className }) => {
|
|
5852
5933
|
if (attachments.length === 0) return null;
|
|
5853
5934
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5935
|
+
"data-testid": "copilot-attachment-queue",
|
|
5854
5936
|
className: cn("cpk:flex cpk:flex-wrap cpk:gap-2 cpk:p-2", className),
|
|
5855
5937
|
children: attachments.map((attachment) => {
|
|
5856
5938
|
const isMedia = attachment.type === "image" || attachment.type === "video";
|
|
@@ -5885,73 +5967,6 @@ function AttachmentPreview({ attachment }) {
|
|
|
5885
5967
|
case "document": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocumentPreview, { attachment });
|
|
5886
5968
|
}
|
|
5887
5969
|
}
|
|
5888
|
-
function Lightbox({ onClose, children }) {
|
|
5889
|
-
(0, react.useEffect)(() => {
|
|
5890
|
-
const handleKey = (e) => {
|
|
5891
|
-
if (e.key === "Escape") onClose();
|
|
5892
|
-
};
|
|
5893
|
-
document.addEventListener("keydown", handleKey);
|
|
5894
|
-
return () => document.removeEventListener("keydown", handleKey);
|
|
5895
|
-
}, [onClose]);
|
|
5896
|
-
if (typeof document === "undefined") return null;
|
|
5897
|
-
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5898
|
-
className: "cpk:fixed cpk:inset-0 cpk:z-[9999] cpk:flex cpk:items-center cpk:justify-center cpk:bg-black/80 cpk:animate-fade-in",
|
|
5899
|
-
onClick: onClose,
|
|
5900
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
5901
|
-
onClick: onClose,
|
|
5902
|
-
className: "cpk:absolute cpk:top-4 cpk:right-4 cpk:text-white cpk:bg-white/10 cpk:hover:bg-white/20 cpk:rounded-full cpk:w-10 cpk:h-10 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer cpk:border-none cpk:z-10",
|
|
5903
|
-
"aria-label": "Close preview",
|
|
5904
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "cpk:w-5 cpk:h-5" })
|
|
5905
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5906
|
-
onClick: (e) => e.stopPropagation(),
|
|
5907
|
-
children
|
|
5908
|
-
})]
|
|
5909
|
-
}), document.body);
|
|
5910
|
-
}
|
|
5911
|
-
/**
|
|
5912
|
-
* Hook that manages lightbox open/close and uses the View Transition API to
|
|
5913
|
-
* morph the thumbnail into fullscreen content.
|
|
5914
|
-
*
|
|
5915
|
-
* The trick: `view-transition-name` must live on exactly ONE element at a time.
|
|
5916
|
-
* - Old state (thumbnail visible): name is on the thumbnail.
|
|
5917
|
-
* - New state (lightbox visible): name moves to the lightbox content.
|
|
5918
|
-
* `flushSync` ensures React commits the DOM change synchronously inside the
|
|
5919
|
-
* `startViewTransition` callback so the API can snapshot old → new correctly.
|
|
5920
|
-
*/
|
|
5921
|
-
function useLightbox() {
|
|
5922
|
-
const thumbnailRef = (0, react.useRef)(null);
|
|
5923
|
-
const [open, setOpen] = (0, react.useState)(false);
|
|
5924
|
-
const vtName = (0, react.useId)();
|
|
5925
|
-
return {
|
|
5926
|
-
thumbnailRef,
|
|
5927
|
-
vtName,
|
|
5928
|
-
open,
|
|
5929
|
-
openLightbox: (0, react.useCallback)(() => {
|
|
5930
|
-
const thumb = thumbnailRef.current;
|
|
5931
|
-
const doc = document;
|
|
5932
|
-
if (doc.startViewTransition && thumb) {
|
|
5933
|
-
thumb.style.viewTransitionName = vtName;
|
|
5934
|
-
doc.startViewTransition(() => {
|
|
5935
|
-
thumb.style.viewTransitionName = "";
|
|
5936
|
-
(0, react_dom.flushSync)(() => setOpen(true));
|
|
5937
|
-
});
|
|
5938
|
-
} else setOpen(true);
|
|
5939
|
-
}, []),
|
|
5940
|
-
closeLightbox: (0, react.useCallback)(() => {
|
|
5941
|
-
const thumb = thumbnailRef.current;
|
|
5942
|
-
const doc = document;
|
|
5943
|
-
if (doc.startViewTransition && thumb) doc.startViewTransition(() => {
|
|
5944
|
-
(0, react_dom.flushSync)(() => setOpen(false));
|
|
5945
|
-
thumb.style.viewTransitionName = vtName;
|
|
5946
|
-
}).finished.then(() => {
|
|
5947
|
-
thumb.style.viewTransitionName = "";
|
|
5948
|
-
}).catch(() => {
|
|
5949
|
-
thumb.style.viewTransitionName = "";
|
|
5950
|
-
});
|
|
5951
|
-
else setOpen(false);
|
|
5952
|
-
}, [])
|
|
5953
|
-
};
|
|
5954
|
-
}
|
|
5955
5970
|
function ImagePreview({ attachment }) {
|
|
5956
5971
|
const src = (0, _copilotkit_shared.getSourceUrl)(attachment.source);
|
|
5957
5972
|
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
@@ -6277,13 +6292,7 @@ function computeOffsetTop(el, stopAt) {
|
|
|
6277
6292
|
|
|
6278
6293
|
//#endregion
|
|
6279
6294
|
//#region src/v2/components/chat/CopilotChatView.tsx
|
|
6280
|
-
const
|
|
6281
|
-
const PIN_TO_SEND_FEATHER_HEIGHT = 48;
|
|
6282
|
-
const PinToSendSoftFeather = ({ className, style, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6283
|
-
className: cn("cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-4 cpk:h-12 cpk:pointer-events-none cpk:z-10 cpk:bg-gradient-to-t", "cpk:from-white cpk:to-transparent", "cpk:dark:from-[rgb(33,33,33)]", className),
|
|
6284
|
-
style,
|
|
6285
|
-
...props
|
|
6286
|
-
});
|
|
6295
|
+
const SCROLL_BUTTON_OFFSET = 16;
|
|
6287
6296
|
function DropOverlay() {
|
|
6288
6297
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6289
6298
|
className: cn("cpk:absolute cpk:inset-0 cpk:z-50 cpk:pointer-events-none", "cpk:flex cpk:items-center cpk:justify-center", "cpk:bg-primary/5 cpk:backdrop-blur-[2px]", "cpk:border-2 cpk:border-dashed cpk:border-primary/40 cpk:rounded-lg cpk:m-2"),
|
|
@@ -6297,14 +6306,17 @@ function DropOverlay() {
|
|
|
6297
6306
|
});
|
|
6298
6307
|
}
|
|
6299
6308
|
function CopilotChatView({ messageView, input, scrollView, suggestionView, welcomeScreen, messages = [], autoScroll = true, isRunning = false, suggestions, suggestionLoadingIndexes, onSelectSuggestion, onSubmitMessage, onStop, inputMode, inputValue, onInputChange, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, attachments, onRemoveAttachment, onAddFile, dragOver, onDragOver, onDragLeave, onDrop, isConnecting = false, hasExplicitThreadId = false, disclaimer, children, className, ...props }) {
|
|
6300
|
-
const
|
|
6309
|
+
const [inputContainerEl, setInputContainerEl] = (0, react.useState)(null);
|
|
6301
6310
|
const [inputContainerHeight, setInputContainerHeight] = (0, react.useState)(0);
|
|
6302
6311
|
const [isResizing, setIsResizing] = (0, react.useState)(false);
|
|
6303
6312
|
const resizeTimeoutRef = (0, react.useRef)(null);
|
|
6304
6313
|
const { isKeyboardOpen, keyboardHeight, availableHeight } = useKeyboardHeight();
|
|
6305
6314
|
(0, react.useEffect)(() => {
|
|
6306
|
-
const element =
|
|
6307
|
-
if (!element)
|
|
6315
|
+
const element = inputContainerEl;
|
|
6316
|
+
if (!element) {
|
|
6317
|
+
setInputContainerHeight(0);
|
|
6318
|
+
return;
|
|
6319
|
+
}
|
|
6308
6320
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
6309
6321
|
for (const entry of entries) {
|
|
6310
6322
|
const newHeight = entry.contentRect.height;
|
|
@@ -6327,7 +6339,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6327
6339
|
resizeObserver.disconnect();
|
|
6328
6340
|
if (resizeTimeoutRef.current) clearTimeout(resizeTimeoutRef.current);
|
|
6329
6341
|
};
|
|
6330
|
-
}, []);
|
|
6342
|
+
}, [inputContainerEl]);
|
|
6331
6343
|
const BoundMessageView = renderSlot(messageView, CopilotChatMessageView, {
|
|
6332
6344
|
messages,
|
|
6333
6345
|
isRunning
|
|
@@ -6346,12 +6358,11 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6346
6358
|
onAddFile,
|
|
6347
6359
|
positioning: "static",
|
|
6348
6360
|
keyboardHeight: isKeyboardOpen ? keyboardHeight : 0,
|
|
6349
|
-
containerRef: inputContainerRef,
|
|
6350
6361
|
showDisclaimer: true,
|
|
6351
6362
|
bottomAnchored: true,
|
|
6352
6363
|
...disclaimer !== void 0 ? { disclaimer } : {}
|
|
6353
6364
|
});
|
|
6354
|
-
const hasSuggestions = !isConnecting &&
|
|
6365
|
+
const hasSuggestions = !isConnecting && Array.isArray(suggestions) && suggestions.length > 0;
|
|
6355
6366
|
const BoundSuggestionView = hasSuggestions ? renderSlot(suggestionView, CopilotChatSuggestionView, {
|
|
6356
6367
|
suggestions,
|
|
6357
6368
|
loadingIndexes: suggestionLoadingIndexes,
|
|
@@ -6363,7 +6374,8 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6363
6374
|
inputContainerHeight,
|
|
6364
6375
|
isResizing,
|
|
6365
6376
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6366
|
-
|
|
6377
|
+
"data-testid": "copilot-scroll-content",
|
|
6378
|
+
style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` },
|
|
6367
6379
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6368
6380
|
className: "cpk:max-w-3xl cpk:mx-auto",
|
|
6369
6381
|
children: [BoundMessageView, hasSuggestions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -6437,15 +6449,19 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6437
6449
|
children: [
|
|
6438
6450
|
dragOver && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropOverlay, {}),
|
|
6439
6451
|
BoundScrollView,
|
|
6440
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
className: "cpk:
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6452
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6453
|
+
ref: setInputContainerEl,
|
|
6454
|
+
"data-testid": "copilot-input-overlay",
|
|
6455
|
+
className: "cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-0 cpk:z-20 cpk:pointer-events-none",
|
|
6456
|
+
children: [attachments && attachments.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6457
|
+
className: "cpk:max-w-3xl cpk:mx-auto cpk:w-full cpk:pointer-events-auto",
|
|
6458
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatAttachmentQueue, {
|
|
6459
|
+
attachments,
|
|
6460
|
+
onRemoveAttachment: (id) => onRemoveAttachment?.(id),
|
|
6461
|
+
className: "cpk:px-4"
|
|
6462
|
+
})
|
|
6463
|
+
}), BoundInput]
|
|
6464
|
+
})
|
|
6449
6465
|
]
|
|
6450
6466
|
});
|
|
6451
6467
|
}
|
|
@@ -6474,7 +6490,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6474
6490
|
BoundFeather,
|
|
6475
6491
|
!isAtBottom && !isResizing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6476
6492
|
className: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
|
|
6477
|
-
style: { bottom: `${inputContainerHeight +
|
|
6493
|
+
style: { bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` },
|
|
6478
6494
|
children: renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, { onClick: () => scrollToBottom() })
|
|
6479
6495
|
})
|
|
6480
6496
|
] })
|
|
@@ -6488,7 +6504,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6488
6504
|
spacerRef,
|
|
6489
6505
|
topOffset: 16
|
|
6490
6506
|
});
|
|
6491
|
-
const BoundFeather = renderSlot(feather,
|
|
6507
|
+
const BoundFeather = renderSlot(feather, CopilotChatView.Feather, {});
|
|
6492
6508
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollElementContext.Provider, {
|
|
6493
6509
|
value: nonAutoScrollEl,
|
|
6494
6510
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -6515,7 +6531,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6515
6531
|
BoundFeather,
|
|
6516
6532
|
showScrollButton && !isResizing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6517
6533
|
className: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
|
|
6518
|
-
style: { bottom: `${inputContainerHeight +
|
|
6534
|
+
style: { bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` },
|
|
6519
6535
|
children: renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, { onClick: () => scrollToBottom() })
|
|
6520
6536
|
})
|
|
6521
6537
|
]
|
|
@@ -6583,7 +6599,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6583
6599
|
BoundFeather,
|
|
6584
6600
|
showScrollButton && !isResizing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6585
6601
|
className: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
|
|
6586
|
-
style: { bottom: `${inputContainerHeight +
|
|
6602
|
+
style: { bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` },
|
|
6587
6603
|
children: renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, { onClick: () => scrollToBottom() })
|
|
6588
6604
|
})
|
|
6589
6605
|
]
|
|
@@ -6627,9 +6643,8 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
6627
6643
|
...props,
|
|
6628
6644
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "cpk:w-4 cpk:h-4 cpk:text-gray-600 cpk:dark:text-white" })
|
|
6629
6645
|
});
|
|
6630
|
-
_CopilotChatView.Feather = ({ className,
|
|
6631
|
-
className
|
|
6632
|
-
style,
|
|
6646
|
+
_CopilotChatView.Feather = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6647
|
+
className,
|
|
6633
6648
|
...props
|
|
6634
6649
|
});
|
|
6635
6650
|
_CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
|
|
@@ -10204,4 +10219,4 @@ Object.defineProperty(exports, 'useToast', {
|
|
|
10204
10219
|
return useToast;
|
|
10205
10220
|
}
|
|
10206
10221
|
});
|
|
10207
|
-
//# sourceMappingURL=copilotkit-
|
|
10222
|
+
//# sourceMappingURL=copilotkit-BAkj3zUc.cjs.map
|