@progress/kendo-react-conversational-ui 12.3.0-develop.2 → 12.3.0-develop.3

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.
Files changed (36) hide show
  1. package/chat/components/ActionGroup.js +1 -1
  2. package/chat/components/ActionGroup.mjs +55 -34
  3. package/chat/components/Attachment.js +1 -1
  4. package/chat/components/Attachment.mjs +16 -9
  5. package/chat/components/Chat.js +1 -1
  6. package/chat/components/Chat.mjs +359 -278
  7. package/chat/components/ChatMessage.js +1 -1
  8. package/chat/components/ChatMessage.mjs +159 -147
  9. package/chat/components/Header.js +1 -1
  10. package/chat/components/Header.mjs +1 -1
  11. package/chat/components/MessageGroup.js +1 -1
  12. package/chat/components/MessageGroup.mjs +82 -61
  13. package/chat/components/NewMessage.js +1 -1
  14. package/chat/components/NewMessage.mjs +63 -59
  15. package/chat/components/ScrollButtonsWrapper.js +8 -0
  16. package/chat/components/ScrollButtonsWrapper.mjs +58 -0
  17. package/chat/components/SuggestionsGroup.js +1 -1
  18. package/chat/components/SuggestionsGroup.mjs +58 -18
  19. package/chat/components/elements/FileBox.js +1 -1
  20. package/chat/components/elements/FileBox.mjs +31 -37
  21. package/chat/components/elements/PinnedMessage.js +1 -1
  22. package/chat/components/elements/PinnedMessage.mjs +5 -4
  23. package/chat/hooks/useScrollWithButtons.js +8 -0
  24. package/chat/hooks/useScrollWithButtons.mjs +46 -0
  25. package/chat/utils/fieldMapping.js +1 -1
  26. package/chat/utils/fieldMapping.mjs +1 -1
  27. package/chat/utils/messageSettings.js +8 -0
  28. package/chat/utils/messageSettings.mjs +31 -0
  29. package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
  30. package/index.d.mts +199 -5
  31. package/index.d.ts +199 -5
  32. package/messages/index.js +1 -1
  33. package/messages/index.mjs +26 -22
  34. package/package-metadata.js +1 -1
  35. package/package-metadata.mjs +2 -2
  36. package/package.json +11 -11
@@ -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 ue=require("react"),g=require("@progress/kendo-react-common"),J=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),F=require("@progress/kendo-react-intl"),Q=require("@progress/kendo-react-layout"),c=require("../utils.js"),de=require("./ChatContext.js"),me=require("./elements/FileBox.js"),l=require("../../messages/index.js");function fe(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const m=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,m.get?m:{enumerable:!0,get:()=>r[s]})}}return i.default=r,Object.freeze(i)}const t=fe(ue),L=t.forwardRef((r,i)=>{const{item:s,template:m,onRequestSelection:T,tabIndex:Z=-1,dateFormat:O="g",selected:o,allowMessageCollapse:b,messageToolbarActions:k,messageContextMenuActions:C,isSender:y}=r,{setReplyToMessage:x,messages:P,user:p,internalScrollContainerRef:h,onToolbarAction:D,onContextMenuAction:N,onFileAction:V,onDownload:d,fileActions:B,setShowCopyNotification:I,statusTemplate:S}=de.useChatContext(),[j,A]=t.useState(!1),[$,z]=t.useState(!1),[E,ee]=t.useState(!0),[te,K]=t.useState(!1),u=F.useLocalization(),W=t.useRef({left:0,top:0}),w=t.useCallback(()=>{s!=null&&s.text&&c.copyToClipboard(s.text),I&&(I(!0),setTimeout(()=>{I(!1)},3e3))},[s,I]),R=t.useCallback(e=>{e.stopPropagation(),ee(a=>!a)},[]),se=t.useCallback(()=>{K(!1)},[]),ae=t.useCallback(e=>{(e.key==="Tab"||e.key==="Enter"||e.key===" "||e.key==="ArrowUp"||e.key==="ArrowDown")&&K(!0)},[]),q=t.useRef(null);t.useEffect(()=>{o&&q.current&&q.current.focus()},[o]);const _=t.useCallback(e=>{W.current={left:e.pageX,top:e.pageY},e.preventDefault(),z(!0),A(!0)},[]),U=t.useCallback(()=>{z(!1),A(!1)},[]),M=t.useCallback((e,a)=>!e.isDeleted&&e.text?e.text:c.getDeletedMessageText(a,u),[u]),X=t.useCallback(e=>{var a;(a=e.item)!=null&&a.text&&(e.item.data.id==="copy"&&!s.isDeleted?w():e.item.data.id==="reply"&&x(s),N&&N(e.item.data,e,s)),A(!1)},[s,N,x,w]),Y=t.useCallback(()=>{if(s.replyToId){const e=c.getMessageById(P,s.replyToId);if(e){const a=n=>{n.preventDefault(),n.stopPropagation();const v=h==null?void 0:h.current;c.scrollToMessageById(e.id,v)};return t.createElement("div",{className:g.classNames("k-message-reference",c.isAuthor(p,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:a},t.createElement("div",{className:"k-message-reference-content"},c.convertTextToLinkedContent(M(e,c.isAuthor(p,e)))))}}return null},[s.replyToId,P,p,M,h]),G=t.useCallback(()=>{const e=[{id:"reply",label:"Reply",svgIcon:f.undoIcon},{id:"copy",label:"Copy",svgIcon:f.copyIcon}],a=C?[...e.map(n=>C.find(ie=>ie.id===n.id)||n),...C.filter(n=>!e.some(v=>v.id===n.id))]:e;return t.createElement(Q.ContextMenu,{onSelect:X,onClose:U,vertical:!0,show:j,offset:W.current},a.map(n=>n.id==="delete"&&!y?null:t.createElement(Q.MenuItem,{key:n.id,text:n.label,icon:n.icon,svgIcon:n.svgIcon,data:n})))},[C,X,U,j,y]),H=t.useCallback(()=>s.files&&s.files.length>1?t.createElement("div",{className:"k-chat-download-button-wrapper"},t.createElement(J.Button,{className:"k-chat-download-button",fillMode:"flat",themeColor:"base",svgIcon:f.downloadIcon,onClick:e=>{e.stopPropagation(),d&&d(s.files,s)},"aria-label":u.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},t.createElement("span",{className:"k-button-text"},u.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[s,d,u]),ne=t.useCallback(()=>{if(s.typing)return t.createElement("div",{className:"k-bubble k-chat-bubble"},t.createElement("div",{className:"k-typing-indicator"},t.createElement("span",null),t.createElement("span",null),t.createElement("span",null)));if(m){const e=m;return t.createElement(e,{item:s})}else if(s.text||s.files&&s.files.length>0)return t.createElement(t.Fragment,null,t.createElement("div",{className:g.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":b,"k-expanded":b&&E,"k-selected":o,"k-active":$}),onClick:()=>T(o?void 0:s.selectionIndex),onContextMenu:_},t.createElement("div",{className:"k-bubble-content"},t.createElement("span",{className:"k-chat-bubble-text"},!s.isDeleted&&Y(),c.convertTextToLinkedContent(M(s,c.isAuthor(p,s)))),s.files&&s.files.length>0&&t.createElement(me,{files:s.files,message:s,onFileAction:V,onDownload:e=>d==null?void 0:d(e,s),renderInTextarea:!1,fileActions:B}),H()),b&&t.createElement("span",{className:"k-bubble-expandable-indicator",onClick:R,role:"button","aria-label":E?u.toLanguageString(l.collapseMessage,l.messages[l.collapseMessage]):u.toLanguageString(l.expandMessage,l.messages[l.expandMessage]),tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),R(e))}},t.createElement(g.IconWrap,{icon:E?f.chevronUpIcon:f.chevronDownIcon,size:"medium"}))),G());return null},[s,m,b,E,o,_,Y,M,p,V,B,H,R,u,G,d]),le=t.useCallback(()=>{let e=null;return s.timestamp&&(e=t.createElement("time",{className:"k-message-time","aria-hidden":!o},F.provideIntlService({props:r}).formatDate(s.timestamp,O))),e},[s.timestamp,o,O,r]),oe=t.useCallback(()=>{let e=null;return s.status&&o&&(S?e=t.createElement(S,{item:s}):e=t.createElement("span",{className:"k-message-status"},t.createElement(g.IconWrap,{icon:f.checkCircleIcon,size:"xsmall"}),s.status)),e},[s,o,S]),re=t.useCallback(()=>g.classNames({"k-focus":o,"k-message-removed":s.isDeleted},"k-message"),[o,s.isDeleted]),ce=t.useCallback(()=>k&&k.length>0&&t.createElement("div",{className:"k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat"},k.map(e=>e.id==="delete"&&!y?null:t.createElement(J.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",themeColor:"base",icon:e.icon,svgIcon:e.svgIcon,onClick:a=>{a.stopPropagation(),e.id==="copy"&&!s.isDeleted?w():e.id==="reply"&&x(s),D&&D(e,a,s)},onMouseDown:a=>a.preventDefault()}))),[w,y,s,k,D,x]);return t.createElement("div",{"data-message-id":s.id,className:re(),tabIndex:Z,onMouseDown:se,onKeyDown:ae,onFocus:e=>{te&&T(s.selectionIndex)},ref:e=>{q.current=e,typeof i=="function"?i(e):i&&(i.current=e)}},le(),ne(),oe(),ce())});L.displayName="ChatMessage";class pe extends t.Component{render(){return t.createElement(L,{...this.props})}}F.registerForIntl(pe);exports.ChatMessage=L;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("react"),g=require("@progress/kendo-react-common"),$=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),B=require("@progress/kendo-react-intl"),ee=require("@progress/kendo-react-layout"),r=require("../utils.js"),fe=require("./ChatContext.js"),pe=require("./elements/FileBox.js"),l=require("../../messages/index.js");function ge(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const n in c)if(n!=="default"){const d=Object.getOwnPropertyDescriptor(c,n);Object.defineProperty(i,n,d.get?d:{enumerable:!0,get:()=>c[n]})}}return i.default=c,Object.freeze(i)}const t=ge(me),j=t.forwardRef((c,i)=>{const{item:n,template:d,contentTemplate:D,onRequestSelection:b,tabIndex:te=-1,dateFormat:z="g",selected:o,allowMessageCollapse:k,messageToolbarActions:C,messageContextMenuActions:y,fileActions:K,isSender:x}=c,{setReplyToMessage:h,messages:W,user:p,internalScrollContainerRef:E,onToolbarAction:N,onContextMenuAction:S,onFileAction:_,onDownload:m,setShowCopyNotification:I,statusTemplate:A,timestampVisibility:R="onFocus"}=fe.useChatContext(),[H,F]=t.useState(!1),[U,q]=t.useState(!1),[w,ne]=t.useState(!0),[se,X]=t.useState(!1),u=B.useLocalization(),Y=t.useRef({left:0,top:0}),M=t.useCallback(()=>{n!=null&&n.text&&r.copyToClipboard(n.text),I&&(I(!0),setTimeout(()=>{I(!1)},3e3))},[n,I]),L=t.useCallback(e=>{e.stopPropagation(),ne(s=>!s)},[]),ae=t.useCallback(()=>{X(!1)},[]),le=t.useCallback(e=>{(e.key==="Tab"||e.key==="Enter"||e.key===" "||e.key==="ArrowUp"||e.key==="ArrowDown")&&X(!0)},[]),V=t.useRef(null);t.useEffect(()=>{o&&V.current&&V.current.focus()},[o]);const O=t.useCallback(e=>{Y.current={left:e.pageX,top:e.pageY},e.preventDefault(),q(!0),F(!0)},[]),G=t.useCallback(()=>{q(!1),F(!1)},[]),v=t.useCallback((e,s)=>e.isDeleted?r.getDeletedMessageText(s,u):e.text?e.text:"",[u]),J=t.useCallback(e=>{var s;(s=e.item)!=null&&s.text&&(e.item.data.id==="copy"&&!n.isDeleted?M():e.item.data.id==="reply"&&h(n),S&&S(e.item.data,e,n)),q(!1),F(!1)},[n,S,h,M]),Q=t.useCallback(()=>{if(n.replyToId){const e=r.getMessageById(W,n.replyToId);if(e){const s=a=>{a.preventDefault(),a.stopPropagation();const T=E==null?void 0:E.current;r.scrollToMessageById(e.id,T)};return t.createElement("div",{className:g.classNames("k-message-reference",r.isAuthor(p,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:s},t.createElement("div",{className:"k-message-reference-content"},r.convertTextToLinkedContent(v(e,r.isAuthor(p,e)))))}}return null},[n.replyToId,W,p,v,E]),P=t.useCallback(()=>{const e=[{id:"reply",label:"Reply",svgIcon:f.undoIcon},{id:"copy",label:"Copy",svgIcon:f.copyIcon}],s=y?[...e.map(a=>y.find(de=>de.id===a.id)||a),...y.filter(a=>!e.some(T=>T.id===a.id))]:e;return t.createElement(ee.ContextMenu,{onSelect:J,onClose:G,vertical:!0,show:H,offset:Y.current},s.map(a=>a.id==="delete"&&!x?null:t.createElement(ee.MenuItem,{key:a.id,text:a.label,icon:a.icon,svgIcon:a.svgIcon,data:a})))},[y,J,G,H,x]),Z=t.useCallback(()=>n.files&&n.files.length>1?t.createElement("div",{className:"k-chat-download-button-wrapper"},t.createElement($.Button,{className:"k-chat-download-button",fillMode:"flat",themeColor:"base",svgIcon:f.downloadIcon,onClick:e=>{e.stopPropagation(),m&&m(n.files,n)},"aria-label":u.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},t.createElement("span",{className:"k-button-text"},u.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[n,m,u]),oe=t.useCallback(()=>{if(n.typing)return t.createElement("div",{className:"k-chat-bubble k-bubble"},t.createElement("div",{className:"k-bubble-content"},t.createElement("div",{className:"k-typing-indicator"},t.createElement("span",null),t.createElement("span",null),t.createElement("span",null))));if(d){const e=d;return t.createElement(t.Fragment,null,t.createElement(e,{item:n}),P())}else if(n.text||n.files&&n.files.length>0)return t.createElement(t.Fragment,null,t.createElement("div",{className:g.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":k,"k-expanded":k&&w,"k-selected":o,"k-active":U}),onClick:()=>b(o?void 0:n.selectionIndex),onContextMenu:O},t.createElement("div",{className:"k-bubble-content"},D?t.createElement(D,{item:n}):t.createElement(t.Fragment,null,(n.text||n.isDeleted||n.replyToId)&&t.createElement("span",{className:"k-chat-bubble-text"},!n.isDeleted&&Q(),r.convertTextToLinkedContent(v(n,r.isAuthor(p,n)))),n.files&&n.files.length>0&&t.createElement(pe,{files:n.files,message:n,onFileAction:_,onDownload:e=>m==null?void 0:m(e,n),renderInTextarea:!1,fileActions:K}),Z())),k&&t.createElement("span",{className:"k-bubble-expandable-indicator",onClick:L,role:"button","aria-label":w?u.toLanguageString(l.collapseMessage,l.messages[l.collapseMessage]):u.toLanguageString(l.expandMessage,l.messages[l.expandMessage]),tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),L(e))}},t.createElement(g.IconWrap,{icon:w?f.chevronUpIcon:f.chevronDownIcon,size:"medium"}))),P());return null},[n,d,D,k,w,o,U,b,O,Q,v,p,_,K,Z,L,u,P,m]),ce=t.useCallback(()=>{let e=null;if(n.timestamp){const s=R==="onFocus"&&o;R==="hidden"||(e=t.createElement("time",{className:"k-message-time","aria-hidden":!s},B.provideIntlService({props:c}).formatDate(n.timestamp,z)))}return e},[n.timestamp,o,z,c,R]),re=t.useCallback(()=>{let e=null;return n.status&&o&&(A?e=t.createElement(A,{item:n}):e=t.createElement("span",{className:"k-message-status"},t.createElement(g.IconWrap,{icon:f.checkCircleIcon,size:"xsmall"}),n.status)),e},[n,o,A]),ie=t.useCallback(()=>g.classNames({"k-focus":o,"k-message-removed":n.isDeleted},"k-message"),[o,n.isDeleted]),ue=t.useCallback(()=>C&&C.length>0&&t.createElement("div",{className:"k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat"},C.map(e=>e.id==="delete"&&!x?null:t.createElement($.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",themeColor:"base",icon:e.icon,svgIcon:e.svgIcon,onClick:s=>{s.stopPropagation(),e.id==="copy"&&!n.isDeleted?M():e.id==="reply"&&h(n),N&&N(e,s,n)},onMouseDown:s=>s.preventDefault()}))),[M,x,n,C,N,h]);return t.createElement("div",{"data-message-id":n.id,className:ie(),tabIndex:te,onMouseDown:ae,onKeyDown:le,onFocus:e=>{se&&b(n.selectionIndex)},ref:e=>{V.current=e,typeof i=="function"?i(e):i&&(i.current=e)},onContextMenu:d?O:void 0},ce(),oe(),re(),ue())});j.displayName="ChatMessage";class be extends t.Component{render(){return t.createElement(j,{...this.props})}}B.registerForIntl(be);exports.ChatMessage=j;
@@ -6,227 +6,238 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as t from "react";
9
- import { classNames as A, IconWrap as j } from "@progress/kendo-react-common";
10
- import { Button as G } from "@progress/kendo-react-buttons";
11
- import { downloadIcon as fe, chevronUpIcon as pe, chevronDownIcon as ge, checkCircleIcon as be, undoIcon as ke, copyIcon as Ce } from "@progress/kendo-svg-icons";
12
- import { useLocalization as ye, provideIntlService as xe, registerForIntl as Ee } from "@progress/kendo-react-intl";
13
- import { ContextMenu as he, MenuItem as Ie } from "@progress/kendo-react-layout";
14
- import { copyToClipboard as we, getDeletedMessageText as Me, getMessageById as ve, isAuthor as R, convertTextToLinkedContent as H, scrollToMessageById as Te } from "../utils.mjs";
15
- import { useChatContext as De } from "./ChatContext.mjs";
16
- import Ne from "./elements/FileBox.mjs";
17
- import { downloadAllFiles as J, messages as h, downloadAll as Q, collapseMessage as Z, expandMessage as _ } from "../../messages/index.mjs";
18
- const ee = t.forwardRef(
9
+ import { classNames as K, IconWrap as J } from "@progress/kendo-react-common";
10
+ import { Button as Q } from "@progress/kendo-react-buttons";
11
+ import { downloadIcon as be, chevronUpIcon as ge, chevronDownIcon as ke, checkCircleIcon as Ce, undoIcon as ye, copyIcon as Ee } from "@progress/kendo-svg-icons";
12
+ import { useLocalization as xe, provideIntlService as he, registerForIntl as Ie } from "@progress/kendo-react-intl";
13
+ import { ContextMenu as we, MenuItem as ve } from "@progress/kendo-react-layout";
14
+ import { copyToClipboard as Me, getDeletedMessageText as Te, getMessageById as De, isAuthor as z, convertTextToLinkedContent as Z, scrollToMessageById as Ne } from "../utils.mjs";
15
+ import { useChatContext as Se } from "./ChatContext.mjs";
16
+ import Ae from "./elements/FileBox.mjs";
17
+ import { downloadAllFiles as _, messages as w, downloadAll as ee, collapseMessage as te, expandMessage as ae } from "../../messages/index.mjs";
18
+ const ne = t.forwardRef(
19
19
  (i, u) => {
20
20
  const {
21
21
  item: a,
22
- template: I,
23
- onRequestSelection: w,
24
- tabIndex: te = -1,
25
- dateFormat: F = "g",
22
+ template: m,
23
+ contentTemplate: v,
24
+ onRequestSelection: d,
25
+ tabIndex: se = -1,
26
+ dateFormat: B = "g",
26
27
  selected: l,
27
- allowMessageCollapse: m,
28
- messageToolbarActions: d,
29
- messageContextMenuActions: f,
30
- isSender: p
28
+ allowMessageCollapse: p,
29
+ messageToolbarActions: f,
30
+ messageContextMenuActions: b,
31
+ fileActions: P,
32
+ isSender: g
31
33
  } = i, {
32
- setReplyToMessage: g,
33
- messages: L,
34
+ setReplyToMessage: k,
35
+ messages: W,
34
36
  user: c,
35
- internalScrollContainerRef: b,
37
+ internalScrollContainerRef: C,
36
38
  onToolbarAction: M,
37
- onContextMenuAction: v,
38
- onFileAction: V,
39
+ onContextMenuAction: T,
40
+ onFileAction: H,
39
41
  onDownload: r,
40
- fileActions: K,
41
- setShowCopyNotification: k,
42
- statusTemplate: T
43
- } = De(), [z, D] = t.useState(!1), [ae, B] = t.useState(!1), [C, se] = t.useState(!0), [ne, P] = t.useState(!1), o = ye(), W = t.useRef({ left: 0, top: 0 }), y = t.useCallback(() => {
44
- a != null && a.text && we(a.text), k && (k(!0), setTimeout(() => {
45
- k(!1);
42
+ setShowCopyNotification: y,
43
+ statusTemplate: D,
44
+ timestampVisibility: N = "onFocus"
45
+ } = Se(), [O, S] = t.useState(!1), [U, A] = t.useState(!1), [E, le] = t.useState(!0), [oe, q] = t.useState(!1), o = xe(), X = t.useRef({ left: 0, top: 0 }), x = t.useCallback(() => {
46
+ a != null && a.text && Me(a.text), y && (y(!0), setTimeout(() => {
47
+ y(!1);
46
48
  }, 3e3));
47
- }, [a, k]), N = t.useCallback((e) => {
48
- e.stopPropagation(), se((s) => !s);
49
- }, []), le = t.useCallback(() => {
50
- P(!1);
51
- }, []), oe = t.useCallback((e) => {
52
- (e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") && P(!0);
53
- }, []), S = t.useRef(null);
49
+ }, [a, y]), F = t.useCallback((e) => {
50
+ e.stopPropagation(), le((n) => !n);
51
+ }, []), re = t.useCallback(() => {
52
+ q(!1);
53
+ }, []), ce = t.useCallback((e) => {
54
+ (e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") && q(!0);
55
+ }, []), R = t.useRef(null);
54
56
  t.useEffect(() => {
55
- l && S.current && S.current.focus();
57
+ l && R.current && R.current.focus();
56
58
  }, [l]);
57
- const O = t.useCallback((e) => {
58
- W.current = { left: e.pageX, top: e.pageY }, e.preventDefault(), B(!0), D(!0);
59
- }, []), U = t.useCallback(() => {
60
- B(!1), D(!1);
61
- }, []), x = t.useCallback(
62
- (e, s) => !e.isDeleted && e.text ? e.text : Me(s, o),
59
+ const V = t.useCallback((e) => {
60
+ X.current = { left: e.pageX, top: e.pageY }, e.preventDefault(), A(!0), S(!0);
61
+ }, []), Y = t.useCallback(() => {
62
+ A(!1), S(!1);
63
+ }, []), h = t.useCallback(
64
+ (e, n) => e.isDeleted ? Te(n, o) : e.text ? e.text : "",
63
65
  [o]
64
- ), q = t.useCallback(
66
+ ), $ = t.useCallback(
65
67
  (e) => {
66
- var s;
67
- (s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ? y() : e.item.data.id === "reply" && g(a), v && v(e.item.data, e, a)), D(!1);
68
+ var n;
69
+ (n = e.item) != null && n.text && (e.item.data.id === "copy" && !a.isDeleted ? x() : e.item.data.id === "reply" && k(a), T && T(e.item.data, e, a)), A(!1), S(!1);
68
70
  },
69
- [a, v, g, y]
70
- ), X = t.useCallback(() => {
71
+ [a, T, k, x]
72
+ ), j = t.useCallback(() => {
71
73
  if (a.replyToId) {
72
- const e = ve(L, a.replyToId);
74
+ const e = De(W, a.replyToId);
73
75
  if (e) {
74
- const s = (n) => {
75
- n.preventDefault(), n.stopPropagation();
76
- const E = b == null ? void 0 : b.current;
77
- Te(e.id, E);
76
+ const n = (s) => {
77
+ s.preventDefault(), s.stopPropagation();
78
+ const I = C == null ? void 0 : C.current;
79
+ Ne(e.id, I);
78
80
  };
79
81
  return /* @__PURE__ */ t.createElement(
80
82
  "div",
81
83
  {
82
- className: A(
84
+ className: K(
83
85
  "k-message-reference",
84
- R(c, e) ? "k-message-reference-sender" : "k-message-reference-receiver"
86
+ z(c, e) ? "k-message-reference-sender" : "k-message-reference-receiver"
85
87
  ),
86
- onClick: s
88
+ onClick: n
87
89
  },
88
- /* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, H(
89
- x(e, R(c, e))
90
+ /* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, Z(
91
+ h(e, z(c, e))
90
92
  ))
91
93
  );
92
94
  }
93
95
  }
94
96
  return null;
95
- }, [a.replyToId, L, c, x, b]), Y = t.useCallback(() => {
97
+ }, [a.replyToId, W, c, h, C]), L = t.useCallback(() => {
96
98
  const e = [
97
99
  {
98
100
  id: "reply",
99
101
  label: "Reply",
100
- svgIcon: ke
102
+ svgIcon: ye
101
103
  },
102
104
  {
103
105
  id: "copy",
104
106
  label: "Copy",
105
- svgIcon: Ce
107
+ svgIcon: Ee
106
108
  }
107
- ], s = f ? [
108
- ...e.map((n) => f.find(
109
- (de) => de.id === n.id
110
- ) || n),
111
- ...f.filter(
112
- (n) => !e.some((E) => E.id === n.id)
109
+ ], n = b ? [
110
+ ...e.map((s) => b.find(
111
+ (fe) => fe.id === s.id
112
+ ) || s),
113
+ ...b.filter(
114
+ (s) => !e.some((I) => I.id === s.id)
113
115
  )
114
116
  ] : e;
115
117
  return /* @__PURE__ */ t.createElement(
116
- he,
118
+ we,
117
119
  {
118
- onSelect: q,
119
- onClose: U,
120
+ onSelect: $,
121
+ onClose: Y,
120
122
  vertical: !0,
121
- show: z,
122
- offset: W.current
123
+ show: O,
124
+ offset: X.current
123
125
  },
124
- s.map(
125
- (n) => n.id === "delete" && !p ? null : /* @__PURE__ */ t.createElement(
126
- Ie,
126
+ n.map(
127
+ (s) => s.id === "delete" && !g ? null : /* @__PURE__ */ t.createElement(
128
+ ve,
127
129
  {
128
- key: n.id,
129
- text: n.label,
130
- icon: n.icon,
131
- svgIcon: n.svgIcon,
132
- data: n
130
+ key: s.id,
131
+ text: s.label,
132
+ icon: s.icon,
133
+ svgIcon: s.svgIcon,
134
+ data: s
133
135
  }
134
136
  )
135
137
  )
136
138
  );
137
- }, [f, q, U, z, p]), $ = t.useCallback(() => a.files && a.files.length > 1 ? /* @__PURE__ */ t.createElement("div", { className: "k-chat-download-button-wrapper" }, /* @__PURE__ */ t.createElement(
138
- G,
139
+ }, [b, $, Y, O, g]), G = t.useCallback(() => a.files && a.files.length > 1 ? /* @__PURE__ */ t.createElement("div", { className: "k-chat-download-button-wrapper" }, /* @__PURE__ */ t.createElement(
140
+ Q,
139
141
  {
140
142
  className: "k-chat-download-button",
141
143
  fillMode: "flat",
142
144
  themeColor: "base",
143
- svgIcon: fe,
145
+ svgIcon: be,
144
146
  onClick: (e) => {
145
147
  e.stopPropagation(), r && r(a.files, a);
146
148
  },
147
149
  "aria-label": o.toLanguageString(
148
- J,
149
- h[J]
150
+ _,
151
+ w[_]
150
152
  )
151
153
  },
152
- /* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, o.toLanguageString(Q, h[Q]))
153
- )) : null, [a, r, o]), re = t.useCallback(() => {
154
+ /* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, o.toLanguageString(ee, w[ee]))
155
+ )) : null, [a, r, o]), ie = t.useCallback(() => {
154
156
  if (a.typing)
155
- return /* @__PURE__ */ t.createElement("div", { className: "k-bubble k-chat-bubble" }, /* @__PURE__ */ t.createElement("div", { className: "k-typing-indicator" }, /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null)));
156
- if (I) {
157
- const e = I;
158
- return /* @__PURE__ */ t.createElement(e, { item: a });
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
+ if (m) {
159
+ const e = m;
160
+ return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(e, { item: a }), L());
159
161
  } else if (a.text || a.files && a.files.length > 0)
160
162
  return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
161
163
  "div",
162
164
  {
163
- className: A("k-chat-bubble", "k-bubble", {
164
- "k-bubble-expandable": m,
165
- "k-expanded": m && C,
165
+ className: K("k-chat-bubble", "k-bubble", {
166
+ "k-bubble-expandable": p,
167
+ "k-expanded": p && E,
166
168
  "k-selected": l,
167
- "k-active": ae
169
+ "k-active": U
168
170
  }),
169
- onClick: () => w(l ? void 0 : a.selectionIndex),
170
- onContextMenu: O
171
+ onClick: () => d(l ? void 0 : a.selectionIndex),
172
+ onContextMenu: V
171
173
  },
172
- /* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, /* @__PURE__ */ t.createElement("span", { className: "k-chat-bubble-text" }, !a.isDeleted && X(), H(x(a, R(c, a)))), a.files && a.files.length > 0 && /* @__PURE__ */ t.createElement(
173
- Ne,
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 && j(), Z(
175
+ h(a, z(c, a))
176
+ )), a.files && a.files.length > 0 && /* @__PURE__ */ t.createElement(
177
+ Ae,
174
178
  {
175
179
  files: a.files,
176
180
  message: a,
177
- onFileAction: V,
181
+ onFileAction: H,
178
182
  onDownload: (e) => r == null ? void 0 : r(e, a),
179
183
  renderInTextarea: !1,
180
- fileActions: K
184
+ fileActions: P
181
185
  }
182
- ), $()),
183
- m && /* @__PURE__ */ t.createElement(
186
+ ), G())),
187
+ p && /* @__PURE__ */ t.createElement(
184
188
  "span",
185
189
  {
186
190
  className: "k-bubble-expandable-indicator",
187
- onClick: N,
191
+ onClick: F,
188
192
  role: "button",
189
- "aria-label": C ? o.toLanguageString(
190
- Z,
191
- h[Z]
193
+ "aria-label": E ? o.toLanguageString(
194
+ te,
195
+ w[te]
192
196
  ) : o.toLanguageString(
193
- _,
194
- h[_]
197
+ ae,
198
+ w[ae]
195
199
  ),
196
200
  tabIndex: 0,
197
201
  onKeyDown: (e) => {
198
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), N(e));
202
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), F(e));
199
203
  }
200
204
  },
201
- /* @__PURE__ */ t.createElement(j, { icon: C ? pe : ge, size: "medium" })
205
+ /* @__PURE__ */ t.createElement(J, { icon: E ? ge : ke, size: "medium" })
202
206
  )
203
- ), Y());
207
+ ), L());
204
208
  return null;
205
209
  }, [
206
210
  a,
207
- I,
208
211
  m,
209
- C,
212
+ v,
213
+ p,
214
+ E,
210
215
  l,
211
- O,
212
- X,
213
- x,
214
- c,
216
+ U,
217
+ d,
215
218
  V,
216
- K,
217
- $,
218
- N,
219
+ j,
220
+ h,
221
+ c,
222
+ H,
223
+ P,
224
+ G,
225
+ F,
219
226
  o,
220
- Y,
227
+ L,
221
228
  r
222
- ]), ce = t.useCallback(() => {
229
+ ]), ue = t.useCallback(() => {
223
230
  let e = null;
224
- return a.timestamp && (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !l }, xe({ props: i }).formatDate(a.timestamp, F))), e;
225
- }, [a.timestamp, l, F, i]), ie = t.useCallback(() => {
231
+ if (a.timestamp) {
232
+ const n = N === "onFocus" && l;
233
+ N === "hidden" || (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !n }, he({ props: i }).formatDate(a.timestamp, B)));
234
+ }
235
+ return e;
236
+ }, [a.timestamp, l, B, i, N]), me = t.useCallback(() => {
226
237
  let e = null;
227
- return a.status && l && (T ? e = t.createElement(T, { item: a }) : e = /* @__PURE__ */ t.createElement("span", { className: "k-message-status" }, /* @__PURE__ */ t.createElement(j, { icon: be, size: "xsmall" }), a.status)), e;
228
- }, [a, l, T]), ue = t.useCallback(() => A({ "k-focus": l, "k-message-removed": a.isDeleted }, "k-message"), [l, a.isDeleted]), me = t.useCallback(() => d && d.length > 0 && /* @__PURE__ */ t.createElement("div", { className: "k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat" }, d.map((e) => e.id === "delete" && !p ? null : /* @__PURE__ */ t.createElement(
229
- G,
238
+ return a.status && l && (D ? e = t.createElement(D, { item: a }) : e = /* @__PURE__ */ t.createElement("span", { className: "k-message-status" }, /* @__PURE__ */ t.createElement(J, { icon: Ce, size: "xsmall" }), a.status)), e;
239
+ }, [a, l, D]), de = t.useCallback(() => K({ "k-focus": l, "k-message-removed": a.isDeleted }, "k-message"), [l, a.isDeleted]), pe = t.useCallback(() => f && f.length > 0 && /* @__PURE__ */ t.createElement("div", { className: "k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat" }, f.map((e) => e.id === "delete" && !g ? null : /* @__PURE__ */ t.createElement(
240
+ Q,
230
241
  {
231
242
  key: e.id,
232
243
  fillMode: "flat",
@@ -234,41 +245,42 @@ const ee = t.forwardRef(
234
245
  themeColor: "base",
235
246
  icon: e.icon,
236
247
  svgIcon: e.svgIcon,
237
- onClick: (s) => {
238
- s.stopPropagation(), e.id === "copy" && !a.isDeleted ? y() : e.id === "reply" && g(a), M && M(e, s, a);
248
+ onClick: (n) => {
249
+ n.stopPropagation(), e.id === "copy" && !a.isDeleted ? x() : e.id === "reply" && k(a), M && M(e, n, a);
239
250
  },
240
- onMouseDown: (s) => s.preventDefault()
251
+ onMouseDown: (n) => n.preventDefault()
241
252
  }
242
- ))), [y, p, a, d, M, g]);
253
+ ))), [x, g, a, f, M, k]);
243
254
  return /* @__PURE__ */ t.createElement(
244
255
  "div",
245
256
  {
246
257
  "data-message-id": a.id,
247
- className: ue(),
248
- tabIndex: te,
249
- onMouseDown: le,
250
- onKeyDown: oe,
258
+ className: de(),
259
+ tabIndex: se,
260
+ onMouseDown: re,
261
+ onKeyDown: ce,
251
262
  onFocus: (e) => {
252
- ne && w(a.selectionIndex);
263
+ oe && d(a.selectionIndex);
253
264
  },
254
265
  ref: (e) => {
255
- S.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
256
- }
266
+ R.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
267
+ },
268
+ onContextMenu: m ? V : void 0
257
269
  },
258
- ce(),
259
- re(),
270
+ ue(),
260
271
  ie(),
261
- me()
272
+ me(),
273
+ pe()
262
274
  );
263
275
  }
264
276
  );
265
- ee.displayName = "ChatMessage";
266
- class Se extends t.Component {
277
+ ne.displayName = "ChatMessage";
278
+ class Fe extends t.Component {
267
279
  render() {
268
- return /* @__PURE__ */ t.createElement(ee, { ...this.props });
280
+ return /* @__PURE__ */ t.createElement(ne, { ...this.props });
269
281
  }
270
282
  }
271
- Ee(Se);
283
+ Ie(Fe);
272
284
  export {
273
- ee as ChatMessage
285
+ ne as ChatMessage
274
286
  };
@@ -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("@progress/kendo-react-layout"),o=require("react");function a(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=a(o),i=e=>s.createElement(n.AppBar,{className:"k-chat-header",positionMode:"sticky",themeColor:"light"},e.children);module.exports=i;
8
+ "use strict";const n=require("@progress/kendo-react-layout"),o=require("react");function a(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 i=a(o),s=e=>i.createElement(n.AppBar,{className:"k-chat-header",positionMode:"sticky",themeColor:"inherit"},e.children);module.exports=s;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { AppBar as t } from "@progress/kendo-react-layout";
9
9
  import * as r from "react";
10
- const o = (e) => /* @__PURE__ */ r.createElement(t, { className: "k-chat-header", positionMode: "sticky", themeColor: "light" }, e.children);
10
+ const o = (e) => /* @__PURE__ */ r.createElement(t, { className: "k-chat-header", positionMode: "sticky", themeColor: "inherit" }, 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 C=require("react"),O=require("@progress/kendo-react-common"),T=require("@progress/kendo-react-layout"),j=require("./Attachment.js"),b=require("../utils.js"),w=require("@progress/kendo-react-intl"),l=require("../../messages/index.js");function L(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:()=>n[a]})}}return e.default=n,Object.freeze(e)}const t=L(C),z=n=>{const{group:e,user:a,itemTemplate:r,attachmentTemplate:u,onRequestSelection:m,selectedItemIndex:i,isLastGroup:g,message:d,allowMessageCollapse:p,messageToolbarActions:h,messageContextMenuActions:v,messageWidthMode:f="standard"}=n,q=w.useLocalization(),o=e.messages.length>0&&b.isAuthor(a,e.messages[0]),c=!o,x=t.useMemo(()=>O.classNames("k-message-group",{"k-message-group-sender k-no-avatar":o,"k-message-group-receiver":c,"k-message-group-full-width":f==="full"}),[o,c,f]),S=()=>{if(!(!c||!k))return t.createElement(T.Avatar,{type:"image"},t.createElement("img",{src:k,alt:I}))},y=t.useMemo(()=>{const R=e.messages.length-1;return e.messages.map((s,N)=>{const M=[t.createElement(d,{item:s,template:r,selected:s.selectionIndex===i,onRequestSelection:m,tabIndex:N===R&&g?0:-1,key:s.id,allowMessageCollapse:p,messageToolbarActions:h,messageContextMenuActions:v,isSender:b.isAuthor(a,s)})];return s.attachments&&s.attachments.length===1&&M.push(t.createElement(j,{item:s.attachments[0],template:u,selected:!1,key:`att-${s.attachments[0].content}`})),M})},[e.messages,d,r,i,m,g,p,h,v,a,u]),{avatarUrl:k,avatarAltText:A,name:E}=e.author,I=A!==void 0?A:q.toLanguageString(l.avatarAlt,l.messages[l.avatarAlt]);return t.createElement("div",{className:x},S(),t.createElement("div",{className:"k-message-group-content"},t.createElement("span",{className:"k-message-author"},E),y))};module.exports=z;
8
+ "use strict";const j=require("react"),G=require("@progress/kendo-react-common"),L=require("@progress/kendo-react-layout"),z=require("./Attachment.js"),q=require("../utils.js"),U=require("./ChatContext.js"),_=require("@progress/kendo-react-intl"),u=require("../../messages/index.js");function D(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const s in n)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:()=>n[s]})}}return e.default=n,Object.freeze(e)}const a=D(j),P=n=>{const{group:e,user:s,itemTemplate:r,contentTemplate:i,attachmentTemplate:g,onRequestSelection:d,selectedItemIndex:p,isLastGroup:h,message:v,allowMessageCollapse:f,messageToolbarActions:k,messageContextMenuActions:A,fileActions:E,messageWidthMode:x="standard",showAvatar:l=!0,showUsername:C=!0}=n,{userStatusTemplate:I}=U.useChatContext(),b=_.useLocalization(),m=e.messages.length>0&&q.isAuthor(s,e.messages[0]),{avatarUrl:o,avatarAltText:M,name:N}=e.author,T=a.useMemo(()=>G.classNames("k-message-group",{"k-message-group-sender":m,"k-message-group-receiver":!m,"k-message-group-full-width":x==="full","k-no-avatar":!l||!o}),[m,x,l,o]),w=()=>{if(!l||!o)return;const c=a.createElement(L.Avatar,{type:"image"},a.createElement("img",{src:o,alt:R}));if(I){const t=e.messages[e.messages.length-1];return a.createElement("div",{className:"k-chat-user-status-wrapper"},c,a.createElement("div",{className:"k-chat-user-status"},a.createElement(I,{message:"dataItem"in t?t.dataItem:t})))}return c},y=a.useMemo(()=>{const c=e.messages.length-1;return e.messages.map((t,O)=>{const S=[a.createElement(v,{item:t,template:r,contentTemplate:i,selected:t.selectionIndex===p,onRequestSelection:d,tabIndex:O===c&&h?0:-1,key:t.id,allowMessageCollapse:f,messageToolbarActions:k,messageContextMenuActions:A,fileActions:E,isSender:q.isAuthor(s,t)})];return t.attachments&&t.attachments.length===1&&S.push(a.createElement(z,{item:t.attachments[0],template:g,selected:!1,key:`att-${t.attachments[0].content}`})),S})},[e.messages,v,r,i,p,d,h,f,k,A,E,s,g]),R=M!==void 0?M:b.toLanguageString(u.avatarAlt,u.messages[u.avatarAlt]);return a.createElement("div",{className:T},w(),a.createElement("div",{className:"k-message-group-content"},C&&a.createElement("span",{className:"k-message-author"},N),y))};module.exports=P;