dp-widgets-framework 1.4.5 → 1.4.7
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/index.esm.js +9 -2
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -39179,6 +39179,7 @@ function CopilotKitChatbot({ widget, showHeader, styles, onResetReady, widgetIds
|
|
|
39179
39179
|
console.log('on reset ready=>');
|
|
39180
39180
|
const wrappedReset = () => {
|
|
39181
39181
|
reset();
|
|
39182
|
+
setChatMessages([]);
|
|
39182
39183
|
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId: widget.id } }));
|
|
39183
39184
|
};
|
|
39184
39185
|
onResetReady(widget.id, wrappedReset);
|
|
@@ -39214,9 +39215,15 @@ function CopilotKitChatbot({ widget, showHeader, styles, onResetReady, widgetIds
|
|
|
39214
39215
|
// Clear input
|
|
39215
39216
|
setInputValue("");
|
|
39216
39217
|
};
|
|
39218
|
+
const handleKeyDown = (e) => {
|
|
39219
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
39220
|
+
e.preventDefault();
|
|
39221
|
+
handleSubmit(e);
|
|
39222
|
+
}
|
|
39223
|
+
};
|
|
39217
39224
|
return (jsxRuntimeExports.jsxs("div", { className: cn("flex flex-col h-full"), children: [showHeader && (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between pb-2 border-b", children: jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx(Bot, { className: "h-4 w-4" }), jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium", children: widget.title })] }) })), jsxRuntimeExports.jsxs("div", { className: "flex-1 h-full flex flex-col", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: chatMessages.length === 0 ? (jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 text-xs mt-8", children: ((_b = widget.config) === null || _b === void 0 ? void 0 : _b.copilotInitialMessage) || ((_c = widget.config) === null || _c === void 0 ? void 0 : _c.placeholder) || "How can I help you today?" })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [chatMessages.map((message) => (jsxRuntimeExports.jsx("div", { className: cn("flex", message.role === "user" ? "justify-end" : "justify-start"), children: jsxRuntimeExports.jsxs("div", { className: cn("max-w-[80%] rounded-lg px-4 py-2 text-xs", message.role === "user"
|
|
39218
|
-
? "bg-
|
|
39219
|
-
: "bg-gray-100 text-gray-900"), children: [jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap", children: jsxRuntimeExports.jsx(Markdown, { children: message.content }) }), message.createdAt && (jsxRuntimeExports.jsx("div", { className: cn("text-[10px] mt-1", message.role === "user" ? "text-
|
|
39225
|
+
? "bg-primary-500 text-white"
|
|
39226
|
+
: "bg-gray-100 text-gray-900"), children: [jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap", children: jsxRuntimeExports.jsx(Markdown, { children: message.content }) }), message.createdAt && (jsxRuntimeExports.jsx("div", { className: cn("text-[10px] mt-1", message.role === "user" ? "text-primary-100" : "text-gray-500"), children: new Date(message.createdAt).toLocaleTimeString() }))] }) }, message.id))), isLoading && (jsxRuntimeExports.jsx("div", { className: "flex justify-start", children: jsxRuntimeExports.jsx("div", { className: "bg-gray-100 rounded-lg px-4 py-2 text-xs", children: jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex space-x-1", children: [jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: '0ms' } }), jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: '150ms' } }), jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: '300ms' } })] }), jsxRuntimeExports.jsx("span", { className: "text-gray-500", children: "Thinking..." })] }) }) })), jsxRuntimeExports.jsx("div", { ref: messagesEndRef })] })) }), jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit, className: "border-t border-slate-200 p-4", children: jsxRuntimeExports.jsxs("div", { className: "flex gap-2 relative", children: [jsxRuntimeExports.jsx("textarea", { value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, placeholder: ((_d = widget.config) === null || _d === void 0 ? void 0 : _d.placeholder) || "Type a message...", className: "resize-none h-20 overflow-y-auto flex-1 px-3 py-2 text-xs border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500" }), jsxRuntimeExports.jsx("button", { type: "submit", disabled: !inputValue.trim(), className: cn("absolute bottom-0 right-0 p-2 rounded-lg text-white flex items-center justify-center bg-transparent"), children: jsxRuntimeExports.jsx(Send, { className: cn("h-4 w-4", inputValue.trim()
|
|
39220
39227
|
? "text-primary-600"
|
|
39221
39228
|
: "text-gray-600 cursor-not-allowed") }) })] }) })] })] }));
|
|
39222
39229
|
}
|
package/dist/index.js
CHANGED
|
@@ -39206,6 +39206,7 @@ function CopilotKitChatbot({ widget, showHeader, styles, onResetReady, widgetIds
|
|
|
39206
39206
|
console.log('on reset ready=>');
|
|
39207
39207
|
const wrappedReset = () => {
|
|
39208
39208
|
reset();
|
|
39209
|
+
setChatMessages([]);
|
|
39209
39210
|
window.dispatchEvent(new CustomEvent('clearChartState', { detail: { widgetId: widget.id } }));
|
|
39210
39211
|
};
|
|
39211
39212
|
onResetReady(widget.id, wrappedReset);
|
|
@@ -39241,9 +39242,15 @@ function CopilotKitChatbot({ widget, showHeader, styles, onResetReady, widgetIds
|
|
|
39241
39242
|
// Clear input
|
|
39242
39243
|
setInputValue("");
|
|
39243
39244
|
};
|
|
39245
|
+
const handleKeyDown = (e) => {
|
|
39246
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
39247
|
+
e.preventDefault();
|
|
39248
|
+
handleSubmit(e);
|
|
39249
|
+
}
|
|
39250
|
+
};
|
|
39244
39251
|
return (jsxRuntimeExports.jsxs("div", { className: cn("flex flex-col h-full"), children: [showHeader && (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between pb-2 border-b", children: jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx(lucideReact.Bot, { className: "h-4 w-4" }), jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium", children: widget.title })] }) })), jsxRuntimeExports.jsxs("div", { className: "flex-1 h-full flex flex-col", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: chatMessages.length === 0 ? (jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 text-xs mt-8", children: ((_b = widget.config) === null || _b === void 0 ? void 0 : _b.copilotInitialMessage) || ((_c = widget.config) === null || _c === void 0 ? void 0 : _c.placeholder) || "How can I help you today?" })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [chatMessages.map((message) => (jsxRuntimeExports.jsx("div", { className: cn("flex", message.role === "user" ? "justify-end" : "justify-start"), children: jsxRuntimeExports.jsxs("div", { className: cn("max-w-[80%] rounded-lg px-4 py-2 text-xs", message.role === "user"
|
|
39245
|
-
? "bg-
|
|
39246
|
-
: "bg-gray-100 text-gray-900"), children: [jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap", children: jsxRuntimeExports.jsx(Markdown, { children: message.content }) }), message.createdAt && (jsxRuntimeExports.jsx("div", { className: cn("text-[10px] mt-1", message.role === "user" ? "text-
|
|
39252
|
+
? "bg-primary-500 text-white"
|
|
39253
|
+
: "bg-gray-100 text-gray-900"), children: [jsxRuntimeExports.jsx("div", { className: "whitespace-pre-wrap", children: jsxRuntimeExports.jsx(Markdown, { children: message.content }) }), message.createdAt && (jsxRuntimeExports.jsx("div", { className: cn("text-[10px] mt-1", message.role === "user" ? "text-primary-100" : "text-gray-500"), children: new Date(message.createdAt).toLocaleTimeString() }))] }) }, message.id))), isLoading && (jsxRuntimeExports.jsx("div", { className: "flex justify-start", children: jsxRuntimeExports.jsx("div", { className: "bg-gray-100 rounded-lg px-4 py-2 text-xs", children: jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsxs("div", { className: "flex space-x-1", children: [jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: '0ms' } }), jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: '150ms' } }), jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: '300ms' } })] }), jsxRuntimeExports.jsx("span", { className: "text-gray-500", children: "Thinking..." })] }) }) })), jsxRuntimeExports.jsx("div", { ref: messagesEndRef })] })) }), jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit, className: "border-t border-slate-200 p-4", children: jsxRuntimeExports.jsxs("div", { className: "flex gap-2 relative", children: [jsxRuntimeExports.jsx("textarea", { value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, placeholder: ((_d = widget.config) === null || _d === void 0 ? void 0 : _d.placeholder) || "Type a message...", className: "resize-none h-20 overflow-y-auto flex-1 px-3 py-2 text-xs border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500" }), jsxRuntimeExports.jsx("button", { type: "submit", disabled: !inputValue.trim(), className: cn("absolute bottom-0 right-0 p-2 rounded-lg text-white flex items-center justify-center bg-transparent"), children: jsxRuntimeExports.jsx(lucideReact.Send, { className: cn("h-4 w-4", inputValue.trim()
|
|
39247
39254
|
? "text-primary-600"
|
|
39248
39255
|
: "text-gray-600 cursor-not-allowed") }) })] }) })] })] }));
|
|
39249
39256
|
}
|