@progress/kendo-react-conversational-ui 13.4.0-develop.2 → 13.4.0-develop.4
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/api/message.interface.d.ts +87 -9
- package/chat/ChatPropsAndState.d.ts +108 -9
- package/chat/Events.d.ts +9 -0
- package/chat/components/ActionGroup.js +1 -1
- package/chat/components/ActionGroup.mjs +58 -48
- package/chat/components/Chat.d.ts +1 -1
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +318 -269
- package/chat/components/ChatContext.d.ts +6 -3
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +237 -177
- package/chat/components/Header.js +1 -1
- package/chat/components/Header.mjs +3 -3
- package/chat/components/NewMessage.d.ts +5 -3
- package/chat/components/NewMessage.js +1 -1
- package/chat/components/NewMessage.mjs +174 -226
- package/chat/components/ScrollButtonsWrapper.js +1 -1
- package/chat/components/ScrollButtonsWrapper.mjs +34 -40
- package/chat/components/SuggestionsGroup.js +1 -1
- package/chat/components/SuggestionsGroup.mjs +40 -39
- package/chat/components/elements/FileBox.js +1 -1
- package/chat/components/elements/FileBox.mjs +33 -41
- package/chat/components/elements/PinnedMessage.js +1 -1
- package/chat/components/elements/PinnedMessage.mjs +24 -22
- package/chat/hooks/useScrollWithButtons.d.ts +4 -0
- package/chat/hooks/useScrollWithButtons.js +1 -1
- package/chat/hooks/useScrollWithButtons.mjs +25 -23
- package/chat/utils/fieldMapping.d.ts +1 -1
- package/chat/utils/fieldMapping.js +1 -1
- package/chat/utils/fieldMapping.mjs +37 -34
- package/chat/utils/scroll.d.ts +15 -1
- package/chat/utils/scroll.js +3 -3
- package/chat/utils/scroll.mjs +92 -65
- package/chat/utils.d.ts +4 -1
- package/chat/utils.js +1 -1
- package/chat/utils.mjs +37 -37
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/index.d.mts +6 -0
- package/index.d.ts +6 -0
- package/index.js +1 -1
- package/index.mjs +39 -31
- package/messages/index.d.ts +50 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +60 -40
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +11 -11
- package/prompt-box/Events.d.ts +66 -0
- package/prompt-box/FileBox.d.ts +22 -0
- package/prompt-box/FileBox.js +8 -0
- package/prompt-box/FileBox.mjs +72 -0
- package/prompt-box/PromptBox.d.ts +35 -0
- package/prompt-box/PromptBox.js +8 -0
- package/prompt-box/PromptBox.mjs +424 -0
- package/prompt-box/PromptBoxActionButton.d.ts +32 -0
- package/prompt-box/PromptBoxActionButton.js +8 -0
- package/prompt-box/PromptBoxActionButton.mjs +14 -0
- package/prompt-box/PromptBoxSpeechToTextButton.d.ts +32 -0
- package/prompt-box/PromptBoxSpeechToTextButton.js +8 -0
- package/prompt-box/PromptBoxSpeechToTextButton.mjs +14 -0
- package/prompt-box/PromptBoxUploadButton.d.ts +108 -0
- package/prompt-box/PromptBoxUploadButton.js +8 -0
- package/prompt-box/PromptBoxUploadButton.mjs +54 -0
- package/prompt-box/interfaces/PromptBoxProps.d.ts +390 -0
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { Message
|
|
8
|
+
import { Message } from '../../api/message.interface.js';
|
|
9
|
+
import { User } from '../../api/user.interface.js';
|
|
9
10
|
import { FileAction, MessageAction } from './ChatMessage.js';
|
|
10
11
|
import { StatusTemplateProps, UserStatusTemplateProps, ChatFile, FilesLayoutMode, TimestampVisibilityMode } from '../ChatPropsAndState.js';
|
|
11
12
|
import { SpeechToTextButtonProps } from '@progress/kendo-react-buttons';
|
|
12
|
-
import {
|
|
13
|
+
import { UploadButtonProps } from '../../prompt-box/interfaces/PromptBoxProps.js';
|
|
14
|
+
import { ChatResendMessageEvent } from '../Events.js';
|
|
13
15
|
import * as React from 'react';
|
|
14
16
|
/**
|
|
15
17
|
* @hidden
|
|
@@ -25,12 +27,13 @@ interface ChatContextType {
|
|
|
25
27
|
onContextMenuAction?: (action: MessageAction, event: React.SyntheticEvent<any>, target: Message) => void;
|
|
26
28
|
onFileAction?: (action: FileAction, event: React.SyntheticEvent<any>, target: ChatFile) => void;
|
|
27
29
|
onDownload?: (files: ChatFile[], message: Message) => void;
|
|
30
|
+
onResendMessage?: (event: ChatResendMessageEvent) => void;
|
|
28
31
|
fileActions?: MessageAction[];
|
|
29
32
|
setShowCopyNotification?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
30
33
|
statusTemplate?: React.ComponentType<StatusTemplateProps>;
|
|
31
34
|
userStatusTemplate?: React.ComponentType<UserStatusTemplateProps>;
|
|
32
35
|
speechToTextConfig?: boolean | SpeechToTextButtonProps;
|
|
33
|
-
uploadConfig?: boolean |
|
|
36
|
+
uploadConfig?: boolean | UploadButtonProps;
|
|
34
37
|
messageFilesLayout?: FilesLayoutMode;
|
|
35
38
|
timestampVisibility?: TimestampVisibilityMode;
|
|
36
39
|
}
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=require("react"),f=require("@progress/kendo-react-common"),D=require("@progress/kendo-react-buttons"),p=require("@progress/kendo-svg-icons"),ae=require("@progress/kendo-react-intl"),ne=require("@progress/kendo-react-layout"),i=require("../utils.js"),ye=require("./ChatContext.js"),Ee=require("./elements/FileBox.js"),l=require("../../messages/index.js");function xe(d){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const m=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(r,e,m.get?m:{enumerable:!0,get:()=>d[e]})}}return r.default=d,Object.freeze(r)}const s=xe(Ce),le=s.forwardRef((d,r)=>{const{item:e,template:m,contentTemplate:F,onRequestSelection:C,tabIndex:oe=-1,dateFormat:_="g",selected:c,allowMessageCollapse:y,messageToolbarActions:E,messageContextMenuActions:x,fileActions:H,isSender:I}=d,{setReplyToMessage:w,messages:U,user:b,internalScrollContainerRef:h,onToolbarAction:A,onContextMenuAction:R,onFileAction:X,onDownload:g,onResendMessage:L,setShowCopyNotification:M,statusTemplate:q,timestampVisibility:v="onFocus"}=ye.useChatContext(),[Y,O]=s.useState(!1),[G,V]=s.useState(!1),[T,ce]=s.useState(!0),[ie,J]=s.useState(!1),o=ae.useLocalization(),Q=ae.useInternationalization(),Z=s.useRef({left:0,top:0}),N=s.useCallback(()=>{e!=null&&e.text&&i.copyToClipboard(e.text),M&&(M(!0),setTimeout(()=>{M(!1)},3e3))},[e,M]),z=s.useCallback(t=>{t.stopPropagation(),ce(a=>!a)},[]),re=s.useCallback(()=>{J(!1)},[]),ue=s.useCallback(t=>{(t.key==="Tab"||t.key==="Enter"||t.key===" "||t.key==="ArrowUp"||t.key==="ArrowDown")&&J(!0)},[]),j=s.useRef(null);s.useEffect(()=>{c&&j.current&&j.current.focus()},[c]);const B=s.useCallback(t=>{Z.current={left:t.pageX,top:t.pageY},t.preventDefault(),V(!0),O(!0)},[]),$=s.useCallback(()=>{V(!1),O(!1)},[]),S=s.useCallback((t,a)=>t.isDeleted?i.getDeletedMessageText(a,o):t.text?t.text:"",[o]),ee=s.useCallback(t=>{var a;(a=t.item)!=null&&a.text&&(t.item.data.id==="copy"&&!e.isDeleted?N():t.item.data.id==="reply"&&w(e),R&&R(t.item.data,t,e)),V(!1),O(!1)},[e,R,w,N]),te=s.useCallback(()=>{if(e.replyToId){const t=i.getMessageById(U,e.replyToId);if(t){const a=n=>{n.preventDefault(),n.stopPropagation();const u=h==null?void 0:h.current;i.scrollToMessageById(t.id,u)};return s.createElement("div",{className:f.classNames("k-message-reference",i.isAuthor(b,t)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:a},s.createElement("div",{className:"k-message-reference-content"},i.convertTextToLinkedContent(S(t,i.isAuthor(b,t)))))}}return null},[e.replyToId,U,b,S,h]),P=s.useCallback(()=>{const t=[{id:"reply",label:"Reply",svgIcon:p.undoIcon},{id:"copy",label:"Copy",svgIcon:p.copyIcon}],a=x?[...t.map(n=>x.find(k=>k.id===n.id)||n),...x.filter(n=>!t.some(u=>u.id===n.id))]:t;return s.createElement(ne.ContextMenu,{onSelect:ee,onClose:$,vertical:!0,show:Y,offset:Z.current},a.map(n=>n.id==="delete"&&!I?null:s.createElement(ne.MenuItem,{key:n.id,text:n.label,icon:n.icon,svgIcon:n.svgIcon,data:n})))},[x,ee,$,Y,I]),se=s.useCallback(()=>e.files&&e.files.length>1?s.createElement("div",{className:"k-chat-download-button-wrapper"},s.createElement(D.Button,{className:"k-chat-download-button",fillMode:"flat",svgIcon:p.downloadLightIcon,size:"small",onClick:t=>{t.stopPropagation(),g&&g(e.files,e)},"aria-label":o.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},s.createElement("span",{className:"k-button-text"},o.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[e,g,o]),de=s.useCallback(()=>{if(e.typing)return s.createElement("div",{className:"k-chat-bubble k-bubble"},s.createElement("div",{className:"k-bubble-content"},s.createElement("div",{className:"k-typing-indicator"},s.createElement("span",null),s.createElement("span",null),s.createElement("span",null))));if(m){const t=m;return s.createElement(s.Fragment,null,s.createElement(t,{item:e}),P())}else if(e.text||e.files&&e.files.length>0)return s.createElement(s.Fragment,null,s.createElement("div",{className:f.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":y,"k-expanded":y&&T,"k-selected":c,"k-active":G}),onClick:()=>C(c?void 0:e.selectionIndex),onContextMenu:B},s.createElement("div",{className:"k-bubble-content"},F?s.createElement(F,{item:e}):s.createElement(s.Fragment,null,(e.text||e.isDeleted||e.replyToId)&&s.createElement("span",{className:"k-chat-bubble-text"},!e.isDeleted&&te(),i.convertTextToLinkedContent(S(e,i.isAuthor(b,e)))),e.files&&e.files.length>0&&s.createElement(Ee,{files:e.files,message:e,onFileAction:X,onDownload:t=>g==null?void 0:g(t,e),renderInTextarea:!1,fileActions:H}),se())),y&&s.createElement("span",{className:"k-bubble-expandable-indicator",onClick:z,role:"button","aria-label":T?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(),z(t))}},s.createElement(f.IconWrap,{icon:T?p.chevronUpIcon:p.chevronDownIcon,size:"medium"}))),P());return null},[e,m,F,y,T,c,G,C,B,te,S,b,X,H,se,z,o,P,g]),me=s.useCallback(()=>{let t=null;if(e.timestamp){const a=v==="onFocus"&&c;v==="hidden"||(t=s.createElement("time",{className:"k-message-time","aria-hidden":!a},Q.formatDate(e.timestamp,_)))}return t},[e.timestamp,c,_,v,Q]),ge=s.useCallback(()=>{if(!e.status)return null;let t;if(q)t=s.createElement(q,{item:e});else{const a=typeof e.status=="object"&&e.status!==null;let n,u,k;if(a){const W=e.status;n=W.text,u=W.icon,k=W.svgIcon}else n=e.status;let K=null;u?K=s.createElement(f.Icon,{name:u,size:"xsmall"}):k&&(K=s.createElement(f.IconWrap,{icon:k,size:"xsmall"})),t=s.createElement(s.Fragment,null,K,n)}return s.createElement("span",{className:"k-message-status"},t)},[e,q]),fe=s.useCallback(()=>{let t=null;if(e.isFailed){const a=o.toLanguageString(l.messageFailed,l.messages[l.messageFailed]);t=s.createElement("span",{className:"k-message-failed-content"},s.createElement(f.IconWrap,{icon:p.warningTriangleIcon,size:"xsmall"}),s.createElement("span",{className:"k-message-failed-text"},a))}return t},[e,o]),pe=s.useCallback(()=>{let t=null;if(e.isFailed){const a=o.toLanguageString(l.retryMessage,l.messages[l.retryMessage]);t=s.createElement(D.Button,{fillMode:"clear",size:"small",className:"k-resend-button",svgIcon:p.arrowRotateCwOutlineIcon,"aria-label":a,title:a,onClick:n=>{n.stopPropagation(),L&&L({message:e,syntheticEvent:n,nativeEvent:n.nativeEvent,target:n.target})}})}return t},[e,o,L]),be=s.useCallback(()=>f.classNames({"k-focus":c,"k-message-removed":e.isDeleted,"k-message-failed":e.isFailed},"k-message"),[c,e.isDeleted,e.isFailed]),ke=s.useCallback(()=>E&&E.length>0&&s.createElement(D.Toolbar,{className:"k-chat-message-toolbar",fillMode:"flat"},E.map(t=>t.id==="delete"&&!I?null:s.createElement(D.Button,{key:t.id,fillMode:"flat",className:"k-toolbar-button",icon:t.icon,svgIcon:t.svgIcon,onClick:a=>{a.stopPropagation(),t.id==="copy"&&!e.isDeleted?N():t.id==="reply"&&w(e),A&&A(t,a,e)},onMouseDown:a=>a.preventDefault()}))),[N,I,e,E,A,w]);return s.createElement("div",{"data-message-id":e.id,className:be(),tabIndex:oe,onMouseDown:re,onKeyDown:ue,onFocus:t=>{ie&&C(e.selectionIndex)},ref:t=>{j.current=t,typeof r=="function"?r(t):r&&(r.current=t)},onContextMenu:m?B:void 0},pe(),de(),(e.status||e.timestamp&&v!=="hidden"||e.isFailed)&&s.createElement("div",{className:"k-message-info"},ge(),me(),fe()),ke())});le.displayName="ChatMessage";exports.ChatMessage=le;
|
|
@@ -6,275 +6,335 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { classNames as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { undoIcon as
|
|
12
|
-
import { useLocalization as
|
|
13
|
-
import { ContextMenu as
|
|
14
|
-
import { copyToClipboard as
|
|
15
|
-
import { useChatContext as
|
|
16
|
-
import
|
|
17
|
-
import { downloadAllFiles as
|
|
18
|
-
const
|
|
19
|
-
(
|
|
9
|
+
import { classNames as O, IconWrap as P, Icon as Ie } from "@progress/kendo-react-common";
|
|
10
|
+
import { Button as j, Toolbar as we } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { undoIcon as he, copyIcon as ve, downloadLightIcon as Me, chevronUpIcon as Te, chevronDownIcon as Ne, warningTriangleIcon as De, arrowRotateCwOutlineIcon as Se } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { useLocalization as Fe, useInternationalization as Ae } from "@progress/kendo-react-intl";
|
|
13
|
+
import { ContextMenu as Re, MenuItem as Ve } from "@progress/kendo-react-layout";
|
|
14
|
+
import { copyToClipboard as Le, getDeletedMessageText as ze, getMessageById as Be, isAuthor as W, convertTextToLinkedContent as ae, scrollToMessageById as Ke } from "../utils.mjs";
|
|
15
|
+
import { useChatContext as Oe } from "./ChatContext.mjs";
|
|
16
|
+
import Pe from "./elements/FileBox.mjs";
|
|
17
|
+
import { downloadAllFiles as se, messages as c, downloadAll as ne, collapseMessage as le, expandMessage as oe, messageFailed as ie, retryMessage as re } from "../../messages/index.mjs";
|
|
18
|
+
const je = t.forwardRef(
|
|
19
|
+
(ce, d) => {
|
|
20
20
|
const {
|
|
21
|
-
item:
|
|
22
|
-
template:
|
|
23
|
-
contentTemplate:
|
|
24
|
-
onRequestSelection:
|
|
25
|
-
tabIndex:
|
|
26
|
-
dateFormat:
|
|
27
|
-
selected:
|
|
28
|
-
allowMessageCollapse:
|
|
29
|
-
messageToolbarActions:
|
|
30
|
-
messageContextMenuActions:
|
|
31
|
-
fileActions:
|
|
32
|
-
isSender:
|
|
33
|
-
} =
|
|
34
|
-
setReplyToMessage:
|
|
35
|
-
messages:
|
|
36
|
-
user:
|
|
37
|
-
internalScrollContainerRef:
|
|
38
|
-
onToolbarAction:
|
|
39
|
-
onContextMenuAction:
|
|
40
|
-
onFileAction:
|
|
21
|
+
item: a,
|
|
22
|
+
template: f,
|
|
23
|
+
contentTemplate: M,
|
|
24
|
+
onRequestSelection: g,
|
|
25
|
+
tabIndex: ue = -1,
|
|
26
|
+
dateFormat: H = "g",
|
|
27
|
+
selected: o,
|
|
28
|
+
allowMessageCollapse: p,
|
|
29
|
+
messageToolbarActions: b,
|
|
30
|
+
messageContextMenuActions: k,
|
|
31
|
+
fileActions: U,
|
|
32
|
+
isSender: C
|
|
33
|
+
} = ce, {
|
|
34
|
+
setReplyToMessage: E,
|
|
35
|
+
messages: q,
|
|
36
|
+
user: u,
|
|
37
|
+
internalScrollContainerRef: x,
|
|
38
|
+
onToolbarAction: T,
|
|
39
|
+
onContextMenuAction: N,
|
|
40
|
+
onFileAction: X,
|
|
41
41
|
onDownload: r,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
onResendMessage: D,
|
|
43
|
+
setShowCopyNotification: y,
|
|
44
|
+
statusTemplate: S,
|
|
45
|
+
timestampVisibility: I = "onFocus"
|
|
46
|
+
} = Oe(), [Y, F] = t.useState(!1), [$, A] = t.useState(!1), [w, me] = t.useState(!0), [de, G] = t.useState(!1), l = Fe(), J = Ae(), Q = t.useRef({ left: 0, top: 0 }), h = t.useCallback(() => {
|
|
47
|
+
a != null && a.text && Le(a.text), y && (y(!0), setTimeout(() => {
|
|
48
|
+
y(!1);
|
|
48
49
|
}, 3e3));
|
|
49
|
-
}, [
|
|
50
|
-
e.stopPropagation(),
|
|
51
|
-
}, []),
|
|
52
|
-
|
|
53
|
-
}, []),
|
|
54
|
-
(e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") &&
|
|
55
|
-
}, []),
|
|
50
|
+
}, [a, y]), R = t.useCallback((e) => {
|
|
51
|
+
e.stopPropagation(), me((s) => !s);
|
|
52
|
+
}, []), fe = t.useCallback(() => {
|
|
53
|
+
G(!1);
|
|
54
|
+
}, []), ge = t.useCallback((e) => {
|
|
55
|
+
(e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") && G(!0);
|
|
56
|
+
}, []), V = t.useRef(null);
|
|
56
57
|
t.useEffect(() => {
|
|
57
|
-
|
|
58
|
-
}, [
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
}, []),
|
|
62
|
-
A(!1),
|
|
63
|
-
}, []),
|
|
64
|
-
(e,
|
|
65
|
-
[
|
|
66
|
-
),
|
|
58
|
+
o && V.current && V.current.focus();
|
|
59
|
+
}, [o]);
|
|
60
|
+
const L = t.useCallback((e) => {
|
|
61
|
+
Q.current = { left: e.pageX, top: e.pageY }, e.preventDefault(), A(!0), F(!0);
|
|
62
|
+
}, []), Z = t.useCallback(() => {
|
|
63
|
+
A(!1), F(!1);
|
|
64
|
+
}, []), v = t.useCallback(
|
|
65
|
+
(e, s) => e.isDeleted ? ze(s, l) : e.text ? e.text : "",
|
|
66
|
+
[l]
|
|
67
|
+
), _ = t.useCallback(
|
|
67
68
|
(e) => {
|
|
68
|
-
var
|
|
69
|
-
(
|
|
69
|
+
var s;
|
|
70
|
+
(s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ? h() : e.item.data.id === "reply" && E(a), N && N(e.item.data, e, a)), A(!1), F(!1);
|
|
70
71
|
},
|
|
71
|
-
[
|
|
72
|
-
),
|
|
73
|
-
if (
|
|
74
|
-
const e =
|
|
72
|
+
[a, N, E, h]
|
|
73
|
+
), ee = t.useCallback(() => {
|
|
74
|
+
if (a.replyToId) {
|
|
75
|
+
const e = Be(q, a.replyToId);
|
|
75
76
|
if (e) {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
77
|
+
const s = (n) => {
|
|
78
|
+
n.preventDefault(), n.stopPropagation();
|
|
79
|
+
const i = x == null ? void 0 : x.current;
|
|
80
|
+
Ke(e.id, i);
|
|
80
81
|
};
|
|
81
82
|
return /* @__PURE__ */ t.createElement(
|
|
82
83
|
"div",
|
|
83
84
|
{
|
|
84
|
-
className:
|
|
85
|
+
className: O(
|
|
85
86
|
"k-message-reference",
|
|
86
|
-
|
|
87
|
+
W(u, e) ? "k-message-reference-sender" : "k-message-reference-receiver"
|
|
87
88
|
),
|
|
88
|
-
onClick:
|
|
89
|
+
onClick: s
|
|
89
90
|
},
|
|
90
|
-
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" },
|
|
91
|
-
|
|
91
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, ae(
|
|
92
|
+
v(e, W(u, e))
|
|
92
93
|
))
|
|
93
94
|
);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
return null;
|
|
97
|
-
}, [
|
|
98
|
+
}, [a.replyToId, q, u, v, x]), z = t.useCallback(() => {
|
|
98
99
|
const e = [
|
|
99
100
|
{
|
|
100
101
|
id: "reply",
|
|
101
102
|
label: "Reply",
|
|
102
|
-
svgIcon:
|
|
103
|
+
svgIcon: he
|
|
103
104
|
},
|
|
104
105
|
{
|
|
105
106
|
id: "copy",
|
|
106
107
|
label: "Copy",
|
|
107
|
-
svgIcon:
|
|
108
|
+
svgIcon: ve
|
|
108
109
|
}
|
|
109
|
-
],
|
|
110
|
-
...e.map((
|
|
111
|
-
(
|
|
112
|
-
) ||
|
|
113
|
-
...
|
|
114
|
-
(
|
|
110
|
+
], s = k ? [
|
|
111
|
+
...e.map((n) => k.find(
|
|
112
|
+
(m) => m.id === n.id
|
|
113
|
+
) || n),
|
|
114
|
+
...k.filter(
|
|
115
|
+
(n) => !e.some((i) => i.id === n.id)
|
|
115
116
|
)
|
|
116
117
|
] : e;
|
|
117
118
|
return /* @__PURE__ */ t.createElement(
|
|
118
|
-
|
|
119
|
+
Re,
|
|
119
120
|
{
|
|
120
|
-
onSelect:
|
|
121
|
-
onClose:
|
|
121
|
+
onSelect: _,
|
|
122
|
+
onClose: Z,
|
|
122
123
|
vertical: !0,
|
|
123
|
-
show:
|
|
124
|
-
offset:
|
|
124
|
+
show: Y,
|
|
125
|
+
offset: Q.current
|
|
125
126
|
},
|
|
126
|
-
|
|
127
|
-
(
|
|
128
|
-
|
|
127
|
+
s.map(
|
|
128
|
+
(n) => n.id === "delete" && !C ? null : /* @__PURE__ */ t.createElement(
|
|
129
|
+
Ve,
|
|
129
130
|
{
|
|
130
|
-
key:
|
|
131
|
-
text:
|
|
132
|
-
icon:
|
|
133
|
-
svgIcon:
|
|
134
|
-
data:
|
|
131
|
+
key: n.id,
|
|
132
|
+
text: n.label,
|
|
133
|
+
icon: n.icon,
|
|
134
|
+
svgIcon: n.svgIcon,
|
|
135
|
+
data: n
|
|
135
136
|
}
|
|
136
137
|
)
|
|
137
138
|
)
|
|
138
139
|
);
|
|
139
|
-
}, [
|
|
140
|
-
|
|
140
|
+
}, [k, _, Z, Y, C]), te = t.useCallback(() => a.files && a.files.length > 1 ? /* @__PURE__ */ t.createElement("div", { className: "k-chat-download-button-wrapper" }, /* @__PURE__ */ t.createElement(
|
|
141
|
+
j,
|
|
141
142
|
{
|
|
142
143
|
className: "k-chat-download-button",
|
|
143
144
|
fillMode: "flat",
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
svgIcon: Me,
|
|
146
|
+
size: "small",
|
|
146
147
|
onClick: (e) => {
|
|
147
|
-
e.stopPropagation(), r && r(
|
|
148
|
+
e.stopPropagation(), r && r(a.files, a);
|
|
148
149
|
},
|
|
149
|
-
"aria-label":
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
"aria-label": l.toLanguageString(
|
|
151
|
+
se,
|
|
152
|
+
c[se]
|
|
152
153
|
)
|
|
153
154
|
},
|
|
154
|
-
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" },
|
|
155
|
-
)) : null, [
|
|
156
|
-
if (
|
|
155
|
+
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, l.toLanguageString(ne, c[ne]))
|
|
156
|
+
)) : null, [a, r, l]), pe = t.useCallback(() => {
|
|
157
|
+
if (a.typing)
|
|
157
158
|
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
|
-
if (
|
|
159
|
-
const e =
|
|
160
|
-
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(e, { item:
|
|
161
|
-
} else if (
|
|
159
|
+
if (f) {
|
|
160
|
+
const e = f;
|
|
161
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(e, { item: a }), z());
|
|
162
|
+
} else if (a.text || a.files && a.files.length > 0)
|
|
162
163
|
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
163
164
|
"div",
|
|
164
165
|
{
|
|
165
|
-
className:
|
|
166
|
-
"k-bubble-expandable":
|
|
167
|
-
"k-expanded":
|
|
168
|
-
"k-selected":
|
|
169
|
-
"k-active":
|
|
166
|
+
className: O("k-chat-bubble", "k-bubble", {
|
|
167
|
+
"k-bubble-expandable": p,
|
|
168
|
+
"k-expanded": p && w,
|
|
169
|
+
"k-selected": o,
|
|
170
|
+
"k-active": $
|
|
170
171
|
}),
|
|
171
|
-
onClick: () =>
|
|
172
|
-
onContextMenu:
|
|
172
|
+
onClick: () => g(o ? void 0 : a.selectionIndex),
|
|
173
|
+
onContextMenu: L
|
|
173
174
|
},
|
|
174
|
-
/* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" },
|
|
175
|
-
|
|
176
|
-
)),
|
|
177
|
-
|
|
175
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, M ? /* @__PURE__ */ t.createElement(M, { 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 && ee(), ae(
|
|
176
|
+
v(a, W(u, a))
|
|
177
|
+
)), a.files && a.files.length > 0 && /* @__PURE__ */ t.createElement(
|
|
178
|
+
Pe,
|
|
178
179
|
{
|
|
179
|
-
files:
|
|
180
|
-
message:
|
|
181
|
-
onFileAction:
|
|
182
|
-
onDownload: (e) => r == null ? void 0 : r(e,
|
|
180
|
+
files: a.files,
|
|
181
|
+
message: a,
|
|
182
|
+
onFileAction: X,
|
|
183
|
+
onDownload: (e) => r == null ? void 0 : r(e, a),
|
|
183
184
|
renderInTextarea: !1,
|
|
184
|
-
fileActions:
|
|
185
|
+
fileActions: U
|
|
185
186
|
}
|
|
186
|
-
),
|
|
187
|
-
|
|
187
|
+
), te())),
|
|
188
|
+
p && /* @__PURE__ */ t.createElement(
|
|
188
189
|
"span",
|
|
189
190
|
{
|
|
190
191
|
className: "k-bubble-expandable-indicator",
|
|
191
|
-
onClick:
|
|
192
|
+
onClick: R,
|
|
192
193
|
role: "button",
|
|
193
|
-
"aria-label":
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
) :
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
"aria-label": w ? l.toLanguageString(
|
|
195
|
+
le,
|
|
196
|
+
c[le]
|
|
197
|
+
) : l.toLanguageString(
|
|
198
|
+
oe,
|
|
199
|
+
c[oe]
|
|
199
200
|
),
|
|
200
201
|
tabIndex: 0,
|
|
201
202
|
onKeyDown: (e) => {
|
|
202
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
203
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), R(e));
|
|
203
204
|
}
|
|
204
205
|
},
|
|
205
|
-
/* @__PURE__ */ t.createElement(
|
|
206
|
+
/* @__PURE__ */ t.createElement(P, { icon: w ? Te : Ne, size: "medium" })
|
|
206
207
|
)
|
|
207
|
-
),
|
|
208
|
+
), z());
|
|
208
209
|
return null;
|
|
209
210
|
}, [
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
a,
|
|
212
|
+
f,
|
|
213
|
+
M,
|
|
214
|
+
p,
|
|
212
215
|
w,
|
|
213
|
-
d,
|
|
214
|
-
y,
|
|
215
|
-
l,
|
|
216
|
-
O,
|
|
217
|
-
m,
|
|
218
|
-
R,
|
|
219
|
-
j,
|
|
220
|
-
x,
|
|
221
|
-
c,
|
|
222
|
-
W,
|
|
223
|
-
B,
|
|
224
|
-
G,
|
|
225
|
-
S,
|
|
226
216
|
o,
|
|
227
|
-
|
|
217
|
+
$,
|
|
218
|
+
g,
|
|
219
|
+
L,
|
|
220
|
+
ee,
|
|
221
|
+
v,
|
|
222
|
+
u,
|
|
223
|
+
X,
|
|
224
|
+
U,
|
|
225
|
+
te,
|
|
226
|
+
R,
|
|
227
|
+
l,
|
|
228
|
+
z,
|
|
228
229
|
r
|
|
229
|
-
]),
|
|
230
|
+
]), be = t.useCallback(() => {
|
|
230
231
|
let e = null;
|
|
231
|
-
if (
|
|
232
|
-
const
|
|
233
|
-
|
|
232
|
+
if (a.timestamp) {
|
|
233
|
+
const s = I === "onFocus" && o;
|
|
234
|
+
I === "hidden" || (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !s }, J.formatDate(a.timestamp, H)));
|
|
234
235
|
}
|
|
235
236
|
return e;
|
|
236
|
-
}, [
|
|
237
|
+
}, [a.timestamp, o, H, I, J]), ke = t.useCallback(() => {
|
|
238
|
+
if (!a.status)
|
|
239
|
+
return null;
|
|
240
|
+
let e;
|
|
241
|
+
if (S)
|
|
242
|
+
e = t.createElement(S, { item: a });
|
|
243
|
+
else {
|
|
244
|
+
const s = typeof a.status == "object" && a.status !== null;
|
|
245
|
+
let n, i, m;
|
|
246
|
+
if (s) {
|
|
247
|
+
const K = a.status;
|
|
248
|
+
n = K.text, i = K.icon, m = K.svgIcon;
|
|
249
|
+
} else
|
|
250
|
+
n = a.status;
|
|
251
|
+
let B = null;
|
|
252
|
+
i ? B = /* @__PURE__ */ t.createElement(Ie, { name: i, size: "xsmall" }) : m && (B = /* @__PURE__ */ t.createElement(P, { icon: m, size: "xsmall" })), e = /* @__PURE__ */ t.createElement(t.Fragment, null, B, n);
|
|
253
|
+
}
|
|
254
|
+
return /* @__PURE__ */ t.createElement("span", { className: "k-message-status" }, e);
|
|
255
|
+
}, [a, S]), Ce = t.useCallback(() => {
|
|
237
256
|
let e = null;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
257
|
+
if (a.isFailed) {
|
|
258
|
+
const s = l.toLanguageString(
|
|
259
|
+
ie,
|
|
260
|
+
c[ie]
|
|
261
|
+
);
|
|
262
|
+
e = /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-content" }, /* @__PURE__ */ t.createElement(P, { icon: De, size: "xsmall" }), /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-text" }, s));
|
|
263
|
+
}
|
|
264
|
+
return e;
|
|
265
|
+
}, [a, l]), Ee = t.useCallback(() => {
|
|
266
|
+
let e = null;
|
|
267
|
+
if (a.isFailed) {
|
|
268
|
+
const s = l.toLanguageString(
|
|
269
|
+
re,
|
|
270
|
+
c[re]
|
|
271
|
+
);
|
|
272
|
+
e = /* @__PURE__ */ t.createElement(
|
|
273
|
+
j,
|
|
274
|
+
{
|
|
275
|
+
fillMode: "clear",
|
|
276
|
+
size: "small",
|
|
277
|
+
className: "k-resend-button",
|
|
278
|
+
svgIcon: Se,
|
|
279
|
+
"aria-label": s,
|
|
280
|
+
title: s,
|
|
281
|
+
onClick: (n) => {
|
|
282
|
+
n.stopPropagation(), D && D({
|
|
283
|
+
message: a,
|
|
284
|
+
syntheticEvent: n,
|
|
285
|
+
nativeEvent: n.nativeEvent,
|
|
286
|
+
target: n.target
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return e;
|
|
293
|
+
}, [a, l, D]), xe = t.useCallback(() => O(
|
|
294
|
+
{
|
|
295
|
+
"k-focus": o,
|
|
296
|
+
"k-message-removed": a.isDeleted,
|
|
297
|
+
"k-message-failed": a.isFailed
|
|
298
|
+
},
|
|
299
|
+
"k-message"
|
|
300
|
+
), [o, a.isDeleted, a.isFailed]), ye = t.useCallback(() => b && b.length > 0 && /* @__PURE__ */ t.createElement(we, { className: "k-chat-message-toolbar", fillMode: "flat" }, b.map((e) => e.id === "delete" && !C ? null : /* @__PURE__ */ t.createElement(
|
|
301
|
+
j,
|
|
241
302
|
{
|
|
242
303
|
key: e.id,
|
|
243
304
|
fillMode: "flat",
|
|
244
305
|
className: "k-toolbar-button",
|
|
245
|
-
themeColor: "base",
|
|
246
306
|
icon: e.icon,
|
|
247
307
|
svgIcon: e.svgIcon,
|
|
248
|
-
onClick: (
|
|
249
|
-
|
|
308
|
+
onClick: (s) => {
|
|
309
|
+
s.stopPropagation(), e.id === "copy" && !a.isDeleted ? h() : e.id === "reply" && E(a), T && T(e, s, a);
|
|
250
310
|
},
|
|
251
|
-
onMouseDown: (
|
|
311
|
+
onMouseDown: (s) => s.preventDefault()
|
|
252
312
|
}
|
|
253
|
-
))), [
|
|
313
|
+
))), [h, C, a, b, T, E]);
|
|
254
314
|
return /* @__PURE__ */ t.createElement(
|
|
255
315
|
"div",
|
|
256
316
|
{
|
|
257
|
-
"data-message-id":
|
|
258
|
-
className:
|
|
259
|
-
tabIndex:
|
|
260
|
-
onMouseDown:
|
|
261
|
-
onKeyDown:
|
|
317
|
+
"data-message-id": a.id,
|
|
318
|
+
className: xe(),
|
|
319
|
+
tabIndex: ue,
|
|
320
|
+
onMouseDown: fe,
|
|
321
|
+
onKeyDown: ge,
|
|
262
322
|
onFocus: (e) => {
|
|
263
|
-
|
|
323
|
+
de && g(a.selectionIndex);
|
|
264
324
|
},
|
|
265
325
|
ref: (e) => {
|
|
266
|
-
|
|
326
|
+
V.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
|
|
267
327
|
},
|
|
268
|
-
onContextMenu:
|
|
328
|
+
onContextMenu: f ? L : void 0
|
|
269
329
|
},
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
330
|
+
Ee(),
|
|
331
|
+
pe(),
|
|
332
|
+
(a.status || a.timestamp && I !== "hidden" || a.isFailed) && /* @__PURE__ */ t.createElement("div", { className: "k-message-info" }, ke(), be(), Ce()),
|
|
333
|
+
ye()
|
|
274
334
|
);
|
|
275
335
|
}
|
|
276
336
|
);
|
|
277
|
-
|
|
337
|
+
je.displayName = "ChatMessage";
|
|
278
338
|
export {
|
|
279
|
-
|
|
339
|
+
je as ChatMessage
|
|
280
340
|
};
|
|
@@ -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("
|
|
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),u=e=>s.createElement(a.Toolbar,{className:"k-chat-header"},e.children);module.exports=u;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const o = (e) => /* @__PURE__ */
|
|
8
|
+
import * as a from "react";
|
|
9
|
+
import { Toolbar as r } from "@progress/kendo-react-buttons";
|
|
10
|
+
const o = (e) => /* @__PURE__ */ a.createElement(r, { className: "k-chat-header" }, e.children);
|
|
11
11
|
export {
|
|
12
12
|
o as default
|
|
13
13
|
};
|