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