@progress/kendo-react-conversational-ui 14.5.0-develop.8 → 15.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +4 -4
  2. package/ai-prompt/AIPrompt.d.ts +6 -0
  3. package/ai-prompt/AIPrompt.js +1 -1
  4. package/ai-prompt/AIPrompt.mjs +40 -38
  5. package/ai-prompt/AIPromptContent.js +1 -1
  6. package/ai-prompt/AIPromptContent.mjs +5 -5
  7. package/ai-prompt/views/AIPromptOutputView.js +1 -1
  8. package/ai-prompt/views/AIPromptOutputView.mjs +6 -6
  9. package/chat/ChatPropsAndState.d.ts +17 -0
  10. package/chat/components/Chat.js +1 -1
  11. package/chat/components/Chat.mjs +222 -220
  12. package/chat/components/ChatMessage.js +1 -1
  13. package/chat/components/ChatMessage.mjs +133 -117
  14. package/chat/components/Header.js +1 -1
  15. package/chat/components/Header.mjs +1 -1
  16. package/chat/components/NewMessage.js +1 -1
  17. package/chat/components/NewMessage.mjs +49 -48
  18. package/chat/components/Notification.js +1 -1
  19. package/chat/components/Notification.mjs +1 -1
  20. package/chat/components/elements/FileBox.js +1 -1
  21. package/chat/components/elements/FileBox.mjs +10 -9
  22. package/chat/components/elements/PinnedMessage.js +1 -1
  23. package/chat/components/elements/PinnedMessage.mjs +14 -13
  24. package/chat/hooks/useEndlessScroll.js +1 -1
  25. package/chat/hooks/useEndlessScroll.mjs +103 -101
  26. package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
  27. package/inline-ai-prompt/InlineAIPrompt.js +1 -1
  28. package/inline-ai-prompt/InlineAIPrompt.mjs +10 -10
  29. package/inline-ai-prompt/InlineAIPromptInput.js +1 -1
  30. package/inline-ai-prompt/InlineAIPromptInput.mjs +1 -1
  31. package/messages/index.d.ts +5 -0
  32. package/messages/index.js +1 -1
  33. package/messages/index.mjs +12 -10
  34. package/package-metadata.js +1 -1
  35. package/package-metadata.mjs +2 -2
  36. package/package.json +17 -12
  37. package/prompt-box/FileBox.js +1 -1
  38. package/prompt-box/FileBox.mjs +21 -20
  39. package/prompt-box/PromptBox.js +1 -1
  40. package/prompt-box/PromptBox.mjs +148 -150
@@ -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 { xMarkSmOutlineIcon as ae } from "@progress/kendo-svg-icons";
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 ce, isAuthor as se } from "../utils.mjs";
16
- import { closeReply as y, messages as l, chatStopGenerating as w, newMessageSendButton as E, newMessageMessageInput as X, attachFile as L } from "../../messages/index.mjs";
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: c, onFilesSelect: g, onFileRemove: C }) => {
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": c.toLanguageString(L, l[L]),
28
- title: c.toLanguageString(L, l[L]),
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: c,
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: s,
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: v, user: x, speechToTextConfig: V, uploadConfig: D } = re(), [ee, U] = t.useState(""), [M, F] = t.useState([]), I = t.useRef(null), o = le(), d = N !== void 0, T = d ? N : ee, i = t.useCallback(() => {
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(), c) {
62
+ if (n.preventDefault(), s) {
63
63
  const m = {
64
64
  id: "",
65
- author: x,
66
- text: T || "",
65
+ author: v,
66
+ text: y || "",
67
67
  timestamp: /* @__PURE__ */ new Date(),
68
68
  replyToId: r ? r.id : void 0,
69
- files: M.map((f) => ({
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
- v(null), c(m, n), F([]), d || U(""), s && s(""), i();
76
+ x(null), s(m, n), F([]), d || U(""), c && c(""), i();
77
77
  }
78
78
  },
79
79
  [
80
- c,
80
+ s,
81
+ y,
82
+ v,
83
+ r,
81
84
  T,
82
85
  x,
83
- r,
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
- }, []), S = t.useCallback(
101
- (n, a) => n.isDeleted ? ce(a, o) : n.text,
100
+ }, []), j = t.useCallback(
101
+ (n, a) => n.isDeleted ? se(a, o) : n.text,
102
102
  [o]
103
- ), j = t.useCallback(() => {
103
+ ), G = t.useCallback(() => {
104
104
  if (r) {
105
- const n = se(x, r);
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" }, S(r, n)),
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: () => v(null),
122
- "aria-label": o.toLanguageString(y, l[y]),
123
- title: o.toLanguageString(y, l[y])
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, x, S, v, o]), G = t.useCallback((n) => {
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
- }, []), O = t.useCallback(
136
+ }, []), q = t.useCallback(
136
137
  (n) => {
137
138
  const a = n.value;
138
- d || U(a), s && s(a || "");
139
+ d || U(a), c && c(a || "");
139
140
  },
140
- [d, s]
141
- ), q = t.useCallback(
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, []), J = t.useCallback(
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: G,
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
- G,
161
+ S,
161
162
  H,
162
163
  e == null ? void 0 : e.startAffix,
163
164
  u
164
165
  ]
165
- ), K = t.useCallback(
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: j(),
182
+ header: G(),
182
183
  ref: I,
183
184
  placeholder: C,
184
- value: T,
185
- onChange: O,
186
- onPromptAction: q,
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: M,
194
- startAffix: J,
195
- endAffix: e != null && e.endAffix ? K : void 0,
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
- T,
209
- O,
209
+ y,
210
210
  q,
211
+ J,
211
212
  e,
212
213
  b,
213
214
  V,
214
215
  k,
215
- M,
216
- j,
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:"dark"},closable:!1},r.createElement("span",null,n))))};module.exports=l;
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: "dark" }, closable: !1 }, /* @__PURE__ */ t.createElement("span", null, n))));
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 z=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"),l=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(z),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.downloadLightIcon}],p=x||I,d=e=>{if(e==null)return"";if(e===0)return"0 B";const t=1024,i=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(2))} ${i[r]}`},f=e=>"."+e.split(".").pop()||"",v=(e,t)=>{var i,r;(r=(i=e.syntheticEvent)==null?void 0:i.stopPropagation)==null||r.call(i),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",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(l.fileActions,l.messages[l.fileActions])} ${e.name}`,title:`${g.toLanguageString(l.fileActions,l.messages[l.fileActions])} ${e.name}`}),N=n.useCallback(()=>m.classNames({"k-files-wrap":u==="wrap","k-files-vertical":u==="vertical"},"k-file-box-wrapper"),[u]);return n.createElement("ul",{className:N()},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;
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;
@@ -6,32 +6,33 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as a from "react";
9
- import { classNames as h, IconWrap as u, getFileExtensionIcon as k } from "@progress/kendo-react-common";
10
- import { DropDownButton as I } from "@progress/kendo-react-buttons";
11
- import { downloadLightIcon as B, moreVerticalIcon as w } from "@progress/kendo-svg-icons";
9
+ import { classNames as I, IconWrap as u, getFileExtensionIcon as k } from "@progress/kendo-react-common";
10
+ import { DropDownButton as h } from "@progress/kendo-react-buttons";
11
+ import { downloadIcon as B, moreVerticalIcon as w } from "@progress/kendo-svg-icons";
12
12
  import { useLocalization as F } from "@progress/kendo-react-intl";
13
13
  import { fileActions as l, messages as E } from "../../../messages/index.mjs";
14
14
  import { useChatContext as C } from "../ChatContext.mjs";
15
15
  const P = (x) => {
16
- const { files: c, onFileAction: i, onDownload: r, fileActions: N } = x, { messageFilesLayout: s = "vertical" } = C(), m = F(), p = N || [{ id: "download", label: "Download", svgIcon: B }], f = (e) => {
16
+ const { files: c, onFileAction: i, onDownload: r, fileActions: z } = x, { messageFilesLayout: s = "vertical" } = C(), m = F(), p = z || [{ id: "download", label: "Download", svgIcon: B }], f = (e) => {
17
17
  if (e == null)
18
18
  return "";
19
19
  if (e === 0)
20
20
  return "0 B";
21
21
  const t = 1024, o = ["B", "KB", "MB", "GB", "TB"], n = Math.floor(Math.log(e) / Math.log(t));
22
22
  return `${parseFloat((e / Math.pow(t, n)).toFixed(2))} ${o[n]}`;
23
- }, g = (e) => "." + e.split(".").pop() || "", v = (e, t) => {
23
+ }, g = (e) => "." + e.split(".").pop() || "", N = (e, t) => {
24
24
  var o, n;
25
25
  (n = (o = e.syntheticEvent) == null ? void 0 : o.stopPropagation) == null || n.call(o), e.item.id === "download" && (r == null || r([t])), i == null || i(e.item, e, t);
26
26
  }, d = (e) => p.length > 0 && /* @__PURE__ */ a.createElement(
27
- I,
27
+ h,
28
28
  {
29
29
  fillMode: "flat",
30
+ size: "small",
30
31
  svgIcon: w,
31
32
  onClick: (t) => {
32
33
  t.syntheticEvent.stopPropagation();
33
34
  },
34
- onItemClick: (t) => v(t, e),
35
+ onItemClick: (t) => N(t, e),
35
36
  items: p.map((t) => ({
36
37
  id: t.id,
37
38
  icon: t.icon,
@@ -44,14 +45,14 @@ const P = (x) => {
44
45
  )} ${e.name}`,
45
46
  title: `${m.toLanguageString(l, E[l])} ${e.name}`
46
47
  }
47
- ), z = a.useCallback(() => h(
48
+ ), v = a.useCallback(() => I(
48
49
  {
49
50
  "k-files-wrap": s === "wrap",
50
51
  "k-files-vertical": s === "vertical"
51
52
  },
52
53
  "k-file-box-wrapper"
53
54
  ), [s]);
54
- return /* @__PURE__ */ a.createElement("ul", { className: z() }, s === "horizontal" ? /* @__PURE__ */ a.createElement("div", { className: "k-files-scroll" }, c.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-file-box" }, /* @__PURE__ */ a.createElement(u, { size: "xlarge", ...k(g(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-file-size" }, f(e.size))), d(e)))) : c.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-file-box" }, /* @__PURE__ */ a.createElement(u, { size: "xlarge", ...k(g(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-file-size" }, f(e.size))), d(e))));
55
+ return /* @__PURE__ */ a.createElement("ul", { className: v() }, s === "horizontal" ? /* @__PURE__ */ a.createElement("div", { className: "k-files-scroll" }, c.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-file-box" }, /* @__PURE__ */ a.createElement(u, { size: "xlarge", ...k(g(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-file-size" }, f(e.size))), d(e)))) : c.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-file-box" }, /* @__PURE__ */ a.createElement(u, { size: "xlarge", ...k(g(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-file-size" }, f(e.size))), d(e))));
55
56
  };
56
57
  export {
57
58
  P 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 m=require("react"),p=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),i=require("@progress/kendo-svg-icons"),k=require("@progress/kendo-react-intl"),a=require("../../utils.js");function v(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const c=v(m),b=n=>{const{message:e,onUnpin:t,user:r,onReferencedMessageClick:s}=n,l=k.useLocalization(),u=c.useRef(null),d=r&&a.isAuthor(r,e),f=c.useCallback(o=>{o.preventDefault(),o.stopPropagation(),s==null||s(e.id)},[e.id,s]);return c.createElement("div",{ref:u,className:`k-message-reference ${d?"k-message-reference-sender":"k-message-reference-receiver"} k-message-pinned`,onClick:f},c.createElement(p.IconWrap,{icon:i.pinOutlineIcon}),c.createElement("div",{className:"k-message-reference-content"},e!=null&&e.isDeleted?r&&a.getDeletedMessageText(a.isAuthor(r,e),l):e==null?void 0:e.text),c.createElement("span",{className:"k-spacer"}),c.createElement(g.Button,{fillMode:"flat",svgIcon:i.xMarkSmOutlineIcon,onClick:o=>{o.stopPropagation(),t==null||t(e)}}))};module.exports=b;
8
+ "use strict";const p=require("react"),m=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),i=require("@progress/kendo-svg-icons"),k=require("@progress/kendo-react-intl"),a=require("../../utils.js");function v(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,c.get?c:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const r=v(p),b=n=>{const{message:e,onUnpin:t,user:c,onReferencedMessageClick:s}=n,l=k.useLocalization(),u=r.useRef(null),d=c&&a.isAuthor(c,e),f=r.useCallback(o=>{o.preventDefault(),o.stopPropagation(),s==null||s(e.id)},[e.id,s]);return r.createElement("div",{ref:u,className:`k-message-reference ${d?"k-message-reference-sender":"k-message-reference-receiver"} k-message-pinned`,onClick:f},r.createElement(m.IconWrap,{icon:i.pinIcon}),r.createElement("div",{className:"k-message-reference-content"},e!=null&&e.isDeleted?c&&a.getDeletedMessageText(a.isAuthor(c,e),l):e==null?void 0:e.text),r.createElement("span",{className:"k-spacer"}),r.createElement(g.Button,{fillMode:"flat",size:"xs",svgIcon:i.xCircleIcon,onClick:o=>{o.stopPropagation(),t==null||t(e)}}))};module.exports=b;
@@ -8,15 +8,15 @@
8
8
  import * as t from "react";
9
9
  import { IconWrap as f } from "@progress/kendo-react-common";
10
10
  import { Button as d } from "@progress/kendo-react-buttons";
11
- import { pinOutlineIcon as u, xMarkSmOutlineIcon as k } from "@progress/kendo-svg-icons";
12
- import { useLocalization as g } from "@progress/kendo-react-intl";
13
- import { isAuthor as s, getDeletedMessageText as v } from "../../utils.mjs";
14
- const C = (c) => {
15
- const { message: e, onUnpin: a, user: n, onReferencedMessageClick: r } = c, i = g(), l = t.useRef(null), m = n && s(n, e), p = t.useCallback(
16
- (o) => {
17
- o.preventDefault(), o.stopPropagation(), r == null || r(e.id);
11
+ import { pinIcon as u, xCircleIcon as g } from "@progress/kendo-svg-icons";
12
+ import { useLocalization as k } from "@progress/kendo-react-intl";
13
+ import { isAuthor as a, getDeletedMessageText as v } from "../../utils.mjs";
14
+ const P = (c) => {
15
+ const { message: e, onUnpin: o, user: r, onReferencedMessageClick: n } = c, i = k(), l = t.useRef(null), m = r && a(r, e), p = t.useCallback(
16
+ (s) => {
17
+ s.preventDefault(), s.stopPropagation(), n == null || n(e.id);
18
18
  },
19
- [e.id, r]
19
+ [e.id, n]
20
20
  );
21
21
  return /* @__PURE__ */ t.createElement(
22
22
  "div",
@@ -26,20 +26,21 @@ const C = (c) => {
26
26
  onClick: p
27
27
  },
28
28
  /* @__PURE__ */ t.createElement(f, { icon: u }),
29
- /* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, e != null && e.isDeleted ? n && v(s(n, e), i) : e == null ? void 0 : e.text),
29
+ /* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, e != null && e.isDeleted ? r && v(a(r, e), i) : e == null ? void 0 : e.text),
30
30
  /* @__PURE__ */ t.createElement("span", { className: "k-spacer" }),
31
31
  /* @__PURE__ */ t.createElement(
32
32
  d,
33
33
  {
34
34
  fillMode: "flat",
35
- svgIcon: k,
36
- onClick: (o) => {
37
- o.stopPropagation(), a == null || a(e);
35
+ size: "xs",
36
+ svgIcon: g,
37
+ onClick: (s) => {
38
+ s.stopPropagation(), o == null || o(e);
38
39
  }
39
40
  }
40
41
  )
41
42
  );
42
43
  };
43
44
  export {
44
- C as default
45
+ P as default
45
46
  };
@@ -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 tt=require("react"),nt=require("../utils.js");function rt(y){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const q in y)if(q!=="default"){const i=Object.getOwnPropertyDescriptor(y,q);Object.defineProperty(n,q,i.get?i:{enumerable:!0,get:()=>y[q]})}}return n.default=y,Object.freeze(n)}const r=rt(tt),ct=50,L=100,ut=({scrollMode:y,processedMessages:n,total:q,pageSize:i=ct,startIndex:Z,endIndex:d,onLoadMoreMessages:u,onReferencedMessageClick:j,viewItemsWrapperRef:l,authorId:v})=>{const k=r.useRef(!1),x=y==="endless",e=q!=null?q:n.length,E=x&&n.length===e&&!k.current,h=x&&(n.length<e||k.current);h&&(k.current=!0);const[D,B]=r.useState(-1),[m,O]=r.useState(-1),K=r.useRef(D),$=r.useRef(m);K.current=D,$.current=m;const o=r.useRef(!1),P=r.useRef(0),w=r.useRef(0),b=r.useRef(!1),I=r.useRef(e),G=r.useRef(v);G.current=v;const U=r.useRef(!1),C=r.useRef(null),J=r.useRef(!1),N=r.useRef(!1),Q=r.useRef(!0),V=r.useRef(e);r.useEffect(()=>{if(E){if(k.current){(D===-1||m===-1)&&(B(0),O(n.length));return}if(D===-1||m===-1){const t=Math.max(0,n.length-i),c=n.length;B(t),O(c)}else if(m<n.length){const t=I.current;if($.current>=t)O(n.length);else if(n.length>t&&n.slice(t).some(f=>{var a;return((a=f.author)==null?void 0:a.id)!==void 0&&String(f.author.id)===String(G.current)})){const f=Math.max(0,n.length-i);B(f),O(n.length),J.current=!0}}I.current=e}},[E,n.length,i,D,m,e]);const _=Z!=null?Z:0,H=d!=null?d:n.length,g=r.useCallback(()=>{const t=l.current;t&&(P.current=t.scrollHeight,w.current=t.scrollTop)},[l]),A=r.useCallback(t=>{var S,f,a;const c=(S=l.current)==null?void 0:S.closest(".k-chat"),T=((a=(f=l.current)==null?void 0:f.querySelector(".k-message-pinned"))==null?void 0:a.offsetHeight)||0;nt.scrollToMessageById(t,c,T)},[l]);r.useLayoutEffect(()=>{if(!b.current)return;const t=l.current;if(!t){b.current=!1;return}const c=t.scrollHeight-P.current;c>0&&(t.scrollTop=w.current+c),b.current=!1,o.current=!1}),r.useLayoutEffect(()=>{if(!J.current)return;const t=l.current;if(!t){J.current=!1;return}m>=n.length&&m>0&&(J.current=!1,t.scrollTop=t.scrollHeight-t.clientHeight)});const z=r.useRef(!1);r.useLayoutEffect(()=>{if(!x||z.current)return;const t=l.current;t&&t.querySelector("[data-message-id]")&&(t.scrollTop=t.scrollHeight-t.clientHeight,z.current=!0)}),r.useEffect(()=>{if(!x)return;const t=l.current;if(!t)return;let c=t.scrollTop;const T=()=>{const{scrollTop:S,scrollHeight:f,clientHeight:a}=t,Y=S<c,M=S>c;if(c=S,!o.current){if(Y&&S<=L){if(E){const R=K.current;if(R>0){const F=Math.max(0,R-i);b.current=!0,g(),B(F),u==null||u({startIndex:F,endIndex:$.current})}}else if(h&&_>0){o.current=!0;const R=Math.max(0,_-i);b.current=!0,g(),u==null||u({startIndex:R,endIndex:H})}}if(M&&f-S-a<=L){if(E){const R=$.current;if(R<n.length){const F=Math.min(n.length,R+i);N.current=!0,O(F),u==null||u({startIndex:K.current,endIndex:F})}}else if(h&&H<e){o.current=!0,N.current=!0;const R=Math.min(e,H+i);u==null||u({startIndex:_,endIndex:R})}}}};return t.addEventListener("scroll",T,{passive:!0}),()=>t.removeEventListener("scroll",T)},[x,E,h,l,i,n.length,_,H,e,u]),r.useEffect(()=>{var S;const t=H>=e;if(!h){V.current=e,Q.current=t;return}const c=V.current,T=Q.current;if(V.current=e,Q.current=t,e>c&&!T&&t){const f=n[n.length-1];G.current!==void 0&&((S=f==null?void 0:f.author)==null?void 0:S.id)!==void 0&&String(f.author.id)===String(G.current)&&(U.current=!0,N.current=!0)}},[h,e,H,n]),r.useEffect(()=>{!h||!U.current||(U.current=!1,o.current=!1,requestAnimationFrame(()=>{const t=l.current;t&&(t.scrollTop=t.scrollHeight-t.clientHeight)}))},[h,n,l]),r.useEffect(()=>{if(!h||C.current===null)return;const t=C.current,c=l.current;if(!c)return;c.querySelector(`[data-message-id="${t}"]`)&&(C.current=null,o.current=!1,requestAnimationFrame(()=>{A(t)}))},[h,n,l,A]),r.useEffect(()=>{h&&o.current&&!b.current&&(o.current=!1)},[h,_,H]);const W=r.useMemo(()=>{if(E){const t=Math.max(0,D),c=Math.min(n.length,m);if(t>=c){const T=Math.max(0,n.length-i);return n.slice(T)}return n.slice(t,c)}return n},[E,n,D,m,i]),X=r.useMemo(()=>x?E?m>=n.length:H>=e:!0,[x,E,m,n.length,H,e]),s=r.useCallback(()=>{if(!x||X){const t=l.current;t&&t.scrollTo({top:t.scrollHeight-t.clientHeight,behavior:"smooth"});return}if(!o.current){if(E){const t=Math.max(0,n.length-i);B(t),O(n.length),u==null||u({startIndex:t,endIndex:n.length}),requestAnimationFrame(()=>{const c=l.current;c&&(c.scrollTop=c.scrollHeight-c.clientHeight)})}else if(h){U.current=!0,b.current=!1,o.current=!0;const t=Math.max(0,e-i);u==null||u({startIndex:t,endIndex:e})}}},[x,E,h,X,n.length,i,e,u,l]),p=r.useCallback(t=>{if(!x)A(t);else if(E){const c=l.current;if(c==null?void 0:c.querySelector(`[data-message-id="${t}"]`))A(t);else{if(o.current)return;const S=n.findIndex(f=>f.id===t||String(f.id)===String(t));if(S>=0){const f=Math.floor(i/2),a=Math.max(0,S-f),Y=Math.min(n.length,a+i);o.current=!0,B(a),O(Y),requestAnimationFrame(()=>{requestAnimationFrame(()=>{A(t),o.current=!1})})}}}else if(h){const c=l.current;if(c==null?void 0:c.querySelector(`[data-message-id="${t}"]`))A(t);else{if(o.current)return;C.current=t,b.current=!1,o.current=!0}}j==null||j({id:t})},[x,E,h,l,n,i,j,A]);return{renderedMessages:W,handleScrollToBottom:s,handleReferencedMessageClick:p,isEndless:x,isOnLastBatch:X,skipAutoScrollRef:N}};exports.useEndlessScroll=ut;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const nt=require("react"),rt=require("../utils.js");function ct(b){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const q in b)if(q!=="default"){const e=Object.getOwnPropertyDescriptor(b,q);Object.defineProperty(n,q,e.get?e:{enumerable:!0,get:()=>b[q]})}}return n.default=b,Object.freeze(n)}const r=ct(nt),ut=50,W=100,lt=({scrollMode:b,processedMessages:n,total:q,pageSize:e=ut,startIndex:N,endIndex:Z,onLoadMoreMessages:u,onReferencedMessageClick:j,viewItemsWrapperRef:l,authorId:Y})=>{const k=r.useRef(!1),m=b==="endless",i=q!=null?q:n.length,E=m&&n.length===i&&!k.current,h=m&&(n.length<i||k.current);h&&(k.current=!0);const[D,B]=r.useState(-1),[x,O]=r.useState(-1),v=r.useRef(D),d=r.useRef(x);v.current=D,d.current=x;const o=r.useRef(!1),P=r.useRef(0),w=r.useRef(0),g=r.useRef(0),y=r.useRef(!1),I=r.useRef(i),C=r.useRef(Y);C.current=Y;const $=r.useRef(!1),G=r.useRef(null),U=r.useRef(!1),J=r.useRef(!1),K=r.useRef(!0),Q=r.useRef(i);r.useEffect(()=>{if(E){if(k.current){(D===-1||x===-1)&&(B(0),O(n.length));return}if(D===-1||x===-1){const t=Math.max(0,n.length-e),c=n.length;B(t),O(c)}else if(x<n.length){const t=I.current;if(d.current>=t)O(n.length);else if(n.length>t&&n.slice(t).some(f=>{var T;return((T=f.author)==null?void 0:T.id)!==void 0&&String(f.author.id)===String(C.current)})){const f=Math.max(0,n.length-e);B(f),O(n.length),U.current=!0}}I.current=i}},[E,n.length,e,D,x,i]);const _=N!=null?N:0,R=Z!=null?Z:n.length,z=r.useCallback(()=>{const t=l.current;t&&(P.current=t.scrollHeight,w.current=t.scrollTop,g.current=t.querySelectorAll("[data-message-id]").length)},[l]),A=r.useCallback(t=>{var a,f,T;const c=(a=l.current)==null?void 0:a.closest(".k-chat"),S=((T=(f=l.current)==null?void 0:f.querySelector(".k-message-pinned"))==null?void 0:T.offsetHeight)||0;rt.scrollToMessageById(t,c,S)},[l]);r.useLayoutEffect(()=>{if(!y.current)return;const t=l.current;if(!t){y.current=!1;return}if(t.querySelectorAll("[data-message-id]").length<=g.current)return;const S=t.scrollHeight-P.current;S>0&&(t.scrollTop=w.current+S),y.current=!1,o.current=!1}),r.useLayoutEffect(()=>{if(!U.current)return;const t=l.current;if(!t){U.current=!1;return}x>=n.length&&x>0&&(U.current=!1,t.scrollTop=t.scrollHeight-t.clientHeight)});const L=r.useRef(!1);r.useLayoutEffect(()=>{if(!m||L.current)return;const t=l.current;t&&t.querySelector("[data-message-id]")&&(t.scrollTop=t.scrollHeight-t.clientHeight,L.current=!0)}),r.useEffect(()=>{if(!m)return;const t=l.current;if(!t)return;let c=t.scrollTop;const S=()=>{const{scrollTop:a,scrollHeight:f,clientHeight:T}=t,X=a<c,tt=a>c;if(c=a,!o.current){if(X&&a<=W){if(E){const H=v.current;if(H>0){const F=Math.max(0,H-e);y.current=!0,z(),B(F),u==null||u({startIndex:F,endIndex:d.current})}}else if(h&&_>0){o.current=!0;const H=Math.max(0,_-e);y.current=!0,z(),u==null||u({startIndex:H,endIndex:R})}}if(tt&&f-a-T<=W){if(E){const H=d.current;if(H<n.length){const F=Math.min(n.length,H+e);J.current=!0,O(F),u==null||u({startIndex:v.current,endIndex:F})}}else if(h&&R<i){o.current=!0,J.current=!0;const H=Math.min(i,R+e);u==null||u({startIndex:_,endIndex:H})}}}};return t.addEventListener("scroll",S,{passive:!0}),()=>t.removeEventListener("scroll",S)},[m,E,h,l,e,n.length,_,R,i,u]),r.useEffect(()=>{var a;const t=R>=i;if(!h){Q.current=i,K.current=t;return}const c=Q.current,S=K.current;if(Q.current=i,K.current=t,i>c&&!S&&t){const f=n[n.length-1];C.current!==void 0&&((a=f==null?void 0:f.author)==null?void 0:a.id)!==void 0&&String(f.author.id)===String(C.current)&&($.current=!0,J.current=!0)}},[h,i,R,n]),r.useEffect(()=>{!h||!$.current||($.current=!1,o.current=!1,requestAnimationFrame(()=>{const t=l.current;t&&(t.scrollTop=t.scrollHeight-t.clientHeight)}))},[h,n,l]),r.useEffect(()=>{if(!h||G.current===null)return;const t=G.current,c=l.current;if(!c)return;c.querySelector(`[data-message-id="${t}"]`)&&(G.current=null,o.current=!1,requestAnimationFrame(()=>{A(t)}))},[h,n,l,A]),r.useEffect(()=>{h&&o.current&&!y.current&&(o.current=!1)},[h,_,R]);const s=r.useMemo(()=>{if(E){const t=Math.max(0,D),c=Math.min(n.length,x);if(t>=c){const S=Math.max(0,n.length-e);return n.slice(S)}return n.slice(t,c)}return n},[E,n,D,x,e]),V=r.useMemo(()=>m?E?x>=n.length:R>=i:!0,[m,E,x,n.length,R,i]),p=r.useCallback(()=>{if(!m||V){const t=l.current;t&&t.scrollTo({top:t.scrollHeight-t.clientHeight,behavior:"smooth"});return}if(!o.current){if(E){const t=Math.max(0,n.length-e);B(t),O(n.length),u==null||u({startIndex:t,endIndex:n.length}),requestAnimationFrame(()=>{const c=l.current;c&&(c.scrollTop=c.scrollHeight-c.clientHeight)})}else if(h){$.current=!0,y.current=!1,o.current=!0;const t=Math.max(0,i-e);u==null||u({startIndex:t,endIndex:i})}}},[m,E,h,V,n.length,e,i,u,l]),M=r.useCallback(t=>{if(!m)A(t);else if(E){const c=l.current;if(c==null?void 0:c.querySelector(`[data-message-id="${t}"]`))A(t);else{if(o.current)return;const a=n.findIndex(f=>f.id===t||String(f.id)===String(t));if(a>=0){const f=Math.floor(e/2),T=Math.max(0,a-f),X=Math.min(n.length,T+e);o.current=!0,B(T),O(X),requestAnimationFrame(()=>{requestAnimationFrame(()=>{A(t),o.current=!1})})}}}else if(h){const c=l.current;if(c==null?void 0:c.querySelector(`[data-message-id="${t}"]`))A(t);else{if(o.current)return;G.current=t,y.current=!1,o.current=!0}}j==null||j({id:t})},[m,E,h,l,n,e,j,A]);return{renderedMessages:s,handleScrollToBottom:p,handleReferencedMessageClick:M,isEndless:m,isOnLastBatch:V,skipAutoScrollRef:J}};exports.useEndlessScroll=lt;