dp-widgets-framework 1.4.5 → 1.4.6

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 CHANGED
@@ -39214,9 +39214,15 @@ function CopilotKitChatbot({ widget, showHeader, styles, onResetReady, widgetIds
39214
39214
  // Clear input
39215
39215
  setInputValue("");
39216
39216
  };
39217
+ const handleKeyDown = (e) => {
39218
+ if (e.key === 'Enter' && !e.shiftKey) {
39219
+ e.preventDefault();
39220
+ handleSubmit(e);
39221
+ }
39222
+ };
39217
39223
  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-blue-500 text-white"
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-blue-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 p-4", children: jsxRuntimeExports.jsxs("div", { className: "flex gap-2 relative", children: [jsxRuntimeExports.jsx("textarea", { value: inputValue, onChange: (e) => setInputValue(e.target.value), 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 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()
39224
+ ? "bg-primary-500 text-white"
39225
+ : "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
39226
  ? "text-primary-600"
39221
39227
  : "text-gray-600 cursor-not-allowed") }) })] }) })] })] }));
39222
39228
  }
package/dist/index.js CHANGED
@@ -39241,9 +39241,15 @@ function CopilotKitChatbot({ widget, showHeader, styles, onResetReady, widgetIds
39241
39241
  // Clear input
39242
39242
  setInputValue("");
39243
39243
  };
39244
+ const handleKeyDown = (e) => {
39245
+ if (e.key === 'Enter' && !e.shiftKey) {
39246
+ e.preventDefault();
39247
+ handleSubmit(e);
39248
+ }
39249
+ };
39244
39250
  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-blue-500 text-white"
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-blue-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 p-4", children: jsxRuntimeExports.jsxs("div", { className: "flex gap-2 relative", children: [jsxRuntimeExports.jsx("textarea", { value: inputValue, onChange: (e) => setInputValue(e.target.value), 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 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()
39251
+ ? "bg-primary-500 text-white"
39252
+ : "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
39253
  ? "text-primary-600"
39248
39254
  : "text-gray-600 cursor-not-allowed") }) })] }) })] })] }));
39249
39255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dp-widgets-framework",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"