@progress/kendo-react-conversational-ui 11.4.0-develop.4 → 11.4.0-develop.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,6 +27,22 @@ Among the features which the KendoReact Chat component delivers are:
27
27
  - [Keyboard navigation](https://www.telerik.com/kendo-react-ui/components/conversationalui/keyboard-navigation/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-chat)—Built-in keyboard shortcuts for usability and navigation in the component.
28
28
  - [Theme support](https://www.telerik.com/kendo-react-ui/components/styling/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-chat)—The KendoReact Chat, as well as all 100+ components in the KendoReact suite, are styled in three polished themes (Bootstrap, Material, and Default) and can be further customized to match your specific design guidelines.
29
29
 
30
+ ## Using for Free vs Commercial License
31
+
32
+ The following table outlines the key resources available with KendoReact and KendoReact Free.
33
+
34
+ | | [KendoReact Free](https://www.telerik.com/kendo-react-ui/components/free) | [KendoReact](https://www.telerik.com/kendo-react-ui) |
35
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
36
+ | React components | 50+ | 120+ |
37
+ | Four professional themes | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
38
+ | Four Figma UI Kits | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
39
+ | Page Templates & Building Blocks | 1 template | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
40
+ | ThemeBuilder | Free\* | Ultimate |
41
+ | Source code | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
42
+ | Visual Studio Code extension | 1 starter template | Full functionality |
43
+ | Legendary customer support | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
44
+ | AI coding assistant | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
45
+
30
46
  ## Support Options
31
47
 
32
48
  For any issues you might encounter while working with the KendoReact Chat, use any of the available support channels:
@@ -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"),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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),g=require("./AIPromptHeader.js"),r=require("./views/constants.js"),q=require("./AIPromptContext.js"),h=require("@progress/kendo-react-common"),b=n=>{const{activeView:t,toolbarItems:c,children:s,onActiveViewChange:o,onPromptRequest:i,onCommandExecute:m,style:l,dir:u,className:p,streaming:d,loading:v,onCancel:P,...w}=n,S=c||[r.promptViewDefaults,r.outputViewDefaults],[A,C]=e.useState({activeView:t}),a={...A,activeView:t,streaming:d,loading:v,onCancel:P,onActiveViewChange:o,onPromptRequest:i,onCommandExecute:m},I=V=>{C(V)};return e.createElement(q.AIPromptContext.Provider,{value:[a,I]},e.createElement("div",{className:h.classNames("k-prompt",p),style:l,dir:u,...w},e.createElement(g.PromptHeader,{activeView:a.activeView,toolbarItems:S,activeViewChange:o}),s))};exports.AIPrompt=b;
@@ -6,9 +6,8 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import t from "react";
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";
9
+ import { PromptHeader as P } from "./AIPromptHeader.mjs";
10
+ import { promptViewDefaults as g, outputViewDefaults as x } from "./views/constants.mjs";
12
11
  import { AIPromptContext as A } from "./AIPromptContext.mjs";
13
12
  import { classNames as E } from "@progress/kendo-react-common";
14
13
  const _ = (r) => {
@@ -23,21 +22,23 @@ const _ = (r) => {
23
22
  dir: l,
24
23
  className: p,
25
24
  streaming: u,
25
+ loading: d,
26
26
  onCancel: f,
27
27
  ...v
28
- } = r, w = m || [P, x], [d, V] = t.useState({ activeView: e }), a = {
29
- ...d,
28
+ } = r, w = m || [g, x], [V, S] = t.useState({ activeView: e }), a = {
29
+ ...V,
30
30
  activeView: e,
31
31
  streaming: u,
32
+ loading: d,
32
33
  onCancel: f,
33
34
  onActiveViewChange: o,
34
35
  onPromptRequest: i,
35
36
  onCommandExecute: n
36
- }, S = (h) => {
37
- V(h);
37
+ }, h = (C) => {
38
+ S(C);
38
39
  };
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,
40
+ return /* @__PURE__ */ t.createElement(A.Provider, { value: [a, h] }, /* @__PURE__ */ t.createElement("div", { className: E("k-prompt", p), style: s, dir: l, ...v }, /* @__PURE__ */ t.createElement(
41
+ P,
41
42
  {
42
43
  activeView: a.activeView,
43
44
  toolbarItems: w,
@@ -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"),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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),g=require("@progress/kendo-svg-icons"),I=require("@progress/kendo-react-buttons"),n=require("../messages/index.js"),k=require("@progress/kendo-react-intl"),C=require("./AIPromptContext.js"),w=require("./views/constants.js"),s=t.forwardRef((i,r)=>{const{children:l,streaming:u,onCancel:e}=i,a=k.useLocalization().toLanguageString(n.aIPromptCancel,n.messages[n.aIPromptCancel]),[m]=C.useAIPromptContext(),p=m.activeView===w.outputViewDefaults.name,o=u&&p,d=t.useCallback(c=>{c.key==="Escape"&&o&&e&&(c.preventDefault(),e())},[o,e]);return t.createElement("div",{className:"k-prompt-content",ref:r,onKeyDown:d},o&&t.createElement(I.FloatingActionButton,{onClick:e,svgIcon:g.stopSmIcon,icon:"stop-sm",size:"small",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":a,title:a}),t.createElement("div",{className:"k-prompt-view"},l))});s.displayName="KendoReactAIPromptContent";exports.AIPromptContent=s;
@@ -6,27 +6,34 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
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,
9
+ import { stopSmIcon as f } from "@progress/kendo-svg-icons";
10
+ import { FloatingActionButton as g } from "@progress/kendo-react-buttons";
11
+ import { aIPromptCancel as i, messages as d } from "../messages/index.mjs";
12
+ import { useLocalization as w } from "@progress/kendo-react-intl";
13
+ import { useAIPromptContext as k } from "./AIPromptContext.mjs";
14
+ import { outputViewDefaults as C } from "./views/constants.mjs";
15
+ const I = t.forwardRef((r, s) => {
16
+ const { children: c, streaming: m, onCancel: o } = r, n = w().toLanguageString(i, d[i]), [l] = k(), p = l.activeView === C.name, e = m && p, u = t.useCallback(
17
+ (a) => {
18
+ a.key === "Escape" && e && o && (a.preventDefault(), o());
19
+ },
20
+ [e, o]
21
+ );
22
+ return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-content", ref: s, onKeyDown: u }, e && /* @__PURE__ */ t.createElement(
23
+ g,
17
24
  {
18
- onClick: m,
19
- svgIcon: c,
25
+ onClick: o,
26
+ svgIcon: f,
20
27
  icon: "stop-sm",
21
28
  size: "small",
22
29
  positionMode: "absolute",
23
30
  className: "k-prompt-stop-fab k-generating",
24
- "aria-label": o,
25
- title: o
31
+ "aria-label": n,
32
+ title: n
26
33
  }
27
- ), /* @__PURE__ */ t.createElement("div", { className: "k-prompt-view" }, r));
34
+ ), /* @__PURE__ */ t.createElement("div", { className: "k-prompt-view" }, c));
28
35
  });
29
- f.displayName = "KendoReactAIPromptContent";
36
+ I.displayName = "KendoReactAIPromptContent";
30
37
  export {
31
- f as AIPromptContent
38
+ I as AIPromptContent
32
39
  };
@@ -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"),s=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-svg-icons"),d=r=>{const[t,c]=e.useState(!0),{children:a,title:n}=r;return e.createElement("div",{className:"k-prompt-expander"},e.createElement(s.Button,{fillMode:"flat",svgIcon:t?o.chevronUpIcon:o.chevronDownIcon,title:n,onClick:()=>c(!t)},n),t&&e.createElement("div",{className:"k-prompt-expander-content"},a))};exports.AIPromptExpander=d;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),d=require("@progress/kendo-react-buttons"),r=require("@progress/kendo-svg-icons"),i=n=>{const[e,c]=t.useState(!0),{children:a,title:o}=n;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(d.Button,{"aria-controls":n.id,fillMode:"flat",svgIcon:e?r.chevronUpIcon:r.chevronDownIcon,title:o,onClick:()=>c(!e),"aria-expanded":e},o),e&&t.createElement("div",{id:n.id,className:"k-prompt-expander-content"},a))};exports.AIPromptExpander=i;
@@ -5,22 +5,24 @@
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
- import { Button as a } from "@progress/kendo-react-buttons";
10
- import { chevronUpIcon as p, chevronDownIcon as m } from "@progress/kendo-svg-icons";
11
- const i = (o) => {
12
- const [t, r] = e.useState(!0), { children: c, title: n } = o;
13
- return /* @__PURE__ */ e.createElement("div", { className: "k-prompt-expander" }, /* @__PURE__ */ e.createElement(
14
- a,
8
+ import t from "react";
9
+ import { Button as c } from "@progress/kendo-react-buttons";
10
+ import { chevronUpIcon as d, chevronDownIcon as i } from "@progress/kendo-svg-icons";
11
+ const s = (n) => {
12
+ const [e, r] = t.useState(!0), { children: a, title: o } = n;
13
+ return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-expander" }, /* @__PURE__ */ t.createElement(
14
+ c,
15
15
  {
16
+ "aria-controls": n.id,
16
17
  fillMode: "flat",
17
- svgIcon: t ? p : m,
18
- title: n,
19
- onClick: () => r(!t)
18
+ svgIcon: e ? d : i,
19
+ title: o,
20
+ onClick: () => r(!e),
21
+ "aria-expanded": e
20
22
  },
21
- n
22
- ), t && /* @__PURE__ */ e.createElement("div", { className: "k-prompt-expander-content" }, c));
23
+ o
24
+ ), e && /* @__PURE__ */ t.createElement("div", { id: n.id, className: "k-prompt-expander-content" }, a));
23
25
  };
24
26
  export {
25
- i as AIPromptExpander
27
+ s as AIPromptExpander
26
28
  };
@@ -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"),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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),p=require("../AIPromptContent.js"),C=require("./AIPromptViewRender.js"),I=require("../AIPromptContext.js"),i=require("@progress/kendo-react-layout"),P=require("./constants.js"),s=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&&s(e.children||[]))),d=t=>{const{commands:e}=t,[r]=I.useAIPromptContext(),u=m=>{var a,c,l;const o=(c=(a=m.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(C.AIPromptViewRender,{name:P.commandsViewDefaults.name},n.createElement(p.AIPromptContent,{streaming:r.streaming,onCancel:r.onCancel},n.createElement("div",{className:"k-prompt-view"},n.createElement(i.PanelBar,{onSelect:u,selected:""},s(e!=null?e:[])))))};exports.AIPromptCommandsView=d;
@@ -5,24 +5,20 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import n from "react";
9
- import { AIPromptContent as p } from "../AIPromptContent.mjs";
10
- import { AIPromptViewRender as u } from "./AIPromptViewRender.mjs";
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
- const E = {
15
- name: "Commands view",
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);
8
+ import r from "react";
9
+ import { AIPromptContent as s } from "../AIPromptContent.mjs";
10
+ import { AIPromptViewRender as f } from "./AIPromptViewRender.mjs";
11
+ import { useAIPromptContext as u } from "../AIPromptContext.mjs";
12
+ import { PanelBar as C, PanelBarItem as I } from "@progress/kendo-react-layout";
13
+ import { commandsViewDefaults as d } from "./constants.mjs";
14
+ const i = (t) => t == null ? void 0 : t.map((e) => /* @__PURE__ */ r.createElement(I, { title: e.text, key: e.id, svgIcon: e.svgIcon, data: e }, e.children && i(e.children || []))), w = (t) => {
15
+ const { commands: e } = t, [n] = u(), c = (p) => {
16
+ var l, a, m;
17
+ const o = (a = (l = p.target) == null ? void 0 : l.props) == null ? void 0 : a.data;
18
+ (m = o.children) != null && m.length || n.onCommandExecute && n.onCommandExecute.call(null, o);
22
19
  };
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 : [])))));
20
+ return /* @__PURE__ */ r.createElement(f, { name: d.name }, /* @__PURE__ */ r.createElement(s, { streaming: n.streaming, onCancel: n.onCancel }, /* @__PURE__ */ r.createElement("div", { className: "k-prompt-view" }, /* @__PURE__ */ r.createElement(C, { onSelect: c, selected: "" }, i(e != null ? e : [])))));
24
21
  };
25
22
  export {
26
- A as AIPromptCommandsView,
27
- E as commandsViewDefaults
23
+ w as AIPromptCommandsView
28
24
  };
@@ -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"),v=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[R,d]=e.useState(""),o=e.useRef(null),[l]=q.useAIPromptContext(),{outputs:s,showOutputRating:I,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()},w=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"})},P=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:R===t.id?r.checkIcon:r.copyIcon,onClick:()=>w(t)},"Copy"),e.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:r.arrowRotateCwIcon,onClick:()=>T(t)},"Retry"),I&&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")})))))),f=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(v.AIPromptContent,{ref:o,streaming:l.streaming,onCancel:l.onCancel},e.createElement("div",{className:"k-card-list"},l.streaming&&P,c,(!c||c.length===0)&&!l.streaming&&f)))};exports.AIPromptOutputView=A;exports.outputViewDefaults=g;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),q=require("../AIPromptContent.js"),w=require("../AIPromptContext.js"),m=require("../../messages/index.js"),v=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"),A=require("./constants.js"),O=g=>{const[y,d]=e.useState(""),o=e.useRef(null),[l]=w.useAIPromptContext(),{outputs:s,showOutputRating:R,outputCard:I}=g,{header:u,body:p,actions:C}=I||{},b=x.useLocalization(),h=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"})},T=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:y===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.arrowRotateCwIcon,onClick:()=>h(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")})))))),f=e.createElement(n.Card,null,e.createElement(n.CardBody,null,b.toLanguageString(m.aIPromptNoOutputs,m.messages[m.aIPromptNoOutputs])));return e.createElement(v.AIPromptViewRender,{name:A.outputViewDefaults.name},e.createElement(q.AIPromptContent,{ref:o,streaming:l.streaming,onCancel:l.onCancel},e.createElement("div",{className:"k-card-list"},l.loading&&T,c,(!c||c.length===0)&&!l.loading&&f)))};exports.AIPromptOutputView=O;
@@ -6,30 +6,27 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import e from "react";
9
- import { AIPromptContent as N } from "../AIPromptContent.mjs";
9
+ import { AIPromptContent as O } from "../AIPromptContent.mjs";
10
10
  import { useAIPromptContext as z } from "../AIPromptContext.mjs";
11
11
  import { aIPromptNoOutputs as E, messages as A } from "../../messages/index.mjs";
12
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, arrowRotateCwIcon as V, thumbUpOutlineIcon as _, thumbDownOutlineIcon as B } from "@progress/kendo-svg-icons";
13
+ import { Card as s, CardHeader as g, CardTitle as f, CardSubtitle as y, CardBody as i, CardActions as R } from "@progress/kendo-react-layout";
14
+ import { checkIcon as M, copyIcon as F, arrowRotateCwIcon as S, thumbUpOutlineIcon as V, thumbDownOutlineIcon as _ } from "@progress/kendo-svg-icons";
15
15
  import { Button as r } from "@progress/kendo-react-buttons";
16
- import { useLocalization as D } from "@progress/kendo-react-intl";
17
- const L = {
18
- name: "Output view",
19
- buttonText: "Output",
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 || {}, w = D(), v = (t) => {
16
+ import { useLocalization as B } from "@progress/kendo-react-intl";
17
+ import { outputViewDefaults as D } from "./constants.mjs";
18
+ const X = (h) => {
19
+ const [b, c] = e.useState(""), l = e.useRef(null), [n] = z(), { outputs: o, showOutputRating: I, outputCard: T } = h, { header: d, body: p, actions: k } = T || {}, w = B(), v = (t) => {
23
20
  n.onPromptRequest && n.onPromptRequest.call(null, t.prompt, { ...t, isRetry: !0 }), C();
24
- }, x = (t) => {
25
- t != null && t.responseContent && navigator.clipboard.writeText(t.responseContent), i(t.id), setTimeout(() => {
26
- i("");
21
+ }, P = (t) => {
22
+ t != null && t.responseContent && navigator.clipboard.writeText(t.responseContent), c(t.id), setTimeout(() => {
23
+ c("");
27
24
  }, 1e3);
28
- }, k = (t, m) => {
25
+ }, u = (t, m) => {
29
26
  n.onPromptRequest && n.onPromptRequest.call(null, t.prompt, { ...t, ratingType: m, isRetry: !1 }), C();
30
27
  }, C = () => {
31
28
  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(
29
+ }, x = /* @__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(i, 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(i, null, p ? p(t) : t.responseContent), /* @__PURE__ */ e.createElement(R, null, k ? k(t) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
33
30
  r,
34
31
  {
35
32
  size: "medium",
@@ -37,8 +34,8 @@ const L = {
37
34
  fillMode: "flat",
38
35
  rounded: "medium",
39
36
  title: "Copy",
40
- svgIcon: b === t.id ? F : S,
41
- onClick: () => x(t)
37
+ svgIcon: b === t.id ? M : F,
38
+ onClick: () => P(t)
42
39
  },
43
40
  "Copy"
44
41
  ), /* @__PURE__ */ e.createElement(
@@ -49,7 +46,7 @@ const L = {
49
46
  fillMode: "flat",
50
47
  rounded: "medium",
51
48
  title: "Retry",
52
- svgIcon: V,
49
+ svgIcon: S,
53
50
  onClick: () => v(t)
54
51
  },
55
52
  "Retry"
@@ -61,8 +58,8 @@ const L = {
61
58
  fillMode: "flat",
62
59
  rounded: "medium",
63
60
  title: "Rate up",
64
- svgIcon: _,
65
- onClick: () => k(t, "positive")
61
+ svgIcon: V,
62
+ onClick: () => u(t, "positive")
66
63
  }
67
64
  ), /* @__PURE__ */ e.createElement(
68
65
  r,
@@ -72,13 +69,12 @@ const L = {
72
69
  fillMode: "flat",
73
70
  rounded: "medium",
74
71
  title: "Rate down",
75
- svgIcon: B,
76
- onClick: () => k(t, "negative")
72
+ svgIcon: _,
73
+ onClick: () => u(t, "negative")
77
74
  }
78
- )))))), O = /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement(c, null, w.toLanguageString(E, A[E])));
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)));
75
+ )))))), N = /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement(i, null, w.toLanguageString(E, A[E])));
76
+ return /* @__PURE__ */ e.createElement(q, { name: D.name }, /* @__PURE__ */ e.createElement(O, { ref: l, streaming: n.streaming, onCancel: n.onCancel }, /* @__PURE__ */ e.createElement("div", { className: "k-card-list" }, n.loading && x, a, (!a || a.length === 0) && !n.loading && N)));
80
77
  };
81
78
  export {
82
- X as AIPromptOutputView,
83
- L as outputViewDefaults
79
+ X as AIPromptOutputView
84
80
  };
@@ -5,4 +5,5 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use 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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),y=require("../AIPromptContent.js"),j=require("../AIPromptFooter.js"),P=require("@progress/kendo-react-buttons"),h=require("@progress/kendo-react-inputs"),G=require("@progress/kendo-svg-icons"),x=require("@progress/kendo-react-common"),O=require("./AIPromptViewRender.js"),F=require("../AIPromptExpander.js"),M=require("../AIPromptContext.js"),z=require("../../chat/components/SuggestionsGroup.js"),W=require("./constants.js"),D=A=>{const{promptInput:I=h.TextArea,generateButton:f=P.Button,enableSpeechToText:n=!1,promptValue:S,promptSuggestions:a}=A,[r,s]=e.useState(S||""),[c]=M.useAIPromptContext(),[C,i]=x.useCustomComponent(f),[q,p]=x.useCustomComponent(I),T=()=>{c.onPromptRequest&&c.onPromptRequest.call(null,r),s("")},R=t=>{s(t)},k=t=>{s(t.target.value)},E={title:"Generate",children:"Generate",svgIcon:G.sparklesIcon},b={placeholder:"Ask or generate content with AI ...",rows:2},m=Object.keys(i).length>0?i:E,V=Object.keys(p).length>0?p:b,d=t=>{const{isFinal:o,alternatives:g}=t;if(o&&g.length>0){const v=g[0].transcript,w=(()=>{const l=r,B=l&&!l.endsWith(" ")&&!l.endsWith(`
9
+ `);return l+(B?" ":"")+v})();s(w)}};let u;return n&&(typeof n=="object"?u={...n,onResult:n.onResult||d}:u={onResult:d}),e.createElement(O.AIPromptViewRender,{name:W.promptViewDefaults.name},e.createElement(y.AIPromptContent,{streaming:c.streaming,onCancel:c.onCancel},e.createElement(q,{value:r,className:"!k-flex-col",suffix:n?e.createElement(h.InputSuffix,{orientation:"horizontal"},e.createElement(P.SpeechToTextButton,{fillMode:"flat",...u})):void 0,onChange:k,...V}),a&&a.length>0&&e.createElement(F.AIPromptExpander,{id:"prompt-suggestions",title:"Prompt Suggestions"},e.createElement(z.SuggestionGroup,{suggestions:a.map((t,o)=>({id:o,text:t,description:t})),onSuggestionClick:(t,o)=>{R(o.text)}}))),e.createElement(j.AIPromptFooter,null,e.createElement(C,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:T,disabled:!r.trim(),...m},m.children)))};exports.AIPromptView=D;
@@ -6,58 +6,95 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import e from "react";
9
- import { AIPromptContent as E } from "../AIPromptContent.mjs";
10
- import { AIPromptFooter as b } from "../AIPromptFooter.mjs";
11
- import { Button as S } from "@progress/kendo-react-buttons";
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
- import { AIPromptViewRender as v } from "./AIPromptViewRender.mjs";
16
- import { AIPromptExpander as w } from "../AIPromptExpander.mjs";
17
- import { useAIPromptContext as R } from "../AIPromptContext.mjs";
18
- const V = {
19
- name: "prompt-view",
20
- buttonText: "Ask AI",
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("");
9
+ import { AIPromptContent as B } from "../AIPromptContent.mjs";
10
+ import { AIPromptFooter as y } from "../AIPromptFooter.mjs";
11
+ import { SpeechToTextButton as j, Button as q } from "@progress/kendo-react-buttons";
12
+ import { InputSuffix as G, TextArea as O } from "@progress/kendo-react-inputs";
13
+ import { sparklesIcon as _ } from "@progress/kendo-svg-icons";
14
+ import { useCustomComponent as g } from "@progress/kendo-react-common";
15
+ import { AIPromptViewRender as z } from "./AIPromptViewRender.mjs";
16
+ import { AIPromptExpander as F } from "../AIPromptExpander.mjs";
17
+ import { useAIPromptContext as M } from "../AIPromptContext.mjs";
18
+ import { SuggestionGroup as W } from "../../chat/components/SuggestionsGroup.mjs";
19
+ import { promptViewDefaults as $ } from "./constants.mjs";
20
+ const te = (h) => {
21
+ const {
22
+ promptInput: x = O,
23
+ generateButton: P = q,
24
+ enableSpeechToText: o = !1,
25
+ promptValue: A,
26
+ promptSuggestions: m
27
+ } = h, [r, s] = e.useState(A || ""), [l] = M(), [S, p] = g(P), [T, c] = g(x), C = () => {
28
+ l.onPromptRequest && l.onPromptRequest.call(null, r), s("");
25
29
  }, I = (t) => {
26
- m(t);
27
- }, h = (t) => {
28
- m(t.target.value);
29
- }, x = {
30
+ s(t);
31
+ }, E = (t) => {
32
+ s(t.target.value);
33
+ }, R = {
30
34
  title: "Generate",
31
35
  children: "Generate",
32
- svgIcon: c
33
- }, C = {
36
+ svgIcon: _
37
+ }, b = {
34
38
  placeholder: "Ask or generate content with AI ...",
35
39
  rows: 2
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(
38
- "div",
40
+ }, u = Object.keys(p).length > 0 ? p : R, k = Object.keys(c).length > 0 ? c : b, f = (t) => {
41
+ const { isFinal: n, alternatives: d } = t;
42
+ if (n && d.length > 0) {
43
+ const V = d[0].transcript, v = (() => {
44
+ const a = r, w = a && !a.endsWith(" ") && !a.endsWith(`
45
+ `);
46
+ return a + (w ? " " : "") + V;
47
+ })();
48
+ s(v);
49
+ }
50
+ };
51
+ let i;
52
+ return o && (typeof o == "object" ? i = {
53
+ ...o,
54
+ onResult: o.onResult || f
55
+ } : i = {
56
+ onResult: f
57
+ }), /* @__PURE__ */ e.createElement(z, { name: $.name }, /* @__PURE__ */ e.createElement(B, { streaming: l.streaming, onCancel: l.onCancel }, /* @__PURE__ */ e.createElement(
58
+ T,
39
59
  {
40
- key: t,
41
- className: "k-suggestion",
42
- onClick: () => I(t),
43
- tabIndex: 0
44
- },
45
- t
46
- ))))), /* @__PURE__ */ e.createElement(b, null, /* @__PURE__ */ e.createElement(
47
- f,
60
+ value: r,
61
+ className: "!k-flex-col",
62
+ suffix: o ? /* @__PURE__ */ e.createElement(G, { orientation: "horizontal" }, /* @__PURE__ */ e.createElement(
63
+ j,
64
+ {
65
+ fillMode: "flat",
66
+ ...i
67
+ }
68
+ )) : void 0,
69
+ onChange: E,
70
+ ...k
71
+ }
72
+ ), m && m.length > 0 && /* @__PURE__ */ e.createElement(F, { id: "prompt-suggestions", title: "Prompt Suggestions" }, /* @__PURE__ */ e.createElement(
73
+ W,
74
+ {
75
+ suggestions: m.map((t, n) => ({
76
+ id: n,
77
+ text: t,
78
+ description: t
79
+ })),
80
+ onSuggestionClick: (t, n) => {
81
+ I(n.text);
82
+ }
83
+ }
84
+ ))), /* @__PURE__ */ e.createElement(y, null, /* @__PURE__ */ e.createElement(
85
+ S,
48
86
  {
49
87
  themeColor: "primary",
50
88
  fillMode: "solid",
51
89
  rounded: "full",
52
90
  size: "medium",
53
- onClick: P,
91
+ onClick: C,
54
92
  disabled: !r.trim(),
55
- ...l
93
+ ...u
56
94
  },
57
- l.children
95
+ u.children
58
96
  )));
59
97
  };
60
98
  export {
61
- D as AIPromptView,
62
- V as promptViewDefaults
99
+ te as AIPromptView
63
100
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@progress/kendo-svg-icons"),e={name:"Output view",buttonText:"Output",buttonIcon:t.commentIcon},o={name:"Commands view",buttonIcon:t.moreHorizontalIcon},n={name:"prompt-view",buttonText:"Ask AI",buttonIcon:t.sparklesIcon};exports.commandsViewDefaults=o;exports.outputViewDefaults=e;exports.promptViewDefaults=n;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { commentIcon as t, moreHorizontalIcon as o, sparklesIcon as n } from "@progress/kendo-svg-icons";
9
+ const m = {
10
+ name: "Output view",
11
+ buttonText: "Output",
12
+ buttonIcon: t
13
+ }, u = {
14
+ name: "Commands view",
15
+ buttonIcon: o
16
+ }, c = {
17
+ name: "prompt-view",
18
+ buttonText: "Ask AI",
19
+ buttonIcon: n
20
+ };
21
+ export {
22
+ u as commandsViewDefaults,
23
+ m as outputViewDefaults,
24
+ c as promptViewDefaults
25
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),d=require("@progress/kendo-react-common");function i(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return r.default=t,Object.freeze(r)}const l=i(c),s=t=>{const{suggestions:r,onSuggestionClick:a}=t,n=(e,o)=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(e,o))};return l.createElement("div",{role:"group",className:"k-suggestion-group"},r.map(e=>l.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:o=>!e.disabled&&a(o,e),onKeyDown:o=>!e.disabled&&n(o,e),key:e.id,title:e.description,className:d.classNames("k-suggestion",{"k-disabled":e.disabled})},e.text)))};exports.SuggestionGroup=s;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as d from "react";
9
+ import { classNames as t } from "@progress/kendo-react-common";
10
+ const n = (r) => {
11
+ const { suggestions: i, onSuggestionClick: l } = r, o = (e, a) => {
12
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l(e, a));
13
+ };
14
+ return /* @__PURE__ */ d.createElement("div", { role: "group", className: "k-suggestion-group" }, i.map((e) => /* @__PURE__ */ d.createElement(
15
+ "span",
16
+ {
17
+ role: "button",
18
+ tabIndex: e.disabled ? -1 : 0,
19
+ "aria-label": e.description,
20
+ "aria-disabled": e.disabled,
21
+ onClick: (a) => !e.disabled && l(a, e),
22
+ onKeyDown: (a) => !e.disabled && o(a, e),
23
+ key: e.id,
24
+ title: e.description,
25
+ className: t("k-suggestion", { "k-disabled": e.disabled })
26
+ },
27
+ e.text
28
+ )));
29
+ };
30
+ export {
31
+ n as SuggestionGroup
32
+ };
@@ -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"),require("@progress/kendo-react-popup")):"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","@progress/kendo-react-popup"],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,e.KendoReactPopup)}(this,(function(e,t,s,n,o,a,r,i,l,c){"use strict";function p(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 m=p(t);let u=class extends m.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}};const d=class extends u{render(){return m.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?m.createElement("div",{className:"k-chat-bubble"},m.createElement("div",{className:"k-typing-indicator"},m.createElement("span",null),m.createElement("span",null),m.createElement("span",null))):this.props.template?m.createElement(this.props.template,{item:this.props.item}):this.props.item.text?m.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=m.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=m.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")}};d.defaultProps={dateFormat:"g",tabIndex:-1};let h=d;n.registerForIntl(h);const g=(e,t)=>e&&t.author&&e.id===t.author.id,k=e=>e[e.length-1],I=e=>(t,s,n)=>{const o=n===e-1;return((e,t)=>{const s=t.timestamp,n=k(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=k(e);let o;t.typing&&!s||(n&&"message-group"===n.type&&(o=n.messages),o&&g(t.author,k(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 E=class extends u{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===s.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return m.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 m.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 C extends v{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return m.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map(((t,s)=>m.createElement(E,{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 y=class extends u{render(){return m.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>{this.elementToFocus=e}},this.props.template?m.createElement(this.props.template,{item:this.props.item}):m.createElement("div",{className:"k-card"},m.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?m.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?m.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return 0===this.props.item.contentType.indexOf("image/")?m.createElement("img",{src:this.props.item.content}):this.props.item.content}};class f extends v{render(){const e=this.isCardDeckLayout(this.props),t=m.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map(((e,t)=>m.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?m.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=m.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=m.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 b=class extends m.Component{render(){const e=this.props.item;return m.createElement("div",{className:"k-timestamp"},n.provideIntlService(this).formatDate(e.timestamp,"D"))}};n.registerForIntl(b);const w="newMessage.sendButton",x="newMessage.optionsButton",N="newMessage.messageInput",T="avatar.alt",S="messageList.ariaLabel",R="aIPrompt.noOutputs",B="aIPrompt.cancel",L={[w]:"Send",[x]:"Options",[N]:"Message",[T]:"Avatar",[S]:"Message list",[B]:"Cancel",[R]:"No output from AI available"};class D extends m.Component{render(){const{avatarUrl:e,avatarAltText:t,name:s}=this.props.group.author,o=n.provideLocalizationService(this);return m.createElement("div",{className:this.getMsgGroupClassNames()},s&&m.createElement("p",{className:"k-author"},s),e&&m.createElement(i.Avatar,{type:"image"},m.createElement("img",{src:e,alt:void 0!==t?t:o.toLanguageString(T,L[T])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return s.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":g(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=[m.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(m.createElement(y,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${s}`})),n}))}}const A=m.forwardRef(((e,t)=>{const{className:n,...o}=e,a=m.useRef(null),i=m.useRef(null);m.useImperativeHandle(i,(()=>({element:a.current,props:e}))),m.useImperativeHandle(t,(()=>i.current));const l=m.useMemo((()=>s.classNames("k-chat-toolbar k-toolbar",n)),[n]);return m.useEffect((()=>{null!==a.current&&s.focusFirstFocusableChild(a.current,[...s.TABBABLE_ELEMENTS])}),[]),m.createElement(r.Toolbar,{id:e.id,ref:e=>{e&&(a.current=e.element)},className:l,...o},m.createElement("div",{className:"k-button-list k-toolbar-group"},e.children))}));A.displayName="KendoReactChatToolbar";class M extends m.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=m.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=m.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(N,L[N])}),s=m.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,L[w]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),o=m.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(x,L[x])});return m.createElement(m.Fragment,null,m.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?m.createElement(this.props.MessageBox,{messageInput:t,sendButton:s,toolbarButton:o}):m.createElement(m.Fragment,null,t,m.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),m.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&o,s))),this.props.showToolbar&&m.createElement(A,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.4.0-develop.4",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},P=class e extends m.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 m.createElement("div",{style:{width:this.props.width,position:"relative"},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>{this.chatWrapperEl=e}},m.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":e.toLanguageString(S,L[S]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>{this.viewItemsWrapperEl=e}},m.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),m.createElement(M,{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&&m.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?m.createElement(b,{item:s,key:n}):"message-group"===s.type?m.createElement(D,{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?m.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?m.createElement(C,{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):[]}};P.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},P.defaultProps={messages:[],dateFormat:"g",message:h};let F=P;class K extends m.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{s.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return m.createElement("div",{className:"k-card"},m.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),m.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),m.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map(((e,t)=>m.createElement("span",{className:"k-card-action",key:t},m.createElement(r.Button,{fillMode:"flat",onClick:t=>this.onBtnClick(e,t)},e.title))))}getTitleView(){let e=null;return this.props.title&&(e=m.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=m.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}const O=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)))))},q=t.forwardRef(((e,s)=>{const{children:o,streaming:i,onCancel:l}=e,c=n.useLocalization().toLanguageString(B,L[B]);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))}));q.displayName="KendoReactAIPromptContent";const G=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))},z=t.createContext([{},()=>{}]),W=()=>t.useContext(z),j=e=>{const[t]=W();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},$={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||[])))),J=({show:e=!1,anchor:s,onOpen:n,onClose:o,animate:a=!0,appendTo:r,popupOptions:i={},children:l,style:p})=>t.createElement(c.Popup,{show:e,anchor:s,style:p,animate:a,appendTo:r,onOpen:n,onClose:o,...i},l),Q=({placeholder:e="Ask or generate content with AI...",promptValue:n,onMenuClick:o,promptInput:i=l.TextArea,generateButton:c,enableSpeechToText:p=!1,streaming:m=!1,commands:u,onPromptRequest:d,onPromptCancel:h})=>{const[g,k]=t.useState(n||""),[I,E]=s.useCustomComponent(c),[v,C]=s.useCustomComponent(i),y={svgIcon:m?a.stopSmIcon:a.paperPlaneIcon,active:m,title:"Send Button","aria-label":"Send Button",disabled:!g.trim()&&!m,"aria-disabled":!g.trim()&&!m},f={placeholder:e,className:"!k-flex-row",autoSize:!0,rows:1},b=u&&u.length>0,w=Object.keys(E).length>0?E:y,x=Object.keys(C).length>0?C:f,N=e=>{const{isFinal:t,alternatives:s}=e;if(t&&s.length>0){const e=s[0].transcript,t=(()=>{const t=g,s=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(s?" ":"")+e})();k(t)}},T=()=>{g.trim()&&d&&d(g.trim())};return t.createElement(v,{value:g,onChange:e=>{const t=e.target.value;k(t)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),T())},prefix:b||p?t.createElement(t.Fragment,null,t.createElement(l.InputPrefix,{className:"!k-align-items-start"},b&&t.createElement(r.Button,{"aria-label":"Commands Button",title:"Commands Button",fillMode:"flat",svgIcon:a.menuIcon,onClick:o}),p&&t.createElement(r.SpeechToTextButton,{fillMode:"flat",..."object"==typeof p?{...p,onResult:p.onResult||N}:{onResult:N}})),t.createElement(l.InputSeparator,null)):void 0,suffix:t.createElement(l.InputSuffix,{className:"!k-align-items-start"},t.createElement(I,{className:s.classNames("k-prompt-send",{"k-generating":m,"k-active":m}),fillMode:"flat",onClick:m?h:T,...w})),...x})};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:d,...h}=e,g=o||[H,$],[k,I]=t.useState({activeView:n}),E={...k,activeView:n,streaming:u,onCancel:d,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l};return t.createElement(z.Provider,{value:[E,e=>{I(e)}]},t.createElement("div",{className:s.classNames("k-prompt",m),style:c,dir:p,...h},t.createElement(O,{activeView:E.activeView,toolbarItems:g,activeViewChange:r}),a))},e.AIPromptCommandsView=e=>{const{commands:s}=e,[n]=W();return t.createElement(j,{name:_.name},t.createElement(q,{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=q,e.AIPromptFooter=G,e.AIPromptOutputView=e=>{const[s,o]=t.useState(""),l=t.useRef(null),[c]=W(),{outputs:p,showOutputRating:m,outputCard:u}=e,{header:d,body:h,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,d?d(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,h?h(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.arrowRotateCwIcon,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(R,L[R])));return t.createElement(j,{name:$.name},t.createElement(q,{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]=W(),[d,h]=s.useCustomComponent(o),[g,k]=s.useCustomComponent(n),I={title:"Generate",children:"Generate",svgIcon:a.sparklesIcon},E=Object.keys(h).length>0?h:I,v=Object.keys(k).length>0?k:{placeholder:"Ask or generate content with AI ...",rows:2};return t.createElement(j,{name:H.name},t.createElement(q,{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(G,null,t.createElement(d,{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=j,e.Chat=F,e.ChatMessage=h,e.HeroCard=K,e.InlineAIPrompt=e=>{const{outputs:n=[],outputCard:o,promptInput:c=l.TextArea,generateButton:p=r.Button,promptPlaceholder:m="Ask or generate content with AI...",promptValue:u,onPromptRequest:d,onCopy:h,onDiscard:g,outputActions:k,onOutputAction:I,enableSpeechToText:E=!1,streaming:v,onPromptCancel:C,show:y=!1,anchor:f,width:b,height:w,onOpen:x,onClose:N,animate:T=!0,appendTo:S,commands:R,onCommandExecute:B,style:L,className:D,popupOptions:A={},...M}=e,[V,P]=t.useState(""),[F,K]=t.useState(!1),[O,G]=t.useState({left:0,top:0}),z=t.useRef(null),{body:W,actions:j}=o||{},U=k||[{id:"copy",text:"Copy",svgIcon:a.copyIcon,themeColor:"primary",title:"Copy"},{id:"discard",text:"Discard",svgIcon:a.cancelOutlineIcon,themeColor:"base",title:"Discard"}],H=(e,t)=>{switch(e.id){case"copy":(e=>{e.responseContent&&(navigator.clipboard.writeText(e.responseContent),P(e.id),setTimeout((()=>P("")),1e3)),null==h||h(e)})(t);break;case"discard":(e=>{null==g||g(e)})(t);break;default:null==I||I(e,t)}},$=t.useCallback((e=>{"Escape"===e.key&&(v&&C?C():!v&&N&&N({target:null}))}),[v,C,N]),_={...L,...b&&{width:b},...w&&{height:w}},Y={...b&&{width:b},...w&&{height:w}},X=t.createElement("div",{className:s.classNames("k-prompt",D),style:_,onKeyDown:$,...M},t.createElement(q,{ref:z},n&&n.length>0&&t.createElement("div",{className:"k-card-list"},n.map(((e,s)=>t.createElement(i.Card,{key:`${e.id}_${s}`},t.createElement(i.CardBody,null,W?W(e):e.responseContent),t.createElement(i.CardActions,null,j?j(e):t.createElement(t.Fragment,null,U.map((s=>{var n;return t.createElement(r.Button,{key:s.id,size:"medium",themeColor:s.themeColor||"primary",fillMode:"flat",rounded:"medium",title:null!=(n=s.title)?n:s.text,svgIcon:"copy"===s.id&&V===e.id?a.checkIcon:s.svgIcon,"aria-hidden":"true",onClick:()=>H(s,e)},s.text)})))))))),t.createElement(Q,{promptValue:u,placeholder:m,onPromptRequest:d,onMenuClick:e=>{if(!z.current)return;const t=z.current.getBoundingClientRect();G({left:t.left,top:t.bottom}),K(!0)},onPromptCancel:C,promptInput:c,generateButton:p,enableSpeechToText:E,streaming:v,commands:R})));return t.createElement(t.Fragment,null,t.createElement(J,{show:y,anchor:f,onOpen:x,onClose:N,animate:T,appendTo:S,popupOptions:A,style:Y},X),t.createElement(i.ContextMenu,{show:F,offset:O,onClose:()=>{K(!1)},items:(e=>null==e?void 0:e.map((e=>({text:e.text,svgIcon:e.svgIcon,data:e,items:e.children?e.children.map((e=>({text:e.text,data:e}))):void 0}))))(R),onSelect:e=>{var t,s;const n=null==(t=e.item)?void 0:t.data;n&&(null==(s=n.children)||!s.length)&&(e=>{K(!1),B&&B(e)})(n)}}))},e.PromptHeader=O,e.commandsViewDefaults=_,e.outputViewDefaults=$,e.promptViewDefaults=H}));
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"),require("@progress/kendo-react-popup")):"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","@progress/kendo-react-popup"],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,e.KendoReactPopup)}(this,(function(e,t,s,n,o,a,r,i,l,c){"use strict";function p(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 m=p(t);let u=class extends m.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}};const d=class extends u{render(){return m.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?m.createElement("div",{className:"k-chat-bubble"},m.createElement("div",{className:"k-typing-indicator"},m.createElement("span",null),m.createElement("span",null),m.createElement("span",null))):this.props.template?m.createElement(this.props.template,{item:this.props.item}):this.props.item.text?m.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=m.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=m.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")}};d.defaultProps={dateFormat:"g",tabIndex:-1};let h=d;n.registerForIntl(h);const g=(e,t)=>e&&t.author&&e.id===t.author.id,k=e=>e[e.length-1],I=e=>(t,s,n)=>{const o=n===e-1;return((e,t)=>{const s=t.timestamp,n=k(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=k(e);let o;t.typing&&!s||(n&&"message-group"===n.type&&(o=n.messages),o&&g(t.author,k(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 E=class extends u{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===s.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return m.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 m.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 C extends v{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return m.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map(((t,s)=>m.createElement(E,{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 y=class extends u{render(){return m.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>{this.elementToFocus=e}},this.props.template?m.createElement(this.props.template,{item:this.props.item}):m.createElement("div",{className:"k-card"},m.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?m.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?m.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return 0===this.props.item.contentType.indexOf("image/")?m.createElement("img",{src:this.props.item.content}):this.props.item.content}};class f extends v{render(){const e=this.isCardDeckLayout(this.props),t=m.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map(((e,t)=>m.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?m.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=m.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=m.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 b=class extends m.Component{render(){const e=this.props.item;return m.createElement("div",{className:"k-timestamp"},n.provideIntlService(this).formatDate(e.timestamp,"D"))}};n.registerForIntl(b);const x="newMessage.sendButton",w="newMessage.optionsButton",N="newMessage.messageInput",T="avatar.alt",S="messageList.ariaLabel",R="aIPrompt.noOutputs",B="aIPrompt.cancel",D={[x]:"Send",[w]:"Options",[N]:"Message",[T]:"Avatar",[S]:"Message list",[B]:"Cancel",[R]:"No output from AI available"};class L extends m.Component{render(){const{avatarUrl:e,avatarAltText:t,name:s}=this.props.group.author,o=n.provideLocalizationService(this);return m.createElement("div",{className:this.getMsgGroupClassNames()},s&&m.createElement("p",{className:"k-author"},s),e&&m.createElement(i.Avatar,{type:"image"},m.createElement("img",{src:e,alt:void 0!==t?t:o.toLanguageString(T,D[T])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return s.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":g(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=[m.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(m.createElement(y,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${s}`})),n}))}}const A=m.forwardRef(((e,t)=>{const{className:n,...o}=e,a=m.useRef(null),i=m.useRef(null);m.useImperativeHandle(i,(()=>({element:a.current,props:e}))),m.useImperativeHandle(t,(()=>i.current));const l=m.useMemo((()=>s.classNames("k-chat-toolbar k-toolbar",n)),[n]);return m.useEffect((()=>{null!==a.current&&s.focusFirstFocusableChild(a.current,[...s.TABBABLE_ELEMENTS])}),[]),m.createElement(r.Toolbar,{id:e.id,ref:e=>{e&&(a.current=e.element)},className:l,...o},m.createElement("div",{className:"k-button-list k-toolbar-group"},e.children))}));A.displayName="KendoReactChatToolbar";class M extends m.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=m.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=m.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(N,D[N])}),s=m.createElement(r.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:a.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(x,D[x]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),o=m.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,D[w])});return m.createElement(m.Fragment,null,m.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?m.createElement(this.props.MessageBox,{messageInput:t,sendButton:s,toolbarButton:o}):m.createElement(m.Fragment,null,t,m.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),m.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&o,s))),this.props.showToolbar&&m.createElement(A,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.4.0-develop.5",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},F=class e extends m.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 m.createElement("div",{style:{width:this.props.width,position:"relative"},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>{this.chatWrapperEl=e}},m.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":e.toLanguageString(S,D[S]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>{this.viewItemsWrapperEl=e}},m.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),m.createElement(M,{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&&m.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?m.createElement(b,{item:s,key:n}):"message-group"===s.type?m.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?m.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?m.createElement(C,{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):[]}};F.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},F.defaultProps={messages:[],dateFormat:"g",message:h};let P=F;const K=e=>{const{suggestions:t,onSuggestionClick:n}=e;return m.createElement("div",{role:"group",className:"k-suggestion-group"},t.map((e=>m.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:t=>!e.disabled&&n(t,e),onKeyDown:t=>!e.disabled&&((e,t)=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),n(e,t))})(t,e),key:e.id,title:e.description,className:s.classNames("k-suggestion",{"k-disabled":e.disabled})},e.text))))};class O extends m.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{s.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return m.createElement("div",{className:"k-card"},m.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),m.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),m.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map(((e,t)=>m.createElement("span",{className:"k-card-action",key:t},m.createElement(r.Button,{fillMode:"flat",onClick:t=>this.onBtnClick(e,t)},e.title))))}getTitleView(){let e=null;return this.props.title&&(e=m.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=m.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)))))},G={name:"Output view",buttonText:"Output",buttonIcon:a.commentIcon},z={name:"Commands view",buttonIcon:a.moreHorizontalIcon},W={name:"prompt-view",buttonText:"Ask AI",buttonIcon:a.sparklesIcon},j=t.createContext([{},()=>{}]),U=()=>t.useContext(j),H=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))},$=t.forwardRef(((e,s)=>{const{children:o,streaming:i,onCancel:l}=e,c=n.useLocalization().toLanguageString(B,D[B]),[p]=U(),m=p.activeView===G.name,u=i&&m,d=t.useCallback((e=>{"Escape"===e.key&&u&&l&&(e.preventDefault(),l())}),[u,l]);return t.createElement("div",{className:"k-prompt-content",ref:s,onKeyDown:d},u&&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))}));$.displayName="KendoReactAIPromptContent";const _=e=>{const[t]=U();return t.activeView===e.name?e.children:null},Y=e=>{const[s,n]=t.useState(!0),{children:o,title:i}=e;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(r.Button,{"aria-controls":e.id,fillMode:"flat",svgIcon:s?a.chevronUpIcon:a.chevronDownIcon,title:i,onClick:()=>n(!s),"aria-expanded":s},i),s&&t.createElement("div",{id:e.id,className:"k-prompt-expander-content"},o))},J=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&&J(e.children||[])))),Q=({show:e=!1,anchor:s,onOpen:n,onClose:o,animate:a=!0,appendTo:r,popupOptions:i={},children:l,style:p})=>t.createElement(c.Popup,{show:e,anchor:s,style:p,animate:a,appendTo:r,onOpen:n,onClose:o,...i},l),X=({placeholder:e="Ask or generate content with AI...",promptValue:n,onMenuClick:o,promptInput:i=l.TextArea,generateButton:c,enableSpeechToText:p=!1,streaming:m=!1,commands:u,onPromptRequest:d,onPromptCancel:h})=>{const[g,k]=t.useState(n||""),[I,E]=s.useCustomComponent(c),[v,C]=s.useCustomComponent(i),y={svgIcon:m?a.stopSmIcon:a.paperPlaneIcon,active:m,title:"Send Button","aria-label":"Send Button",disabled:!g.trim()&&!m,"aria-disabled":!g.trim()&&!m},f={placeholder:e,className:"!k-flex-row",autoSize:!0,rows:1},b=u&&u.length>0,x=Object.keys(E).length>0?E:y,w=Object.keys(C).length>0?C:f,N=e=>{const{isFinal:t,alternatives:s}=e;if(t&&s.length>0){const e=s[0].transcript,t=(()=>{const t=g,s=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(s?" ":"")+e})();k(t)}},T=()=>{g.trim()&&d&&d(g.trim())};return t.createElement(v,{value:g,onChange:e=>{const t=e.target.value;k(t)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),T())},prefix:b||p?t.createElement(t.Fragment,null,t.createElement(l.InputPrefix,{className:"!k-align-items-start"},b&&t.createElement(r.Button,{"aria-label":"Commands Button",title:"Commands Button",fillMode:"flat",svgIcon:a.menuIcon,onClick:o}),p&&t.createElement(r.SpeechToTextButton,{fillMode:"flat",..."object"==typeof p?{...p,onResult:p.onResult||N}:{onResult:N}})),t.createElement(l.InputSeparator,null)):void 0,suffix:t.createElement(l.InputSuffix,{className:"!k-align-items-start"},t.createElement(I,{className:s.classNames("k-prompt-send",{"k-generating":m,"k-active":m}),fillMode:"flat",onClick:m?h:T,...x})),...w})};e.AIPrompt=e=>{const{activeView:n,toolbarItems:o,children:a,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l,style:c,dir:p,className:m,streaming:u,loading:d,onCancel:h,...g}=e,k=o||[W,G],[I,E]=t.useState({activeView:n}),v={...I,activeView:n,streaming:u,loading:d,onCancel:h,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l};return t.createElement(j.Provider,{value:[v,e=>{E(e)}]},t.createElement("div",{className:s.classNames("k-prompt",m),style:c,dir:p,...g},t.createElement(q,{activeView:v.activeView,toolbarItems:k,activeViewChange:r}),a))},e.AIPromptCommandsView=e=>{const{commands:s}=e,[n]=U();return t.createElement(_,{name:z.name},t.createElement($,{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:""},J(null!=s?s:[])))))},e.AIPromptContent=$,e.AIPromptFooter=H,e.AIPromptOutputView=e=>{const[s,o]=t.useState(""),l=t.useRef(null),[c]=U(),{outputs:p,showOutputRating:m,outputCard:u}=e,{header:d,body:h,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,d?d(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,h?h(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.arrowRotateCwIcon,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(R,D[R])));return t.createElement(_,{name:G.name},t.createElement($,{ref:l,streaming:c.streaming,onCancel:c.onCancel},t.createElement("div",{className:"k-card-list"},c.loading&&v,C,(!C||0===C.length)&&!c.loading&&y)))},e.AIPromptView=e=>{const{promptInput:n=l.TextArea,generateButton:o=r.Button,enableSpeechToText:i=!1,promptValue:c,promptSuggestions:p}=e,[m,u]=t.useState(c||""),[d]=U(),[h,g]=s.useCustomComponent(o),[k,I]=s.useCustomComponent(n),E={title:"Generate",children:"Generate",svgIcon:a.sparklesIcon},v=Object.keys(g).length>0?g:E,C=Object.keys(I).length>0?I:{placeholder:"Ask or generate content with AI ...",rows:2},y=e=>{const{isFinal:t,alternatives:s}=e;if(t&&s.length>0){const e=s[0].transcript,t=(()=>{const t=m,s=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(s?" ":"")+e})();u(t)}};let f;return i&&(f="object"==typeof i?{...i,onResult:i.onResult||y}:{onResult:y}),t.createElement(_,{name:W.name},t.createElement($,{streaming:d.streaming,onCancel:d.onCancel},t.createElement(k,{value:m,className:"!k-flex-col",suffix:i?t.createElement(l.InputSuffix,{orientation:"horizontal"},t.createElement(r.SpeechToTextButton,{fillMode:"flat",...f})):void 0,onChange:e=>{u(e.target.value)},...C}),p&&p.length>0&&t.createElement(Y,{id:"prompt-suggestions",title:"Prompt Suggestions"},t.createElement(K,{suggestions:p.map(((e,t)=>({id:t,text:e,description:e}))),onSuggestionClick:(e,t)=>{(e=>{u(e)})(t.text)}}))),t.createElement(H,null,t.createElement(h,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:()=>{d.onPromptRequest&&d.onPromptRequest.call(null,m),u("")},disabled:!m.trim(),...v},v.children)))},e.AIPromptViewRender=_,e.Chat=P,e.ChatMessage=h,e.HeroCard=O,e.InlineAIPrompt=e=>{const{outputs:n=[],outputCard:o,promptInput:c=l.TextArea,generateButton:p=r.Button,promptPlaceholder:m="Ask or generate content with AI...",promptValue:u,onPromptRequest:d,onCopy:h,onDiscard:g,outputActions:k,onOutputAction:I,enableSpeechToText:E=!1,streaming:v,onPromptCancel:C,show:y=!1,anchor:f,width:b,height:x,onOpen:w,onClose:N,animate:T=!0,appendTo:S,commands:R,onCommandExecute:B,style:D,className:L,popupOptions:A={},...M}=e,[V,F]=t.useState(""),[P,K]=t.useState(!1),[O,q]=t.useState({left:0,top:0}),G=t.useRef(null),{body:z,actions:W}=o||{},j=k||[{id:"copy",text:"Copy",svgIcon:a.copyIcon,themeColor:"primary",title:"Copy"},{id:"discard",text:"Discard",svgIcon:a.cancelOutlineIcon,themeColor:"base",title:"Discard"}],U=(e,t)=>{switch(e.id){case"copy":(e=>{e.responseContent&&(navigator.clipboard.writeText(e.responseContent),F(e.id),setTimeout((()=>F("")),1e3)),null==h||h(e)})(t);break;case"discard":(e=>{null==g||g(e)})(t);break;default:null==I||I(e,t)}},H=t.useCallback((e=>{"Escape"===e.key&&(v&&C?C():!v&&N&&N({target:null}))}),[v,C,N]),_={...D,...b&&{width:b},...x&&{height:x}},Y={...b&&{width:b},...x&&{height:x}},J=t.createElement("div",{className:s.classNames("k-prompt",L),style:_,onKeyDown:H,...M},t.createElement($,{ref:G},n&&n.length>0&&t.createElement("div",{className:"k-card-list"},n.map(((e,s)=>t.createElement(i.Card,{key:`${e.id}_${s}`},t.createElement(i.CardBody,null,z?z(e):e.responseContent),t.createElement(i.CardActions,null,W?W(e):t.createElement(t.Fragment,null,j.map((s=>{var n;return t.createElement(r.Button,{key:s.id,size:"medium",themeColor:s.themeColor||"primary",fillMode:"flat",rounded:"medium",title:null!=(n=s.title)?n:s.text,svgIcon:"copy"===s.id&&V===e.id?a.checkIcon:s.svgIcon,"aria-hidden":"true",onClick:()=>U(s,e)},s.text)})))))))),t.createElement(X,{promptValue:u,placeholder:m,onPromptRequest:d,onMenuClick:e=>{if(!G.current)return;const t=G.current.getBoundingClientRect();q({left:t.left,top:t.bottom}),K(!0)},onPromptCancel:C,promptInput:c,generateButton:p,enableSpeechToText:E,streaming:v,commands:R})));return t.createElement(t.Fragment,null,t.createElement(Q,{show:y,anchor:f,onOpen:w,onClose:N,animate:T,appendTo:S,popupOptions:A,style:Y},J),t.createElement(i.ContextMenu,{show:P,offset:O,onClose:()=>{K(!1)},items:(e=>null==e?void 0:e.map((e=>({text:e.text,svgIcon:e.svgIcon,data:e,items:e.children?e.children.map((e=>({text:e.text,data:e}))):void 0}))))(R),onSelect:e=>{var t,s;const n=null==(t=e.item)?void 0:t.data;n&&(null==(s=n.children)||!s.length)&&(e=>{K(!1),B&&B(e)})(n)}}))},e.PromptHeader=q,e.SuggestionGroup=K,e.commandsViewDefaults=z,e.outputViewDefaults=G,e.promptViewDefaults=W}));
package/index.d.mts CHANGED
@@ -339,6 +339,13 @@ export declare interface AIPromptProps extends default_3.HTMLAttributes<HTMLElem
339
339
  * ```
340
340
  */
341
341
  streaming?: boolean;
342
+ /**
343
+ * If true, the prompt is in a loading state.
344
+ * ```jsx
345
+ * <AIPrompt loading={true} />
346
+ * ```
347
+ */
348
+ loading?: boolean;
342
349
  }
343
350
 
344
351
  /**
@@ -384,6 +391,13 @@ export declare interface AIPromptViewProps {
384
391
  * The suggestions that will be displayed in the prompt view. See example [here]({% slug suggestions_aiprompt %}).
385
392
  */
386
393
  promptSuggestions?: string[];
394
+ /**
395
+ * Show speech to text button in input. When true, shows the button with default settings.
396
+ * When an object is provided, passes those props directly to the SpeechToTextButton component.
397
+ *
398
+ * @default false
399
+ */
400
+ enableSpeechToText?: boolean | SpeechToTextButtonProps;
387
401
  }
388
402
 
389
403
  /**
@@ -688,6 +702,18 @@ export declare interface ChatState {
688
702
  isFirstRender: boolean;
689
703
  }
690
704
 
705
+ /**
706
+ * Represents the structure of a chat suggestion item that can be displayed above the message input.
707
+ *
708
+ * @interface ChatSuggestion
709
+ */
710
+ export declare interface ChatSuggestion {
711
+ id: string | number;
712
+ text: string;
713
+ description?: string;
714
+ disabled?: boolean;
715
+ }
716
+
691
717
  /**
692
718
  * The arguments for the `toolbaractionexecute` event of the Chat.
693
719
  */
@@ -1080,6 +1106,13 @@ declare interface Selectable {
1080
1106
  selectionIndex: number;
1081
1107
  }
1082
1108
 
1109
+ export declare const SuggestionGroup: React_2.FC<SuggestionGroupProps>;
1110
+
1111
+ declare interface SuggestionGroupProps {
1112
+ suggestions: ChatSuggestion[];
1113
+ onSuggestionClick: (event: React_2.MouseEvent<HTMLSpanElement>, suggestion: ChatSuggestion) => void;
1114
+ }
1115
+
1083
1116
  /**
1084
1117
  * Represents a participant in a Chat conversation.
1085
1118
  */
package/index.d.ts CHANGED
@@ -339,6 +339,13 @@ export declare interface AIPromptProps extends default_3.HTMLAttributes<HTMLElem
339
339
  * ```
340
340
  */
341
341
  streaming?: boolean;
342
+ /**
343
+ * If true, the prompt is in a loading state.
344
+ * ```jsx
345
+ * <AIPrompt loading={true} />
346
+ * ```
347
+ */
348
+ loading?: boolean;
342
349
  }
343
350
 
344
351
  /**
@@ -384,6 +391,13 @@ export declare interface AIPromptViewProps {
384
391
  * The suggestions that will be displayed in the prompt view. See example [here]({% slug suggestions_aiprompt %}).
385
392
  */
386
393
  promptSuggestions?: string[];
394
+ /**
395
+ * Show speech to text button in input. When true, shows the button with default settings.
396
+ * When an object is provided, passes those props directly to the SpeechToTextButton component.
397
+ *
398
+ * @default false
399
+ */
400
+ enableSpeechToText?: boolean | SpeechToTextButtonProps;
387
401
  }
388
402
 
389
403
  /**
@@ -688,6 +702,18 @@ export declare interface ChatState {
688
702
  isFirstRender: boolean;
689
703
  }
690
704
 
705
+ /**
706
+ * Represents the structure of a chat suggestion item that can be displayed above the message input.
707
+ *
708
+ * @interface ChatSuggestion
709
+ */
710
+ export declare interface ChatSuggestion {
711
+ id: string | number;
712
+ text: string;
713
+ description?: string;
714
+ disabled?: boolean;
715
+ }
716
+
691
717
  /**
692
718
  * The arguments for the `toolbaractionexecute` event of the Chat.
693
719
  */
@@ -1080,6 +1106,13 @@ declare interface Selectable {
1080
1106
  selectionIndex: number;
1081
1107
  }
1082
1108
 
1109
+ export declare const SuggestionGroup: React_2.FC<SuggestionGroupProps>;
1110
+
1111
+ declare interface SuggestionGroupProps {
1112
+ suggestions: ChatSuggestion[];
1113
+ onSuggestionClick: (event: React_2.MouseEvent<HTMLSpanElement>, suggestion: ChatSuggestion) => void;
1114
+ }
1115
+
1083
1116
  /**
1084
1117
  * Represents a participant in a Chat conversation.
1085
1118
  */
package/index.js CHANGED
@@ -6,4 +6,4 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./components/ChatMessage.js"),m=require("./components/Chat.js"),p=require("./components/templates/HeroCard.js"),i=require("./ai-prompt/AIPrompt.js"),n=require("./ai-prompt/AIPromptHeader.js"),s=require("./ai-prompt/AIPromptFooter.js"),u=require("./ai-prompt/AIPromptContent.js"),e=require("./ai-prompt/views/AIPromptView.js"),t=require("./ai-prompt/views/AIPromptOutputView.js"),r=require("./ai-prompt/views/AIPromptCommandsView.js"),a=require("./ai-prompt/views/AIPromptViewRender.js"),I=require("./inline-ai-prompt/InlineAIPrompt.js");exports.ChatMessage=o.ChatMessage;exports.Chat=m.Chat;exports.HeroCard=p.HeroCard;exports.AIPrompt=i.AIPrompt;exports.PromptHeader=n.PromptHeader;exports.AIPromptFooter=s.AIPromptFooter;exports.AIPromptContent=u.AIPromptContent;exports.AIPromptView=e.AIPromptView;exports.promptViewDefaults=e.promptViewDefaults;exports.AIPromptOutputView=t.AIPromptOutputView;exports.outputViewDefaults=t.outputViewDefaults;exports.AIPromptCommandsView=r.AIPromptCommandsView;exports.commandsViewDefaults=r.commandsViewDefaults;exports.AIPromptViewRender=a.AIPromptViewRender;exports.InlineAIPrompt=I.InlineAIPrompt;
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components/ChatMessage.js"),r=require("./components/Chat.js"),o=require("./chat/components/SuggestionsGroup.js"),i=require("./components/templates/HeroCard.js"),n=require("./ai-prompt/AIPrompt.js"),m=require("./ai-prompt/AIPromptHeader.js"),p=require("./ai-prompt/AIPromptFooter.js"),s=require("./ai-prompt/AIPromptContent.js"),u=require("./ai-prompt/views/AIPromptView.js"),a=require("./ai-prompt/views/AIPromptOutputView.js"),I=require("./ai-prompt/views/AIPromptCommandsView.js"),P=require("./ai-prompt/views/AIPromptViewRender.js"),A=require("./inline-ai-prompt/InlineAIPrompt.js"),e=require("./ai-prompt/views/constants.js");exports.ChatMessage=t.ChatMessage;exports.Chat=r.Chat;exports.SuggestionGroup=o.SuggestionGroup;exports.HeroCard=i.HeroCard;exports.AIPrompt=n.AIPrompt;exports.PromptHeader=m.PromptHeader;exports.AIPromptFooter=p.AIPromptFooter;exports.AIPromptContent=s.AIPromptContent;exports.AIPromptView=u.AIPromptView;exports.AIPromptOutputView=a.AIPromptOutputView;exports.AIPromptCommandsView=I.AIPromptCommandsView;exports.AIPromptViewRender=P.AIPromptViewRender;exports.InlineAIPrompt=A.InlineAIPrompt;exports.commandsViewDefaults=e.commandsViewDefaults;exports.outputViewDefaults=e.outputViewDefaults;exports.promptViewDefaults=e.promptViewDefaults;
package/index.mjs CHANGED
@@ -8,30 +8,33 @@
8
8
  "use client";
9
9
  import { ChatMessage as t } from "./components/ChatMessage.mjs";
10
10
  import { Chat as m } from "./components/Chat.mjs";
11
- import { HeroCard as f } from "./components/templates/HeroCard.mjs";
12
- import { AIPrompt as a } from "./ai-prompt/AIPrompt.mjs";
11
+ import { SuggestionGroup as f } from "./chat/components/SuggestionsGroup.mjs";
12
+ import { HeroCard as a } from "./components/templates/HeroCard.mjs";
13
+ import { AIPrompt as u } from "./ai-prompt/AIPrompt.mjs";
13
14
  import { PromptHeader as P } from "./ai-prompt/AIPromptHeader.mjs";
14
- import { AIPromptFooter as A } from "./ai-prompt/AIPromptFooter.mjs";
15
- import { AIPromptContent as s } from "./ai-prompt/AIPromptContent.mjs";
16
- import { AIPromptView as w, promptViewDefaults as V } from "./ai-prompt/views/AIPromptView.mjs";
17
- import { AIPromptOutputView as C, outputViewDefaults as l } from "./ai-prompt/views/AIPromptOutputView.mjs";
18
- import { AIPromptCommandsView as h, commandsViewDefaults as H } from "./ai-prompt/views/AIPromptCommandsView.mjs";
19
- import { AIPromptViewRender as g } from "./ai-prompt/views/AIPromptViewRender.mjs";
20
- import { InlineAIPrompt as M } from "./inline-ai-prompt/InlineAIPrompt.mjs";
15
+ import { AIPromptFooter as s } from "./ai-prompt/AIPromptFooter.mjs";
16
+ import { AIPromptContent as w } from "./ai-prompt/AIPromptContent.mjs";
17
+ import { AIPromptView as d } from "./ai-prompt/views/AIPromptView.mjs";
18
+ import { AIPromptOutputView as l } from "./ai-prompt/views/AIPromptOutputView.mjs";
19
+ import { AIPromptCommandsView as D } from "./ai-prompt/views/AIPromptCommandsView.mjs";
20
+ import { AIPromptViewRender as H } from "./ai-prompt/views/AIPromptViewRender.mjs";
21
+ import { InlineAIPrompt as F } from "./inline-ai-prompt/InlineAIPrompt.mjs";
22
+ import { commandsViewDefaults as M, outputViewDefaults as O, promptViewDefaults as R } from "./ai-prompt/views/constants.mjs";
21
23
  export {
22
- a as AIPrompt,
23
- h as AIPromptCommandsView,
24
- s as AIPromptContent,
25
- A as AIPromptFooter,
26
- C as AIPromptOutputView,
27
- w as AIPromptView,
28
- g as AIPromptViewRender,
24
+ u as AIPrompt,
25
+ D as AIPromptCommandsView,
26
+ w as AIPromptContent,
27
+ s as AIPromptFooter,
28
+ l as AIPromptOutputView,
29
+ d as AIPromptView,
30
+ H as AIPromptViewRender,
29
31
  m as Chat,
30
32
  t as ChatMessage,
31
- f as HeroCard,
32
- M as InlineAIPrompt,
33
+ a as HeroCard,
34
+ F as InlineAIPrompt,
33
35
  P as PromptHeader,
34
- H as commandsViewDefaults,
35
- l as outputViewDefaults,
36
- V as promptViewDefaults
36
+ f as SuggestionGroup,
37
+ M as commandsViewDefaults,
38
+ O as outputViewDefaults,
39
+ R as promptViewDefaults
37
40
  };
@@ -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: 1754046323,version:"11.4.0-develop.4",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: 1754052800,version:"11.4.0-develop.5",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: 1754046323,
14
- version: "11.4.0-develop.4",
13
+ publishDate: 1754052800,
14
+ version: "11.4.0-develop.5",
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.4.0-develop.4",
3
+ "version": "11.4.0-develop.5",
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.4.0-develop.4",
30
- "@progress/kendo-react-common": "11.4.0-develop.4",
31
- "@progress/kendo-react-intl": "11.4.0-develop.4",
32
- "@progress/kendo-react-inputs": "11.4.0-develop.4",
33
- "@progress/kendo-react-layout": "11.4.0-develop.4",
29
+ "@progress/kendo-react-buttons": "11.4.0-develop.5",
30
+ "@progress/kendo-react-common": "11.4.0-develop.5",
31
+ "@progress/kendo-react-intl": "11.4.0-develop.5",
32
+ "@progress/kendo-react-inputs": "11.4.0-develop.5",
33
+ "@progress/kendo-react-layout": "11.4.0-develop.5",
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": 1754046323,
62
+ "publishDate": 1754052800,
63
63
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
64
64
  }
65
65
  },