@progress/kendo-react-conversational-ui 9.3.1 → 9.4.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/ViewItem.js +1 -1
- package/ViewItem.mjs +0 -1
- package/ai-prompt/AIPrompt.js +1 -1
- package/ai-prompt/AIPrompt.mjs +0 -1
- package/ai-prompt/AIPromptContent.js +1 -1
- package/ai-prompt/AIPromptContent.mjs +5 -6
- package/ai-prompt/AIPromptContext.js +1 -1
- package/ai-prompt/AIPromptContext.mjs +0 -1
- package/ai-prompt/AIPromptExpander.js +1 -1
- package/ai-prompt/AIPromptExpander.mjs +0 -1
- package/ai-prompt/AIPromptFooter.js +1 -1
- package/ai-prompt/AIPromptFooter.mjs +3 -4
- package/ai-prompt/AIPromptHeader.js +1 -1
- package/ai-prompt/AIPromptHeader.mjs +5 -6
- package/ai-prompt/views/AIPromptCommandsView.js +1 -1
- package/ai-prompt/views/AIPromptCommandsView.mjs +0 -1
- package/ai-prompt/views/AIPromptOutputView.js +1 -1
- package/ai-prompt/views/AIPromptOutputView.mjs +5 -6
- package/ai-prompt/views/AIPromptView.js +1 -1
- package/ai-prompt/views/AIPromptView.mjs +2 -3
- package/ai-prompt/views/AIPromptViewRender.js +1 -1
- package/ai-prompt/views/AIPromptViewRender.mjs +4 -5
- package/components/Action.js +1 -1
- package/components/Action.mjs +2 -3
- package/components/ActionGroup.js +1 -1
- package/components/ActionGroup.mjs +0 -1
- package/components/Attachment.js +1 -1
- package/components/Attachment.mjs +0 -1
- package/components/AttachmentGroup.js +1 -1
- package/components/AttachmentGroup.mjs +7 -8
- package/components/Chat.js +1 -1
- package/components/Chat.mjs +0 -1
- package/components/ChatMessage.js +1 -1
- package/components/ChatMessage.mjs +0 -1
- package/components/ChatToolbar.js +1 -1
- package/components/ChatToolbar.mjs +0 -1
- package/components/DateMarker.js +1 -1
- package/components/DateMarker.mjs +4 -5
- package/components/MessageGroup.js +1 -1
- package/components/MessageGroup.mjs +0 -1
- package/components/NewMessage.js +1 -1
- package/components/NewMessage.mjs +0 -1
- package/components/base/FocusableUponSelection.js +1 -1
- package/components/base/FocusableUponSelection.mjs +0 -1
- package/components/base/SelectableItemsContainer.js +1 -1
- package/components/base/SelectableItemsContainer.mjs +0 -1
- package/components/templates/HeroCard.js +1 -1
- package/components/templates/HeroCard.mjs +0 -1
- package/dist/cdn/js/kendo-react-conversational-ui.js +8 -1
- package/index.js +2 -1
- package/index.mjs +9 -9
- package/messages/index.js +1 -1
- package/messages/index.mjs +0 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -3
- package/package.json +7 -7
- package/utils.js +1 -1
- package/utils.mjs +2 -3
package/ViewItem.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./utils.js"),o=s=>s[s.length-1],r=(s,e)=>s&&e&&(e.getDate()!==s.getDate()||e.getMonth()!==s.getMonth()||e.getFullYear()!==s.getFullYear()),u=(s,e)=>{const t=e.timestamp,a=o(s);if(t&&(!a||r(t,a.timestamp))){const n={type:"date-marker",timestamp:t,trackBy:t.getTime()};s.push(n)}},c=(s,e,t)=>{const a=o(s);let n;e.typing&&!t||(a&&a.type==="message-group"&&(n=a.messages),n&&i.isAuthor(e.author,o(n))?n.push(e):s.push({type:"message-group",messages:[e],author:e.author,timestamp:e.timestamp,trackBy:e}))},p=s=>(e,t,a)=>{const n=a===s-1;return u(e,t),c(e,t,n),t.attachments&&t.attachments.length>1&&e.push({type:"attachment-group",attachments:t.attachments,attachmentLayout:t.attachmentLayout,timestamp:t.timestamp,trackBy:t}),t.suggestedActions&&n&&e.push({type:"action-group",actions:t.suggestedActions,timestamp:t.timestamp,trackBy:t}),e};function l(s){let e=0;s.forEach(t=>{t.type==="message-group"?t.messages.forEach(a=>{a.selectionIndex=e++}):(t.type==="attachment-group"||t.type==="action-group")&&(t.selectionIndex=e++)}),s.lastSelectionIndex=e-1}const h=s=>{const t=s.slice().reduce(p(s.length),[]);return l(t),t};exports.convertMsgsToViewItems=h;
|
package/ViewItem.mjs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import { isAuthor as i } from "./utils.mjs";
|
|
10
9
|
const o = (s) => s[s.length - 1], p = (s, e) => s && e && (e.getDate() !== s.getDate() || e.getMonth() !== s.getMonth() || e.getFullYear() !== s.getFullYear()), r = (s, e) => {
|
|
11
10
|
const t = e.timestamp, a = o(s);
|
package/ai-prompt/AIPrompt.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),I=require("./AIPromptHeader.js"),V=require("./views/AIPromptView.js"),S=require("./views/AIPromptOutputView.js"),q=require("./AIPromptContext.js"),C=require("@progress/kendo-react-common"),h=a=>{const{activeView:t,toolbarItems:c,children:n,onActiveViewChange:o,onPromptRequest:s,onCommandExecute:i,style:m,dir:u,className:l,...p}=a,P=c||[V.promptViewDefaults,S.outputViewDefaults],[d,w]=e.useState({activeView:t}),r={...d,activeView:t,onActiveViewChange:o,onPromptRequest:s,onCommandExecute:i},v=A=>{w(A)};return e.createElement(q.AIPromptContext.Provider,{value:[r,v]},e.createElement("div",{className:C.classNames("k-prompt",l),style:m,dir:u,...p},e.createElement(I.PromptHeader,{activeView:r.activeView,toolbarItems:P,activeViewChange:o}),n))};exports.AIPrompt=h;
|
package/ai-prompt/AIPrompt.mjs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import t from "react";
|
|
10
9
|
import { PromptHeader as S } from "./AIPromptHeader.mjs";
|
|
11
10
|
import { promptViewDefaults as h } from "./views/AIPromptView.mjs";
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.forwardRef((n,o)=>{const{children:r}=n;return e.createElement("div",{className:"k-prompt-content",ref:o},e.createElement("div",{className:"k-prompt-view"},r))});t.displayName="KendoReactAIPromptContent";exports.AIPromptContent=t;
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import e from "react";
|
|
10
|
-
const
|
|
11
|
-
const { children:
|
|
12
|
-
return /* @__PURE__ */ e.createElement("div", { className: "k-prompt-content", ref:
|
|
9
|
+
const n = e.forwardRef((t, o) => {
|
|
10
|
+
const { children: r } = t;
|
|
11
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-prompt-content", ref: o }, /* @__PURE__ */ e.createElement("div", { className: "k-prompt-view" }, r));
|
|
13
12
|
});
|
|
14
|
-
|
|
13
|
+
n.displayName = "KendoReactAIPromptContent";
|
|
15
14
|
export {
|
|
16
|
-
|
|
15
|
+
n as AIPromptContent
|
|
17
16
|
};
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),e=t.createContext([{},()=>{}]),o=()=>t.useContext(e);exports.AIPromptContext=e;exports.useAIPromptContext=o;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import t from "react";
|
|
10
9
|
const e = t.createContext([{}, () => {
|
|
11
10
|
}]), n = () => t.useContext(e);
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),s=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-svg-icons"),d=r=>{const[t,c]=e.useState(!0),{children:a,title:n}=r;return e.createElement("div",{className:"k-prompt-expander"},e.createElement(s.Button,{fillMode:"flat",svgIcon:t?o.chevronUpIcon:o.chevronDownIcon,title:n,onClick:()=>c(!t)},n),t&&e.createElement("div",{className:"k-prompt-expander-content"},a))};exports.AIPromptExpander=d;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import e from "react";
|
|
10
9
|
import { Button as a } from "@progress/kendo-react-buttons";
|
|
11
10
|
import { chevronUpIcon as p, chevronDownIcon as m } from "@progress/kendo-svg-icons";
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),r=e=>{const{children:o}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},o))};exports.AIPromptFooter=r;
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import t from "react";
|
|
10
|
-
const a = (
|
|
11
|
-
const { children:
|
|
12
|
-
return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-footer" }, /* @__PURE__ */ t.createElement("div", { className: "k-actions k-actions-start k-actions-horizontal k-prompt-actions" },
|
|
9
|
+
const a = (o) => {
|
|
10
|
+
const { children: e } = o;
|
|
11
|
+
return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-footer" }, /* @__PURE__ */ t.createElement("div", { className: "k-actions k-actions-start k-actions-horizontal k-prompt-actions" }, e));
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
14
|
a as AIPromptFooter
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),a=require("@progress/kendo-react-buttons"),s=l=>{const{activeView:r,toolbarItems:n,activeViewChange:o}=l,c=e=>{o==null||o.call(null,e)};return t.createElement("div",{className:"k-prompt-header"},t.createElement(a.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map(e=>t.isValidElement(e)?e:t.createElement(a.Button,{key:e.name,className:r===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>c(e.name)},e.buttonText))))};exports.PromptHeader=s;
|
|
@@ -5,19 +5,18 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import t from "react";
|
|
10
|
-
import { Toolbar as c, Button as
|
|
11
|
-
const u = (
|
|
12
|
-
const { activeView:
|
|
9
|
+
import { Toolbar as c, Button as m } from "@progress/kendo-react-buttons";
|
|
10
|
+
const u = (o) => {
|
|
11
|
+
const { activeView: l, toolbarItems: r, activeViewChange: a } = o, n = (e) => {
|
|
13
12
|
a == null || a.call(null, e);
|
|
14
13
|
};
|
|
15
14
|
return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-header" }, /* @__PURE__ */ t.createElement(c, { keyboardNavigation: !1, role: "toolbar", className: "k-toolbar-flat" }, r.map(
|
|
16
15
|
(e) => t.isValidElement(e) ? e : /* @__PURE__ */ t.createElement(
|
|
17
|
-
|
|
16
|
+
m,
|
|
18
17
|
{
|
|
19
18
|
key: e.name,
|
|
20
|
-
className:
|
|
19
|
+
className: l === e.name ? "k-selected" : "",
|
|
21
20
|
size: "medium",
|
|
22
21
|
themeColor: "primary",
|
|
23
22
|
fillMode: "flat",
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),d=require("../AIPromptContent.js"),p=require("./AIPromptViewRender.js"),P=require("@progress/kendo-svg-icons"),C=require("../AIPromptContext.js"),i=require("@progress/kendo-react-layout"),s={name:"Commands view",buttonIcon:P.moreHorizontalIcon},m=t=>t==null?void 0:t.map(e=>n.createElement(i.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&m(e.children||[]))),v=t=>{const{commands:e}=t,[r]=C.useAIPromptContext(),u=I=>{var c,a,l;const o=(a=(c=I.target)==null?void 0:c.props)==null?void 0:a.data;(l=o.children)!=null&&l.length||r.onCommandExecute&&r.onCommandExecute.call(null,o)};return n.createElement(p.AIPromptViewRender,{name:s.name},n.createElement(d.AIPromptContent,null,n.createElement("div",{className:"k-prompt-view"},n.createElement(i.PanelBar,{onSelect:u,selected:""},m(e!=null?e:[])))))};exports.AIPromptCommandsView=v;exports.commandsViewDefaults=s;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import r from "react";
|
|
10
9
|
import { AIPromptContent as s } from "../AIPromptContent.mjs";
|
|
11
10
|
import { AIPromptViewRender as u } from "./AIPromptViewRender.mjs";
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),v=require("../AIPromptContent.js"),q=require("../AIPromptContext.js"),s=require("../../messages/index.js"),T=require("./AIPromptViewRender.js"),n=require("@progress/kendo-react-layout"),r=require("@progress/kendo-svg-icons"),l=require("@progress/kendo-react-buttons"),k=require("@progress/kendo-react-intl"),g={name:"Output view",buttonText:"Output",buttonIcon:r.commentIcon},w=y=>{const[R,m]=t.useState(""),o=t.useRef(null),[a]=q.useAIPromptContext(),{outputs:i,showOutputRating:E,outputCard:b}=y,{header:d,body:u,actions:p}=b||{},h=k.useLocalization(),P=e=>{a.onPromptRequest&&a.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),I()},f=e=>{e!=null&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),m(e.id),setTimeout(()=>{m("")},1e3)},C=(e,c)=>{a.onPromptRequest&&a.onPromptRequest.call(null,e.prompt,{...e,ratingType:c,isRetry:!1}),I()},I=()=>{o&&o.current&&o.current.scrollTo({top:0,behavior:"smooth"})};return t.createElement(T.AIPromptViewRender,{name:g.name},t.createElement(v.AIPromptContent,{ref:o},t.createElement("div",{className:"k-card-list"},i&&i.length>0?i.map((e,c)=>t.createElement(n.Card,{key:`${e.id}_${c}`},t.createElement(n.CardHeader,null,d?d(e):t.createElement(t.Fragment,null,e.title&&t.createElement(n.CardTitle,null,e.title),e.subTitle&&t.createElement(n.CardSubtitle,null,e.subTitle))),t.createElement(n.CardBody,null,u?u(e):e.responseContent),t.createElement(n.CardActions,null,p?p(e):t.createElement(t.Fragment,null,t.createElement(l.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:R===e.id?r.copyIcon:r.checkIcon,"aria-hidden":"true",onClick:()=>f(e)},"Copy"),t.createElement(l.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:r.rotateIcon,"aria-hidden":"true",onClick:()=>P(e)},"Retry"),E&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(l.Button,{size:"medium",themeColor:e.ratingType==="positive"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:r.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>C(e,"positive")}),t.createElement(l.Button,{size:"medium",themeColor:e.ratingType==="negative"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:r.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>C(e,"negative")})))))):t.createElement(n.Card,null,t.createElement(n.CardBody,null,h.toLanguageString(s.aIPromptNoOutputs,s.messages[s.aIPromptNoOutputs]))))))};exports.AIPromptOutputView=w;exports.outputViewDefaults=g;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import t from "react";
|
|
10
9
|
import { AIPromptContent as v } from "../AIPromptContent.mjs";
|
|
11
10
|
import { useAIPromptContext as T } from "../AIPromptContext.mjs";
|
|
@@ -20,18 +19,18 @@ const _ = {
|
|
|
20
19
|
buttonText: "Output",
|
|
21
20
|
buttonIcon: A
|
|
22
21
|
}, K = (g) => {
|
|
23
|
-
const [E, i] = t.useState(""),
|
|
24
|
-
|
|
22
|
+
const [E, i] = t.useState(""), r = t.useRef(null), [n] = T(), { outputs: l, showOutputRating: y, outputCard: b } = g, { header: m, body: c, actions: s } = b || {}, h = V(), I = (e) => {
|
|
23
|
+
n.onPromptRequest && n.onPromptRequest.call(null, e.prompt, { ...e, isRetry: !0 }), p();
|
|
25
24
|
}, R = (e) => {
|
|
26
25
|
e != null && e.responseContent && navigator.clipboard.writeText(e.responseContent), i(e.id), setTimeout(() => {
|
|
27
26
|
i("");
|
|
28
27
|
}, 1e3);
|
|
29
28
|
}, d = (e, a) => {
|
|
30
|
-
|
|
29
|
+
n.onPromptRequest && n.onPromptRequest.call(null, e.prompt, { ...e, ratingType: a, isRetry: !1 }), p();
|
|
31
30
|
}, p = () => {
|
|
32
|
-
|
|
31
|
+
r && r.current && r.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
33
32
|
};
|
|
34
|
-
return /* @__PURE__ */ t.createElement(k, { name: _.name }, /* @__PURE__ */ t.createElement(v, { ref:
|
|
33
|
+
return /* @__PURE__ */ t.createElement(k, { name: _.name }, /* @__PURE__ */ t.createElement(v, { ref: r }, /* @__PURE__ */ t.createElement("div", { className: "k-card-list" }, l && l.length > 0 ? l.map((e, a) => /* @__PURE__ */ t.createElement(C, { key: `${e.id}_${a}` }, /* @__PURE__ */ t.createElement(w, null, m ? m(e) : /* @__PURE__ */ t.createElement(t.Fragment, null, e.title && /* @__PURE__ */ t.createElement(O, null, e.title), e.subTitle && /* @__PURE__ */ t.createElement(z, null, e.subTitle))), /* @__PURE__ */ t.createElement(f, null, c ? c(e) : e.responseContent), /* @__PURE__ */ t.createElement(x, null, s ? s(e) : /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
35
34
|
o,
|
|
36
35
|
{
|
|
37
36
|
size: "medium",
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),w=require("../AIPromptContent.js"),E=require("../AIPromptFooter.js"),R=require("@progress/kendo-react-buttons"),T=require("@progress/kendo-react-inputs"),l=require("@progress/kendo-svg-icons"),a=require("@progress/kendo-react-common"),V=require("./AIPromptViewRender.js"),f=require("../AIPromptExpander.js"),v=require("../AIPromptContext.js"),p={name:"prompt-view",buttonText:"Ask AI",buttonIcon:l.sparklesIcon},y=m=>{const i="Generate",{promptInput:d=T.TextArea,generateButton:P=R.Button,promptValue:A,promptSuggestions:o}=m,[r,n]=e.useState(A||""),[s]=v.useAIPromptContext(),[I,c]=a.useCustomComponent(P),[g,u]=a.useCustomComponent(d),k=()=>{s.onPromptRequest&&s.onPromptRequest.call(null,r),n("")},C=t=>{n(t)},q=t=>{n(t.target.value)},x={title:"Generate",svgIcon:l.sparklesIcon},h={placeholder:"Ask or generate content with AI ...",rows:2},S=Object.keys(c).length>0?c:x,b=Object.keys(u).length>0?u:h;return e.createElement(V.AIPromptViewRender,{name:p.name},e.createElement(w.AIPromptContent,null,e.createElement(g,{value:r,onChange:q,...b}),o&&o.length>0&&e.createElement(f.AIPromptExpander,{title:"Prompt Suggestions"},o.map(t=>e.createElement("div",{key:t,className:"k-prompt-suggestion",onClick:()=>C(t)},t)))),e.createElement(E.AIPromptFooter,null,e.createElement(I,{themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:k,...S},i)))};exports.AIPromptView=y;exports.promptViewDefaults=p;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import t from "react";
|
|
10
9
|
import { AIPromptContent as T } from "../AIPromptContent.mjs";
|
|
11
10
|
import { AIPromptFooter as b } from "../AIPromptFooter.mjs";
|
|
@@ -21,7 +20,7 @@ const y = {
|
|
|
21
20
|
buttonText: "Ask AI",
|
|
22
21
|
buttonIcon: l
|
|
23
22
|
}, M = (c) => {
|
|
24
|
-
const u = "Generate", { promptInput: i = w, generateButton: d = S, promptValue: f, promptSuggestions: o } = c, [r, n] = t.useState(f || ""), [m] = V(), [A,
|
|
23
|
+
const u = "Generate", { promptInput: i = w, generateButton: d = S, promptValue: f, promptSuggestions: o } = c, [r, n] = t.useState(f || ""), [m] = V(), [A, p] = a(d), [P, s] = a(i), g = () => {
|
|
25
24
|
m.onPromptRequest && m.onPromptRequest.call(null, r), n("");
|
|
26
25
|
}, x = (e) => {
|
|
27
26
|
n(e);
|
|
@@ -33,7 +32,7 @@ const y = {
|
|
|
33
32
|
}, k = {
|
|
34
33
|
placeholder: "Ask or generate content with AI ...",
|
|
35
34
|
rows: 2
|
|
36
|
-
}, C = Object.keys(
|
|
35
|
+
}, C = Object.keys(p).length > 0 ? p : h, E = Object.keys(s).length > 0 ? s : k;
|
|
37
36
|
return /* @__PURE__ */ t.createElement(v, { name: y.name }, /* @__PURE__ */ t.createElement(T, null, /* @__PURE__ */ t.createElement(P, { value: r, onChange: I, ...E }), o && o.length > 0 && /* @__PURE__ */ t.createElement(R, { title: "Prompt Suggestions" }, o.map((e) => /* @__PURE__ */ t.createElement(
|
|
38
37
|
"div",
|
|
39
38
|
{
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../AIPromptContext.js"),o=e=>{const[t]=n.useAIPromptContext();return t.activeView===e.name?e.children:null};exports.AIPromptViewRender=o;
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import { useAIPromptContext as n } from "../AIPromptContext.mjs";
|
|
10
|
-
const
|
|
11
|
-
const [
|
|
12
|
-
return
|
|
9
|
+
const r = (t) => {
|
|
10
|
+
const [e] = n();
|
|
11
|
+
return e.activeView === t.name ? t.children : null;
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
r as AIPromptViewRender
|
|
16
15
|
};
|
package/components/Action.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";const n=require("react"),r=require("@progress/kendo-react-common"),i=require("./base/FocusableUponSelection.js");function c(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const p=c(n);class a extends i.FocusableUponSelection{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===r.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return r.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}}module.exports=a;
|
package/components/Action.mjs
CHANGED
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as s from "react";
|
|
10
9
|
import { Keys as t, classNames as o } from "@progress/kendo-react-common";
|
|
11
10
|
import { FocusableUponSelection as r } from "./base/FocusableUponSelection.mjs";
|
|
12
|
-
class
|
|
11
|
+
class a extends r {
|
|
13
12
|
constructor() {
|
|
14
13
|
super(...arguments), this.onKeyDown = (e) => {
|
|
15
14
|
e.keyCode === t.enter && this.props.onActionExecute(this.props.item, e);
|
|
@@ -40,5 +39,5 @@ class c extends r {
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
export {
|
|
43
|
-
|
|
42
|
+
a as default
|
|
44
43
|
};
|
|
@@ -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
|
|
8
|
+
"use strict";const r=require("react"),c=require("@progress/kendo-react-common"),a=require("./Action.js"),i=require("./base/SelectableItemsContainer.js");function u(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const o in s)if(o!=="default"){const t=Object.getOwnPropertyDescriptor(s,o);Object.defineProperty(e,o,t.get?t:{enumerable:!0,get:()=>s[o]})}}return e.default=s,Object.freeze(e)}const n=u(r);class l extends i.SelectableItemsContainer{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return n.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map((o,t)=>n.createElement(a,{item:o,onActionExecute:this.props.onActionExecute,selected:t===this.state.selectedItemIndex,isFirstItemInGroup:t===0,isLastItemInGroup:t===e,key:t})))}getClassNames(){return c.classNames("k-quick-replies")}}module.exports=l;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as s from "react";
|
|
10
9
|
import { classNames as r } from "@progress/kendo-react-common";
|
|
11
10
|
import n from "./Action.mjs";
|
package/components/Attachment.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";const n=require("react"),a=require("@progress/kendo-react-common"),o=require("./base/FocusableUponSelection.js");function l(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(s,i,r.get?r:{enumerable:!0,get:()=>t[i]})}}return s.default=t,Object.freeze(s)}const e=l(n);class c extends o.FocusableUponSelection{render(){return e.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:s=>this.elementToFocus=s},this.props.template?e.createElement(this.props.template,{item:this.props.item}):e.createElement("div",{className:"k-card"},e.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(this.props.tabbable!==void 0)return this.props.tabbable?0:-1}getClassNames(){return a.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?e.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?e.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return this.props.item.contentType.indexOf("image/")===0?e.createElement("img",{src:this.props.item.content}):this.props.item.content}}module.exports=c;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as e from "react";
|
|
10
9
|
import { classNames as s } from "@progress/kendo-react-common";
|
|
11
10
|
import { FocusableUponSelection as i } from "./base/FocusableUponSelection.mjs";
|
|
@@ -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
|
|
8
|
+
"use strict";const c=require("react"),l=require("@progress/kendo-react-common"),a=require("@progress/kendo-svg-icons"),u=require("./Attachment.js"),h=require("./base/SelectableItemsContainer.js"),i=require("@progress/kendo-react-buttons");function m(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>s[e]})}}return t.default=s,Object.freeze(t)}const o=m(c);class p extends h.SelectableItemsContainer{render(){const t=this.isCardDeckLayout(this.props),e=o.createElement("div",{className:this.getClassNames(),onKeyDown:t?void 0:this.onKeyDown},this.props.group.attachments.map((r,n)=>o.createElement(u,{item:r,template:this.props.itemTemplate,selected:n===this.state.selectedItemIndex,tabbable:this.props.isLastGroup&&n===this.state.selectedItemIndex,isFirstItemInGroup:n===0,isLastItemInGroup:n===this.getLastItemIndex(),onClick:()=>this.onAttachmentClick(n),key:n})));return t?o.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:this.onKeyDown},this.getLeftScrollBtn(),e,this.getRightScrollBtn()):e}get isKeyboardNavigationLeftRight(){return this.isCardDeckLayout(this.props)}getLastItemIndex(){return this.props.group.attachments.length-1}getLeftScrollBtn(){let t=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex&&(t=o.createElement(i.Button,{icon:"chevron-left",onClick:()=>this.onNavigateBtnClick(!1),svgIcon:a.chevronLeftIcon})),t}getRightScrollBtn(){let t=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex!==this.getLastItemIndex()&&(t=o.createElement(i.Button,{icon:"chevron-right",onClick:()=>this.onNavigateBtnClick(!0),svgIcon:a.chevronRightIcon})),t}onAttachmentClick(t){this.onRequestContainerSelection(),this.setState({selectedItemIndex:t})}onNavigateBtnClick(t){this.onRequestContainerSelection(),this.navigate(t,1)}isCardDeckLayout(t){return t.group.attachmentLayout!=="list"}getClassNames(){return l.classNames({"k-card-list":this.props.group.attachmentLayout,"k-card-deck":this.isCardDeckLayout(this.props)})}}module.exports=p;
|
|
@@ -5,19 +5,18 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as s from "react";
|
|
10
|
-
import { classNames as
|
|
9
|
+
import { classNames as i } from "@progress/kendo-react-common";
|
|
11
10
|
import { chevronLeftIcon as n, chevronRightIcon as c } from "@progress/kendo-svg-icons";
|
|
12
11
|
import l from "./Attachment.mjs";
|
|
13
12
|
import { SelectableItemsContainer as h } from "./base/SelectableItemsContainer.mjs";
|
|
14
|
-
import { Button as
|
|
13
|
+
import { Button as r } from "@progress/kendo-react-buttons";
|
|
15
14
|
class k extends h {
|
|
16
15
|
render() {
|
|
17
|
-
const t = this.isCardDeckLayout(this.props), o = /* @__PURE__ */ s.createElement("div", { className: this.getClassNames(), onKeyDown: t ? void 0 : this.onKeyDown }, this.props.group.attachments.map((
|
|
16
|
+
const t = this.isCardDeckLayout(this.props), o = /* @__PURE__ */ s.createElement("div", { className: this.getClassNames(), onKeyDown: t ? void 0 : this.onKeyDown }, this.props.group.attachments.map((a, e) => /* @__PURE__ */ s.createElement(
|
|
18
17
|
l,
|
|
19
18
|
{
|
|
20
|
-
item:
|
|
19
|
+
item: a,
|
|
21
20
|
template: this.props.itemTemplate,
|
|
22
21
|
selected: e === this.state.selectedItemIndex,
|
|
23
22
|
tabbable: this.props.isLastGroup && e === this.state.selectedItemIndex,
|
|
@@ -38,11 +37,11 @@ class k extends h {
|
|
|
38
37
|
}
|
|
39
38
|
getLeftScrollBtn() {
|
|
40
39
|
let t = null;
|
|
41
|
-
return this.isCardDeckLayout(this.props) && this.state.selectedItemIndex && (t = /* @__PURE__ */ s.createElement(
|
|
40
|
+
return this.isCardDeckLayout(this.props) && this.state.selectedItemIndex && (t = /* @__PURE__ */ s.createElement(r, { icon: "chevron-left", onClick: () => this.onNavigateBtnClick(!1), svgIcon: n })), t;
|
|
42
41
|
}
|
|
43
42
|
getRightScrollBtn() {
|
|
44
43
|
let t = null;
|
|
45
|
-
return this.isCardDeckLayout(this.props) && this.state.selectedItemIndex !== this.getLastItemIndex() && (t = /* @__PURE__ */ s.createElement(
|
|
44
|
+
return this.isCardDeckLayout(this.props) && this.state.selectedItemIndex !== this.getLastItemIndex() && (t = /* @__PURE__ */ s.createElement(r, { icon: "chevron-right", onClick: () => this.onNavigateBtnClick(!0), svgIcon: c })), t;
|
|
46
45
|
}
|
|
47
46
|
onAttachmentClick(t) {
|
|
48
47
|
this.onRequestContainerSelection(), this.setState({ selectedItemIndex: t });
|
|
@@ -54,7 +53,7 @@ class k extends h {
|
|
|
54
53
|
return t.group.attachmentLayout !== "list";
|
|
55
54
|
}
|
|
56
55
|
getClassNames() {
|
|
57
|
-
return
|
|
56
|
+
return i({
|
|
58
57
|
"k-card-list": this.props.group.attachmentLayout,
|
|
59
58
|
"k-card-deck": this.isCardDeckLayout(this.props)
|
|
60
59
|
});
|
package/components/Chat.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@progress/kendo-react-common"),o=require("prop-types"),p=require("react"),u=require("../ViewItem.js"),m=require("./ActionGroup.js"),d=require("./AttachmentGroup.js"),g=require("./DateMarker.js"),I=require("./MessageGroup.js"),f=require("./NewMessage.js"),T=require("./ChatMessage.js"),w=require("../package-metadata.js"),c=require("../messages/index.js"),y=require("@progress/kendo-react-intl");function S(a){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>a[e]})}}return s.default=a,Object.freeze(s)}const i=S(p),l=class l extends i.Component{constructor(s){super(s),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.onFocus=()=>{clearTimeout(this.timeoutIdForChatLosingFocus)},this.onBlur=()=>{this.timeoutIdForChatLosingFocus=window.setTimeout(()=>{this.setState({selectedItemIndex:null})},0)},this.onSelectionRequested=e=>{this.setState({selectedItemIndex:e})},this.onKeyDown=e=>{let t=null;const r=this.state.selectedItemIndex!==null?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===n.Keys.up?r===null?t=0:r>0&&(t=r-1):e.keyCode===n.Keys.down&&(r===null?t=0:r<this.viewItems.lastSelectionIndex&&(t=r+1)),t!==null&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{n.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(n.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value);break}this.newMsgComp.focusInput()}},n.validatePackage(w.packageMetadata),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const s=y.provideLocalizationService(this);return i.createElement("div",{style:{width:this.props.width},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>this.chatWrapperEl=e},i.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":s.toLanguageString(c.ariaLabelMessageList,c.messages[c.ariaLabelMessageList]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>this.viewItemsWrapperEl=e},i.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),i.createElement(f,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>this.newMsgComp=e,placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}))}componentDidMount(){this.setState({isFirstRender:!1},()=>{this.nextTickId=window.setTimeout(()=>this.scrollViewItemsToBottom(),250)})}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(s){s.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return n.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(s){return!!(s.dir!==void 0?s.dir==="rtl":this.chatWrapperEl&&getComputedStyle(this.chatWrapperEl).direction==="rtl")}renderViewItems(){const s=this.viewItems.length-1;return this.viewItems.map((e,t)=>{if(e.type==="date-marker")return i.createElement(g,{item:e,key:t});if(e.type==="message-group")return i.createElement(I,{group:e,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:t===s,key:t,message:this.props.message||l.defaultProps.message});if(e.type==="attachment-group")return i.createElement(d,{group:e,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===s,key:t});if(e.type==="action-group")return i.createElement(m,{group:e,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===s,key:t})})}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(s){return s.length>0?u.convertMsgsToViewItems(s):[]}};l.propTypes={messages:o.arrayOf(o.object),user:o.object,messageTemplate:o.any,attachmentTemplate:o.any,width:o.oneOfType([o.string,o.number]),onMessageSend:o.func,onActionExecute:o.func,dir:o.string,messageBox:o.any},l.defaultProps={messages:[],dateFormat:"g",message:T.ChatMessage};let h=l;exports.Chat=h;
|
package/components/Chat.mjs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import { Keys as n, dispatchEvent as l, validatePackage as p, classNames as h } from "@progress/kendo-react-common";
|
|
10
9
|
import o from "prop-types";
|
|
11
10
|
import * as i from "react";
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),p=require("@progress/kendo-react-common"),o=require("@progress/kendo-react-intl"),c=require("./base/FocusableUponSelection.js");function m(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>s[i]})}}return e.default=s,Object.freeze(e)}const t=m(l),n=class n extends c.FocusableUponSelection{render(){return t.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>this.elementToFocus=e},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?t.createElement("div",{className:"k-chat-bubble"},t.createElement("div",{className:"k-typing-indicator"},t.createElement("span",null),t.createElement("span",null),t.createElement("span",null))):this.props.template?t.createElement(this.props.template,{item:this.props.item}):this.props.item.text?t.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=t.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},o.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=t.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return p.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}};n.defaultProps={dateFormat:"g",tabIndex:-1};let r=n;o.registerForIntl(r);exports.ChatMessage=r;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as e from "react";
|
|
10
9
|
import { classNames as r } from "@progress/kendo-react-common";
|
|
11
10
|
import { provideIntlService as p, registerForIntl as a } from "@progress/kendo-react-intl";
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),c=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-buttons");function d(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const t=d(f),u=t.forwardRef((e,o)=>{const{className:r,...a}=e,n=t.useRef(null),l=t.useRef(null);t.useImperativeHandle(l,()=>({element:n.current,props:e})),t.useImperativeHandle(o,()=>l.current);const i=t.useMemo(()=>c.classNames("k-chat-toolbar k-toolbar",r),[r]);return t.useEffect(()=>{n.current!==null&&c.focusFirstFocusableChild(n.current,[...c.TABBABLE_ELEMENTS])},[]),t.createElement(m.Toolbar,{id:e.id,ref:s=>{s&&(n.current=s.element)},className:i,...a},t.createElement("div",{className:"k-button-list k-toolbar-group"},e.children))});u.displayName="KendoReactChatToolbar";exports.ChatToolbar=u;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as e from "react";
|
|
10
9
|
import { classNames as m, focusFirstFocusableChild as u, TABBABLE_ELEMENTS as i } from "@progress/kendo-react-common";
|
|
11
10
|
import { Toolbar as f } from "@progress/kendo-react-buttons";
|
package/components/DateMarker.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";const s=require("react"),c=require("@progress/kendo-react-intl");function i(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const a=i(s);class o extends a.Component{render(){const t=this.props.item;return a.createElement("div",{className:"k-timestamp"},c.provideIntlService(this).formatDate(t.timestamp,"D"))}}c.registerForIntl(o);module.exports=o;
|
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as e from "react";
|
|
10
|
-
import { provideIntlService as r, registerForIntl as
|
|
11
|
-
class
|
|
9
|
+
import { provideIntlService as r, registerForIntl as a } from "@progress/kendo-react-intl";
|
|
10
|
+
class m extends e.Component {
|
|
12
11
|
render() {
|
|
13
12
|
const t = this.props.item;
|
|
14
13
|
return /* @__PURE__ */ e.createElement("div", { className: "k-timestamp" }, r(this).formatDate(t.timestamp, "D"));
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
|
|
16
|
+
a(m);
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
m as default
|
|
20
19
|
};
|
|
@@ -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
|
|
8
|
+
"use strict";const c=require("react"),i=require("@progress/kendo-react-common"),p=require("@progress/kendo-react-layout"),l=require("./Attachment.js"),u=require("../utils.js"),m=require("@progress/kendo-react-intl"),n=require("../messages/index.js");function g(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>r[e]})}}return s.default=r,Object.freeze(s)}const a=g(c);class h extends a.Component{render(){const{avatarUrl:s,avatarAltText:e,name:t}=this.props.group.author,o=m.provideLocalizationService(this);return a.createElement("div",{className:this.getMsgGroupClassNames()},t&&a.createElement("p",{className:"k-author"},t),s&&a.createElement(p.Avatar,{type:"image"},a.createElement("img",{src:s,alt:e!==void 0?e:o.toLanguageString(n.avatarAlt,n.messages[n.avatarAlt])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return i.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":u.isAuthor(this.props.user,this.props.group.messages[0])})}getGroupMessagesView(){const s=this.props.group.messages.length-1;return this.props.group.messages.map((e,t)=>{const o=[a.createElement(this.props.message,{item:e,template:this.props.itemTemplate,selected:e.selectionIndex===this.props.selectedItemIndex,onRequestSelection:this.props.onRequestSelection,tabIndex:t===s&&this.props.isLastGroup?0:-1,isFirstItemInGroup:t===0,isLastItemInGroup:t===s,isOnlyItemInGroup:s===0,key:t})];return e.attachments&&e.attachments.length===1&&o.push(a.createElement(l,{item:e.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${t}`})),o})}}module.exports=h;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as s from "react";
|
|
10
9
|
import { classNames as p } from "@progress/kendo-react-common";
|
|
11
10
|
import { Avatar as m } from "@progress/kendo-react-layout";
|
package/components/NewMessage.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";const c=require("@progress/kendo-react-common"),p=require("react"),h=require("./ChatToolbar.js"),l=require("@progress/kendo-react-buttons"),u=require("@progress/kendo-svg-icons"),g=require("@progress/kendo-react-intl"),n=require("../messages/index.js");function m(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}return e.default=a,Object.freeze(e)}const t=m(p);class f extends t.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=t.createRef(),this.onInputKeyDown=e=>{switch(e.key){case"Enter":return this.sendMessage(e);case"F10":return this.openToolbar(e);default:return}},this.sendMessage=e=>{if(this.props.onMessageSend&&this.inputEl!==null){const s=this.inputEl.value;if(s){const o={author:this.props.user,text:s,timestamp:new Date};this.props.onMessageSend(o,e)}}this.inputEl!==null&&(this.inputEl.value=null)},this.openToolbar=e=>{this.toolbarBtnRef.current!==null&&(e.preventDefault(),this.props.onToolbarActionButtonClick(!this.props.showToolbar,e))}}render(){const e=g.provideLocalizationService(this),s=t.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:r=>this.inputEl=r,"aria-label":e.toLanguageString(n.newMessageMessageInput,n.messages[n.newMessageMessageInput])}),o=t.createElement(l.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:u.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),i=t.createElement(l.Button,{ref:this.toolbarBtnRef,fillMode:"flat",themeColor:"base",icon:"more-horizontal",svgIcon:u.moreHorizontalIcon,onClick:r=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,r),"aria-label":e.toLanguageString(n.newMessageOptionsButton,n.messages[n.newMessageOptionsButton])});return t.createElement(t.Fragment,null,t.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?t.createElement(this.props.MessageBox,{messageInput:s,sendButton:o,toolbarButton:i}):t.createElement(t.Fragment,null,s,t.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),t.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&i,o))),this.props.showToolbar&&t.createElement(h.ChatToolbar,null,this.props.toolbar))}focusInput(){this.inputEl!==null&&this.inputEl.focus()}getClassNames(){return c.classNames("k-input-inner",{"k-focus":this.state.focused})}}module.exports=f;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import { classNames as c } from "@progress/kendo-react-common";
|
|
10
9
|
import * as e from "react";
|
|
11
10
|
import { ChatToolbar as h } from "./ChatToolbar.mjs";
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react");function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=r(c);class l extends s.Component{componentDidUpdate(t){!t.selected&&this.props.selected&&this.elementToFocus.focus()}}exports.FocusableUponSelection=l;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as o from "react";
|
|
10
9
|
class s extends o.Component {
|
|
11
10
|
/**
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),o=require("@progress/kendo-react-common");function i(l){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>l[e]})}}return t.default=l,Object.freeze(t)}const a=i(r);class c extends a.Component{constructor(){super(...arguments),this.state={selectedItemIndex:null},this.onRequestContainerSelection=()=>this.props.onRequestSelection(this.props.group.selectionIndex),this.onKeyDown=t=>{let e=null,n,s;this.isKeyboardNavigationLeftRight?(n=o.Keys.left,s=o.Keys.right):(n=o.Keys.up,s=o.Keys.down),t.keyCode===n?e=this.navigate(!1):t.keyCode===s&&(e=this.navigate(!0)),e!==null&&(t.preventDefault(),t.stopPropagation())}}static getDerivedStateFromProps(t,e){return!t.selected&&e.selectedItemIndex!==null?{selectedItemIndex:null}:t.selected&&e.selectedItemIndex===null?{selectedItemIndex:0}:null}navigate(t,e=0){let n=null;const s=this.state.selectedItemIndex;return t?s===null?n=e:s<this.getLastSelectionIndex()&&(n=s+1):s===null?n=0:s>0&&(n=s-1),n!==null&&this.setState({selectedItemIndex:n}),n}get isKeyboardNavigationLeftRight(){return!0}getLastSelectionIndex(){let t=-1;if(this.props.group.type==="action-group"){const e=this.props.group;t=e.actions?e.actions.length-1:-1}else if(this.props.group.type==="attachment-group"){const e=this.props.group;t=e.attachments?e.attachments.length-1:-1}return t}}exports.SelectableItemsContainer=c;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as i from "react";
|
|
10
9
|
import { Keys as l } from "@progress/kendo-react-common";
|
|
11
10
|
class a extends i.Component {
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("@progress/kendo-react-buttons"),n=require("@progress/kendo-react-common");function l(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}return e.default=s,Object.freeze(e)}const t=l(a);class o extends t.Component{constructor(){super(...arguments),this.onBtnClick=(e,r)=>{n.dispatchEvent(this.props.onActionExecute,r,this,{action:e})}}render(){return t.createElement("div",{className:"k-card"},t.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),t.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),t.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map((e,r)=>t.createElement("span",{className:"k-card-action",key:r},t.createElement(c.Button,{fillMode:"flat",onClick:i=>this.onBtnClick(e,i)},e.title)))}getTitleView(){let e=null;return this.props.title&&(e=t.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=t.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}exports.HeroCard=o;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as e from "react";
|
|
10
9
|
import { Button as r } from "@progress/kendo-react-buttons";
|
|
11
10
|
import { dispatchEvent as a } from "@progress/kendo-react-common";
|
|
@@ -5,4 +5,11 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl"),require("prop-types"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-inputs")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-intl","prop-types","@progress/kendo-svg-icons","@progress/kendo-react-buttons","@progress/kendo-react-layout","@progress/kendo-react-inputs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactIntl,e.PropTypes,e.KendoSvgIcons,e.KendoReactButtons,e.KendoReactLayout,e.KendoReactInputs)}(this,(function(e,t,s,n,o,a,r,i,l){"use strict";function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var p=c(t);let m=class extends p.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}};const u=class extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>this.elementToFocus=e},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?p.createElement("div",{className:"k-chat-bubble"},p.createElement("div",{className:"k-typing-indicator"},p.createElement("span",null),p.createElement("span",null),p.createElement("span",null))):this.props.template?p.createElement(this.props.template,{item:this.props.item}):this.props.item.text?p.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=p.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},n.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=p.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return s.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}};u.defaultProps={dateFormat:"g",tabIndex:-1};let h=u;n.registerForIntl(h);const d=(e,t)=>e&&t.author&&e.id===t.author.id,g=e=>e[e.length-1],I=e=>(t,s,n)=>{const o=n===e-1;return((e,t)=>{const s=t.timestamp,n=g(e);if(s&&(!n||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(s,n.timestamp))){const t={type:"date-marker",timestamp:s,trackBy:s.getTime()};e.push(t)}})(t,s),((e,t,s)=>{const n=g(e);let o;t.typing&&!s||(n&&"message-group"===n.type&&(o=n.messages),o&&d(t.author,g(o))?o.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,s,o),s.attachments&&s.attachments.length>1&&t.push({type:"attachment-group",attachments:s.attachments,attachmentLayout:s.attachmentLayout,timestamp:s.timestamp,trackBy:s}),s.suggestedActions&&o&&t.push({type:"action-group",actions:s.suggestedActions,timestamp:s.timestamp,trackBy:s}),t};let k=class extends m{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===s.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return s.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}},v=class extends p.Component{constructor(){super(...arguments),this.state={selectedItemIndex:null},this.onRequestContainerSelection=()=>this.props.onRequestSelection(this.props.group.selectionIndex),this.onKeyDown=e=>{let t,n,o=null;this.isKeyboardNavigationLeftRight?(t=s.Keys.left,n=s.Keys.right):(t=s.Keys.up,n=s.Keys.down),e.keyCode===t?o=this.navigate(!1):e.keyCode===n&&(o=this.navigate(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())}}static getDerivedStateFromProps(e,t){return e.selected||null===t.selectedItemIndex?e.selected&&null===t.selectedItemIndex?{selectedItemIndex:0}:null:{selectedItemIndex:null}}navigate(e,t=0){let s=null;const n=this.state.selectedItemIndex;return e?null===n?s=t:n<this.getLastSelectionIndex()&&(s=n+1):null===n?s=0:n>0&&(s=n-1),null!==s&&this.setState({selectedItemIndex:s}),s}get isKeyboardNavigationLeftRight(){return!0}getLastSelectionIndex(){let e=-1;if("action-group"===this.props.group.type){const t=this.props.group;e=t.actions?t.actions.length-1:-1}else if("attachment-group"===this.props.group.type){const t=this.props.group;e=t.attachments?t.attachments.length-1:-1}return e}};class E extends v{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return p.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map(((t,s)=>p.createElement(k,{item:t,onActionExecute:this.props.onActionExecute,selected:s===this.state.selectedItemIndex,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,key:s}))))}getClassNames(){return s.classNames("k-quick-replies")}}class y extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>this.elementToFocus=e},this.props.template?p.createElement(this.props.template,{item:this.props.item}):p.createElement("div",{className:"k-card"},p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(void 0!==this.props.tabbable)return this.props.tabbable?0:-1}getClassNames(){return s.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?p.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?p.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return 0===this.props.item.contentType.indexOf("image/")?p.createElement("img",{src:this.props.item.content}):this.props.item.content}}class f extends v{render(){const e=this.isCardDeckLayout(this.props),t=p.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map(((e,t)=>p.createElement(y,{item:e,template:this.props.itemTemplate,selected:t===this.state.selectedItemIndex,tabbable:this.props.isLastGroup&&t===this.state.selectedItemIndex,isFirstItemInGroup:0===t,isLastItemInGroup:t===this.getLastItemIndex(),onClick:()=>this.onAttachmentClick(t),key:t}))));return e?p.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:this.onKeyDown},this.getLeftScrollBtn(),t,this.getRightScrollBtn()):t}get isKeyboardNavigationLeftRight(){return this.isCardDeckLayout(this.props)}getLastItemIndex(){return this.props.group.attachments.length-1}getLeftScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex&&(e=p.createElement(r.Button,{icon:"chevron-left",onClick:()=>this.onNavigateBtnClick(!1),svgIcon:a.chevronLeftIcon})),e}getRightScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex!==this.getLastItemIndex()&&(e=p.createElement(r.Button,{icon:"chevron-right",onClick:()=>this.onNavigateBtnClick(!0),svgIcon:a.chevronRightIcon})),e}onAttachmentClick(e){this.onRequestContainerSelection(),this.setState({selectedItemIndex:e})}onNavigateBtnClick(e){this.onRequestContainerSelection(),this.navigate(e,1)}isCardDeckLayout(e){return"list"!==e.group.attachmentLayout}getClassNames(){return s.classNames({"k-card-list":this.props.group.attachmentLayout,"k-card-deck":this.isCardDeckLayout(this.props)})}}let C=class extends p.Component{render(){const e=this.props.item;return p.createElement("div",{className:"k-timestamp"},n.provideIntlService(this).formatDate(e.timestamp,"D"))}};n.registerForIntl(C);const b="newMessage.sendButton",w="newMessage.optionsButton",x="newMessage.messageInput",N="avatar.alt",T="messageList.ariaLabel",S="aIPrompt.noOutputs",R={[b]:"Send",[w]:"Options",[x]:"Message",[N]:"Avatar",[T]:"Message list",[S]:"No output from AI available"};class L extends p.Component{render(){const{avatarUrl:e,avatarAltText:t,name:s}=this.props.group.author,o=n.provideLocalizationService(this);return p.createElement("div",{className:this.getMsgGroupClassNames()},s&&p.createElement("p",{className:"k-author"},s),e&&p.createElement(i.Avatar,{type:"image"},p.createElement("img",{src:e,alt:void 0!==t?t:o.toLanguageString(N,R[N])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return s.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":d(this.props.user,this.props.group.messages[0])})}getGroupMessagesView(){const e=this.props.group.messages.length-1;return this.props.group.messages.map(((t,s)=>{const n=[p.createElement(this.props.message,{item:t,template:this.props.itemTemplate,selected:t.selectionIndex===this.props.selectedItemIndex,onRequestSelection:this.props.onRequestSelection,tabIndex:s===e&&this.props.isLastGroup?0:-1,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,isOnlyItemInGroup:0===e,key:s})];return t.attachments&&1===t.attachments.length&&n.push(p.createElement(y,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${s}`})),n}))}}const B=p.forwardRef(((e,t)=>{const{className:n,...o}=e,a=p.useRef(null),i=p.useRef(null);p.useImperativeHandle(i,(()=>({element:a.current,props:e}))),p.useImperativeHandle(t,(()=>i.current));const l=p.useMemo((()=>s.classNames("k-chat-toolbar k-toolbar",n)),[n]);return p.useEffect((()=>{null!==a.current&&s.focusFirstFocusableChild(a.current,[...s.TABBABLE_ELEMENTS])}),[]),p.createElement(r.Toolbar,{id:e.id,ref:e=>{e&&(a.current=e.element)},className:l,...o},p.createElement("div",{className:"k-button-list k-toolbar-group"},e.children))}));B.displayName="KendoReactChatToolbar";class D extends p.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=p.createRef(),this.onInputKeyDown=e=>{switch(e.key){case"Enter":return this.sendMessage(e);case"F10":return this.openToolbar(e);default:return}},this.sendMessage=e=>{if(this.props.onMessageSend&&null!==this.inputEl){const t=this.inputEl.value;if(t){const s={author:this.props.user,text:t,timestamp:new Date};this.props.onMessageSend(s,e)}}null!==this.inputEl&&(this.inputEl.value=null)},this.openToolbar=e=>{null!==this.toolbarBtnRef.current&&(e.preventDefault(),this.props.onToolbarActionButtonClick(!this.props.showToolbar,e))}}render(){const e=n.provideLocalizationService(this),t=p.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:e=>this.inputEl=e,"aria-label":e.toLanguageString(x,R[x])}),s=p.createElement(r.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:a.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(b,R[b]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),o=p.createElement(r.Button,{ref:this.toolbarBtnRef,fillMode:"flat",themeColor:"base",icon:"more-horizontal",svgIcon:a.moreHorizontalIcon,onClick:e=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,e),"aria-label":e.toLanguageString(w,R[w])});return p.createElement(p.Fragment,null,p.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?p.createElement(this.props.MessageBox,{messageInput:t,sendButton:s,toolbarButton:o}):p.createElement(p.Fragment,null,t,p.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),p.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&o,s))),this.props.showToolbar&&p.createElement(B,null,this.props.toolbar))}focusInput(){null!==this.inputEl&&this.inputEl.focus()}getClassNames(){return s.classNames("k-input-inner",{"k-focus":this.state.focused})}}const V={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:1737534960,version:"$VERSION",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},M=class e extends p.Component{constructor(e){super(e),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.onFocus=()=>{clearTimeout(this.timeoutIdForChatLosingFocus)},this.onBlur=()=>{this.timeoutIdForChatLosingFocus=window.setTimeout((()=>{this.setState({selectedItemIndex:null})}),0)},this.onSelectionRequested=e=>{this.setState({selectedItemIndex:e})},this.onKeyDown=e=>{let t=null;const n=null!==this.state.selectedItemIndex?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===s.Keys.up?null===n?t=0:n>0&&(t=n-1):e.keyCode===s.Keys.down&&(null===n?t=0:n<this.viewItems.lastSelectionIndex&&(t=n+1)),null!==t&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{s.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(s.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value)}this.newMsgComp.focusInput()}},s.validatePackage(V),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const e=n.provideLocalizationService(this);return p.createElement("div",{style:{width:this.props.width},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>this.chatWrapperEl=e},p.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":e.toLanguageString(T,R[T]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>this.viewItemsWrapperEl=e},p.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),p.createElement(D,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>this.newMsgComp=e,placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}))}componentDidMount(){this.setState({isFirstRender:!1},(()=>{this.nextTickId=window.setTimeout((()=>this.scrollViewItemsToBottom()),250)}))}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(e){e.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return s.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(e){return!!(void 0!==e.dir?"rtl"===e.dir:this.chatWrapperEl&&"rtl"===getComputedStyle(this.chatWrapperEl).direction)}renderViewItems(){const t=this.viewItems.length-1;return this.viewItems.map(((s,n)=>"date-marker"===s.type?p.createElement(C,{item:s,key:n}):"message-group"===s.type?p.createElement(L,{group:s,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:n===t,key:n,message:this.props.message||e.defaultProps.message}):"attachment-group"===s.type?p.createElement(f,{group:s,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):"action-group"===s.type?p.createElement(E,{group:s,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):void 0))}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(e){return e.length>0?(e=>{const t=e.slice().reduce(I(e.length),[]);return function(e){let t=0;e.forEach((e=>{"message-group"===e.type?e.messages.forEach((e=>{e.selectionIndex=t++})):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)})),e.lastSelectionIndex=t-1}(t),t})(e):[]}};M.propTypes={messages:o.arrayOf(o.object),user:o.object,messageTemplate:o.any,attachmentTemplate:o.any,width:o.oneOfType([o.string,o.number]),onMessageSend:o.func,onActionExecute:o.func,dir:o.string,messageBox:o.any},M.defaultProps={messages:[],dateFormat:"g",message:h};let A=M;class F extends p.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{s.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return p.createElement("div",{className:"k-card"},p.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),p.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map(((e,t)=>p.createElement("span",{className:"k-card-action",key:t},p.createElement(r.Button,{fillMode:"flat",onClick:t=>this.onBtnClick(e,t)},e.title))))}getTitleView(){let e=null;return this.props.title&&(e=p.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=p.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}const K=e=>{const{activeView:s,toolbarItems:n,activeViewChange:o}=e;return t.createElement("div",{className:"k-prompt-header"},t.createElement(r.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map((e=>t.isValidElement(e)?e:t.createElement(r.Button,{key:e.name,className:s===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>(e=>{null==o||o.call(null,e)})(e.name)},e.buttonText)))))},q=t.forwardRef(((e,s)=>{const{children:n}=e;return t.createElement("div",{className:"k-prompt-content",ref:s},t.createElement("div",{className:"k-prompt-view"},n))}));q.displayName="KendoReactAIPromptContent";const P=e=>{const{children:s}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},s))},O=t.createContext([{},()=>{}]),G=()=>t.useContext(O),z=e=>{const[t]=G();return t.activeView===e.name?e.children:null},U=e=>{const[s,n]=t.useState(!0),{children:o,title:i}=e;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(r.Button,{fillMode:"flat",svgIcon:s?a.chevronUpIcon:a.chevronDownIcon,title:i,onClick:()=>n(!s)},i),s&&t.createElement("div",{className:"k-prompt-expander-content"},o))},H={name:"prompt-view",buttonText:"Ask AI",buttonIcon:a.sparklesIcon},W={name:"Output view",buttonText:"Output",buttonIcon:a.commentIcon},j={name:"Commands view",buttonIcon:a.moreHorizontalIcon},$=e=>null==e?void 0:e.map((e=>t.createElement(i.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&$(e.children||[]))));e.AIPrompt=e=>{const{activeView:n,toolbarItems:o,children:a,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l,style:c,dir:p,className:m,...u}=e,h=o||[H,W],[d,g]=t.useState({activeView:n}),I={...d,activeView:n,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l};return t.createElement(O.Provider,{value:[I,e=>{g(e)}]},t.createElement("div",{className:s.classNames("k-prompt",m),style:c,dir:p,...u},t.createElement(K,{activeView:I.activeView,toolbarItems:h,activeViewChange:r}),a))},e.AIPromptCommandsView=e=>{const{commands:s}=e,[n]=G();return t.createElement(z,{name:j.name},t.createElement(q,null,t.createElement("div",{className:"k-prompt-view"},t.createElement(i.PanelBar,{onSelect:e=>{var t,s,o;const a=null==(s=null==(t=e.target)?void 0:t.props)?void 0:s.data;null!=(o=a.children)&&o.length||n.onCommandExecute&&n.onCommandExecute.call(null,a)},selected:""},$(null!=s?s:[])))))},e.AIPromptContent=q,e.AIPromptFooter=P,e.AIPromptOutputView=e=>{const[s,o]=t.useState(""),l=t.useRef(null),[c]=G(),{outputs:p,showOutputRating:m,outputCard:u}=e,{header:h,body:d,actions:g}=u||{},I=n.useLocalization(),k=(e,t)=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),v()},v=()=>{l&&l.current&&l.current.scrollTo({top:0,behavior:"smooth"})};return t.createElement(z,{name:W.name},t.createElement(q,{ref:l},t.createElement("div",{className:"k-card-list"},p&&p.length>0?p.map(((e,n)=>t.createElement(i.Card,{key:`${e.id}_${n}`},t.createElement(i.CardHeader,null,h?h(e):t.createElement(t.Fragment,null,e.title&&t.createElement(i.CardTitle,null,e.title),e.subTitle&&t.createElement(i.CardSubtitle,null,e.subTitle))),t.createElement(i.CardBody,null,d?d(e):e.responseContent),t.createElement(i.CardActions,null,g?g(e):t.createElement(t.Fragment,null,t.createElement(r.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:s===e.id?a.copyIcon:a.checkIcon,"aria-hidden":"true",onClick:()=>(e=>{null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),o(e.id),setTimeout((()=>{o("")}),1e3)})(e)},"Copy"),t.createElement(r.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:a.rotateIcon,"aria-hidden":"true",onClick:()=>(e=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),v()})(e)},"Retry"),m&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(r.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:a.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"positive")}),t.createElement(r.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:a.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"negative")}))))))):t.createElement(i.Card,null,t.createElement(i.CardBody,null,I.toLanguageString(S,R[S]))))))},e.AIPromptView=e=>{const{promptInput:n=l.TextArea,generateButton:o=r.Button,promptValue:i,promptSuggestions:c}=e,[p,m]=t.useState(i||""),[u]=G(),[h,d]=s.useCustomComponent(o),[g,I]=s.useCustomComponent(n),k={title:"Generate",svgIcon:a.sparklesIcon},v=Object.keys(d).length>0?d:k,E=Object.keys(I).length>0?I:{placeholder:"Ask or generate content with AI ...",rows:2};return t.createElement(z,{name:H.name},t.createElement(q,null,t.createElement(g,{value:p,onChange:e=>{m(e.target.value)},...E}),c&&c.length>0&&t.createElement(U,{title:"Prompt Suggestions"},c.map((e=>t.createElement("div",{key:e,className:"k-prompt-suggestion",onClick:()=>(e=>{m(e)})(e)},e))))),t.createElement(P,null,t.createElement(h,{themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:()=>{u.onPromptRequest&&u.onPromptRequest.call(null,p),m("")},...v},"Generate")))},e.AIPromptViewRender=z,e.Chat=A,e.ChatMessage=h,e.HeroCard=F,e.PromptHeader=K,e.commandsViewDefaults=j,e.outputViewDefaults=W,e.promptViewDefaults=H}));
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
*-------------------------------------------------------------------------------------------
|
|
11
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
12
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
|
+
*-------------------------------------------------------------------------------------------
|
|
14
|
+
*/
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl"),require("prop-types"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-inputs")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-intl","prop-types","@progress/kendo-svg-icons","@progress/kendo-react-buttons","@progress/kendo-react-layout","@progress/kendo-react-inputs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactIntl,e.PropTypes,e.KendoSvgIcons,e.KendoReactButtons,e.KendoReactLayout,e.KendoReactInputs)}(this,(function(e,t,s,n,o,a,r,i,l){"use strict";function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var p=c(t);let m=class extends p.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}};const u=class extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>this.elementToFocus=e},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?p.createElement("div",{className:"k-chat-bubble"},p.createElement("div",{className:"k-typing-indicator"},p.createElement("span",null),p.createElement("span",null),p.createElement("span",null))):this.props.template?p.createElement(this.props.template,{item:this.props.item}):this.props.item.text?p.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=p.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},n.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=p.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return s.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}};u.defaultProps={dateFormat:"g",tabIndex:-1};let h=u;n.registerForIntl(h);const d=(e,t)=>e&&t.author&&e.id===t.author.id,g=e=>e[e.length-1],I=e=>(t,s,n)=>{const o=n===e-1;return((e,t)=>{const s=t.timestamp,n=g(e);if(s&&(!n||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(s,n.timestamp))){const t={type:"date-marker",timestamp:s,trackBy:s.getTime()};e.push(t)}})(t,s),((e,t,s)=>{const n=g(e);let o;t.typing&&!s||(n&&"message-group"===n.type&&(o=n.messages),o&&d(t.author,g(o))?o.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,s,o),s.attachments&&s.attachments.length>1&&t.push({type:"attachment-group",attachments:s.attachments,attachmentLayout:s.attachmentLayout,timestamp:s.timestamp,trackBy:s}),s.suggestedActions&&o&&t.push({type:"action-group",actions:s.suggestedActions,timestamp:s.timestamp,trackBy:s}),t};let k=class extends m{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===s.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return s.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}},v=class extends p.Component{constructor(){super(...arguments),this.state={selectedItemIndex:null},this.onRequestContainerSelection=()=>this.props.onRequestSelection(this.props.group.selectionIndex),this.onKeyDown=e=>{let t,n,o=null;this.isKeyboardNavigationLeftRight?(t=s.Keys.left,n=s.Keys.right):(t=s.Keys.up,n=s.Keys.down),e.keyCode===t?o=this.navigate(!1):e.keyCode===n&&(o=this.navigate(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())}}static getDerivedStateFromProps(e,t){return e.selected||null===t.selectedItemIndex?e.selected&&null===t.selectedItemIndex?{selectedItemIndex:0}:null:{selectedItemIndex:null}}navigate(e,t=0){let s=null;const n=this.state.selectedItemIndex;return e?null===n?s=t:n<this.getLastSelectionIndex()&&(s=n+1):null===n?s=0:n>0&&(s=n-1),null!==s&&this.setState({selectedItemIndex:s}),s}get isKeyboardNavigationLeftRight(){return!0}getLastSelectionIndex(){let e=-1;if("action-group"===this.props.group.type){const t=this.props.group;e=t.actions?t.actions.length-1:-1}else if("attachment-group"===this.props.group.type){const t=this.props.group;e=t.attachments?t.attachments.length-1:-1}return e}};class E extends v{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return p.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map(((t,s)=>p.createElement(k,{item:t,onActionExecute:this.props.onActionExecute,selected:s===this.state.selectedItemIndex,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,key:s}))))}getClassNames(){return s.classNames("k-quick-replies")}}class y extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>this.elementToFocus=e},this.props.template?p.createElement(this.props.template,{item:this.props.item}):p.createElement("div",{className:"k-card"},p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(void 0!==this.props.tabbable)return this.props.tabbable?0:-1}getClassNames(){return s.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?p.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?p.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return 0===this.props.item.contentType.indexOf("image/")?p.createElement("img",{src:this.props.item.content}):this.props.item.content}}class f extends v{render(){const e=this.isCardDeckLayout(this.props),t=p.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map(((e,t)=>p.createElement(y,{item:e,template:this.props.itemTemplate,selected:t===this.state.selectedItemIndex,tabbable:this.props.isLastGroup&&t===this.state.selectedItemIndex,isFirstItemInGroup:0===t,isLastItemInGroup:t===this.getLastItemIndex(),onClick:()=>this.onAttachmentClick(t),key:t}))));return e?p.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:this.onKeyDown},this.getLeftScrollBtn(),t,this.getRightScrollBtn()):t}get isKeyboardNavigationLeftRight(){return this.isCardDeckLayout(this.props)}getLastItemIndex(){return this.props.group.attachments.length-1}getLeftScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex&&(e=p.createElement(r.Button,{icon:"chevron-left",onClick:()=>this.onNavigateBtnClick(!1),svgIcon:a.chevronLeftIcon})),e}getRightScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex!==this.getLastItemIndex()&&(e=p.createElement(r.Button,{icon:"chevron-right",onClick:()=>this.onNavigateBtnClick(!0),svgIcon:a.chevronRightIcon})),e}onAttachmentClick(e){this.onRequestContainerSelection(),this.setState({selectedItemIndex:e})}onNavigateBtnClick(e){this.onRequestContainerSelection(),this.navigate(e,1)}isCardDeckLayout(e){return"list"!==e.group.attachmentLayout}getClassNames(){return s.classNames({"k-card-list":this.props.group.attachmentLayout,"k-card-deck":this.isCardDeckLayout(this.props)})}}let C=class extends p.Component{render(){const e=this.props.item;return p.createElement("div",{className:"k-timestamp"},n.provideIntlService(this).formatDate(e.timestamp,"D"))}};n.registerForIntl(C);const b="newMessage.sendButton",w="newMessage.optionsButton",x="newMessage.messageInput",N="avatar.alt",T="messageList.ariaLabel",S="aIPrompt.noOutputs",R={[b]:"Send",[w]:"Options",[x]:"Message",[N]:"Avatar",[T]:"Message list",[S]:"No output from AI available"};class L extends p.Component{render(){const{avatarUrl:e,avatarAltText:t,name:s}=this.props.group.author,o=n.provideLocalizationService(this);return p.createElement("div",{className:this.getMsgGroupClassNames()},s&&p.createElement("p",{className:"k-author"},s),e&&p.createElement(i.Avatar,{type:"image"},p.createElement("img",{src:e,alt:void 0!==t?t:o.toLanguageString(N,R[N])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return s.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":d(this.props.user,this.props.group.messages[0])})}getGroupMessagesView(){const e=this.props.group.messages.length-1;return this.props.group.messages.map(((t,s)=>{const n=[p.createElement(this.props.message,{item:t,template:this.props.itemTemplate,selected:t.selectionIndex===this.props.selectedItemIndex,onRequestSelection:this.props.onRequestSelection,tabIndex:s===e&&this.props.isLastGroup?0:-1,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,isOnlyItemInGroup:0===e,key:s})];return t.attachments&&1===t.attachments.length&&n.push(p.createElement(y,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${s}`})),n}))}}const B=p.forwardRef(((e,t)=>{const{className:n,...o}=e,a=p.useRef(null),i=p.useRef(null);p.useImperativeHandle(i,(()=>({element:a.current,props:e}))),p.useImperativeHandle(t,(()=>i.current));const l=p.useMemo((()=>s.classNames("k-chat-toolbar k-toolbar",n)),[n]);return p.useEffect((()=>{null!==a.current&&s.focusFirstFocusableChild(a.current,[...s.TABBABLE_ELEMENTS])}),[]),p.createElement(r.Toolbar,{id:e.id,ref:e=>{e&&(a.current=e.element)},className:l,...o},p.createElement("div",{className:"k-button-list k-toolbar-group"},e.children))}));B.displayName="KendoReactChatToolbar";class D extends p.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=p.createRef(),this.onInputKeyDown=e=>{switch(e.key){case"Enter":return this.sendMessage(e);case"F10":return this.openToolbar(e);default:return}},this.sendMessage=e=>{if(this.props.onMessageSend&&null!==this.inputEl){const t=this.inputEl.value;if(t){const s={author:this.props.user,text:t,timestamp:new Date};this.props.onMessageSend(s,e)}}null!==this.inputEl&&(this.inputEl.value=null)},this.openToolbar=e=>{null!==this.toolbarBtnRef.current&&(e.preventDefault(),this.props.onToolbarActionButtonClick(!this.props.showToolbar,e))}}render(){const e=n.provideLocalizationService(this),t=p.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:e=>this.inputEl=e,"aria-label":e.toLanguageString(x,R[x])}),s=p.createElement(r.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:a.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(b,R[b]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),o=p.createElement(r.Button,{ref:this.toolbarBtnRef,fillMode:"flat",themeColor:"base",icon:"more-horizontal",svgIcon:a.moreHorizontalIcon,onClick:e=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,e),"aria-label":e.toLanguageString(w,R[w])});return p.createElement(p.Fragment,null,p.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?p.createElement(this.props.MessageBox,{messageInput:t,sendButton:s,toolbarButton:o}):p.createElement(p.Fragment,null,t,p.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),p.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&o,s))),this.props.showToolbar&&p.createElement(B,null,this.props.toolbar))}focusInput(){null!==this.inputEl&&this.inputEl.focus()}getClassNames(){return s.classNames("k-input-inner",{"k-focus":this.state.focused})}}const V={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"$VERSION",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},M=class e extends p.Component{constructor(e){super(e),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.onFocus=()=>{clearTimeout(this.timeoutIdForChatLosingFocus)},this.onBlur=()=>{this.timeoutIdForChatLosingFocus=window.setTimeout((()=>{this.setState({selectedItemIndex:null})}),0)},this.onSelectionRequested=e=>{this.setState({selectedItemIndex:e})},this.onKeyDown=e=>{let t=null;const n=null!==this.state.selectedItemIndex?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===s.Keys.up?null===n?t=0:n>0&&(t=n-1):e.keyCode===s.Keys.down&&(null===n?t=0:n<this.viewItems.lastSelectionIndex&&(t=n+1)),null!==t&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{s.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(s.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value)}this.newMsgComp.focusInput()}},s.validatePackage(V),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const e=n.provideLocalizationService(this);return p.createElement("div",{style:{width:this.props.width},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>this.chatWrapperEl=e},p.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":e.toLanguageString(T,R[T]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>this.viewItemsWrapperEl=e},p.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),p.createElement(D,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>this.newMsgComp=e,placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}))}componentDidMount(){this.setState({isFirstRender:!1},(()=>{this.nextTickId=window.setTimeout((()=>this.scrollViewItemsToBottom()),250)}))}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(e){e.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return s.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(e){return!!(void 0!==e.dir?"rtl"===e.dir:this.chatWrapperEl&&"rtl"===getComputedStyle(this.chatWrapperEl).direction)}renderViewItems(){const t=this.viewItems.length-1;return this.viewItems.map(((s,n)=>"date-marker"===s.type?p.createElement(C,{item:s,key:n}):"message-group"===s.type?p.createElement(L,{group:s,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:n===t,key:n,message:this.props.message||e.defaultProps.message}):"attachment-group"===s.type?p.createElement(f,{group:s,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):"action-group"===s.type?p.createElement(E,{group:s,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):void 0))}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(e){return e.length>0?(e=>{const t=e.slice().reduce(I(e.length),[]);return function(e){let t=0;e.forEach((e=>{"message-group"===e.type?e.messages.forEach((e=>{e.selectionIndex=t++})):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)})),e.lastSelectionIndex=t-1}(t),t})(e):[]}};M.propTypes={messages:o.arrayOf(o.object),user:o.object,messageTemplate:o.any,attachmentTemplate:o.any,width:o.oneOfType([o.string,o.number]),onMessageSend:o.func,onActionExecute:o.func,dir:o.string,messageBox:o.any},M.defaultProps={messages:[],dateFormat:"g",message:h};let A=M;class F extends p.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{s.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return p.createElement("div",{className:"k-card"},p.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),p.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map(((e,t)=>p.createElement("span",{className:"k-card-action",key:t},p.createElement(r.Button,{fillMode:"flat",onClick:t=>this.onBtnClick(e,t)},e.title))))}getTitleView(){let e=null;return this.props.title&&(e=p.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=p.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}const K=e=>{const{activeView:s,toolbarItems:n,activeViewChange:o}=e;return t.createElement("div",{className:"k-prompt-header"},t.createElement(r.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map((e=>t.isValidElement(e)?e:t.createElement(r.Button,{key:e.name,className:s===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>(e=>{null==o||o.call(null,e)})(e.name)},e.buttonText)))))},q=t.forwardRef(((e,s)=>{const{children:n}=e;return t.createElement("div",{className:"k-prompt-content",ref:s},t.createElement("div",{className:"k-prompt-view"},n))}));q.displayName="KendoReactAIPromptContent";const P=e=>{const{children:s}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},s))},O=t.createContext([{},()=>{}]),G=()=>t.useContext(O),z=e=>{const[t]=G();return t.activeView===e.name?e.children:null},U=e=>{const[s,n]=t.useState(!0),{children:o,title:i}=e;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(r.Button,{fillMode:"flat",svgIcon:s?a.chevronUpIcon:a.chevronDownIcon,title:i,onClick:()=>n(!s)},i),s&&t.createElement("div",{className:"k-prompt-expander-content"},o))},H={name:"prompt-view",buttonText:"Ask AI",buttonIcon:a.sparklesIcon},W={name:"Output view",buttonText:"Output",buttonIcon:a.commentIcon},j={name:"Commands view",buttonIcon:a.moreHorizontalIcon},$=e=>null==e?void 0:e.map((e=>t.createElement(i.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&$(e.children||[]))));e.AIPrompt=e=>{const{activeView:n,toolbarItems:o,children:a,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l,style:c,dir:p,className:m,...u}=e,h=o||[H,W],[d,g]=t.useState({activeView:n}),I={...d,activeView:n,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l};return t.createElement(O.Provider,{value:[I,e=>{g(e)}]},t.createElement("div",{className:s.classNames("k-prompt",m),style:c,dir:p,...u},t.createElement(K,{activeView:I.activeView,toolbarItems:h,activeViewChange:r}),a))},e.AIPromptCommandsView=e=>{const{commands:s}=e,[n]=G();return t.createElement(z,{name:j.name},t.createElement(q,null,t.createElement("div",{className:"k-prompt-view"},t.createElement(i.PanelBar,{onSelect:e=>{var t,s,o;const a=null==(s=null==(t=e.target)?void 0:t.props)?void 0:s.data;null!=(o=a.children)&&o.length||n.onCommandExecute&&n.onCommandExecute.call(null,a)},selected:""},$(null!=s?s:[])))))},e.AIPromptContent=q,e.AIPromptFooter=P,e.AIPromptOutputView=e=>{const[s,o]=t.useState(""),l=t.useRef(null),[c]=G(),{outputs:p,showOutputRating:m,outputCard:u}=e,{header:h,body:d,actions:g}=u||{},I=n.useLocalization(),k=(e,t)=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),v()},v=()=>{l&&l.current&&l.current.scrollTo({top:0,behavior:"smooth"})};return t.createElement(z,{name:W.name},t.createElement(q,{ref:l},t.createElement("div",{className:"k-card-list"},p&&p.length>0?p.map(((e,n)=>t.createElement(i.Card,{key:`${e.id}_${n}`},t.createElement(i.CardHeader,null,h?h(e):t.createElement(t.Fragment,null,e.title&&t.createElement(i.CardTitle,null,e.title),e.subTitle&&t.createElement(i.CardSubtitle,null,e.subTitle))),t.createElement(i.CardBody,null,d?d(e):e.responseContent),t.createElement(i.CardActions,null,g?g(e):t.createElement(t.Fragment,null,t.createElement(r.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:s===e.id?a.copyIcon:a.checkIcon,"aria-hidden":"true",onClick:()=>(e=>{null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),o(e.id),setTimeout((()=>{o("")}),1e3)})(e)},"Copy"),t.createElement(r.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:a.rotateIcon,"aria-hidden":"true",onClick:()=>(e=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),v()})(e)},"Retry"),m&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(r.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:a.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"positive")}),t.createElement(r.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:a.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"negative")}))))))):t.createElement(i.Card,null,t.createElement(i.CardBody,null,I.toLanguageString(S,R[S]))))))},e.AIPromptView=e=>{const{promptInput:n=l.TextArea,generateButton:o=r.Button,promptValue:i,promptSuggestions:c}=e,[p,m]=t.useState(i||""),[u]=G(),[h,d]=s.useCustomComponent(o),[g,I]=s.useCustomComponent(n),k={title:"Generate",svgIcon:a.sparklesIcon},v=Object.keys(d).length>0?d:k,E=Object.keys(I).length>0?I:{placeholder:"Ask or generate content with AI ...",rows:2};return t.createElement(z,{name:H.name},t.createElement(q,null,t.createElement(g,{value:p,onChange:e=>{m(e.target.value)},...E}),c&&c.length>0&&t.createElement(U,{title:"Prompt Suggestions"},c.map((e=>t.createElement("div",{key:e,className:"k-prompt-suggestion",onClick:()=>(e=>{m(e)})(e)},e))))),t.createElement(P,null,t.createElement(h,{themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:()=>{u.onPromptRequest&&u.onPromptRequest.call(null,p),m("")},...v},"Generate")))},e.AIPromptViewRender=z,e.Chat=A,e.ChatMessage=h,e.HeroCard=F,e.PromptHeader=K,e.commandsViewDefaults=j,e.outputViewDefaults=W,e.promptViewDefaults=H}));
|
package/index.js
CHANGED
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
8
|
+
"use client";
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./components/ChatMessage.js"),m=require("./components/Chat.js"),p=require("./components/templates/HeroCard.js"),i=require("./ai-prompt/AIPrompt.js"),s=require("./ai-prompt/AIPromptHeader.js"),u=require("./ai-prompt/AIPromptFooter.js"),a=require("./ai-prompt/AIPromptContent.js"),e=require("./ai-prompt/views/AIPromptView.js"),t=require("./ai-prompt/views/AIPromptOutputView.js"),r=require("./ai-prompt/views/AIPromptCommandsView.js"),n=require("./ai-prompt/views/AIPromptViewRender.js");exports.ChatMessage=o.ChatMessage;exports.Chat=m.Chat;exports.HeroCard=p.HeroCard;exports.AIPrompt=i.AIPrompt;exports.PromptHeader=s.PromptHeader;exports.AIPromptFooter=u.AIPromptFooter;exports.AIPromptContent=a.AIPromptContent;exports.AIPromptView=e.AIPromptView;exports.promptViewDefaults=e.promptViewDefaults;exports.AIPromptOutputView=t.AIPromptOutputView;exports.outputViewDefaults=t.outputViewDefaults;exports.AIPromptCommandsView=r.AIPromptCommandsView;exports.commandsViewDefaults=r.commandsViewDefaults;exports.AIPromptViewRender=n.AIPromptViewRender;
|
package/index.mjs
CHANGED
|
@@ -10,26 +10,26 @@ import { ChatMessage as t } from "./components/ChatMessage.mjs";
|
|
|
10
10
|
import { Chat as m } from "./components/Chat.mjs";
|
|
11
11
|
import { HeroCard as f } from "./components/templates/HeroCard.mjs";
|
|
12
12
|
import { AIPrompt as a } from "./ai-prompt/AIPrompt.mjs";
|
|
13
|
-
import { PromptHeader as
|
|
14
|
-
import { AIPromptFooter as
|
|
13
|
+
import { PromptHeader as i } from "./ai-prompt/AIPromptHeader.mjs";
|
|
14
|
+
import { AIPromptFooter as u } from "./ai-prompt/AIPromptFooter.mjs";
|
|
15
15
|
import { AIPromptContent as A } from "./ai-prompt/AIPromptContent.mjs";
|
|
16
|
-
import { AIPromptView as V, promptViewDefaults as
|
|
16
|
+
import { AIPromptView as V, promptViewDefaults as d } from "./ai-prompt/views/AIPromptView.mjs";
|
|
17
17
|
import { AIPromptOutputView as C, outputViewDefaults as l } from "./ai-prompt/views/AIPromptOutputView.mjs";
|
|
18
|
-
import { AIPromptCommandsView as
|
|
18
|
+
import { AIPromptCommandsView as h, commandsViewDefaults as H } from "./ai-prompt/views/AIPromptCommandsView.mjs";
|
|
19
19
|
import { AIPromptViewRender as g } from "./ai-prompt/views/AIPromptViewRender.mjs";
|
|
20
20
|
export {
|
|
21
21
|
a as AIPrompt,
|
|
22
|
-
|
|
22
|
+
h as AIPromptCommandsView,
|
|
23
23
|
A as AIPromptContent,
|
|
24
|
-
|
|
24
|
+
u as AIPromptFooter,
|
|
25
25
|
C as AIPromptOutputView,
|
|
26
26
|
V as AIPromptView,
|
|
27
27
|
g as AIPromptViewRender,
|
|
28
28
|
m as Chat,
|
|
29
29
|
t as ChatMessage,
|
|
30
30
|
f as HeroCard,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
i as PromptHeader,
|
|
32
|
+
H as commandsViewDefaults,
|
|
33
33
|
l as outputViewDefaults,
|
|
34
|
-
|
|
34
|
+
d as promptViewDefaults
|
|
35
35
|
};
|
package/messages/index.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="newMessage.sendButton",s="newMessage.optionsButton",t="newMessage.messageInput",a="avatar.alt",n="messageList.ariaLabel",o="aIPrompt.noOutputs",g={[e]:"Send",[s]:"Options",[t]:"Message",[a]:"Avatar",[n]:"Message list",[o]:"No output from AI available"};exports.aIPromptNoOutputs=o;exports.ariaLabelMessageList=n;exports.avatarAlt=a;exports.messages=g;exports.newMessageMessageInput=t;exports.newMessageOptionsButton=s;exports.newMessageSendButton=e;
|
package/messages/index.mjs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
const s = "newMessage.sendButton", e = "newMessage.optionsButton", t = "newMessage.messageInput", a = "avatar.alt", n = "messageList.ariaLabel", o = "aIPrompt.noOutputs", g = {
|
|
10
9
|
[s]: "Send",
|
|
11
10
|
[e]: "Options",
|
package/package-metadata.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1738310624,version:"9.4.0-develop.10",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
const e = {
|
|
10
9
|
name: "@progress/kendo-react-conversational-ui",
|
|
11
10
|
productName: "KendoReact",
|
|
12
11
|
productCode: "KENDOUIREACT",
|
|
13
12
|
productCodes: ["KENDOUIREACT"],
|
|
14
|
-
publishDate:
|
|
15
|
-
version: "9.
|
|
13
|
+
publishDate: 1738310624,
|
|
14
|
+
version: "9.4.0-develop.10",
|
|
16
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
17
16
|
};
|
|
18
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-conversational-ui",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0-develop.10",
|
|
4
4
|
"description": "React Chat component allows the user to participate in chat sessions with users or chat bots. KendoReact Conversational UI components",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-licensing": "^1.3.4",
|
|
29
|
-
"@progress/kendo-react-buttons": "9.
|
|
30
|
-
"@progress/kendo-react-common": "9.
|
|
31
|
-
"@progress/kendo-react-intl": "9.
|
|
32
|
-
"@progress/kendo-react-inputs": "9.
|
|
33
|
-
"@progress/kendo-react-layout": "9.
|
|
29
|
+
"@progress/kendo-react-buttons": "9.4.0-develop.10",
|
|
30
|
+
"@progress/kendo-react-common": "9.4.0-develop.10",
|
|
31
|
+
"@progress/kendo-react-intl": "9.4.0-develop.10",
|
|
32
|
+
"@progress/kendo-react-inputs": "9.4.0-develop.10",
|
|
33
|
+
"@progress/kendo-react-layout": "9.4.0-develop.10",
|
|
34
34
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
35
35
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
36
36
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"package": {
|
|
59
59
|
"productName": "KendoReact",
|
|
60
60
|
"productCode": "KENDOUIREACT",
|
|
61
|
-
"publishDate":
|
|
61
|
+
"publishDate": 1738310624,
|
|
62
62
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
63
63
|
}
|
|
64
64
|
},
|
package/utils.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=(t,o)=>t&&o.author&&t.id===o.author.id;exports.isAuthor=i;
|
package/utils.mjs
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
const i = (t, o) => t && o.author && t.id === o.author.id;
|
|
8
|
+
const h = (o, t) => o && t.author && o.id === t.author.id;
|
|
10
9
|
export {
|
|
11
|
-
|
|
10
|
+
h as isAuthor
|
|
12
11
|
};
|