@progress/kendo-react-conversational-ui 14.5.0-develop.8 → 15.0.0-develop.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/README.md +4 -4
- package/ai-prompt/AIPrompt.d.ts +6 -0
- package/ai-prompt/AIPrompt.js +1 -1
- package/ai-prompt/AIPrompt.mjs +40 -38
- package/ai-prompt/AIPromptContent.js +1 -1
- package/ai-prompt/AIPromptContent.mjs +5 -5
- package/ai-prompt/views/AIPromptOutputView.js +1 -1
- package/ai-prompt/views/AIPromptOutputView.mjs +6 -6
- package/chat/ChatPropsAndState.d.ts +17 -0
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +222 -220
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +133 -117
- package/chat/components/Header.js +1 -1
- package/chat/components/Header.mjs +1 -1
- package/chat/components/NewMessage.js +1 -1
- package/chat/components/NewMessage.mjs +49 -48
- package/chat/components/Notification.js +1 -1
- package/chat/components/Notification.mjs +1 -1
- package/chat/components/elements/FileBox.js +1 -1
- package/chat/components/elements/FileBox.mjs +10 -9
- package/chat/components/elements/PinnedMessage.js +1 -1
- package/chat/components/elements/PinnedMessage.mjs +14 -13
- package/chat/hooks/useEndlessScroll.js +1 -1
- package/chat/hooks/useEndlessScroll.mjs +103 -101
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/inline-ai-prompt/InlineAIPrompt.js +1 -1
- package/inline-ai-prompt/InlineAIPrompt.mjs +10 -10
- package/inline-ai-prompt/InlineAIPromptInput.js +1 -1
- package/inline-ai-prompt/InlineAIPromptInput.mjs +1 -1
- package/messages/index.d.ts +5 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +12 -10
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -12
- package/prompt-box/FileBox.js +1 -1
- package/prompt-box/FileBox.mjs +21 -20
- package/prompt-box/PromptBox.js +1 -1
- package/prompt-box/PromptBox.mjs +148 -150
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("react"),g=require("@progress/kendo-react-common"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("react"),g=require("@progress/kendo-react-common"),S=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),ne=require("@progress/kendo-react-layout"),c=require("../utils.js"),Ee=require("./ChatContext.js"),xe=require("./elements/FileBox.js"),le=require("@progress/kendo-react-intl"),l=require("../../messages/index.js");function Ie(i){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const u=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(r,e,u.get?u:{enumerable:!0,get:()=>i[e]})}}return r.default=i,Object.freeze(r)}const a=Ie(ye),oe=a.forwardRef((i,r)=>{const{item:e,template:u,contentTemplate:D,onRequestSelection:C,tabIndex:ce=-1,dateFormat:H="g",selected:d,allowMessageCollapse:y,messageToolbarActions:E,messageContextMenuActions:x,fileActions:U,isSender:I}=i,{setReplyToMessage:M,messages:X,repliedToMessages:A,user:b,onToolbarAction:F,onContextMenuAction:R,onFileAction:Y,onDownload:m,onResendMessage:L,setShowCopyNotification:w,statusTemplate:q,timestampVisibility:z="onFocus",onReferencedMessageClick:T}=Ee.useChatContext(),[G,O]=a.useState(!1),[J,V]=a.useState(!1),[h,re]=a.useState(!0),[ie,Q]=a.useState(!1),o=le.useLocalization(),Z=le.useInternationalization(),$=a.useRef({left:0,top:0}),v=a.useCallback(()=>{e!=null&&e.text&&c.copyToClipboard(e.text),w&&(w(!0),setTimeout(()=>{w(!1)},3e3))},[e,w]),j=a.useCallback(t=>{t.stopPropagation(),re(s=>!s)},[]),ue=a.useCallback(()=>{Q(!1)},[]),de=a.useCallback(t=>{(t.key==="Tab"||t.key==="Enter"||t.key===" "||t.key==="ArrowUp"||t.key==="ArrowDown")&&Q(!0)},[]),B=a.useRef(null);a.useEffect(()=>{d&&B.current&&B.current.focus()},[d]);const P=a.useCallback(t=>{$.current={left:t.pageX,top:t.pageY},t.preventDefault(),V(!0),O(!0)},[]),ee=a.useCallback(()=>{V(!1),O(!1)},[]),N=a.useCallback((t,s)=>t.isDeleted?c.getDeletedMessageText(s,o):t.text?t.text:"",[o]),te=a.useCallback(t=>{var s;(s=t.item)!=null&&s.text&&(t.item.data.id==="copy"&&!e.isDeleted?v():t.item.data.id==="reply"&&M(e),R&&R(t.item.data,t,e)),V(!1),O(!1)},[e,R,M,v]),ae=a.useCallback(()=>{if(e.replyToId){const t=c.getMessageById(X,e.replyToId)||(A?c.getMessageById(A,e.replyToId):void 0);if(t){const s=n=>{n.preventDefault(),n.stopPropagation(),T==null||T(t.id)};return a.createElement("div",{className:g.classNames("k-message-reference",c.isAuthor(b,t)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:s},a.createElement("div",{className:"k-message-reference-content"},c.convertTextToLinkedContent(N(t,c.isAuthor(b,t)))))}}return null},[e.replyToId,X,A,b,N,T]),K=a.useCallback(()=>{const t=[{id:"reply",label:"Reply",svgIcon:f.undoIcon},{id:"copy",label:"Copy",svgIcon:f.copyIcon}],s=x?[...t.map(n=>x.find(k=>k.id===n.id)||n),...x.filter(n=>!t.some(p=>p.id===n.id))]:t;return a.createElement(ne.ContextMenu,{onSelect:te,onClose:ee,vertical:!0,show:G,offset:$.current},s.map(n=>n.id==="delete"&&!I?null:a.createElement(ne.MenuItem,{key:n.id,text:n.label,icon:n.icon,svgIcon:n.svgIcon,data:n})))},[x,te,ee,G,I]),se=a.useCallback(()=>e.files&&e.files.length>1?a.createElement("div",{className:"k-chat-download-button-wrapper"},a.createElement(S.Button,{className:"k-chat-download-button",fillMode:"flat",svgIcon:f.downloadIcon,size:"small",onClick:t=>{t.stopPropagation(),m&&m(e.files,e)},"aria-label":o.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},a.createElement("span",{className:"k-button-text"},o.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[e,m,o]),me=a.useCallback(()=>{if(e.typing)return a.createElement("div",{className:"k-chat-bubble k-bubble"},a.createElement("div",{className:"k-bubble-content"},a.createElement("div",{className:"k-typing-indicator"},a.createElement("span",null),a.createElement("span",null),a.createElement("span",null))));if(u){const t=u;return a.createElement(a.Fragment,null,a.createElement(t,{item:e}),K())}else if(e.text||e.files&&e.files.length>0)return a.createElement(a.Fragment,null,a.createElement("div",{className:g.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":y,"k-expanded":y&&h,"k-selected":d,"k-active":J}),onClick:()=>C(d?void 0:e.selectionIndex),onContextMenu:P},a.createElement("div",{className:"k-bubble-content"},D?a.createElement(D,{item:e}):a.createElement(a.Fragment,null,(e.text||e.isDeleted||e.replyToId)&&a.createElement("span",{className:"k-chat-bubble-text"},!e.isDeleted&&ae(),c.convertTextToLinkedContent(N(e,c.isAuthor(b,e)))),e.files&&e.files.length>0&&a.createElement(xe,{files:e.files,message:e,onFileAction:Y,onDownload:t=>m==null?void 0:m(t,e),renderInTextarea:!1,fileActions:U}),se())),y&&a.createElement("span",{className:"k-bubble-expandable-indicator",onClick:j,role:"button","aria-label":h?o.toLanguageString(l.collapseMessage,l.messages[l.collapseMessage]):o.toLanguageString(l.expandMessage,l.messages[l.expandMessage]),tabIndex:0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),j(t))}},a.createElement(g.IconWrap,{icon:h?f.chevronUpIcon:f.chevronDownIcon,size:"medium"}))),K());return null},[e,u,D,y,h,d,J,C,P,ae,N,b,Y,U,se,j,o,K,m]),ge=a.useCallback(()=>{let t=null;return e.timestamp&&(z==="hidden"||(t=a.createElement("time",{className:"k-message-time"},Z.formatDate(e.timestamp,H)))),t},[e.timestamp,H,z,Z]),fe=a.useCallback(()=>{if(!e.status)return null;let t;if(q)t=a.createElement(q,{item:e});else{const s=typeof e.status=="object"&&e.status!==null;let n,p,k;if(s){const _=e.status;n=_.text,p=_.icon,k=_.svgIcon}else n=e.status;let W=null;p?W=a.createElement(g.Icon,{name:p,size:"xsmall"}):k&&(W=a.createElement(g.IconWrap,{icon:k,size:"xsmall"})),t=a.createElement(a.Fragment,null,W,n)}return a.createElement("span",{className:"k-message-status"},t)},[e,q]),pe=a.useCallback(()=>{let t=null;if(e.isFailed){const s=o.toLanguageString(l.messageFailed,l.messages[l.messageFailed]);t=a.createElement("span",{className:"k-message-failed-content"},a.createElement(g.IconWrap,{icon:f.warningTriangleIcon,size:"xsmall"}),a.createElement("span",{className:"k-message-failed-text"},s))}return t},[e,o]),be=a.useCallback(()=>{let t=null;if(e.isFailed){const s=o.toLanguageString(l.retryMessage,l.messages[l.retryMessage]);t=a.createElement(S.Button,{fillMode:"clear",size:"xs",className:"k-resend-button",svgIcon:f.arrowRotateCwIcon,"aria-label":s,title:s,onClick:n=>{n.stopPropagation(),L&&L({message:e,syntheticEvent:n,nativeEvent:n.nativeEvent,target:n.target})}})}return t},[e,o,L]),ke=a.useCallback(()=>g.classNames({"k-focus":d,"k-message-removed":e.isDeleted,"k-message-failed":e.isFailed},"k-message"),[d,e.isDeleted,e.isFailed]),Ce=a.useCallback(()=>E&&E.length>0&&a.createElement(S.Toolbar,{className:"k-chat-message-toolbar",fillMode:"flat",ariaLabel:o.toLanguageString(l.chatMessageToolbar,l.messages[l.chatMessageToolbar])},E.map(t=>t.id==="delete"&&!I?null:a.createElement(S.Button,{key:t.id,fillMode:"flat",className:"k-toolbar-button",icon:t.icon,svgIcon:t.svgIcon,"aria-label":t.label,onClick:s=>{s.stopPropagation(),t.id==="copy"&&!e.isDeleted?v():t.id==="reply"&&M(e),F&&F(t,s,e)},onMouseDown:s=>s.preventDefault()}))),[v,I,e,o,E,F,M]);return a.createElement("div",{key:e.id,"data-message-id":e.id,className:ke(),tabIndex:ce,onMouseDown:ue,onKeyDown:de,onFocus:t=>{ie&&C(e.selectionIndex)},ref:t=>{B.current=t,typeof r=="function"?r(t):r&&(r.current=t)},onContextMenu:u?P:void 0},be(),me(),(e.status||e.timestamp&&z!=="hidden"||e.isFailed)&&a.createElement("div",{className:"k-message-info"},fe(),ge(),pe()),Ce())});oe.displayName="ChatMessage";exports.ChatMessage=oe;
|
|
@@ -6,116 +6,116 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { classNames as
|
|
10
|
-
import { Button as W, Toolbar as
|
|
11
|
-
import { undoIcon as
|
|
12
|
-
import { ContextMenu as
|
|
13
|
-
import { copyToClipboard as
|
|
14
|
-
import { useChatContext as
|
|
15
|
-
import
|
|
16
|
-
import { useLocalization as
|
|
17
|
-
import { downloadAllFiles as le, messages as
|
|
18
|
-
const
|
|
19
|
-
(
|
|
9
|
+
import { classNames as O, IconWrap as j, Icon as ve } from "@progress/kendo-react-common";
|
|
10
|
+
import { Button as W, Toolbar as he } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { undoIcon as Me, copyIcon as Ne, downloadIcon as De, chevronUpIcon as Se, chevronDownIcon as Fe, warningTriangleIcon as Ae, arrowRotateCwIcon as Re } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { ContextMenu as Le, MenuItem as Ve } from "@progress/kendo-react-layout";
|
|
13
|
+
import { copyToClipboard as ze, getDeletedMessageText as Ke, getMessageById as se, isAuthor as H, convertTextToLinkedContent as ne } from "../utils.mjs";
|
|
14
|
+
import { useChatContext as Pe } from "./ChatContext.mjs";
|
|
15
|
+
import Be from "./elements/FileBox.mjs";
|
|
16
|
+
import { useLocalization as Oe, useInternationalization as je } from "@progress/kendo-react-intl";
|
|
17
|
+
import { downloadAllFiles as le, messages as r, downloadAll as oe, collapseMessage as ie, expandMessage as re, messageFailed as ce, retryMessage as ue, chatMessageToolbar as me } from "../../messages/index.mjs";
|
|
18
|
+
const We = t.forwardRef(
|
|
19
|
+
(de, d) => {
|
|
20
20
|
const {
|
|
21
21
|
item: a,
|
|
22
22
|
template: f,
|
|
23
|
-
contentTemplate:
|
|
24
|
-
onRequestSelection:
|
|
25
|
-
tabIndex:
|
|
23
|
+
contentTemplate: v,
|
|
24
|
+
onRequestSelection: g,
|
|
25
|
+
tabIndex: fe = -1,
|
|
26
26
|
dateFormat: U = "g",
|
|
27
27
|
selected: o,
|
|
28
|
-
allowMessageCollapse:
|
|
28
|
+
allowMessageCollapse: p,
|
|
29
29
|
messageToolbarActions: b,
|
|
30
30
|
messageContextMenuActions: k,
|
|
31
31
|
fileActions: q,
|
|
32
32
|
isSender: C
|
|
33
|
-
} =
|
|
33
|
+
} = de, {
|
|
34
34
|
setReplyToMessage: E,
|
|
35
35
|
messages: X,
|
|
36
|
-
repliedToMessages:
|
|
36
|
+
repliedToMessages: h,
|
|
37
37
|
user: u,
|
|
38
|
-
onToolbarAction:
|
|
39
|
-
onContextMenuAction:
|
|
38
|
+
onToolbarAction: M,
|
|
39
|
+
onContextMenuAction: N,
|
|
40
40
|
onFileAction: Y,
|
|
41
41
|
onDownload: i,
|
|
42
|
-
onResendMessage:
|
|
43
|
-
setShowCopyNotification:
|
|
44
|
-
statusTemplate:
|
|
45
|
-
timestampVisibility:
|
|
46
|
-
onReferencedMessageClick:
|
|
47
|
-
} =
|
|
48
|
-
a != null && a.text &&
|
|
49
|
-
|
|
42
|
+
onResendMessage: D,
|
|
43
|
+
setShowCopyNotification: x,
|
|
44
|
+
statusTemplate: S,
|
|
45
|
+
timestampVisibility: F = "onFocus",
|
|
46
|
+
onReferencedMessageClick: y
|
|
47
|
+
} = Pe(), [$, A] = t.useState(!1), [G, R] = t.useState(!1), [I, ge] = t.useState(!0), [pe, J] = t.useState(!1), l = Oe(), Q = je(), Z = t.useRef({ left: 0, top: 0 }), w = t.useCallback(() => {
|
|
48
|
+
a != null && a.text && ze(a.text), x && (x(!0), setTimeout(() => {
|
|
49
|
+
x(!1);
|
|
50
50
|
}, 3e3));
|
|
51
|
-
}, [a,
|
|
52
|
-
e.stopPropagation(),
|
|
53
|
-
}, []),
|
|
51
|
+
}, [a, x]), L = t.useCallback((e) => {
|
|
52
|
+
e.stopPropagation(), ge((s) => !s);
|
|
53
|
+
}, []), be = t.useCallback(() => {
|
|
54
54
|
J(!1);
|
|
55
|
-
}, []),
|
|
55
|
+
}, []), ke = t.useCallback((e) => {
|
|
56
56
|
(e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") && J(!0);
|
|
57
|
-
}, []),
|
|
57
|
+
}, []), V = t.useRef(null);
|
|
58
58
|
t.useEffect(() => {
|
|
59
|
-
o &&
|
|
59
|
+
o && V.current && V.current.focus();
|
|
60
60
|
}, [o]);
|
|
61
61
|
const z = t.useCallback((e) => {
|
|
62
62
|
Z.current = { left: e.pageX, top: e.pageY }, e.preventDefault(), R(!0), A(!0);
|
|
63
63
|
}, []), _ = t.useCallback(() => {
|
|
64
64
|
R(!1), A(!1);
|
|
65
|
-
}, []),
|
|
66
|
-
(e, s) => e.isDeleted ?
|
|
65
|
+
}, []), T = t.useCallback(
|
|
66
|
+
(e, s) => e.isDeleted ? Ke(s, l) : e.text ? e.text : "",
|
|
67
67
|
[l]
|
|
68
68
|
), ee = t.useCallback(
|
|
69
69
|
(e) => {
|
|
70
70
|
var s;
|
|
71
|
-
(s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ?
|
|
71
|
+
(s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ? w() : e.item.data.id === "reply" && E(a), N && N(e.item.data, e, a)), R(!1), A(!1);
|
|
72
72
|
},
|
|
73
|
-
[a,
|
|
73
|
+
[a, N, E, w]
|
|
74
74
|
), te = t.useCallback(() => {
|
|
75
75
|
if (a.replyToId) {
|
|
76
|
-
const e = se(X, a.replyToId) || (
|
|
76
|
+
const e = se(X, a.replyToId) || (h ? se(h, a.replyToId) : void 0);
|
|
77
77
|
if (e) {
|
|
78
78
|
const s = (n) => {
|
|
79
|
-
n.preventDefault(), n.stopPropagation(),
|
|
79
|
+
n.preventDefault(), n.stopPropagation(), y == null || y(e.id);
|
|
80
80
|
};
|
|
81
81
|
return /* @__PURE__ */ t.createElement(
|
|
82
82
|
"div",
|
|
83
83
|
{
|
|
84
|
-
className:
|
|
84
|
+
className: O(
|
|
85
85
|
"k-message-reference",
|
|
86
86
|
H(u, e) ? "k-message-reference-sender" : "k-message-reference-receiver"
|
|
87
87
|
),
|
|
88
88
|
onClick: s
|
|
89
89
|
},
|
|
90
90
|
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, ne(
|
|
91
|
-
|
|
91
|
+
T(e, H(u, e))
|
|
92
92
|
))
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
return null;
|
|
97
|
-
}, [a.replyToId, X,
|
|
97
|
+
}, [a.replyToId, X, h, u, T, y]), K = t.useCallback(() => {
|
|
98
98
|
const e = [
|
|
99
99
|
{
|
|
100
100
|
id: "reply",
|
|
101
101
|
label: "Reply",
|
|
102
|
-
svgIcon:
|
|
102
|
+
svgIcon: Me
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
id: "copy",
|
|
106
106
|
label: "Copy",
|
|
107
|
-
svgIcon:
|
|
107
|
+
svgIcon: Ne
|
|
108
108
|
}
|
|
109
109
|
], s = k ? [
|
|
110
110
|
...e.map((n) => k.find(
|
|
111
111
|
(m) => m.id === n.id
|
|
112
112
|
) || n),
|
|
113
113
|
...k.filter(
|
|
114
|
-
(n) => !e.some((
|
|
114
|
+
(n) => !e.some((c) => c.id === n.id)
|
|
115
115
|
)
|
|
116
116
|
] : e;
|
|
117
117
|
return /* @__PURE__ */ t.createElement(
|
|
118
|
-
|
|
118
|
+
Le,
|
|
119
119
|
{
|
|
120
120
|
onSelect: ee,
|
|
121
121
|
onClose: _,
|
|
@@ -141,18 +141,18 @@ const je = t.forwardRef(
|
|
|
141
141
|
{
|
|
142
142
|
className: "k-chat-download-button",
|
|
143
143
|
fillMode: "flat",
|
|
144
|
-
svgIcon:
|
|
144
|
+
svgIcon: De,
|
|
145
145
|
size: "small",
|
|
146
146
|
onClick: (e) => {
|
|
147
147
|
e.stopPropagation(), i && i(a.files, a);
|
|
148
148
|
},
|
|
149
149
|
"aria-label": l.toLanguageString(
|
|
150
150
|
le,
|
|
151
|
-
|
|
151
|
+
r[le]
|
|
152
152
|
)
|
|
153
153
|
},
|
|
154
|
-
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, l.toLanguageString(oe,
|
|
155
|
-
)) : null, [a, i, l]),
|
|
154
|
+
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, l.toLanguageString(oe, r[oe]))
|
|
155
|
+
)) : null, [a, i, l]), Ce = t.useCallback(() => {
|
|
156
156
|
if (a.typing)
|
|
157
157
|
return /* @__PURE__ */ t.createElement("div", { className: "k-chat-bubble k-bubble" }, /* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, /* @__PURE__ */ t.createElement("div", { className: "k-typing-indicator" }, /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null))));
|
|
158
158
|
if (f) {
|
|
@@ -162,19 +162,19 @@ const je = t.forwardRef(
|
|
|
162
162
|
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
163
163
|
"div",
|
|
164
164
|
{
|
|
165
|
-
className:
|
|
166
|
-
"k-bubble-expandable":
|
|
167
|
-
"k-expanded":
|
|
165
|
+
className: O("k-chat-bubble", "k-bubble", {
|
|
166
|
+
"k-bubble-expandable": p,
|
|
167
|
+
"k-expanded": p && I,
|
|
168
168
|
"k-selected": o,
|
|
169
169
|
"k-active": G
|
|
170
170
|
}),
|
|
171
|
-
onClick: () =>
|
|
171
|
+
onClick: () => g(o ? void 0 : a.selectionIndex),
|
|
172
172
|
onContextMenu: z
|
|
173
173
|
},
|
|
174
|
-
/* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" },
|
|
175
|
-
|
|
174
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, v ? /* @__PURE__ */ t.createElement(v, { item: a }) : /* @__PURE__ */ t.createElement(t.Fragment, null, (a.text || a.isDeleted || a.replyToId) && /* @__PURE__ */ t.createElement("span", { className: "k-chat-bubble-text" }, !a.isDeleted && te(), ne(
|
|
175
|
+
T(a, H(u, a))
|
|
176
176
|
)), a.files && a.files.length > 0 && /* @__PURE__ */ t.createElement(
|
|
177
|
-
|
|
177
|
+
Be,
|
|
178
178
|
{
|
|
179
179
|
files: a.files,
|
|
180
180
|
message: a,
|
|
@@ -184,101 +184,97 @@ const je = t.forwardRef(
|
|
|
184
184
|
fileActions: q
|
|
185
185
|
}
|
|
186
186
|
), ae())),
|
|
187
|
-
|
|
187
|
+
p && /* @__PURE__ */ t.createElement(
|
|
188
188
|
"span",
|
|
189
189
|
{
|
|
190
190
|
className: "k-bubble-expandable-indicator",
|
|
191
|
-
onClick:
|
|
191
|
+
onClick: L,
|
|
192
192
|
role: "button",
|
|
193
|
-
"aria-label":
|
|
193
|
+
"aria-label": I ? l.toLanguageString(
|
|
194
194
|
ie,
|
|
195
|
-
|
|
195
|
+
r[ie]
|
|
196
196
|
) : l.toLanguageString(
|
|
197
197
|
re,
|
|
198
|
-
|
|
198
|
+
r[re]
|
|
199
199
|
),
|
|
200
200
|
tabIndex: 0,
|
|
201
201
|
onKeyDown: (e) => {
|
|
202
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
202
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), L(e));
|
|
203
203
|
}
|
|
204
204
|
},
|
|
205
|
-
/* @__PURE__ */ t.createElement(j, { icon:
|
|
205
|
+
/* @__PURE__ */ t.createElement(j, { icon: I ? Se : Fe, size: "medium" })
|
|
206
206
|
)
|
|
207
207
|
), K());
|
|
208
208
|
return null;
|
|
209
209
|
}, [
|
|
210
210
|
a,
|
|
211
211
|
f,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
v,
|
|
213
|
+
p,
|
|
214
|
+
I,
|
|
215
215
|
o,
|
|
216
216
|
G,
|
|
217
|
-
|
|
217
|
+
g,
|
|
218
218
|
z,
|
|
219
219
|
te,
|
|
220
|
-
|
|
220
|
+
T,
|
|
221
221
|
u,
|
|
222
222
|
Y,
|
|
223
223
|
q,
|
|
224
224
|
ae,
|
|
225
|
-
|
|
225
|
+
L,
|
|
226
226
|
l,
|
|
227
227
|
K,
|
|
228
228
|
i
|
|
229
|
-
]),
|
|
229
|
+
]), Ee = t.useCallback(() => {
|
|
230
230
|
let e = null;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
x === "hidden" || (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !s }, Q.formatDate(a.timestamp, U)));
|
|
234
|
-
}
|
|
235
|
-
return e;
|
|
236
|
-
}, [a.timestamp, o, U, x, Q]), Ee = t.useCallback(() => {
|
|
231
|
+
return a.timestamp && (F === "hidden" || (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time" }, Q.formatDate(a.timestamp, U)))), e;
|
|
232
|
+
}, [a.timestamp, U, F, Q]), xe = t.useCallback(() => {
|
|
237
233
|
if (!a.status)
|
|
238
234
|
return null;
|
|
239
235
|
let e;
|
|
240
|
-
if (
|
|
241
|
-
e = t.createElement(
|
|
236
|
+
if (S)
|
|
237
|
+
e = t.createElement(S, { item: a });
|
|
242
238
|
else {
|
|
243
239
|
const s = typeof a.status == "object" && a.status !== null;
|
|
244
|
-
let n,
|
|
240
|
+
let n, c, m;
|
|
245
241
|
if (s) {
|
|
246
|
-
const
|
|
247
|
-
n =
|
|
242
|
+
const B = a.status;
|
|
243
|
+
n = B.text, c = B.icon, m = B.svgIcon;
|
|
248
244
|
} else
|
|
249
245
|
n = a.status;
|
|
250
|
-
let
|
|
251
|
-
|
|
246
|
+
let P = null;
|
|
247
|
+
c ? P = /* @__PURE__ */ t.createElement(ve, { name: c, size: "xsmall" }) : m && (P = /* @__PURE__ */ t.createElement(j, { icon: m, size: "xsmall" })), e = /* @__PURE__ */ t.createElement(t.Fragment, null, P, n);
|
|
252
248
|
}
|
|
253
249
|
return /* @__PURE__ */ t.createElement("span", { className: "k-message-status" }, e);
|
|
254
|
-
}, [a,
|
|
250
|
+
}, [a, S]), ye = t.useCallback(() => {
|
|
255
251
|
let e = null;
|
|
256
252
|
if (a.isFailed) {
|
|
257
253
|
const s = l.toLanguageString(
|
|
258
254
|
ce,
|
|
259
|
-
|
|
255
|
+
r[ce]
|
|
260
256
|
);
|
|
261
|
-
e = /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-content" }, /* @__PURE__ */ t.createElement(j, { icon:
|
|
257
|
+
e = /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-content" }, /* @__PURE__ */ t.createElement(j, { icon: Ae, size: "xsmall" }), /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-text" }, s));
|
|
262
258
|
}
|
|
263
259
|
return e;
|
|
264
|
-
}, [a, l]),
|
|
260
|
+
}, [a, l]), Ie = t.useCallback(() => {
|
|
265
261
|
let e = null;
|
|
266
262
|
if (a.isFailed) {
|
|
267
263
|
const s = l.toLanguageString(
|
|
268
264
|
ue,
|
|
269
|
-
|
|
265
|
+
r[ue]
|
|
270
266
|
);
|
|
271
267
|
e = /* @__PURE__ */ t.createElement(
|
|
272
268
|
W,
|
|
273
269
|
{
|
|
274
270
|
fillMode: "clear",
|
|
275
|
-
size: "
|
|
271
|
+
size: "xs",
|
|
276
272
|
className: "k-resend-button",
|
|
277
|
-
svgIcon:
|
|
273
|
+
svgIcon: Re,
|
|
278
274
|
"aria-label": s,
|
|
279
275
|
title: s,
|
|
280
276
|
onClick: (n) => {
|
|
281
|
-
n.stopPropagation(),
|
|
277
|
+
n.stopPropagation(), D && D({
|
|
282
278
|
message: a,
|
|
283
279
|
syntheticEvent: n,
|
|
284
280
|
nativeEvent: n.nativeEvent,
|
|
@@ -289,52 +285,72 @@ const je = t.forwardRef(
|
|
|
289
285
|
);
|
|
290
286
|
}
|
|
291
287
|
return e;
|
|
292
|
-
}, [a, l,
|
|
288
|
+
}, [a, l, D]), we = t.useCallback(() => O(
|
|
293
289
|
{
|
|
294
290
|
"k-focus": o,
|
|
295
291
|
"k-message-removed": a.isDeleted,
|
|
296
292
|
"k-message-failed": a.isFailed
|
|
297
293
|
},
|
|
298
294
|
"k-message"
|
|
299
|
-
), [o, a.isDeleted, a.isFailed]),
|
|
300
|
-
|
|
295
|
+
), [o, a.isDeleted, a.isFailed]), Te = t.useCallback(() => b && b.length > 0 && /* @__PURE__ */ t.createElement(
|
|
296
|
+
he,
|
|
301
297
|
{
|
|
302
|
-
|
|
298
|
+
className: "k-chat-message-toolbar",
|
|
303
299
|
fillMode: "flat",
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
300
|
+
ariaLabel: l.toLanguageString(
|
|
301
|
+
me,
|
|
302
|
+
r[me]
|
|
303
|
+
)
|
|
304
|
+
},
|
|
305
|
+
b.map((e) => e.id === "delete" && !C ? null : /* @__PURE__ */ t.createElement(
|
|
306
|
+
W,
|
|
307
|
+
{
|
|
308
|
+
key: e.id,
|
|
309
|
+
fillMode: "flat",
|
|
310
|
+
className: "k-toolbar-button",
|
|
311
|
+
icon: e.icon,
|
|
312
|
+
svgIcon: e.svgIcon,
|
|
313
|
+
"aria-label": e.label,
|
|
314
|
+
onClick: (s) => {
|
|
315
|
+
s.stopPropagation(), e.id === "copy" && !a.isDeleted ? w() : e.id === "reply" && E(a), M && M(e, s, a);
|
|
316
|
+
},
|
|
317
|
+
onMouseDown: (s) => s.preventDefault()
|
|
318
|
+
}
|
|
319
|
+
))
|
|
320
|
+
), [
|
|
321
|
+
w,
|
|
322
|
+
C,
|
|
323
|
+
a,
|
|
324
|
+
l,
|
|
325
|
+
b,
|
|
326
|
+
M,
|
|
327
|
+
E
|
|
328
|
+
]);
|
|
313
329
|
return /* @__PURE__ */ t.createElement(
|
|
314
330
|
"div",
|
|
315
331
|
{
|
|
316
332
|
key: a.id,
|
|
317
333
|
"data-message-id": a.id,
|
|
318
|
-
className:
|
|
319
|
-
tabIndex:
|
|
320
|
-
onMouseDown:
|
|
321
|
-
onKeyDown:
|
|
334
|
+
className: we(),
|
|
335
|
+
tabIndex: fe,
|
|
336
|
+
onMouseDown: be,
|
|
337
|
+
onKeyDown: ke,
|
|
322
338
|
onFocus: (e) => {
|
|
323
|
-
pe &&
|
|
339
|
+
pe && g(a.selectionIndex);
|
|
324
340
|
},
|
|
325
341
|
ref: (e) => {
|
|
326
|
-
|
|
342
|
+
V.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
|
|
327
343
|
},
|
|
328
344
|
onContextMenu: f ? z : void 0
|
|
329
345
|
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
(a.status || a.timestamp &&
|
|
333
|
-
|
|
346
|
+
Ie(),
|
|
347
|
+
Ce(),
|
|
348
|
+
(a.status || a.timestamp && F !== "hidden" || a.isFailed) && /* @__PURE__ */ t.createElement("div", { className: "k-message-info" }, xe(), Ee(), ye()),
|
|
349
|
+
Te()
|
|
334
350
|
);
|
|
335
351
|
}
|
|
336
352
|
);
|
|
337
|
-
|
|
353
|
+
We.displayName = "ChatMessage";
|
|
338
354
|
export {
|
|
339
|
-
|
|
355
|
+
We as ChatMessage
|
|
340
356
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";const n=require("react"),a=require("@progress/kendo-react-buttons");function o(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const s=o(n),
|
|
8
|
+
"use strict";const n=require("react"),a=require("@progress/kendo-react-buttons");function o(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const s=o(n),l=e=>s.createElement(a.Toolbar,{className:"k-chat-header",size:"small"},e.children);module.exports=l;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
9
|
import { Toolbar as r } from "@progress/kendo-react-buttons";
|
|
10
|
-
const o = (e) => /* @__PURE__ */ a.createElement(r, { className: "k-chat-header" }, e.children);
|
|
10
|
+
const o = (e) => /* @__PURE__ */ a.createElement(r, { className: "k-chat-header", size: "small" }, e.children);
|
|
11
11
|
export {
|
|
12
12
|
o as default
|
|
13
13
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";const Z=require("@progress/kendo-react-common"),$=require("react"),ee=require("@progress/kendo-react-buttons"),te=require("./SuggestionsGroup.js"),ne=require("@progress/kendo-svg-icons"),ae=require("./ChatContext.js"),oe=require("@progress/kendo-react-intl"),H=require("../utils.js"),n=require("../../messages/index.js"),re=require("../../prompt-box/PromptBoxUploadButton.js"),se=require("../../prompt-box/PromptBox.js");function le(l){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(c,r,i.get?i:{enumerable:!0,get:()=>l[r]})}}return c.default=l,Object.freeze(c)}const t=le($),_=t.memo(({affixProps:l,uploadConfig:c,localizationService:r,onFilesSelect:i,onFileRemove:
|
|
8
|
+
"use strict";const Z=require("@progress/kendo-react-common"),$=require("react"),ee=require("@progress/kendo-react-buttons"),te=require("./SuggestionsGroup.js"),ne=require("@progress/kendo-svg-icons"),ae=require("./ChatContext.js"),oe=require("@progress/kendo-react-intl"),H=require("../utils.js"),n=require("../../messages/index.js"),re=require("../../prompt-box/PromptBoxUploadButton.js"),se=require("../../prompt-box/PromptBox.js");function le(l){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(c,r,i.get?i:{enumerable:!0,get:()=>l[r]})}}return c.default=l,Object.freeze(c)}const t=le($),_=t.memo(({affixProps:l,uploadConfig:c,localizationService:r,onFilesSelect:i,onFileRemove:h})=>{const k=typeof c=="object"?c:{};return c!==!1?t.createElement(re.PromptBoxUploadButton,{...l.uploadButtonProps,fillMode:"clear","aria-label":r.toLanguageString(n.attachFile,n.messages[n.attachFile]),title:r.toLanguageString(n.attachFile,n.messages[n.attachFile]),...k,onSelectAttachments:i,onRemoveAttachment:h}):null});_.displayName="UploadButtonAffix";const J=t.forwardRef((l,c)=>{const{onSendMessage:r,isDirectionRightToLeft:i,placeholder:h,MessageBox:k,suggestions:b,onSuggestionClick:K,inputValue:E,onInputValueChange:f,suggestionTemplate:Q,sendButtonConfig:A,onInputClick:F,suggestionsLayout:W,dir:X,messageBoxSettings:e,loading:x}=l,{replyToMessage:u,setReplyToMessage:y,user:M,speechToTextConfig:P,uploadConfig:I}=ae.useChatContext(),[Y,L]=t.useState(""),[w,v]=t.useState([]),T=t.useRef(null),o=oe.useLocalization(),m=E!==void 0,R=m?E:Y,p=t.useCallback(()=>{T.current!==null&&T.current.focus()},[]);t.useEffect(()=>{u&&p()},[u,p]);const S=t.useCallback(a=>{if(a.preventDefault(),r){const C={id:"",author:M,text:R||"",timestamp:new Date,replyToId:u?u.id:void 0,files:w.map(g=>({name:g.name,size:g.size,type:g.extension,rawFile:g.getRawFile?g.getRawFile():g}))};y(null),r(C,a),v([]),m||L(""),f&&f(""),p()}},[r,R,M,u,w,y,f,p,m]);t.useImperativeHandle(c,()=>({focusInput:p}),[p]);const q=t.useCallback(a=>{v(s=>s.filter(C=>C.name!==a))},[]),N=t.useCallback((a,s)=>a.isDeleted?H.getDeletedMessageText(s,o):a.text,[o]),D=t.useCallback(()=>{if(u){const a=H.isAuthor(M,u);return t.createElement("div",{className:Z.classNames("k-message-reference",a?"k-message-reference-sender":"k-message-reference-receiver")},t.createElement("div",{className:"k-message-reference-content"},N(u,a)),t.createElement("span",{className:"k-spacer"}),t.createElement(ee.Button,{fillMode:"flat",size:"xs",svgIcon:ne.xCircleIcon,onClick:()=>y(null),"aria-label":o.toLanguageString(n.closeReply,n.messages[n.closeReply]),title:o.toLanguageString(n.closeReply,n.messages[n.closeReply])}))}return null},[u,M,N,y,o]),j=t.useCallback(a=>{try{const s=Array.from(a.allFiles);v(s)}catch{}},[]),B=t.useCallback(a=>{const s=a.value;m||L(s),f&&f(s||"")},[m,f]),G=t.useCallback(a=>{S(a.syntheticEvent)},[S]),d=t.useCallback(a=>a?typeof a=="function"?a():a:null,[]),U=t.useCallback(a=>t.createElement(t.Fragment,null,t.createElement(_,{affixProps:a,uploadConfig:I,localizationService:o,onFilesSelect:j,onFileRemove:q}),d(e==null?void 0:e.startAffix)),[I,o,j,q,e==null?void 0:e.startAffix,d]),V=t.useCallback(()=>d(e==null?void 0:e.endAffix),[e==null?void 0:e.endAffix,d]),z=t.useCallback(()=>d(e==null?void 0:e.topAffix),[e==null?void 0:e.topAffix,d]),O=t.useMemo(()=>{const a=typeof A=="object"?A:{},C=A!==!1?{"aria-label":x?o.toLanguageString(n.chatStopGenerating,n.messages[n.chatStopGenerating]):o.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),title:x?o.toLanguageString(n.chatStopGenerating,n.messages[n.chatStopGenerating]):o.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),dir:i?"rtl":void 0,...a}:!1;return t.createElement(se.PromptBox,{header:D(),ref:T,placeholder:h,value:R,onChange:B,onPromptAction:G,mode:(e==null?void 0:e.mode)||"multi",rows:(e==null?void 0:e.rows)||2,maxTextAreaHeight:(e==null?void 0:e.maxTextAreaHeight)||"110",loading:x,speechToTextButtonConfig:P,actionButtonConfig:C,attachments:w,startAffix:U,endAffix:e!=null&&e.endAffix?V:void 0,topAffix:e!=null&&e.topAffix?z:void 0,inputAttributes:{onClick:F,"aria-label":o.toLanguageString(n.newMessageMessageInput,n.messages[n.newMessageMessageInput])}})},[h,R,B,G,e,x,P,A,w,D,U,V,z,o,i,F]);return t.createElement("div",{className:"k-message-box-wrapper"},b&&b.length>0&&t.createElement(te.SuggestionGroup,{onSuggestionClick:K,suggestions:b,suggestionTemplate:Q,suggestionsLayout:W,dir:X}),k?t.createElement(k,{messageInput:O}):O)});J.displayName="NewMessage";module.exports=J;
|