@progress/kendo-react-conversational-ui 11.3.1-develop.1 → 11.4.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),S=require("./AIPromptHeader.js"),q=require("./views/AIPromptView.js"),C=require("./views/AIPromptOutputView.js"),g=require("./AIPromptContext.js"),h=require("@progress/kendo-react-common"),b=a=>{const{activeView:t,toolbarItems:n,children:c,onActiveViewChange:o,onPromptRequest:s,onCommandExecute:i,style:m,dir:l,className:u,streaming:p,onCancel:P,...d}=a,w=n||[q.promptViewDefaults,C.outputViewDefaults],[v,A]=e.useState({activeView:t}),r={...v,activeView:t,streaming:p,onCancel:P,onActiveViewChange:o,onPromptRequest:s,onCommandExecute:i},I=V=>{A(V)};return e.createElement(g.AIPromptContext.Provider,{value:[r,I]},e.createElement("div",{className:h.classNames("k-prompt",u),style:m,dir:l,...d},e.createElement(S.PromptHeader,{activeView:r.activeView,toolbarItems:w,activeViewChange:o}),c))};exports.AIPrompt=b;
@@ -6,41 +6,45 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import t from "react";
9
- import { PromptHeader as S } from "./AIPromptHeader.mjs";
10
- import { promptViewDefaults as h } from "./views/AIPromptView.mjs";
11
- import { outputViewDefaults as P } from "./views/AIPromptOutputView.mjs";
12
- import { AIPromptContext as x } from "./AIPromptContext.mjs";
13
- import { classNames as A } from "@progress/kendo-react-common";
14
- const D = (a) => {
9
+ import { PromptHeader as C } from "./AIPromptHeader.mjs";
10
+ import { promptViewDefaults as P } from "./views/AIPromptView.mjs";
11
+ import { outputViewDefaults as x } from "./views/AIPromptOutputView.mjs";
12
+ import { AIPromptContext as A } from "./AIPromptContext.mjs";
13
+ import { classNames as E } from "@progress/kendo-react-common";
14
+ const _ = (r) => {
15
15
  const {
16
16
  activeView: e,
17
17
  toolbarItems: m,
18
18
  children: c,
19
19
  onActiveViewChange: o,
20
20
  onPromptRequest: i,
21
- onCommandExecute: s,
22
- style: n,
21
+ onCommandExecute: n,
22
+ style: s,
23
23
  dir: l,
24
24
  className: p,
25
- ...u
26
- } = a, f = m || [h, P], [v, w] = t.useState({ activeView: e }), r = {
27
- ...v,
25
+ streaming: u,
26
+ onCancel: f,
27
+ ...v
28
+ } = r, w = m || [P, x], [d, V] = t.useState({ activeView: e }), a = {
29
+ ...d,
28
30
  activeView: e,
31
+ streaming: u,
32
+ onCancel: f,
29
33
  onActiveViewChange: o,
30
34
  onPromptRequest: i,
31
- onCommandExecute: s
32
- }, d = (V) => {
33
- w(V);
35
+ onCommandExecute: n
36
+ }, S = (h) => {
37
+ V(h);
34
38
  };
35
- return /* @__PURE__ */ t.createElement(x.Provider, { value: [r, d] }, /* @__PURE__ */ t.createElement("div", { className: A("k-prompt", p), style: n, dir: l, ...u }, /* @__PURE__ */ t.createElement(
36
- S,
39
+ return /* @__PURE__ */ t.createElement(A.Provider, { value: [a, S] }, /* @__PURE__ */ t.createElement("div", { className: E("k-prompt", p), style: s, dir: l, ...v }, /* @__PURE__ */ t.createElement(
40
+ C,
37
41
  {
38
- activeView: r.activeView,
39
- toolbarItems: f,
42
+ activeView: a.activeView,
43
+ toolbarItems: w,
40
44
  activeViewChange: o
41
45
  }
42
46
  ), c));
43
47
  };
44
48
  export {
45
- D as AIPrompt
49
+ _ as AIPrompt
46
50
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),l=require("@progress/kendo-svg-icons"),m=require("@progress/kendo-react-buttons"),t=require("../messages/index.js"),p=require("@progress/kendo-react-intl"),n=e.forwardRef((a,c)=>{const{children:r,streaming:s,onCancel:i}=a,o=p.useLocalization().toLanguageString(t.aIPromptCancel,t.messages[t.aIPromptCancel]);return e.createElement("div",{className:"k-prompt-content",ref:c},s&&e.createElement(m.FloatingActionButton,{onClick:i,svgIcon:l.stopSmIcon,icon:"stop-sm",size:"small",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":o,title:o}),e.createElement("div",{className:"k-prompt-view"},r))});n.displayName="KendoReactAIPromptContent";exports.AIPromptContent=n;
@@ -5,12 +5,28 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import e from "react";
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));
8
+ import t from "react";
9
+ import { stopSmIcon as c } from "@progress/kendo-svg-icons";
10
+ import { FloatingActionButton as l } from "@progress/kendo-react-buttons";
11
+ import { aIPromptCancel as e, messages as s } from "../messages/index.mjs";
12
+ import { useLocalization as p } from "@progress/kendo-react-intl";
13
+ const f = t.forwardRef((a, n) => {
14
+ const { children: r, streaming: i, onCancel: m } = a, o = p().toLanguageString(e, s[e]);
15
+ return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-content", ref: n }, i && /* @__PURE__ */ t.createElement(
16
+ l,
17
+ {
18
+ onClick: m,
19
+ svgIcon: c,
20
+ icon: "stop-sm",
21
+ size: "small",
22
+ positionMode: "absolute",
23
+ className: "k-prompt-stop-fab k-generating",
24
+ "aria-label": o,
25
+ title: o
26
+ }
27
+ ), /* @__PURE__ */ t.createElement("div", { className: "k-prompt-view" }, r));
12
28
  });
13
- n.displayName = "KendoReactAIPromptContent";
29
+ f.displayName = "KendoReactAIPromptContent";
14
30
  export {
15
- n as AIPromptContent
31
+ f as AIPromptContent
16
32
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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;
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,onClick:()=>c(e.name)},e.buttonText))))};exports.PromptHeader=s;
@@ -5,25 +5,24 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import t from "react";
8
+ import o from "react";
9
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) => {
12
- a == null || a.call(null, e);
10
+ const u = (l) => {
11
+ const { activeView: a, toolbarItems: r, activeViewChange: t } = l, n = (e) => {
12
+ t == null || t.call(null, e);
13
13
  };
14
- return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-header" }, /* @__PURE__ */ t.createElement(c, { keyboardNavigation: !1, role: "toolbar", className: "k-toolbar-flat" }, r.map(
15
- (e) => t.isValidElement(e) ? e : /* @__PURE__ */ t.createElement(
14
+ return /* @__PURE__ */ o.createElement("div", { className: "k-prompt-header" }, /* @__PURE__ */ o.createElement(c, { keyboardNavigation: !1, role: "toolbar", className: "k-toolbar-flat" }, r.map(
15
+ (e) => o.isValidElement(e) ? e : /* @__PURE__ */ o.createElement(
16
16
  m,
17
17
  {
18
18
  key: e.name,
19
- className: l === e.name ? "k-selected" : "",
19
+ className: a === e.name ? "k-selected" : "",
20
20
  size: "medium",
21
21
  themeColor: "primary",
22
22
  fillMode: "flat",
23
23
  rounded: "full",
24
24
  title: e.buttonText,
25
25
  svgIcon: e.buttonIcon,
26
- "aria-hidden": "true",
27
26
  onClick: () => n(e.name)
28
27
  },
29
28
  e.buttonText
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),d=require("../AIPromptContent.js"),p=require("./AIPromptViewRender.js"),C=require("@progress/kendo-svg-icons"),P=require("../AIPromptContext.js"),i=require("@progress/kendo-react-layout"),s={name:"Commands view",buttonIcon:C.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||[]))),g=t=>{const{commands:e}=t,[r]=P.useAIPromptContext(),u=I=>{var a,c,l;const o=(c=(a=I.target)==null?void 0:a.props)==null?void 0:c.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,{streaming:r.streaming,onCancel:r.onCancel},n.createElement("div",{className:"k-prompt-view"},n.createElement(i.PanelBar,{onSelect:u,selected:""},m(e!=null?e:[])))))};exports.AIPromptCommandsView=g;exports.commandsViewDefaults=s;
@@ -5,22 +5,22 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import r from "react";
9
- import { AIPromptContent as s } from "../AIPromptContent.mjs";
8
+ import n from "react";
9
+ import { AIPromptContent as p } from "../AIPromptContent.mjs";
10
10
  import { AIPromptViewRender as u } from "./AIPromptViewRender.mjs";
11
- import { moreHorizontalIcon as I } from "@progress/kendo-svg-icons";
12
- import { useAIPromptContext as f } from "../AIPromptContext.mjs";
13
- import { PanelBar as d, PanelBarItem as C } from "@progress/kendo-react-layout";
11
+ import { moreHorizontalIcon as C } from "@progress/kendo-svg-icons";
12
+ import { useAIPromptContext as I } from "../AIPromptContext.mjs";
13
+ import { PanelBar as f, PanelBarItem as d } from "@progress/kendo-react-layout";
14
14
  const E = {
15
15
  name: "Commands view",
16
- buttonIcon: I
17
- }, c = (t) => t == null ? void 0 : t.map((e) => /* @__PURE__ */ r.createElement(C, { title: e.text, key: e.id, svgIcon: e.svgIcon, data: e }, e.children && c(e.children || []))), A = (t) => {
18
- const { commands: e } = t, [n] = f(), i = (p) => {
19
- var l, a, m;
20
- const o = (a = (l = p.target) == null ? void 0 : l.props) == null ? void 0 : a.data;
21
- (m = o.children) != null && m.length || n.onCommandExecute && n.onCommandExecute.call(null, o);
16
+ buttonIcon: C
17
+ }, c = (t) => t == null ? void 0 : t.map((e) => /* @__PURE__ */ n.createElement(d, { title: e.text, key: e.id, svgIcon: e.svgIcon, data: e }, e.children && c(e.children || []))), A = (t) => {
18
+ const { commands: e } = t, [r] = I(), i = (s) => {
19
+ var a, l, m;
20
+ const o = (l = (a = s.target) == null ? void 0 : a.props) == null ? void 0 : l.data;
21
+ (m = o.children) != null && m.length || r.onCommandExecute && r.onCommandExecute.call(null, o);
22
22
  };
23
- return /* @__PURE__ */ r.createElement(u, { name: E.name }, /* @__PURE__ */ r.createElement(s, null, /* @__PURE__ */ r.createElement("div", { className: "k-prompt-view" }, /* @__PURE__ */ r.createElement(d, { onSelect: i, selected: "" }, c(e != null ? e : [])))));
23
+ return /* @__PURE__ */ n.createElement(u, { name: E.name }, /* @__PURE__ */ n.createElement(p, { streaming: r.streaming, onCancel: r.onCancel }, /* @__PURE__ */ n.createElement("div", { className: "k-prompt-view" }, /* @__PURE__ */ n.createElement(f, { onSelect: i, selected: "" }, c(e != null ? e : [])))));
24
24
  };
25
25
  export {
26
26
  A as AIPromptCommandsView,
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),w=require("../AIPromptContent.js"),q=require("../AIPromptContext.js"),m=require("../../messages/index.js"),O=require("./AIPromptViewRender.js"),n=require("@progress/kendo-react-layout"),r=require("@progress/kendo-svg-icons"),a=require("@progress/kendo-react-buttons"),x=require("@progress/kendo-react-intl"),g={name:"Output view",buttonText:"Output",buttonIcon:r.commentIcon},A=y=>{const[I,d]=e.useState(""),o=e.useRef(null),[l]=q.useAIPromptContext(),{outputs:s,showOutputRating:R,outputCard:b}=y,{header:u,body:p,actions:C}=b||{},h=x.useLocalization(),T=t=>{l.onPromptRequest&&l.onPromptRequest.call(null,t.prompt,{...t,isRetry:!0}),E()},P=t=>{t!=null&&t.responseContent&&navigator.clipboard.writeText(t.responseContent),d(t.id),setTimeout(()=>{d("")},1e3)},k=(t,i)=>{l.onPromptRequest&&l.onPromptRequest.call(null,t.prompt,{...t,ratingType:i,isRetry:!1}),E()},E=()=>{o&&o.current&&o.current.scrollTo({top:0,behavior:"smooth"})},f=e.createElement(n.Card,null,e.createElement(n.CardHeader,null,e.createElement(n.CardTitle,null,e.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}})),e.createElement(n.CardSubtitle,null,e.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),e.createElement(n.CardBody,null,e.createElement("span",{className:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}})),e.createElement(n.CardActions,null,e.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),c=s==null?void 0:s.map((t,i)=>e.createElement(n.Card,{key:`${t.id}_${i}`},e.createElement(n.CardHeader,null,u?u(t):e.createElement(e.Fragment,null,t.title&&e.createElement(n.CardTitle,null,t.title),t.subTitle&&e.createElement(n.CardSubtitle,null,t.subTitle))),e.createElement(n.CardBody,null,p?p(t):t.responseContent),e.createElement(n.CardActions,null,C?C(t):e.createElement(e.Fragment,null,e.createElement(a.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:I===t.id?r.checkIcon:r.copyIcon,onClick:()=>P(t)},"Copy"),e.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:r.rotateIcon,onClick:()=>T(t)},"Retry"),R&&e.createElement(e.Fragment,null,e.createElement("span",{className:"k-spacer"}),e.createElement(a.Button,{size:"medium",themeColor:t.ratingType==="positive"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:r.thumbUpOutlineIcon,onClick:()=>k(t,"positive")}),e.createElement(a.Button,{size:"medium",themeColor:t.ratingType==="negative"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:r.thumbDownOutlineIcon,onClick:()=>k(t,"negative")})))))),v=e.createElement(n.Card,null,e.createElement(n.CardBody,null,h.toLanguageString(m.aIPromptNoOutputs,m.messages[m.aIPromptNoOutputs])));return e.createElement(O.AIPromptViewRender,{name:g.name},e.createElement(w.AIPromptContent,{ref:o,streaming:l.streaming,onCancel:l.onCancel},e.createElement("div",{className:"k-card-list"},l.streaming&&f,c,(!c||c.length===0)&&!l.streaming&&v)))};exports.AIPromptOutputView=A;exports.outputViewDefaults=g;
@@ -5,84 +5,80 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import t from "react";
9
- import { AIPromptContent as v } from "../AIPromptContent.mjs";
10
- import { useAIPromptContext as T } from "../AIPromptContext.mjs";
11
- import { aIPromptNoOutputs as u, messages as P } from "../../messages/index.mjs";
12
- import { AIPromptViewRender as k } from "./AIPromptViewRender.mjs";
13
- import { Card as C, CardHeader as w, CardTitle as O, CardSubtitle as z, CardBody as f, CardActions as x } from "@progress/kendo-react-layout";
14
- import { commentIcon as A, copyIcon as q, checkIcon as M, rotateIcon as F, thumbUpOutlineIcon as N, thumbDownOutlineIcon as S } from "@progress/kendo-svg-icons";
15
- import { Button as o } from "@progress/kendo-react-buttons";
16
- import { useLocalization as V } from "@progress/kendo-react-intl";
17
- const _ = {
8
+ import e from "react";
9
+ import { AIPromptContent as N } from "../AIPromptContent.mjs";
10
+ import { useAIPromptContext as z } from "../AIPromptContext.mjs";
11
+ import { aIPromptNoOutputs as C, messages as A } from "../../messages/index.mjs";
12
+ import { AIPromptViewRender as q } from "./AIPromptViewRender.mjs";
13
+ import { Card as s, CardHeader as g, CardTitle as f, CardSubtitle as y, CardBody as c, CardActions as R } from "@progress/kendo-react-layout";
14
+ import { commentIcon as M, checkIcon as F, copyIcon as S, rotateIcon as V, thumbUpOutlineIcon as _, thumbDownOutlineIcon as B } from "@progress/kendo-svg-icons";
15
+ import { Button as r } from "@progress/kendo-react-buttons";
16
+ import { useLocalization as D } from "@progress/kendo-react-intl";
17
+ const L = {
18
18
  name: "Output view",
19
19
  buttonText: "Output",
20
- buttonIcon: A
21
- }, K = (g) => {
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();
24
- }, R = (e) => {
25
- e != null && e.responseContent && navigator.clipboard.writeText(e.responseContent), i(e.id), setTimeout(() => {
20
+ buttonIcon: M
21
+ }, X = (h) => {
22
+ const [b, i] = e.useState(""), l = e.useRef(null), [n] = z(), { outputs: o, showOutputRating: I, outputCard: T } = h, { header: d, body: p, actions: u } = T || {}, v = D(), w = (t) => {
23
+ n.onPromptRequest && n.onPromptRequest.call(null, t.prompt, { ...t, isRetry: !0 }), E();
24
+ }, x = (t) => {
25
+ t != null && t.responseContent && navigator.clipboard.writeText(t.responseContent), i(t.id), setTimeout(() => {
26
26
  i("");
27
27
  }, 1e3);
28
- }, d = (e, a) => {
29
- n.onPromptRequest && n.onPromptRequest.call(null, e.prompt, { ...e, ratingType: a, isRetry: !1 }), p();
30
- }, p = () => {
31
- r && r.current && r.current.scrollTo({ top: 0, behavior: "smooth" });
32
- };
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(
34
- o,
28
+ }, k = (t, m) => {
29
+ n.onPromptRequest && n.onPromptRequest.call(null, t.prompt, { ...t, ratingType: m, isRetry: !1 }), E();
30
+ }, E = () => {
31
+ l && l.current && l.current.scrollTo({ top: 0, behavior: "smooth" });
32
+ }, P = /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement(g, null, /* @__PURE__ */ e.createElement(f, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-text k-skeleton-pulse", style: { width: "200px" } })), /* @__PURE__ */ e.createElement(y, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-text k-skeleton-pulse", style: { width: "100%" } }))), /* @__PURE__ */ e.createElement(c, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-rect k-skeleton-pulse", style: { height: "80px" } })), /* @__PURE__ */ e.createElement(R, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-text k-skeleton-pulse", style: { width: "100%" } }))), a = o == null ? void 0 : o.map((t, m) => /* @__PURE__ */ e.createElement(s, { key: `${t.id}_${m}` }, /* @__PURE__ */ e.createElement(g, null, d ? d(t) : /* @__PURE__ */ e.createElement(e.Fragment, null, t.title && /* @__PURE__ */ e.createElement(f, null, t.title), t.subTitle && /* @__PURE__ */ e.createElement(y, null, t.subTitle))), /* @__PURE__ */ e.createElement(c, null, p ? p(t) : t.responseContent), /* @__PURE__ */ e.createElement(R, null, u ? u(t) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
33
+ r,
35
34
  {
36
35
  size: "medium",
37
36
  themeColor: "primary",
38
37
  fillMode: "flat",
39
38
  rounded: "medium",
40
39
  title: "Copy",
41
- svgIcon: E === e.id ? q : M,
42
- "aria-hidden": "true",
43
- onClick: () => R(e)
40
+ svgIcon: b === t.id ? F : S,
41
+ onClick: () => x(t)
44
42
  },
45
43
  "Copy"
46
- ), /* @__PURE__ */ t.createElement(
47
- o,
44
+ ), /* @__PURE__ */ e.createElement(
45
+ r,
48
46
  {
49
47
  size: "medium",
50
48
  themeColor: "base",
51
49
  fillMode: "flat",
52
50
  rounded: "medium",
53
51
  title: "Retry",
54
- svgIcon: F,
55
- "aria-hidden": "true",
56
- onClick: () => I(e)
52
+ svgIcon: V,
53
+ onClick: () => w(t)
57
54
  },
58
55
  "Retry"
59
- ), y && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ t.createElement(
60
- o,
56
+ ), I && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ e.createElement(
57
+ r,
61
58
  {
62
59
  size: "medium",
63
- themeColor: e.ratingType === "positive" ? "primary" : "base",
60
+ themeColor: t.ratingType === "positive" ? "primary" : "base",
64
61
  fillMode: "flat",
65
62
  rounded: "medium",
66
63
  title: "Rate up",
67
- svgIcon: N,
68
- "aria-hidden": "true",
69
- onClick: () => d(e, "positive")
64
+ svgIcon: _,
65
+ onClick: () => k(t, "positive")
70
66
  }
71
- ), /* @__PURE__ */ t.createElement(
72
- o,
67
+ ), /* @__PURE__ */ e.createElement(
68
+ r,
73
69
  {
74
70
  size: "medium",
75
- themeColor: e.ratingType === "negative" ? "primary" : "base",
71
+ themeColor: t.ratingType === "negative" ? "primary" : "base",
76
72
  fillMode: "flat",
77
73
  rounded: "medium",
78
74
  title: "Rate down",
79
- svgIcon: S,
80
- "aria-hidden": "true",
81
- onClick: () => d(e, "negative")
75
+ svgIcon: B,
76
+ onClick: () => k(t, "negative")
82
77
  }
83
- )))))) : /* @__PURE__ */ t.createElement(C, null, /* @__PURE__ */ t.createElement(f, null, h.toLanguageString(u, P[u]))))));
78
+ )))))), O = /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement(c, null, v.toLanguageString(C, A[C])));
79
+ return /* @__PURE__ */ e.createElement(q, { name: L.name }, /* @__PURE__ */ e.createElement(N, { ref: l, streaming: n.streaming, onCancel: n.onCancel }, /* @__PURE__ */ e.createElement("div", { className: "k-card-list" }, n.streaming && P, a, (!a || a.length === 0) && !n.streaming && O)));
84
80
  };
85
81
  export {
86
- K as AIPromptOutputView,
87
- _ as outputViewDefaults
82
+ X as AIPromptOutputView,
83
+ L as outputViewDefaults
88
84
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),E=require("../AIPromptContent.js"),S=require("../AIPromptFooter.js"),w=require("@progress/kendo-react-buttons"),R=require("@progress/kendo-react-inputs"),m=require("@progress/kendo-svg-icons"),u=require("@progress/kendo-react-common"),v=require("./AIPromptViewRender.js"),T=require("../AIPromptExpander.js"),V=require("../AIPromptContext.js"),p={name:"prompt-view",buttonText:"Ask AI",buttonIcon:m.sparklesIcon},f=i=>{const{promptInput:d=R.TextArea,generateButton:I=w.Button,promptValue:P,promptSuggestions:n}=i,[r,s]=e.useState(P||""),[o]=V.useAIPromptContext(),[g,a]=u.useCustomComponent(I),[A,c]=u.useCustomComponent(d),C=()=>{o.onPromptRequest&&o.onPromptRequest.call(null,r),s("")},k=t=>{s(t)},q=t=>{s(t.target.value)},x={title:"Generate",children:"Generate",svgIcon:m.sparklesIcon},h={placeholder:"Ask or generate content with AI ...",rows:2},l=Object.keys(a).length>0?a:x,b=Object.keys(c).length>0?c:h;return e.createElement(v.AIPromptViewRender,{name:p.name},e.createElement(E.AIPromptContent,{streaming:o.streaming,onCancel:o.onCancel},e.createElement(A,{value:r,onChange:q,...b}),n&&n.length>0&&e.createElement(T.AIPromptExpander,{title:"Prompt Suggestions"},e.createElement("div",{className:"k-suggestion-group"},n.map(t=>e.createElement("div",{key:t,className:"k-suggestion",onClick:()=>k(t),tabIndex:0},t))))),e.createElement(S.AIPromptFooter,null,e.createElement(g,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:C,disabled:!r.trim(),...l},l.children)))};exports.AIPromptView=f;exports.promptViewDefaults=p;
@@ -5,57 +5,59 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import t from "react";
9
- import { AIPromptContent as T } from "../AIPromptContent.mjs";
8
+ import e from "react";
9
+ import { AIPromptContent as E } from "../AIPromptContent.mjs";
10
10
  import { AIPromptFooter as b } from "../AIPromptFooter.mjs";
11
11
  import { Button as S } from "@progress/kendo-react-buttons";
12
- import { TextArea as w } from "@progress/kendo-react-inputs";
13
- import { sparklesIcon as l } from "@progress/kendo-svg-icons";
14
- import { useCustomComponent as a } from "@progress/kendo-react-common";
12
+ import { TextArea as T } from "@progress/kendo-react-inputs";
13
+ import { sparklesIcon as c } from "@progress/kendo-svg-icons";
14
+ import { useCustomComponent as p } from "@progress/kendo-react-common";
15
15
  import { AIPromptViewRender as v } from "./AIPromptViewRender.mjs";
16
- import { AIPromptExpander as R } from "../AIPromptExpander.mjs";
17
- import { useAIPromptContext as V } from "../AIPromptContext.mjs";
18
- const y = {
16
+ import { AIPromptExpander as w } from "../AIPromptExpander.mjs";
17
+ import { useAIPromptContext as R } from "../AIPromptContext.mjs";
18
+ const V = {
19
19
  name: "prompt-view",
20
20
  buttonText: "Ask AI",
21
- buttonIcon: l
22
- }, M = (c) => {
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 = () => {
24
- m.onPromptRequest && m.onPromptRequest.call(null, r), n("");
25
- }, x = (e) => {
26
- n(e);
27
- }, I = (e) => {
28
- n(e.target.value);
29
- }, h = {
21
+ buttonIcon: c
22
+ }, D = (i) => {
23
+ const { promptInput: u = T, generateButton: d = S, promptValue: g, promptSuggestions: n } = i, [r, m] = e.useState(g || ""), [o] = R(), [f, a] = p(d), [A, s] = p(u), P = () => {
24
+ o.onPromptRequest && o.onPromptRequest.call(null, r), m("");
25
+ }, I = (t) => {
26
+ m(t);
27
+ }, h = (t) => {
28
+ m(t.target.value);
29
+ }, x = {
30
30
  title: "Generate",
31
- svgIcon: l
32
- }, k = {
31
+ children: "Generate",
32
+ svgIcon: c
33
+ }, C = {
33
34
  placeholder: "Ask or generate content with AI ...",
34
35
  rows: 2
35
- }, C = Object.keys(p).length > 0 ? p : h, E = Object.keys(s).length > 0 ? s : k;
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(
36
+ }, l = Object.keys(a).length > 0 ? a : x, k = Object.keys(s).length > 0 ? s : C;
37
+ return /* @__PURE__ */ e.createElement(v, { name: V.name }, /* @__PURE__ */ e.createElement(E, { streaming: o.streaming, onCancel: o.onCancel }, /* @__PURE__ */ e.createElement(A, { value: r, onChange: h, ...k }), n && n.length > 0 && /* @__PURE__ */ e.createElement(w, { title: "Prompt Suggestions" }, /* @__PURE__ */ e.createElement("div", { className: "k-suggestion-group" }, n.map((t) => /* @__PURE__ */ e.createElement(
37
38
  "div",
38
39
  {
39
- key: e,
40
- className: "k-prompt-suggestion",
41
- onClick: () => x(e)
40
+ key: t,
41
+ className: "k-suggestion",
42
+ onClick: () => I(t),
43
+ tabIndex: 0
42
44
  },
43
- e
44
- )))), /* @__PURE__ */ t.createElement(b, null, /* @__PURE__ */ t.createElement(
45
- A,
45
+ t
46
+ ))))), /* @__PURE__ */ e.createElement(b, null, /* @__PURE__ */ e.createElement(
47
+ f,
46
48
  {
47
49
  themeColor: "primary",
48
50
  fillMode: "solid",
49
- "aria-hidden": "true",
50
51
  rounded: "full",
51
52
  size: "medium",
52
- onClick: g,
53
- ...C
53
+ onClick: P,
54
+ disabled: !r.trim(),
55
+ ...l
54
56
  },
55
- u
57
+ l.children
56
58
  )));
57
59
  };
58
60
  export {
59
- M as AIPromptView,
60
- y as promptViewDefaults
61
+ D as AIPromptView,
62
+ V as promptViewDefaults
61
63
  };
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
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 w="newMessage.sendButton",b="newMessage.optionsButton",x="newMessage.messageInput",N="avatar.alt",T="messageList.ariaLabel",S="aIPrompt.noOutputs",R={[w]:"Send",[b]:"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(w,R[w]),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(b,R[b])});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:"11.3.1-develop.1",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.showLicenseWatermark=!1,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()}},this.showLicenseWatermark=!s.validatePackage(V,{component:"Chat"}),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,position:"relative"},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}),this.showLicenseWatermark&&p.createElement(s.WatermarkOverlay,null))}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},W=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))},U={name:"prompt-view",buttonText:"Ask AI",buttonIcon:a.sparklesIcon},H={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||[U,H],[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:H.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:U.name},t.createElement(q,null,t.createElement(g,{value:p,onChange:e=>{m(e.target.value)},...E}),c&&c.length>0&&t.createElement(W,{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=H,e.promptViewDefaults=U}));
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],k=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 I=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})}},E=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 v extends E{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(I,{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")}}let C=class 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 y extends E{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(C,{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 f=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(f);const b="newMessage.sendButton",w="newMessage.optionsButton",x="newMessage.messageInput",N="avatar.alt",T="messageList.ariaLabel",S="aIPrompt.noOutputs",R="aIPrompt.cancel",L={[b]:"Send",[w]:"Options",[x]:"Message",[N]:"Avatar",[T]:"Message list",[R]:"Cancel",[S]:"No output from AI available"};class B 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,L[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(C,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${s}`})),n}))}}const D=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))}));D.displayName="KendoReactChatToolbar";class V 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,L[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,L[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,L[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(D,null,this.props.toolbar))}focusInput(){null!==this.inputEl&&this.inputEl.focus()}getClassNames(){return s.classNames("k-input-inner",{"k-focus":this.state.focused})}}const M={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"11.4.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},A=class e extends p.Component{constructor(e){super(e),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.showLicenseWatermark=!1,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()}},this.showLicenseWatermark=!s.validatePackage(M,{component:"Chat"}),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,position:"relative"},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,L[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(V,{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}),this.showLicenseWatermark&&p.createElement(s.WatermarkOverlay,null))}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(f,{item:s,key:n}):"message-group"===s.type?p.createElement(B,{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(y,{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(v,{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(k(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):[]}};A.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},A.defaultProps={messages:[],dateFormat:"g",message:h};let F=A;class K 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 q=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,onClick:()=>(e=>{null==o||o.call(null,e)})(e.name)},e.buttonText)))))},P=t.forwardRef(((e,s)=>{const{children:o,streaming:i,onCancel:l}=e,c=n.useLocalization().toLanguageString(R,L[R]);return t.createElement("div",{className:"k-prompt-content",ref:s},i&&t.createElement(r.FloatingActionButton,{onClick:l,svgIcon:a.stopSmIcon,icon:"stop-sm",size:"small",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":c,title:c}),t.createElement("div",{className:"k-prompt-view"},o))}));P.displayName="KendoReactAIPromptContent";const O=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))},G=t.createContext([{},()=>{}]),z=()=>t.useContext(G),W=e=>{const[t]=z();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},j={name:"Output view",buttonText:"Output",buttonIcon:a.commentIcon},$={name:"Commands view",buttonIcon:a.moreHorizontalIcon},Y=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&&Y(e.children||[]))));e.AIPrompt=e=>{const{activeView:n,toolbarItems:o,children:a,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l,style:c,dir:p,className:m,streaming:u,onCancel:h,...d}=e,g=o||[H,j],[k,I]=t.useState({activeView:n}),E={...k,activeView:n,streaming:u,onCancel:h,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l};return t.createElement(G.Provider,{value:[E,e=>{I(e)}]},t.createElement("div",{className:s.classNames("k-prompt",m),style:c,dir:p,...d},t.createElement(q,{activeView:E.activeView,toolbarItems:g,activeViewChange:r}),a))},e.AIPromptCommandsView=e=>{const{commands:s}=e,[n]=z();return t.createElement(W,{name:$.name},t.createElement(P,{streaming:n.streaming,onCancel:n.onCancel},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:""},Y(null!=s?s:[])))))},e.AIPromptContent=P,e.AIPromptFooter=O,e.AIPromptOutputView=e=>{const[s,o]=t.useState(""),l=t.useRef(null),[c]=z(),{outputs:p,showOutputRating:m,outputCard:u}=e,{header:h,body:d,actions:g}=u||{},k=n.useLocalization(),I=(e,t)=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),E()},E=()=>{l&&l.current&&l.current.scrollTo({top:0,behavior:"smooth"})},v=t.createElement(i.Card,null,t.createElement(i.CardHeader,null,t.createElement(i.CardTitle,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}})),t.createElement(i.CardSubtitle,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),t.createElement(i.CardBody,null,t.createElement("span",{className:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}})),t.createElement(i.CardActions,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),C=null==p?void 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.checkIcon:a.copyIcon,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,onClick:()=>(e=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),E()})(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,onClick:()=>I(e,"positive")}),t.createElement(r.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:a.thumbDownOutlineIcon,onClick:()=>I(e,"negative")}))))))),y=t.createElement(i.Card,null,t.createElement(i.CardBody,null,k.toLanguageString(S,L[S])));return t.createElement(W,{name:j.name},t.createElement(P,{ref:l,streaming:c.streaming,onCancel:c.onCancel},t.createElement("div",{className:"k-card-list"},c.streaming&&v,C,(!C||0===C.length)&&!c.streaming&&y)))},e.AIPromptView=e=>{const{promptInput:n=l.TextArea,generateButton:o=r.Button,promptValue:i,promptSuggestions:c}=e,[p,m]=t.useState(i||""),[u]=z(),[h,d]=s.useCustomComponent(o),[g,k]=s.useCustomComponent(n),I={title:"Generate",children:"Generate",svgIcon:a.sparklesIcon},E=Object.keys(d).length>0?d:I,v=Object.keys(k).length>0?k:{placeholder:"Ask or generate content with AI ...",rows:2};return t.createElement(W,{name:H.name},t.createElement(P,{streaming:u.streaming,onCancel:u.onCancel},t.createElement(g,{value:p,onChange:e=>{m(e.target.value)},...v}),c&&c.length>0&&t.createElement(U,{title:"Prompt Suggestions"},t.createElement("div",{className:"k-suggestion-group"},c.map((e=>t.createElement("div",{key:e,className:"k-suggestion",onClick:()=>(e=>{m(e)})(e),tabIndex:0},e)))))),t.createElement(O,null,t.createElement(h,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:()=>{u.onPromptRequest&&u.onPromptRequest.call(null,p),m("")},disabled:!p.trim(),...E},E.children)))},e.AIPromptViewRender=W,e.Chat=F,e.ChatMessage=h,e.HeroCard=K,e.PromptHeader=q,e.commandsViewDefaults=$,e.outputViewDefaults=j,e.promptViewDefaults=H}));
package/index.d.mts CHANGED
@@ -57,7 +57,7 @@ export declare const AIPrompt: (props: AIPromptProps) => JSX.Element;
57
57
  /**
58
58
  * The fields of the AIPromptOutputView card prop.
59
59
  */
60
- declare interface AIPromptCardInterface {
60
+ export declare interface AIPromptCardInterface {
61
61
  /**
62
62
  * Custom template for AIPromptCard header.
63
63
  */
@@ -104,6 +104,14 @@ declare interface AIPromptContentProps {
104
104
  * Specifies the AIPromptContent children elements.
105
105
  */
106
106
  children?: default_3.ReactNode;
107
+ /**
108
+ * Specifies the callback for cancel action.
109
+ */
110
+ onCancel?: () => void;
111
+ /**
112
+ * Specifies if the streaming indicator should be shown.
113
+ */
114
+ streaming?: boolean;
107
115
  }
108
116
 
109
117
  /**
@@ -217,7 +225,6 @@ declare interface AIPromptOutputViewProps {
217
225
  * @default false
218
226
  */
219
227
  showOutputRating?: boolean;
220
- onRetry?: (value: any) => void;
221
228
  /**
222
229
  * Fires each time the user clicks Copy button in the card.
223
230
  */
@@ -304,6 +311,20 @@ export declare interface AIPromptProps extends default_3.HTMLAttributes<HTMLElem
304
311
  * ```
305
312
  */
306
313
  onPromptRequest?: (prompt?: string, outputItem?: AIPromptOutputInterface) => void;
314
+ /**
315
+ * Called when the prompt is cancelled.
316
+ * ```jsx
317
+ * <AIPrompt onCancel={() => console.log('Prompt cancelled')} />
318
+ * ```
319
+ */
320
+ onCancel?: () => void;
321
+ /**
322
+ * If true, the prompt is in a streaming state.
323
+ * ```jsx
324
+ * <AIPrompt streaming={true} />
325
+ * ```
326
+ */
327
+ streaming?: boolean;
307
328
  }
308
329
 
309
330
  /**
package/index.d.ts CHANGED
@@ -57,7 +57,7 @@ export declare const AIPrompt: (props: AIPromptProps) => JSX.Element;
57
57
  /**
58
58
  * The fields of the AIPromptOutputView card prop.
59
59
  */
60
- declare interface AIPromptCardInterface {
60
+ export declare interface AIPromptCardInterface {
61
61
  /**
62
62
  * Custom template for AIPromptCard header.
63
63
  */
@@ -104,6 +104,14 @@ declare interface AIPromptContentProps {
104
104
  * Specifies the AIPromptContent children elements.
105
105
  */
106
106
  children?: default_3.ReactNode;
107
+ /**
108
+ * Specifies the callback for cancel action.
109
+ */
110
+ onCancel?: () => void;
111
+ /**
112
+ * Specifies if the streaming indicator should be shown.
113
+ */
114
+ streaming?: boolean;
107
115
  }
108
116
 
109
117
  /**
@@ -217,7 +225,6 @@ declare interface AIPromptOutputViewProps {
217
225
  * @default false
218
226
  */
219
227
  showOutputRating?: boolean;
220
- onRetry?: (value: any) => void;
221
228
  /**
222
229
  * Fires each time the user clicks Copy button in the card.
223
230
  */
@@ -304,6 +311,20 @@ export declare interface AIPromptProps extends default_3.HTMLAttributes<HTMLElem
304
311
  * ```
305
312
  */
306
313
  onPromptRequest?: (prompt?: string, outputItem?: AIPromptOutputInterface) => void;
314
+ /**
315
+ * Called when the prompt is cancelled.
316
+ * ```jsx
317
+ * <AIPrompt onCancel={() => console.log('Prompt cancelled')} />
318
+ * ```
319
+ */
320
+ onCancel?: () => void;
321
+ /**
322
+ * If true, the prompt is in a streaming state.
323
+ * ```jsx
324
+ * <AIPrompt streaming={true} />
325
+ * ```
326
+ */
327
+ streaming?: boolean;
307
328
  }
308
329
 
309
330
  /**
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 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;
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="aIPrompt.cancel",u={[e]:"Send",[s]:"Options",[t]:"Message",[a]:"Avatar",[n]:"Message list",[g]:"Cancel",[o]:"No output from AI available"};exports.aIPromptCancel=g;exports.aIPromptNoOutputs=o;exports.ariaLabelMessageList=n;exports.avatarAlt=a;exports.messages=u;exports.newMessageMessageInput=t;exports.newMessageOptionsButton=s;exports.newMessageSendButton=e;
@@ -5,19 +5,21 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- const s = "newMessage.sendButton", e = "newMessage.optionsButton", t = "newMessage.messageInput", a = "avatar.alt", n = "messageList.ariaLabel", o = "aIPrompt.noOutputs", g = {
8
+ const s = "newMessage.sendButton", e = "newMessage.optionsButton", t = "newMessage.messageInput", a = "avatar.alt", n = "messageList.ariaLabel", o = "aIPrompt.noOutputs", g = "aIPrompt.cancel", p = {
9
9
  [s]: "Send",
10
10
  [e]: "Options",
11
11
  [t]: "Message",
12
12
  [a]: "Avatar",
13
13
  [n]: "Message list",
14
+ [g]: "Cancel",
14
15
  [o]: "No output from AI available"
15
16
  };
16
17
  export {
18
+ g as aIPromptCancel,
17
19
  o as aIPromptNoOutputs,
18
20
  n as ariaLabelMessageList,
19
21
  a as avatarAlt,
20
- g as messages,
22
+ p as messages,
21
23
  t as newMessageMessageInput,
22
24
  e as newMessageOptionsButton,
23
25
  s as newMessageSendButton
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1753436807,version:"11.3.1-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
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: 1753686704,version:"11.4.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "KendoReact",
11
11
  productCode: "KENDOUIREACT",
12
12
  productCodes: ["KENDOUIREACT"],
13
- publishDate: 1753436807,
14
- version: "11.3.1-develop.1",
13
+ publishDate: 1753686704,
14
+ version: "11.4.0-develop.1",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
16
  };
17
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-conversational-ui",
3
- "version": "11.3.1-develop.1",
3
+ "version": "11.4.0-develop.1",
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.6.0",
29
- "@progress/kendo-react-buttons": "11.3.1-develop.1",
30
- "@progress/kendo-react-common": "11.3.1-develop.1",
31
- "@progress/kendo-react-intl": "11.3.1-develop.1",
32
- "@progress/kendo-react-inputs": "11.3.1-develop.1",
33
- "@progress/kendo-react-layout": "11.3.1-develop.1",
29
+ "@progress/kendo-react-buttons": "11.4.0-develop.1",
30
+ "@progress/kendo-react-common": "11.4.0-develop.1",
31
+ "@progress/kendo-react-intl": "11.4.0-develop.1",
32
+ "@progress/kendo-react-inputs": "11.4.0-develop.1",
33
+ "@progress/kendo-react-layout": "11.4.0-develop.1",
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"
@@ -59,7 +59,7 @@
59
59
  "package": {
60
60
  "productName": "KendoReact",
61
61
  "productCode": "KENDOUIREACT",
62
- "publishDate": 1753436807,
62
+ "publishDate": 1753686704,
63
63
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
64
64
  }
65
65
  },