@progress/kendo-react-conversational-ui 13.4.0-develop.1 → 13.4.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/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,11 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { ChatMessageBoxProps } from '../ChatPropsAndState.js';
|
|
8
|
+
import { ChatMessageBoxProps, MessageBoxSettings } from '../ChatPropsAndState.js';
|
|
9
9
|
import { MessageAction, FileAction } from './ChatMessage.js';
|
|
10
10
|
import { ButtonProps } from '@progress/kendo-react-buttons';
|
|
11
11
|
import { ChatSuggestion, SuggestionTemplateProps } from './SuggestionsGroup.js';
|
|
12
|
-
import { Message } from '../../
|
|
12
|
+
import { Message } from '../../api/message.interface.js';
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
/**
|
|
15
15
|
* @hidden
|
|
@@ -24,10 +24,12 @@ export interface NewMessageProps {
|
|
|
24
24
|
suggestionTemplate?: React.ComponentType<SuggestionTemplateProps>;
|
|
25
25
|
onSuggestionClick?: (suggestion: ChatSuggestion) => void;
|
|
26
26
|
onInputValueChange?: (value: string) => void;
|
|
27
|
-
sendButtonConfig?: ButtonProps;
|
|
27
|
+
sendButtonConfig?: boolean | ButtonProps;
|
|
28
28
|
onInputClick?: () => void;
|
|
29
29
|
suggestionsLayout?: 'scroll' | 'wrap' | 'scrollbuttons';
|
|
30
30
|
dir?: string;
|
|
31
|
+
messageBoxSettings?: MessageBoxSettings;
|
|
32
|
+
loading?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export interface ActionTriggeredEvent {
|
|
33
35
|
/**
|
|
@@ -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
|
|
8
|
+
"use strict";const Z=require("@progress/kendo-react-common"),$=require("react"),ee=require("@progress/kendo-react-buttons"),te=require("./SuggestionsGroup.js"),ne=require("@progress/kendo-svg-icons"),se=require("./ChatContext.js"),oe=require("@progress/kendo-react-intl"),H=require("../utils.js"),t=require("../../messages/index.js"),ae=require("../../prompt-box/PromptBoxUploadButton.js"),re=require("../../prompt-box/PromptBox.js");function le(l){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const o in l)if(o!=="default"){const g=Object.getOwnPropertyDescriptor(l,o);Object.defineProperty(c,o,g.get?g:{enumerable:!0,get:()=>l[o]})}}return c.default=l,Object.freeze(c)}const e=le($),_=e.memo(({affixProps:l,uploadConfig:c,localizationService:o,onFilesSelect:g,onFileRemove:S})=>{const k=typeof c=="object"?c:{};return c!==!1?e.createElement(ae.PromptBoxUploadButton,{...l.uploadButtonProps,fillMode:"clear",size:void 0,"aria-label":o.toLanguageString(t.attachFile,t.messages[t.attachFile]),title:o.toLanguageString(t.attachFile,t.messages[t.attachFile]),...k,onSelectAttachments:g,onRemoveAttachment:S}):null});_.displayName="UploadButtonAffix";const J=e.forwardRef((l,c)=>{const{onSendMessage:o,isDirectionRightToLeft:g,placeholder:S,MessageBox:k,suggestions:x,onSuggestionClick:K,inputValue:T,onInputValueChange:p,suggestionTemplate:Q,sendButtonConfig:C,onInputClick:E,suggestionsLayout:W,dir:X,messageBoxSettings:r,loading:B}=l,{replyToMessage:u,setReplyToMessage:b,user:M,messageListScrollContainerRef:m,speechToTextConfig:A,uploadConfig:P}=se.useChatContext(),[Y,F]=e.useState(""),[y,R]=e.useState([]),[I,L]=e.useState(!1),v=e.useRef(null),s=oe.useLocalization(),f=T!==void 0,w=f?T:Y,i=e.useCallback(()=>{v.current!==null&&v.current.focus()},[]);e.useEffect(()=>{u&&i()},[u,i]),e.useLayoutEffect(()=>{I&&(m!=null&&m.current)&&(m.current.scrollTop=m.current.scrollHeight-m.current.clientHeight,L(!1))},[I,m]);const q=e.useCallback(n=>{if(n.preventDefault(),o){const h={id:"",author:M,text:w||"",timestamp:new Date,replyToId:u?u.id:void 0,files:y.map(d=>({name:d.name,size:d.size,type:d.extension,rawFile:d.getRawFile?d.getRawFile():d}))};b(null),o(h,n),R([]),f||F(""),p&&p(""),L(!0),i()}},[o,w,M,u,y,b,p,i,f]);e.useImperativeHandle(c,()=>({focusInput:i}),[i]);const N=e.useCallback(n=>{R(a=>a.filter(h=>h.name!==n))},[]),D=e.useCallback((n,a)=>n.isDeleted?H.getDeletedMessageText(a,s):n.text,[s]),j=e.useCallback(()=>{if(u){const n=H.isAuthor(M,u);return e.createElement("div",{className:Z.classNames("k-message-reference",n?"k-message-reference-sender":"k-message-reference-receiver")},e.createElement("div",{className:"k-message-reference-content"},D(u,n)),e.createElement("span",{className:"k-spacer"}),e.createElement(ee.Button,{fillMode:"flat",svgIcon:ne.xMarkSmOutlineIcon,onClick:()=>b(null),"aria-label":s.toLanguageString(t.closeReply,t.messages[t.closeReply]),title:s.toLanguageString(t.closeReply,t.messages[t.closeReply])}))}return null},[u,M,D,b,s]),G=e.useCallback(n=>{try{const a=Array.from(n.allFiles);R(a)}catch{}},[]);e.useEffect(()=>{i()},[T,i]);const O=e.useCallback(n=>{const a=n.value;f||F(a),p&&p(a||"")},[f,p]),U=e.useCallback(n=>{q(n.syntheticEvent)},[q]),V=e.useCallback(n=>e.createElement(_,{affixProps:n,uploadConfig:P,localizationService:s,onFilesSelect:G,onFileRemove:N}),[P,s,G,N]),z=e.useMemo(()=>{const n=typeof C=="object"?C:{},h=C!==!1?{"aria-label":B?s.toLanguageString(t.chatStopGenerating,t.messages[t.chatStopGenerating]):s.toLanguageString(t.newMessageSendButton,t.messages[t.newMessageSendButton]),title:B?s.toLanguageString(t.chatStopGenerating,t.messages[t.chatStopGenerating]):s.toLanguageString(t.newMessageSendButton,t.messages[t.newMessageSendButton]),dir:g?"rtl":void 0,...n}:!1;return e.createElement(re.PromptBox,{header:j(),ref:v,placeholder:S,value:w,onChange:O,onPromptAction:U,mode:(r==null?void 0:r.mode)||"multi",rows:(r==null?void 0:r.rows)||2,maxTextAreaHeight:(r==null?void 0:r.maxTextAreaHeight)||"110",loading:B,speechToTextButtonConfig:A,actionButtonConfig:h,attachments:y,startAffix:V,inputAttributes:{onClick:E,"aria-label":s.toLanguageString(t.newMessageMessageInput,t.messages[t.newMessageMessageInput])}})},[S,w,O,U,r,B,A,C,y,j,V,s,g,E]);return e.createElement("div",{className:"k-message-box-wrapper"},x&&x.length>0&&e.createElement(te.SuggestionGroup,{onSuggestionClick:K,suggestions:x,suggestionTemplate:Q,suggestionsLayout:W,dir:X}),k?e.createElement(k,{messageInput:z}):z)});J.displayName="NewMessage";module.exports=J;
|
|
@@ -5,276 +5,224 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { classNames as
|
|
8
|
+
import { classNames as te } from "@progress/kendo-react-common";
|
|
9
9
|
import * as e from "react";
|
|
10
|
-
import { Button as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
import { Button as oe } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { SuggestionGroup as ne } from "./SuggestionsGroup.mjs";
|
|
12
|
+
import { xMarkSmOutlineIcon as ae } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { useChatContext as se } from "./ChatContext.mjs";
|
|
14
|
+
import { useLocalization as re } from "@progress/kendo-react-intl";
|
|
15
|
+
import { getDeletedMessageText as le, isAuthor as ce } from "../utils.mjs";
|
|
16
|
+
import { closeReply as v, messages as r, chatStopGenerating as y, newMessageSendButton as w, newMessageMessageInput as W, attachFile as E } from "../../messages/index.mjs";
|
|
17
|
+
import { PromptBoxUploadButton as ie } from "../../prompt-box/PromptBoxUploadButton.mjs";
|
|
18
|
+
import { PromptBox as ue } from "../../prompt-box/PromptBox.mjs";
|
|
19
|
+
const X = e.memo(
|
|
20
|
+
({ affixProps: A, uploadConfig: g, localizationService: i, onFilesSelect: d, onFileRemove: h }) => {
|
|
21
|
+
const C = typeof g == "object" ? g : {};
|
|
22
|
+
return g !== !1 ? /* @__PURE__ */ e.createElement(
|
|
23
|
+
ie,
|
|
24
|
+
{
|
|
25
|
+
...A.uploadButtonProps,
|
|
26
|
+
fillMode: "clear",
|
|
27
|
+
size: void 0,
|
|
28
|
+
"aria-label": i.toLanguageString(E, r[E]),
|
|
29
|
+
title: i.toLanguageString(E, r[E]),
|
|
30
|
+
...C,
|
|
31
|
+
onSelectAttachments: d,
|
|
32
|
+
onRemoveAttachment: h
|
|
33
|
+
}
|
|
34
|
+
) : null;
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
X.displayName = "UploadButtonAffix";
|
|
38
|
+
const me = e.forwardRef((A, g) => {
|
|
21
39
|
const {
|
|
22
|
-
onSendMessage:
|
|
23
|
-
isDirectionRightToLeft:
|
|
24
|
-
placeholder:
|
|
25
|
-
MessageBox:
|
|
26
|
-
suggestions:
|
|
27
|
-
onSuggestionClick:
|
|
28
|
-
inputValue:
|
|
29
|
-
onInputValueChange:
|
|
30
|
-
suggestionTemplate:
|
|
31
|
-
sendButtonConfig:
|
|
32
|
-
onInputClick:
|
|
33
|
-
suggestionsLayout:
|
|
34
|
-
dir:
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
onSendMessage: i,
|
|
41
|
+
isDirectionRightToLeft: d,
|
|
42
|
+
placeholder: h,
|
|
43
|
+
MessageBox: C,
|
|
44
|
+
suggestions: x,
|
|
45
|
+
onSuggestionClick: Y,
|
|
46
|
+
inputValue: L,
|
|
47
|
+
onInputValueChange: u,
|
|
48
|
+
suggestionTemplate: Z,
|
|
49
|
+
sendButtonConfig: S,
|
|
50
|
+
onInputClick: I,
|
|
51
|
+
suggestionsLayout: _,
|
|
52
|
+
dir: $,
|
|
53
|
+
messageBoxSettings: a,
|
|
54
|
+
loading: k
|
|
55
|
+
} = A, { replyToMessage: s, setReplyToMessage: T, user: b, messageListScrollContainerRef: c, speechToTextConfig: N, uploadConfig: P } = se(), [ee, V] = e.useState(""), [B, R] = e.useState([]), [D, H] = e.useState(!1), F = e.useRef(null), o = re(), p = L !== void 0, M = p ? L : ee, l = e.useCallback(() => {
|
|
56
|
+
F.current !== null && F.current.focus();
|
|
37
57
|
}, []);
|
|
38
58
|
e.useEffect(() => {
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
}, [K, f]);
|
|
45
|
-
const P = e.useCallback(
|
|
59
|
+
s && l();
|
|
60
|
+
}, [s, l]), e.useLayoutEffect(() => {
|
|
61
|
+
D && (c != null && c.current) && (c.current.scrollTop = c.current.scrollHeight - c.current.clientHeight, H(!1));
|
|
62
|
+
}, [D, c]);
|
|
63
|
+
const U = e.useCallback(
|
|
46
64
|
(t) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
text: s || "",
|
|
63
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
64
|
-
replyToId: n ? n.id : void 0,
|
|
65
|
-
files: l.map((u) => ({
|
|
66
|
-
name: u.name,
|
|
67
|
-
size: u.size,
|
|
68
|
-
type: u.extension,
|
|
69
|
-
rawFile: u.getRawFile ? u.getRawFile() : u
|
|
70
|
-
}))
|
|
71
|
-
};
|
|
72
|
-
k(null), y(c, t), M([]), b(""), m && m(""), A(!0);
|
|
73
|
-
}
|
|
65
|
+
if (t.preventDefault(), i) {
|
|
66
|
+
const f = {
|
|
67
|
+
id: "",
|
|
68
|
+
author: b,
|
|
69
|
+
text: M || "",
|
|
70
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
71
|
+
replyToId: s ? s.id : void 0,
|
|
72
|
+
files: B.map((m) => ({
|
|
73
|
+
name: m.name,
|
|
74
|
+
size: m.size,
|
|
75
|
+
type: m.extension,
|
|
76
|
+
rawFile: m.getRawFile ? m.getRawFile() : m
|
|
77
|
+
}))
|
|
78
|
+
};
|
|
79
|
+
T(null), i(f, t), R([]), p || V(""), u && u(""), H(!0), l();
|
|
74
80
|
}
|
|
75
81
|
},
|
|
76
82
|
[
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
i,
|
|
84
|
+
M,
|
|
85
|
+
b,
|
|
86
|
+
s,
|
|
87
|
+
B,
|
|
88
|
+
T,
|
|
89
|
+
u,
|
|
81
90
|
l,
|
|
82
|
-
|
|
83
|
-
m,
|
|
84
|
-
g
|
|
91
|
+
p
|
|
85
92
|
]
|
|
86
|
-
), U = e.useCallback(
|
|
87
|
-
(t) => {
|
|
88
|
-
if (!(t.key === "Enter" && t.shiftKey))
|
|
89
|
-
switch (t.key) {
|
|
90
|
-
case "Enter":
|
|
91
|
-
return t.preventDefault(), x(t);
|
|
92
|
-
case "Escape":
|
|
93
|
-
p.current && p.current.blur();
|
|
94
|
-
break;
|
|
95
|
-
default:
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
[x]
|
|
100
93
|
);
|
|
101
94
|
e.useImperativeHandle(
|
|
102
|
-
|
|
95
|
+
g,
|
|
103
96
|
() => ({
|
|
104
|
-
focusInput:
|
|
97
|
+
focusInput: l
|
|
105
98
|
}),
|
|
106
|
-
[
|
|
99
|
+
[l]
|
|
107
100
|
);
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
}, []),
|
|
111
|
-
(t,
|
|
112
|
-
[
|
|
101
|
+
const z = e.useCallback((t) => {
|
|
102
|
+
R((n) => n.filter((f) => f.name !== t));
|
|
103
|
+
}, []), j = e.useCallback(
|
|
104
|
+
(t, n) => t.isDeleted ? le(n, o) : t.text,
|
|
105
|
+
[o]
|
|
113
106
|
), G = e.useCallback(() => {
|
|
114
|
-
if (
|
|
115
|
-
const t =
|
|
107
|
+
if (s) {
|
|
108
|
+
const t = ce(b, s);
|
|
116
109
|
return /* @__PURE__ */ e.createElement(
|
|
117
110
|
"div",
|
|
118
111
|
{
|
|
119
|
-
className:
|
|
112
|
+
className: te(
|
|
120
113
|
"k-message-reference",
|
|
121
114
|
t ? "k-message-reference-sender" : "k-message-reference-receiver"
|
|
122
115
|
)
|
|
123
116
|
},
|
|
124
|
-
/* @__PURE__ */ e.createElement("div", { className: "k-message-reference-content" }, j(
|
|
117
|
+
/* @__PURE__ */ e.createElement("div", { className: "k-message-reference-content" }, j(s, t)),
|
|
125
118
|
/* @__PURE__ */ e.createElement("span", { className: "k-spacer" }),
|
|
126
119
|
/* @__PURE__ */ e.createElement(
|
|
127
|
-
|
|
120
|
+
oe,
|
|
128
121
|
{
|
|
129
122
|
fillMode: "flat",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
svgIcon: ae,
|
|
124
|
+
onClick: () => T(null),
|
|
125
|
+
"aria-label": o.toLanguageString(v, r[v]),
|
|
126
|
+
title: o.toLanguageString(v, r[v])
|
|
134
127
|
}
|
|
135
128
|
)
|
|
136
129
|
);
|
|
137
130
|
}
|
|
138
131
|
return null;
|
|
139
|
-
}, [
|
|
132
|
+
}, [s, b, j, T, o]), O = e.useCallback((t) => {
|
|
133
|
+
try {
|
|
134
|
+
const n = Array.from(t.allFiles);
|
|
135
|
+
R(n);
|
|
136
|
+
} catch {
|
|
137
|
+
}
|
|
138
|
+
}, []);
|
|
139
|
+
e.useEffect(() => {
|
|
140
|
+
l();
|
|
141
|
+
}, [L, l]);
|
|
142
|
+
const q = e.useCallback(
|
|
140
143
|
(t) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
M((c) => [...c, ...s]), i();
|
|
144
|
-
} catch {
|
|
145
|
-
}
|
|
144
|
+
const n = t.value;
|
|
145
|
+
p || V(n), u && u(n || "");
|
|
146
146
|
},
|
|
147
|
-
[
|
|
148
|
-
),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
s && b((E) => (E ? `${E} ` : "") + u.transcript);
|
|
156
|
-
}
|
|
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) => {
|
|
158
|
-
t.preventDefault();
|
|
159
|
-
}, []), X = e.useCallback((t) => {
|
|
160
|
-
t.key === "Escape" && t.currentTarget.blur();
|
|
161
|
-
}, []), I = e.useMemo(
|
|
162
|
-
() => /* @__PURE__ */ e.createElement(
|
|
163
|
-
N,
|
|
164
|
-
{
|
|
165
|
-
rounded: "full",
|
|
166
|
-
fillMode: "solid",
|
|
167
|
-
themeColor: "primary",
|
|
168
|
-
className: "k-chat-send",
|
|
169
|
-
icon: "paper-plane",
|
|
170
|
-
svgIcon: he,
|
|
171
|
-
onClick: x,
|
|
172
|
-
onMouseDown: W,
|
|
173
|
-
onKeyDown: X,
|
|
174
|
-
"aria-label": r.toLanguageString(ee, S[ee]),
|
|
175
|
-
dir: B ? "rtl" : void 0,
|
|
176
|
-
disabled: !g,
|
|
177
|
-
"aria-disabled": !g,
|
|
178
|
-
...D
|
|
179
|
-
}
|
|
180
|
-
),
|
|
181
|
-
[
|
|
182
|
-
x,
|
|
183
|
-
W,
|
|
147
|
+
[p, u]
|
|
148
|
+
), J = e.useCallback(
|
|
149
|
+
(t) => {
|
|
150
|
+
U(t.syntheticEvent);
|
|
151
|
+
},
|
|
152
|
+
[U]
|
|
153
|
+
), K = e.useCallback(
|
|
154
|
+
(t) => /* @__PURE__ */ e.createElement(
|
|
184
155
|
X,
|
|
185
|
-
r,
|
|
186
|
-
B,
|
|
187
|
-
g,
|
|
188
|
-
D
|
|
189
|
-
]
|
|
190
|
-
), Y = e.useCallback(() => {
|
|
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,
|
|
194
|
-
{
|
|
195
|
-
fillMode: "clear",
|
|
196
|
-
themeColor: "base",
|
|
197
|
-
onError: J,
|
|
198
|
-
onResult: O,
|
|
199
|
-
...t
|
|
200
|
-
}
|
|
201
|
-
), ue && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
202
|
-
N,
|
|
203
156
|
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
"aria-label": r.toLanguageString(te, S[te])
|
|
157
|
+
affixProps: t,
|
|
158
|
+
uploadConfig: P,
|
|
159
|
+
localizationService: o,
|
|
160
|
+
onFilesSelect: O,
|
|
161
|
+
onFileRemove: z
|
|
210
162
|
}
|
|
211
|
-
),
|
|
212
|
-
|
|
163
|
+
),
|
|
164
|
+
[P, o, O, z]
|
|
165
|
+
), Q = e.useMemo(() => {
|
|
166
|
+
const t = typeof S == "object" ? S : {}, f = S !== !1 ? {
|
|
167
|
+
"aria-label": k ? o.toLanguageString(y, r[y]) : o.toLanguageString(w, r[w]),
|
|
168
|
+
title: k ? o.toLanguageString(y, r[y]) : o.toLanguageString(w, r[w]),
|
|
169
|
+
dir: d ? "rtl" : void 0,
|
|
170
|
+
...t
|
|
171
|
+
} : !1;
|
|
172
|
+
return /* @__PURE__ */ e.createElement(
|
|
173
|
+
ue,
|
|
213
174
|
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
175
|
+
header: G(),
|
|
176
|
+
ref: F,
|
|
177
|
+
placeholder: h,
|
|
178
|
+
value: M,
|
|
179
|
+
onChange: q,
|
|
180
|
+
onPromptAction: J,
|
|
181
|
+
mode: (a == null ? void 0 : a.mode) || "multi",
|
|
182
|
+
rows: (a == null ? void 0 : a.rows) || 2,
|
|
183
|
+
maxTextAreaHeight: (a == null ? void 0 : a.maxTextAreaHeight) || "110",
|
|
184
|
+
loading: k,
|
|
185
|
+
speechToTextButtonConfig: N,
|
|
186
|
+
actionButtonConfig: f,
|
|
187
|
+
attachments: B,
|
|
188
|
+
startAffix: K,
|
|
189
|
+
inputAttributes: {
|
|
190
|
+
onClick: I,
|
|
191
|
+
"aria-label": o.toLanguageString(
|
|
192
|
+
W,
|
|
193
|
+
r[W]
|
|
194
|
+
)
|
|
195
|
+
}
|
|
221
196
|
}
|
|
222
|
-
)
|
|
197
|
+
);
|
|
223
198
|
}, [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
l,
|
|
227
|
-
J,
|
|
228
|
-
O,
|
|
199
|
+
h,
|
|
200
|
+
M,
|
|
229
201
|
q,
|
|
230
|
-
|
|
231
|
-
|
|
202
|
+
J,
|
|
203
|
+
a,
|
|
204
|
+
k,
|
|
205
|
+
N,
|
|
206
|
+
S,
|
|
207
|
+
B,
|
|
208
|
+
G,
|
|
209
|
+
K,
|
|
210
|
+
o,
|
|
211
|
+
d,
|
|
232
212
|
I
|
|
233
|
-
])
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
{
|
|
237
|
-
className: v("k-message-box", "!k-flex-col", { "k-focus": z }),
|
|
238
|
-
resizable: "none",
|
|
239
|
-
rows: 1,
|
|
240
|
-
placeholder: F,
|
|
241
|
-
value: o,
|
|
242
|
-
onChange: P,
|
|
243
|
-
onKeyDown: U,
|
|
244
|
-
onClick: L,
|
|
245
|
-
prefix: Q,
|
|
246
|
-
suffix: Y,
|
|
247
|
-
ref: p,
|
|
248
|
-
"aria-label": r.toLanguageString(
|
|
249
|
-
se,
|
|
250
|
-
S[se]
|
|
251
|
-
)
|
|
252
|
-
}
|
|
253
|
-
),
|
|
254
|
-
[
|
|
255
|
-
z,
|
|
256
|
-
F,
|
|
257
|
-
o,
|
|
258
|
-
P,
|
|
259
|
-
U,
|
|
260
|
-
L,
|
|
261
|
-
Q,
|
|
262
|
-
Y,
|
|
263
|
-
r
|
|
264
|
-
]
|
|
265
|
-
);
|
|
266
|
-
return /* @__PURE__ */ e.createElement("div", { className: "k-message-box-wrapper" }, T && T.length > 0 && /* @__PURE__ */ e.createElement(
|
|
267
|
-
pe,
|
|
213
|
+
]);
|
|
214
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-message-box-wrapper" }, x && x.length > 0 && /* @__PURE__ */ e.createElement(
|
|
215
|
+
ne,
|
|
268
216
|
{
|
|
269
|
-
onSuggestionClick:
|
|
270
|
-
suggestions:
|
|
271
|
-
suggestionTemplate:
|
|
272
|
-
suggestionsLayout:
|
|
273
|
-
dir:
|
|
217
|
+
onSuggestionClick: Y,
|
|
218
|
+
suggestions: x,
|
|
219
|
+
suggestionTemplate: Z,
|
|
220
|
+
suggestionsLayout: _,
|
|
221
|
+
dir: $
|
|
274
222
|
}
|
|
275
|
-
),
|
|
223
|
+
), C ? /* @__PURE__ */ e.createElement(C, { messageInput: Q }) : Q);
|
|
276
224
|
});
|
|
277
|
-
|
|
225
|
+
me.displayName = "NewMessage";
|
|
278
226
|
export {
|
|
279
|
-
|
|
227
|
+
me as default
|
|
280
228
|
};
|
|
@@ -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 p=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),b=require("@progress/kendo-react-buttons"),r=require("@progress/kendo-svg-icons"),v=require("@progress/kendo-react-intl"),l=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 n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const c=L(p),S=({visible:t,dir:e,canScrollLeft:o,canScrollRight:n,onScrollLeft:d,onScrollRight:m,children:a})=>{const s=v.useLocalization();if(!t)return a;const i=s.toLanguageString(l.scrollLeft,l.messages[l.scrollLeft]),u=s.toLanguageString(l.scrollRight,l.messages[l.scrollRight]),g=e!=="rtl"?i:u,f=e!=="rtl"?u:i;return c.createElement("div",{className:"k-suggestion-scrollwrap"},c.createElement(b.Button,{fillMode:"flat",size:"small",svgIcon:e==="rtl"?r.chevronRightIcon:r.chevronLeftIcon,onClick:d,disabled:!o,"aria-label":g,title:g}),a,c.createElement(b.Button,{fillMode:"flat",size:"small",svgIcon:e==="rtl"?r.chevronLeftIcon:r.chevronRightIcon,onClick:m,disabled:!n,"aria-label":f,title:f}))};exports.ScrollButtonsWrapper=S;
|
|
@@ -5,54 +5,48 @@
|
|
|
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 { Button as
|
|
10
|
-
import { chevronRightIcon as
|
|
11
|
-
import { useLocalization as
|
|
12
|
-
import { scrollLeft as
|
|
13
|
-
const
|
|
14
|
-
visible:
|
|
15
|
-
dir:
|
|
16
|
-
canScrollLeft:
|
|
17
|
-
canScrollRight:
|
|
18
|
-
onScrollLeft:
|
|
19
|
-
onScrollRight:
|
|
20
|
-
children:
|
|
8
|
+
import * as e from "react";
|
|
9
|
+
import { Button as c } from "@progress/kendo-react-buttons";
|
|
10
|
+
import { chevronRightIcon as i, chevronLeftIcon as m } from "@progress/kendo-svg-icons";
|
|
11
|
+
import { useLocalization as z } from "@progress/kendo-react-intl";
|
|
12
|
+
import { scrollLeft as g, messages as f, scrollRight as p } from "../../messages/index.mjs";
|
|
13
|
+
const k = ({
|
|
14
|
+
visible: L,
|
|
15
|
+
dir: t,
|
|
16
|
+
canScrollLeft: b,
|
|
17
|
+
canScrollRight: u,
|
|
18
|
+
onScrollLeft: v,
|
|
19
|
+
onScrollRight: h,
|
|
20
|
+
children: l
|
|
21
21
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
return
|
|
25
|
-
const r =
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
22
|
+
const o = z();
|
|
23
|
+
if (!L)
|
|
24
|
+
return l;
|
|
25
|
+
const r = o.toLanguageString(g, f[g]), a = o.toLanguageString(p, f[p]), s = t !== "rtl" ? r : a, n = t !== "rtl" ? a : r;
|
|
26
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-suggestion-scrollwrap" }, /* @__PURE__ */ e.createElement(
|
|
27
|
+
c,
|
|
28
28
|
{
|
|
29
|
-
fillMode: "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onClick: L,
|
|
35
|
-
disabled: !f,
|
|
36
|
-
className: "k-icon-button",
|
|
29
|
+
fillMode: "flat",
|
|
30
|
+
size: "small",
|
|
31
|
+
svgIcon: t === "rtl" ? i : m,
|
|
32
|
+
onClick: v,
|
|
33
|
+
disabled: !b,
|
|
37
34
|
"aria-label": s,
|
|
38
35
|
title: s
|
|
39
36
|
}
|
|
40
|
-
),
|
|
41
|
-
|
|
37
|
+
), l, /* @__PURE__ */ e.createElement(
|
|
38
|
+
c,
|
|
42
39
|
{
|
|
43
|
-
fillMode: "
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className: "k-icon-button",
|
|
51
|
-
"aria-label": i,
|
|
52
|
-
title: i
|
|
40
|
+
fillMode: "flat",
|
|
41
|
+
size: "small",
|
|
42
|
+
svgIcon: t === "rtl" ? m : i,
|
|
43
|
+
onClick: h,
|
|
44
|
+
disabled: !u,
|
|
45
|
+
"aria-label": n,
|
|
46
|
+
title: n
|
|
53
47
|
}
|
|
54
48
|
));
|
|
55
49
|
};
|
|
56
50
|
export {
|
|
57
|
-
|
|
51
|
+
k as ScrollButtonsWrapper
|
|
58
52
|
};
|
|
@@ -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 R=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),f=require("@progress/kendo-react-common"),h=require("./ScrollButtonsWrapper.js"),D=require("../hooks/useScrollWithButtons.js");function E(o){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>o[t]})}}return r.default=o,Object.freeze(r)}const s=E(R),N=o=>{const{suggestions:r,onSuggestionClick:t,suggestionsView:c,suggestionTemplate:n,suggestionsLayout:l,dir:u}=o,d=s.useRef(null),{canScrollLeft:b,canScrollRight:p,scrollLeft:g,scrollRight:k}=D.useScrollWithButtons(d,{enabled:l==="scrollbuttons"||l==="scroll",dir:u,mode:l,itemsDependency:r}),m=s.useCallback((e,i)=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t==null||t(i))},[t]),a=s.useCallback(()=>r.map(e=>n?s.createElement(n,{key:e.id,suggestion:e,onClick:()=>{t==null||t(e)}}):s.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:i=>!e.disabled&&m(i,e),key:e.id,title:e.description,className:f.classNames(c==="classic"?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},e.text)),[r,n,t,c,m]);if(!r||r.length===0)return null;if(c==="classic")return a();const y=l==="scroll"||l==="scrollbuttons",S=s.createElement("div",{role:"group",className:f.classNames("k-suggestion-group",{"k-suggestion-group-scrollable":l==="scroll","k-suggestion-group-scrollable-start":p&&(l==="scroll"||l==="scrollbuttons"),"k-suggestion-group-scrollable-end":b&&(l==="scroll"||l==="scrollbuttons")})},y?s.createElement("div",{className:"k-suggestions-scroll",ref:d},a()):a());return s.createElement(h.ScrollButtonsWrapper,{visible:l==="scrollbuttons",dir:u,canScrollLeft:b,canScrollRight:p,onScrollLeft:g,onScrollRight:k},S)};exports.SuggestionGroup=N;
|