@progress/kendo-react-conversational-ui 12.3.0-develop.1 → 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.
- package/chat/components/ActionGroup.js +1 -1
- package/chat/components/ActionGroup.mjs +55 -34
- package/chat/components/Attachment.js +1 -1
- package/chat/components/Attachment.mjs +16 -9
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +359 -278
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +159 -147
- package/chat/components/Header.js +1 -1
- package/chat/components/Header.mjs +1 -1
- package/chat/components/MessageGroup.js +1 -1
- package/chat/components/MessageGroup.mjs +82 -61
- package/chat/components/NewMessage.js +1 -1
- package/chat/components/NewMessage.mjs +63 -59
- package/chat/components/ScrollButtonsWrapper.js +8 -0
- package/chat/components/ScrollButtonsWrapper.mjs +58 -0
- package/chat/components/SuggestionsGroup.js +1 -1
- package/chat/components/SuggestionsGroup.mjs +58 -18
- package/chat/components/elements/FileBox.js +1 -1
- package/chat/components/elements/FileBox.mjs +31 -37
- package/chat/components/elements/PinnedMessage.js +1 -1
- package/chat/components/elements/PinnedMessage.mjs +5 -4
- package/chat/hooks/useScrollWithButtons.js +8 -0
- package/chat/hooks/useScrollWithButtons.mjs +46 -0
- package/chat/utils/fieldMapping.js +1 -1
- package/chat/utils/fieldMapping.mjs +1 -1
- package/chat/utils/messageSettings.js +8 -0
- package/chat/utils/messageSettings.mjs +31 -0
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/index.d.mts +199 -5
- package/index.d.ts +199 -5
- package/messages/index.js +1 -1
- package/messages/index.mjs +26 -22
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -11
|
@@ -5,84 +5,105 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { classNames as
|
|
10
|
-
import { Avatar as
|
|
11
|
-
import
|
|
12
|
-
import { isAuthor as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import { classNames as z } from "@progress/kendo-react-common";
|
|
10
|
+
import { Avatar as R } from "@progress/kendo-react-layout";
|
|
11
|
+
import q from "./Attachment.mjs";
|
|
12
|
+
import { isAuthor as x } from "../utils.mjs";
|
|
13
|
+
import { useChatContext as V } from "./ChatContext.mjs";
|
|
14
|
+
import { useLocalization as W } from "@progress/kendo-react-intl";
|
|
15
|
+
import { avatarAlt as S, messages as $ } from "../../messages/index.mjs";
|
|
16
|
+
const O = (N) => {
|
|
16
17
|
const {
|
|
17
18
|
group: a,
|
|
18
|
-
user:
|
|
19
|
-
itemTemplate:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
user: n,
|
|
20
|
+
itemTemplate: l,
|
|
21
|
+
contentTemplate: c,
|
|
22
|
+
attachmentTemplate: i,
|
|
23
|
+
onRequestSelection: u,
|
|
24
|
+
selectedItemIndex: g,
|
|
25
|
+
isLastGroup: p,
|
|
26
|
+
message: d,
|
|
27
|
+
allowMessageCollapse: h,
|
|
28
|
+
messageToolbarActions: f,
|
|
29
|
+
messageContextMenuActions: v,
|
|
30
|
+
fileActions: k,
|
|
31
|
+
messageWidthMode: A = "standard",
|
|
32
|
+
showAvatar: m = !0,
|
|
33
|
+
showUsername: T = !0
|
|
34
|
+
} = N, { userStatusTemplate: E } = V(), w = W(), o = a.messages.length > 0 && x(n, a.messages[0]), { avatarUrl: s, avatarAltText: I, name: C } = a.author, G = t.useMemo(
|
|
35
|
+
() => z("k-message-group", {
|
|
36
|
+
"k-message-group-sender": o,
|
|
37
|
+
"k-message-group-receiver": !o,
|
|
38
|
+
"k-message-group-full-width": A === "full",
|
|
39
|
+
"k-no-avatar": !m || !s
|
|
34
40
|
}),
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
-
if (!
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
[o, A, m, s]
|
|
42
|
+
), y = () => {
|
|
43
|
+
if (!m || !s)
|
|
44
|
+
return;
|
|
45
|
+
const r = /* @__PURE__ */ t.createElement(R, { type: "image" }, /* @__PURE__ */ t.createElement("img", { src: s, alt: U }));
|
|
46
|
+
if (E) {
|
|
47
|
+
const e = a.messages[a.messages.length - 1];
|
|
48
|
+
return /* @__PURE__ */ t.createElement("div", { className: "k-chat-user-status-wrapper" }, r, /* @__PURE__ */ t.createElement("div", { className: "k-chat-user-status" }, /* @__PURE__ */ t.createElement(
|
|
49
|
+
E,
|
|
50
|
+
{
|
|
51
|
+
message: "dataItem" in e ? e.dataItem : e
|
|
52
|
+
}
|
|
53
|
+
)));
|
|
54
|
+
}
|
|
55
|
+
return r;
|
|
56
|
+
}, L = t.useMemo(() => {
|
|
57
|
+
const r = a.messages.length - 1;
|
|
58
|
+
return a.messages.map((e, b) => {
|
|
59
|
+
const M = [
|
|
60
|
+
/* @__PURE__ */ t.createElement(
|
|
61
|
+
d,
|
|
45
62
|
{
|
|
46
|
-
item:
|
|
47
|
-
template:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
item: e,
|
|
64
|
+
template: l,
|
|
65
|
+
contentTemplate: c,
|
|
66
|
+
selected: e.selectionIndex === g,
|
|
67
|
+
onRequestSelection: u,
|
|
68
|
+
tabIndex: b === r && p ? 0 : -1,
|
|
69
|
+
key: e.id,
|
|
70
|
+
allowMessageCollapse: h,
|
|
71
|
+
messageToolbarActions: f,
|
|
72
|
+
messageContextMenuActions: v,
|
|
73
|
+
fileActions: k,
|
|
74
|
+
isSender: x(n, e)
|
|
56
75
|
}
|
|
57
76
|
)
|
|
58
77
|
];
|
|
59
|
-
return
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
78
|
+
return e.attachments && e.attachments.length === 1 && M.push(
|
|
79
|
+
/* @__PURE__ */ t.createElement(
|
|
80
|
+
q,
|
|
62
81
|
{
|
|
63
|
-
item:
|
|
64
|
-
template:
|
|
82
|
+
item: e.attachments[0],
|
|
83
|
+
template: i,
|
|
65
84
|
selected: !1,
|
|
66
|
-
key: `att-${
|
|
85
|
+
key: `att-${e.attachments[0].content}`
|
|
67
86
|
}
|
|
68
87
|
)
|
|
69
|
-
),
|
|
88
|
+
), M;
|
|
70
89
|
});
|
|
71
90
|
}, [
|
|
72
91
|
a.messages,
|
|
73
|
-
|
|
74
|
-
n,
|
|
75
|
-
c,
|
|
92
|
+
d,
|
|
76
93
|
l,
|
|
77
|
-
|
|
94
|
+
c,
|
|
78
95
|
g,
|
|
96
|
+
u,
|
|
79
97
|
p,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
98
|
+
h,
|
|
99
|
+
f,
|
|
100
|
+
v,
|
|
101
|
+
k,
|
|
102
|
+
n,
|
|
103
|
+
i
|
|
104
|
+
]), U = I !== void 0 ? I : w.toLanguageString(S, $[S]);
|
|
105
|
+
return /* @__PURE__ */ t.createElement("div", { className: G }, y(), /* @__PURE__ */ t.createElement("div", { className: "k-message-group-content" }, T && /* @__PURE__ */ t.createElement("span", { className: "k-message-author" }, C), L));
|
|
85
106
|
};
|
|
86
107
|
export {
|
|
87
|
-
|
|
108
|
+
O as default
|
|
88
109
|
};
|
|
@@ -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 D=require("@progress/kendo-react-common"),
|
|
8
|
+
"use strict";const D=require("@progress/kendo-react-common"),fe=require("react"),I=require("@progress/kendo-react-buttons"),ge=require("@progress/kendo-react-upload"),pe=require("./SuggestionsGroup.js"),ne=require("@progress/kendo-react-inputs"),F=require("@progress/kendo-svg-icons"),de=require("./ChatContext.js"),me=require("@progress/kendo-react-intl"),se=require("../utils.js"),s=require("../../messages/index.js"),ke=require("./elements/FileBox.js");function be(p){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const f in p)if(f!=="default"){const b=Object.getOwnPropertyDescriptor(p,f);Object.defineProperty(k,f,b.get?b:{enumerable:!0,get:()=>p[f]})}}return k.default=p,Object.freeze(k)}const e=be(fe),ae=e.forwardRef((p,k)=>{const{onSendMessage:f,isDirectionRightToLeft:b,placeholder:q,MessageBox:z,suggestions:R,onSuggestionClick:oe,inputValue:S,onInputValueChange:m,suggestionTemplate:le,sendButtonConfig:L,onInputClick:j,suggestionsLayout:re,dir:ce}=p,{replyToMessage:a,setReplyToMessage:x,user:E,messageListScrollContainerRef:d,speechToTextConfig:y,uploadConfig:o}=de.useChatContext(),[P]=e.useState(!1),[l,M]=e.useState(void 0),[r,B]=e.useState([]),[K,O]=e.useState(!1),h=e.useRef(null),N=e.useRef(null),c=me.useLocalization(),g=e.useCallback(()=>{h.current!==null&&h.current.focus()},[]);e.useEffect(()=>{S!==void 0&&S!==l&&(M(S),g())},[S,l,g]),e.useEffect(()=>{a&&g()},[a,g]),e.useLayoutEffect(()=>{K&&(d!=null&&d.current)&&(d.current.scrollTop=d.current.scrollHeight-d.current.clientHeight,O(!1))},[K,d]);const U=e.useCallback(t=>{const n=t.value;M(n),m&&m(n)},[m]),C=e.useMemo(()=>!!(l!=null&&l.trim()||o!==!1&&r.length>0),[l,r.length,o]),w=e.useCallback(t=>{if(t.preventDefault(),f){const n=l;if(C){const u={id:"",author:E,text:n||"",timestamp:new Date,replyToId:a?a.id:void 0,files:r.map(i=>({name:i.name,size:i.size,type:i.extension,rawFile:i.getRawFile?i.getRawFile():i}))};x(null),f(u,t),B([]),M(""),m&&m(""),O(!0)}}},[f,l,E,a,r,x,m,C]),A=e.useCallback(t=>{if(!(t.key==="Enter"&&t.shiftKey))switch(t.key){case"Enter":return t.preventDefault(),w(t);case"Escape":h.current&&h.current.blur();break;default:return}},[w]);e.useImperativeHandle(k,()=>({focusInput:g}),[g]);const H=e.useCallback(t=>{B(n=>n.filter(u=>u.name!==t))},[]),V=e.useCallback(()=>o===!1?null:e.createElement(ke,{files:r,onFileRemove:H,renderInTextarea:!0}),[r,H,o]),_=e.useCallback((t,n)=>t.isDeleted?se.getDeletedMessageText(n,c):t.text,[c]),G=e.useCallback(()=>{if(a){const t=se.isAuthor(E,a);return e.createElement("div",{className:D.classNames("k-message-reference",t?"k-message-reference-sender":"k-message-reference-receiver")},e.createElement("div",{className:"k-message-reference-content"},_(a,t)),e.createElement("span",{className:"k-spacer"}),e.createElement(I.Button,{fillMode:"flat",themeColor:"base",svgIcon:F.xIcon,onClick:()=>x(null),"aria-label":c.toLanguageString(s.closeReply,s.messages[s.closeReply])}))}return null},[a,E,_,x,c]),$=e.useCallback(t=>{try{const n=Array.from(t.newState);B(u=>[...u,...n]),g()}catch{}},[g]),J=e.useCallback(()=>{N.current&&o!==!1&&N.current.actionElement.click()},[o]),Q=e.useCallback(t=>{},[]),W=e.useCallback(t=>{const{isFinal:n,alternatives:u}=t;if(u.length>0){const i=u[0];n&&M(T=>(T?`${T} `:"")+i.transcript)}},[]),X=e.useCallback(()=>e.createElement(e.Fragment,null,r.length>0&&V(),a&&e.createElement("span",{className:"k-input-prefix k-input-prefix-horizontal"},G())),[r.length,a,V,G]),Y=e.useCallback(t=>{t.preventDefault()},[]),Z=e.useCallback(t=>{t.key==="Escape"&&t.currentTarget.blur()},[]),v=e.useMemo(()=>e.createElement(I.Button,{rounded:"full",fillMode:"solid",themeColor:"primary",className:"k-chat-send",icon:"paper-plane",svgIcon:F.paperPlaneIcon,onClick:w,onMouseDown:Y,onKeyDown:Z,"aria-label":c.toLanguageString(s.newMessageSendButton,s.messages[s.newMessageSendButton]),dir:b?"rtl":void 0,disabled:!C,"aria-disabled":!C,...L}),[w,Y,Z,c,b,C,L]),ee=e.useCallback(()=>{const t=typeof y=="object"?y:void 0,n=typeof o=="object"?o:{},{className:u,...i}=n,T=D.classNames("k-hidden",u),ue=o!==!1,ie=y!==!1;return e.createElement(ne.InputSuffix,null,ie&&e.createElement(I.SpeechToTextButton,{fillMode:"clear",themeColor:"base",onError:Q,onResult:W,...t}),ue&&e.createElement(e.Fragment,null,e.createElement(I.Button,{key:"attach-file",fillMode:"clear",themeColor:"base",svgIcon:F.paperclipIcon,onClick:J,"aria-label":c.toLanguageString(s.attachFile,s.messages[s.attachFile])}),e.createElement(ge.Upload,{ref:N,files:r,onAdd:$,multiple:!0,autoUpload:!1,...i,className:T})),e.createElement("span",{className:"k-spacer"}),v)},[y,o,r,Q,W,J,$,c,v]),te=e.useMemo(()=>e.createElement(ne.TextArea,{className:D.classNames("k-message-box","!k-flex-col",{"k-focus":P}),resizable:"none",rows:1,placeholder:q,value:l,onChange:U,onKeyDown:A,onClick:j,prefix:X,suffix:ee,ref:h,"aria-label":c.toLanguageString(s.newMessageMessageInput,s.messages[s.newMessageMessageInput])}),[P,q,l,U,A,j,X,ee,c]);return e.createElement("div",{className:"k-message-box-wrapper"},R&&R.length>0&&e.createElement(pe.SuggestionGroup,{onSuggestionClick:oe,suggestions:R,suggestionTemplate:le,suggestionsLayout:re,dir:ce}),z?e.createElement(z,{messageInput:te,sendButton:v}):te)});ae.displayName="NewMessage";module.exports=ae;
|
|
@@ -7,43 +7,45 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { classNames as v } from "@progress/kendo-react-common";
|
|
9
9
|
import * as e from "react";
|
|
10
|
-
import { Button as N, SpeechToTextButton as
|
|
11
|
-
import { Upload as
|
|
12
|
-
import { SuggestionGroup as
|
|
13
|
-
import { InputSuffix as
|
|
14
|
-
import { xIcon as
|
|
15
|
-
import { useChatContext as
|
|
16
|
-
import { useLocalization as
|
|
17
|
-
import { getDeletedMessageText as
|
|
18
|
-
import { closeReply as _, messages as S, newMessageSendButton as ee, attachFile as te, newMessageMessageInput as
|
|
19
|
-
import
|
|
20
|
-
const
|
|
10
|
+
import { Button as N, SpeechToTextButton as fe } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { Upload as me } from "@progress/kendo-react-upload";
|
|
12
|
+
import { SuggestionGroup as pe } from "./SuggestionsGroup.mjs";
|
|
13
|
+
import { InputSuffix as ge, TextArea as de } from "@progress/kendo-react-inputs";
|
|
14
|
+
import { xIcon as ke, paperPlaneIcon as he, paperclipIcon as Ce } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { useChatContext as be } from "./ChatContext.mjs";
|
|
16
|
+
import { useLocalization as xe } from "@progress/kendo-react-intl";
|
|
17
|
+
import { getDeletedMessageText as Ee, isAuthor as Se } from "../utils.mjs";
|
|
18
|
+
import { closeReply as _, messages as S, newMessageSendButton as ee, attachFile as te, newMessageMessageInput as se } from "../../messages/index.mjs";
|
|
19
|
+
import ye from "./elements/FileBox.mjs";
|
|
20
|
+
const Te = e.forwardRef((ne, ae) => {
|
|
21
21
|
const {
|
|
22
|
-
onSendMessage:
|
|
22
|
+
onSendMessage: y,
|
|
23
23
|
isDirectionRightToLeft: B,
|
|
24
24
|
placeholder: F,
|
|
25
25
|
MessageBox: R,
|
|
26
|
-
suggestions:
|
|
26
|
+
suggestions: T,
|
|
27
27
|
onSuggestionClick: oe,
|
|
28
28
|
inputValue: d,
|
|
29
29
|
onInputValueChange: m,
|
|
30
30
|
suggestionTemplate: le,
|
|
31
31
|
sendButtonConfig: D,
|
|
32
|
-
onInputClick:
|
|
33
|
-
|
|
32
|
+
onInputClick: L,
|
|
33
|
+
suggestionsLayout: re,
|
|
34
|
+
dir: ce
|
|
35
|
+
} = ne, { replyToMessage: n, setReplyToMessage: k, user: h, messageListScrollContainerRef: f, speechToTextConfig: C, uploadConfig: a } = be(), [z] = e.useState(!1), [o, b] = e.useState(void 0), [l, M] = e.useState([]), [K, A] = e.useState(!1), p = e.useRef(null), w = e.useRef(null), r = xe(), i = e.useCallback(() => {
|
|
34
36
|
p.current !== null && p.current.focus();
|
|
35
37
|
}, []);
|
|
36
38
|
e.useEffect(() => {
|
|
37
39
|
d !== void 0 && d !== o && (b(d), i());
|
|
38
40
|
}, [d, o, i]), e.useEffect(() => {
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
+
n && i();
|
|
42
|
+
}, [n, i]), e.useLayoutEffect(() => {
|
|
41
43
|
K && (f != null && f.current) && (f.current.scrollTop = f.current.scrollHeight - f.current.clientHeight, A(!1));
|
|
42
44
|
}, [K, f]);
|
|
43
45
|
const P = e.useCallback(
|
|
44
46
|
(t) => {
|
|
45
|
-
const
|
|
46
|
-
b(
|
|
47
|
+
const s = t.value;
|
|
48
|
+
b(s), m && m(s);
|
|
47
49
|
},
|
|
48
50
|
[m]
|
|
49
51
|
), g = e.useMemo(
|
|
@@ -51,15 +53,15 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
51
53
|
[o, l.length, a]
|
|
52
54
|
), x = e.useCallback(
|
|
53
55
|
(t) => {
|
|
54
|
-
if (t.preventDefault(),
|
|
55
|
-
const
|
|
56
|
+
if (t.preventDefault(), y) {
|
|
57
|
+
const s = o;
|
|
56
58
|
if (g) {
|
|
57
59
|
const c = {
|
|
58
60
|
id: "",
|
|
59
61
|
author: h,
|
|
60
|
-
text:
|
|
62
|
+
text: s || "",
|
|
61
63
|
timestamp: /* @__PURE__ */ new Date(),
|
|
62
|
-
replyToId:
|
|
64
|
+
replyToId: n ? n.id : void 0,
|
|
63
65
|
files: l.map((u) => ({
|
|
64
66
|
name: u.name,
|
|
65
67
|
size: u.size,
|
|
@@ -67,15 +69,15 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
67
69
|
rawFile: u.getRawFile ? u.getRawFile() : u
|
|
68
70
|
}))
|
|
69
71
|
};
|
|
70
|
-
k(null),
|
|
72
|
+
k(null), y(c, t), M([]), b(""), m && m(""), A(!0);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
},
|
|
74
76
|
[
|
|
75
|
-
|
|
77
|
+
y,
|
|
76
78
|
o,
|
|
77
79
|
h,
|
|
78
|
-
|
|
80
|
+
n,
|
|
79
81
|
l,
|
|
80
82
|
k,
|
|
81
83
|
m,
|
|
@@ -104,13 +106,13 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
104
106
|
[i]
|
|
105
107
|
);
|
|
106
108
|
const H = e.useCallback((t) => {
|
|
107
|
-
M((
|
|
108
|
-
}, []), V = e.useCallback(() => a === !1 ? null : /* @__PURE__ */ e.createElement(
|
|
109
|
-
(t,
|
|
109
|
+
M((s) => s.filter((c) => c.name !== t));
|
|
110
|
+
}, []), V = e.useCallback(() => a === !1 ? null : /* @__PURE__ */ e.createElement(ye, { files: l, onFileRemove: H, renderInTextarea: !0 }), [l, H, a]), j = e.useCallback(
|
|
111
|
+
(t, s) => t.isDeleted ? Ee(s, r) : t.text,
|
|
110
112
|
[r]
|
|
111
113
|
), G = e.useCallback(() => {
|
|
112
|
-
if (
|
|
113
|
-
const t =
|
|
114
|
+
if (n) {
|
|
115
|
+
const t = Se(h, n);
|
|
114
116
|
return /* @__PURE__ */ e.createElement(
|
|
115
117
|
"div",
|
|
116
118
|
{
|
|
@@ -119,14 +121,14 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
119
121
|
t ? "k-message-reference-sender" : "k-message-reference-receiver"
|
|
120
122
|
)
|
|
121
123
|
},
|
|
122
|
-
/* @__PURE__ */ e.createElement("div", { className: "k-message-reference-content" }, j(
|
|
124
|
+
/* @__PURE__ */ e.createElement("div", { className: "k-message-reference-content" }, j(n, t)),
|
|
123
125
|
/* @__PURE__ */ e.createElement("span", { className: "k-spacer" }),
|
|
124
126
|
/* @__PURE__ */ e.createElement(
|
|
125
127
|
N,
|
|
126
128
|
{
|
|
127
129
|
fillMode: "flat",
|
|
128
130
|
themeColor: "base",
|
|
129
|
-
svgIcon:
|
|
131
|
+
svgIcon: ke,
|
|
130
132
|
onClick: () => k(null),
|
|
131
133
|
"aria-label": r.toLanguageString(_, S[_])
|
|
132
134
|
}
|
|
@@ -134,11 +136,11 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
134
136
|
);
|
|
135
137
|
}
|
|
136
138
|
return null;
|
|
137
|
-
}, [
|
|
139
|
+
}, [n, h, j, k, r]), $ = e.useCallback(
|
|
138
140
|
(t) => {
|
|
139
141
|
try {
|
|
140
|
-
const
|
|
141
|
-
M((c) => [...c, ...
|
|
142
|
+
const s = Array.from(t.newState);
|
|
143
|
+
M((c) => [...c, ...s]), i();
|
|
142
144
|
} catch {
|
|
143
145
|
}
|
|
144
146
|
},
|
|
@@ -147,12 +149,12 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
147
149
|
w.current && a !== !1 && w.current.actionElement.click();
|
|
148
150
|
}, [a]), J = e.useCallback((t) => {
|
|
149
151
|
}, []), O = e.useCallback((t) => {
|
|
150
|
-
const { isFinal:
|
|
152
|
+
const { isFinal: s, alternatives: c } = t;
|
|
151
153
|
if (c.length > 0) {
|
|
152
154
|
const u = c[0];
|
|
153
|
-
|
|
155
|
+
s && b((E) => (E ? `${E} ` : "") + u.transcript);
|
|
154
156
|
}
|
|
155
|
-
}, []), Q = e.useCallback(() => /* @__PURE__ */ e.createElement(e.Fragment, null, l.length > 0 && V(),
|
|
157
|
+
}, []), Q = e.useCallback(() => /* @__PURE__ */ e.createElement(e.Fragment, null, l.length > 0 && V(), n && /* @__PURE__ */ e.createElement("span", { className: "k-input-prefix k-input-prefix-horizontal" }, G())), [l.length, n, V, G]), W = e.useCallback((t) => {
|
|
156
158
|
t.preventDefault();
|
|
157
159
|
}, []), X = e.useCallback((t) => {
|
|
158
160
|
t.key === "Escape" && t.currentTarget.blur();
|
|
@@ -165,7 +167,7 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
165
167
|
themeColor: "primary",
|
|
166
168
|
className: "k-chat-send",
|
|
167
169
|
icon: "paper-plane",
|
|
168
|
-
svgIcon:
|
|
170
|
+
svgIcon: he,
|
|
169
171
|
onClick: x,
|
|
170
172
|
onMouseDown: W,
|
|
171
173
|
onKeyDown: X,
|
|
@@ -186,9 +188,9 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
186
188
|
D
|
|
187
189
|
]
|
|
188
190
|
), Y = e.useCallback(() => {
|
|
189
|
-
const t = typeof C == "object" ? C : void 0,
|
|
190
|
-
return /* @__PURE__ */ e.createElement(
|
|
191
|
-
|
|
191
|
+
const t = typeof C == "object" ? C : void 0, s = typeof a == "object" ? a : {}, { className: c, ...u } = s, E = v("k-hidden", c), ue = a !== !1, ie = C !== !1;
|
|
192
|
+
return /* @__PURE__ */ e.createElement(ge, null, ie && /* @__PURE__ */ e.createElement(
|
|
193
|
+
fe,
|
|
192
194
|
{
|
|
193
195
|
fillMode: "clear",
|
|
194
196
|
themeColor: "base",
|
|
@@ -196,18 +198,18 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
196
198
|
onResult: O,
|
|
197
199
|
...t
|
|
198
200
|
}
|
|
199
|
-
),
|
|
201
|
+
), ue && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
200
202
|
N,
|
|
201
203
|
{
|
|
202
204
|
key: "attach-file",
|
|
203
205
|
fillMode: "clear",
|
|
204
206
|
themeColor: "base",
|
|
205
|
-
svgIcon:
|
|
207
|
+
svgIcon: Ce,
|
|
206
208
|
onClick: q,
|
|
207
209
|
"aria-label": r.toLanguageString(te, S[te])
|
|
208
210
|
}
|
|
209
211
|
), /* @__PURE__ */ e.createElement(
|
|
210
|
-
|
|
212
|
+
me,
|
|
211
213
|
{
|
|
212
214
|
ref: w,
|
|
213
215
|
files: l,
|
|
@@ -230,47 +232,49 @@ const Se = e.forwardRef((se, ae) => {
|
|
|
230
232
|
I
|
|
231
233
|
]), Z = e.useMemo(
|
|
232
234
|
() => /* @__PURE__ */ e.createElement(
|
|
233
|
-
|
|
235
|
+
de,
|
|
234
236
|
{
|
|
235
|
-
className: v("k-message-box", "!k-flex-col", { "k-focus":
|
|
237
|
+
className: v("k-message-box", "!k-flex-col", { "k-focus": z }),
|
|
236
238
|
resizable: "none",
|
|
237
239
|
rows: 1,
|
|
238
240
|
placeholder: F,
|
|
239
241
|
value: o,
|
|
240
242
|
onChange: P,
|
|
241
243
|
onKeyDown: U,
|
|
242
|
-
onClick:
|
|
244
|
+
onClick: L,
|
|
243
245
|
prefix: Q,
|
|
244
246
|
suffix: Y,
|
|
245
247
|
ref: p,
|
|
246
248
|
"aria-label": r.toLanguageString(
|
|
247
|
-
|
|
248
|
-
S[
|
|
249
|
+
se,
|
|
250
|
+
S[se]
|
|
249
251
|
)
|
|
250
252
|
}
|
|
251
253
|
),
|
|
252
254
|
[
|
|
253
|
-
|
|
255
|
+
z,
|
|
254
256
|
F,
|
|
255
257
|
o,
|
|
256
258
|
P,
|
|
257
259
|
U,
|
|
258
|
-
|
|
260
|
+
L,
|
|
259
261
|
Q,
|
|
260
262
|
Y,
|
|
261
263
|
r
|
|
262
264
|
]
|
|
263
265
|
);
|
|
264
|
-
return /* @__PURE__ */ e.createElement("div", { className: "k-message-box-wrapper" },
|
|
265
|
-
|
|
266
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-message-box-wrapper" }, T && T.length > 0 && /* @__PURE__ */ e.createElement(
|
|
267
|
+
pe,
|
|
266
268
|
{
|
|
267
269
|
onSuggestionClick: oe,
|
|
268
|
-
suggestions:
|
|
269
|
-
suggestionTemplate: le
|
|
270
|
+
suggestions: T,
|
|
271
|
+
suggestionTemplate: le,
|
|
272
|
+
suggestionsLayout: re,
|
|
273
|
+
dir: ce
|
|
270
274
|
}
|
|
271
275
|
), R ? /* @__PURE__ */ e.createElement(R, { messageInput: Z, sendButton: I }) : Z);
|
|
272
276
|
});
|
|
273
|
-
|
|
277
|
+
Te.displayName = "NewMessage";
|
|
274
278
|
export {
|
|
275
|
-
|
|
279
|
+
Te as default
|
|
276
280
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),m=require("@progress/kendo-react-buttons"),r=require("@progress/kendo-svg-icons"),v=require("@progress/kendo-react-intl"),n=require("../../messages/index.js");function L(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const c=L(p),h=({visible:t,dir:e,canScrollLeft:o,canScrollRight:l,onScrollLeft:b,onScrollRight:f,children:s})=>{const a=v.useLocalization();if(!t)return s;const i=a.toLanguageString(n.scrollLeft,n.messages[n.scrollLeft]),u=a.toLanguageString(n.scrollRight,n.messages[n.scrollRight]),g=e!=="rtl"?i:u,d=e!=="rtl"?u:i;return c.createElement("div",{className:"k-suggestion-scrollwrap"},c.createElement(m.Button,{fillMode:"solid",themeColor:"base",size:"medium",rounded:"medium",svgIcon:e==="rtl"?r.chevronRightIcon:r.chevronLeftIcon,onClick:b,disabled:!o,className:"k-icon-button","aria-label":g,title:g}),s,c.createElement(m.Button,{fillMode:"solid",themeColor:"base",size:"medium",rounded:"medium",svgIcon:e==="rtl"?r.chevronLeftIcon:r.chevronRightIcon,onClick:f,disabled:!l,className:"k-icon-button","aria-label":d,title:d}))};exports.ScrollButtonsWrapper=h;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as o from "react";
|
|
9
|
+
import { Button as n } from "@progress/kendo-react-buttons";
|
|
10
|
+
import { chevronRightIcon as c, chevronLeftIcon as m } from "@progress/kendo-svg-icons";
|
|
11
|
+
import { useLocalization as h } from "@progress/kendo-react-intl";
|
|
12
|
+
import { scrollLeft as u, messages as g, scrollRight as d } from "../../messages/index.mjs";
|
|
13
|
+
const R = ({
|
|
14
|
+
visible: b,
|
|
15
|
+
dir: e,
|
|
16
|
+
canScrollLeft: f,
|
|
17
|
+
canScrollRight: p,
|
|
18
|
+
onScrollLeft: L,
|
|
19
|
+
onScrollRight: v,
|
|
20
|
+
children: t
|
|
21
|
+
}) => {
|
|
22
|
+
const l = h();
|
|
23
|
+
if (!b)
|
|
24
|
+
return t;
|
|
25
|
+
const r = l.toLanguageString(u, g[u]), a = l.toLanguageString(d, g[d]), s = e !== "rtl" ? r : a, i = e !== "rtl" ? a : r;
|
|
26
|
+
return /* @__PURE__ */ o.createElement("div", { className: "k-suggestion-scrollwrap" }, /* @__PURE__ */ o.createElement(
|
|
27
|
+
n,
|
|
28
|
+
{
|
|
29
|
+
fillMode: "solid",
|
|
30
|
+
themeColor: "base",
|
|
31
|
+
size: "medium",
|
|
32
|
+
rounded: "medium",
|
|
33
|
+
svgIcon: e === "rtl" ? c : m,
|
|
34
|
+
onClick: L,
|
|
35
|
+
disabled: !f,
|
|
36
|
+
className: "k-icon-button",
|
|
37
|
+
"aria-label": s,
|
|
38
|
+
title: s
|
|
39
|
+
}
|
|
40
|
+
), t, /* @__PURE__ */ o.createElement(
|
|
41
|
+
n,
|
|
42
|
+
{
|
|
43
|
+
fillMode: "solid",
|
|
44
|
+
themeColor: "base",
|
|
45
|
+
size: "medium",
|
|
46
|
+
rounded: "medium",
|
|
47
|
+
svgIcon: e === "rtl" ? m : c,
|
|
48
|
+
onClick: v,
|
|
49
|
+
disabled: !p,
|
|
50
|
+
className: "k-icon-button",
|
|
51
|
+
"aria-label": i,
|
|
52
|
+
title: i
|
|
53
|
+
}
|
|
54
|
+
));
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
R as ScrollButtonsWrapper
|
|
58
|
+
};
|
|
@@ -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 R=require("react"),p=require("@progress/kendo-react-common"),h=require("./ScrollButtonsWrapper.js"),D=require("../hooks/useScrollWithButtons.js");function O(r){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(l,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return l.default=r,Object.freeze(l)}const o=O(R),g=r=>{const{suggestions:l,onSuggestionClick:t,suggestionsView:s,suggestionTemplate:c,suggestionsLayout:a,dir:i}=r,u=o.useRef(null),{canScrollLeft:f,canScrollRight:m,scrollLeft:y,scrollRight:S}=D.useScrollWithButtons(u,{enabled:a==="scrollbuttons",dir:i,itemsDependency:l}),d=o.useCallback((e,n)=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t==null||t(n))},[t]),b=o.useCallback(()=>l.map(e=>c?o.createElement(c,{key:e.id,suggestion:e,onClick:()=>{t==null||t(e)}}):o.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:()=>!e.disabled&&(t==null?void 0:t(e)),onKeyDown:n=>!e.disabled&&d(n,e),key:e.id,title:e.description,className:p.classNames(s==="classic"?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},e.text)),[l,c,t,s,d]);if(!l||l.length===0)return null;if(s==="classic")return b();const k=o.createElement("div",{role:"group",className:p.classNames("k-suggestion-group",{"k-suggestion-group-scrollable":a==="scroll"}),ref:a==="scrollbuttons"?u:void 0},b());return o.createElement(h.ScrollButtonsWrapper,{visible:a==="scrollbuttons",dir:i,canScrollLeft:f,canScrollRight:m,onScrollLeft:y,onScrollRight:S},k)};exports.SuggestionGroup=g;
|