@progress/kendo-react-conversational-ui 10.2.0-develop.1 → 10.2.0-develop.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";const n=require("react"),r=require("@progress/kendo-react-common"),i=require("./base/FocusableUponSelection.js");function c(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const p=c(n);class a extends i.FocusableUponSelection{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===r.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return r.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}}module.exports=a;
8
+ "use strict";const n=require("react"),r=require("@progress/kendo-react-common"),i=require("./base/FocusableUponSelection.js");function c(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const p=c(n);class a extends i.FocusableUponSelection{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===r.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>{this.elementToFocus=e},onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return r.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}}module.exports=a;
@@ -21,7 +21,9 @@ class a extends r {
21
21
  role: "button",
22
22
  className: this.getClassNames(),
23
23
  onClick: (e) => this.props.onActionExecute(this.props.item, e),
24
- ref: (e) => this.elementToFocus = e,
24
+ ref: (e) => {
25
+ this.elementToFocus = e;
26
+ },
25
27
  onKeyDown: this.onKeyDown,
26
28
  tabIndex: 0
27
29
  },
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";const n=require("react"),a=require("@progress/kendo-react-common"),o=require("./base/FocusableUponSelection.js");function l(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(s,i,r.get?r:{enumerable:!0,get:()=>t[i]})}}return s.default=t,Object.freeze(s)}const e=l(n);class c extends o.FocusableUponSelection{render(){return e.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:s=>this.elementToFocus=s},this.props.template?e.createElement(this.props.template,{item:this.props.item}):e.createElement("div",{className:"k-card"},e.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(this.props.tabbable!==void 0)return this.props.tabbable?0:-1}getClassNames(){return a.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?e.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?e.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return this.props.item.contentType.indexOf("image/")===0?e.createElement("img",{src:this.props.item.content}):this.props.item.content}}module.exports=c;
8
+ "use strict";const n=require("react"),a=require("@progress/kendo-react-common"),o=require("./base/FocusableUponSelection.js");function l(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(s,i,r.get?r:{enumerable:!0,get:()=>t[i]})}}return s.default=t,Object.freeze(s)}const e=l(n);class c extends o.FocusableUponSelection{render(){return e.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:s=>{this.elementToFocus=s}},this.props.template?e.createElement(this.props.template,{item:this.props.item}):e.createElement("div",{className:"k-card"},e.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(this.props.tabbable!==void 0)return this.props.tabbable?0:-1}getClassNames(){return a.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?e.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?e.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return this.props.item.contentType.indexOf("image/")===0?e.createElement("img",{src:this.props.item.content}):this.props.item.content}}module.exports=c;
@@ -16,7 +16,9 @@ class p extends i {
16
16
  className: this.getClassNames(),
17
17
  tabIndex: this.getTabIndexValue(),
18
18
  onClick: this.props.onClick,
19
- ref: (t) => this.elementToFocus = t
19
+ ref: (t) => {
20
+ this.elementToFocus = t;
21
+ }
20
22
  },
21
23
  this.props.template ? /* @__PURE__ */ e.createElement(this.props.template, { item: this.props.item }) : /* @__PURE__ */ e.createElement("div", { className: "k-card" }, /* @__PURE__ */ e.createElement("div", { className: "k-card-body" }, this.getTitleView(), this.getSubtitleView(), this.getContentView()))
22
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 r=require("@progress/kendo-react-common"),o=require("prop-types"),p=require("react"),u=require("../ViewItem.js"),m=require("./ActionGroup.js"),d=require("./AttachmentGroup.js"),g=require("./DateMarker.js"),I=require("./MessageGroup.js"),f=require("./NewMessage.js"),T=require("./ChatMessage.js"),w=require("../package-metadata.js"),c=require("../messages/index.js"),y=require("@progress/kendo-react-intl");function k(n){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>n[e]})}}return s.default=n,Object.freeze(s)}const i=k(p),l=class l extends i.Component{constructor(s){super(s),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 a=this.state.selectedItemIndex!==null?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===r.Keys.up?a===null?t=0:a>0&&(t=a-1):e.keyCode===r.Keys.down&&(a===null?t=0:a<this.viewItems.lastSelectionIndex&&(t=a+1)),t!==null&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{r.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(r.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value);break}this.newMsgComp.focusInput()}},this.showLicenseWatermark=!r.validatePackage(w.packageMetadata,{component:"Chat"}),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const s=y.provideLocalizationService(this);return i.createElement("div",{style:{width:this.props.width,position:"relative"},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>this.chatWrapperEl=e},i.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":s.toLanguageString(c.ariaLabelMessageList,c.messages[c.ariaLabelMessageList]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>this.viewItemsWrapperEl=e},i.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),i.createElement(f,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>this.newMsgComp=e,placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}),this.showLicenseWatermark&&i.createElement(r.WatermarkOverlay,null))}componentDidMount(){this.setState({isFirstRender:!1},()=>{this.nextTickId=window.setTimeout(()=>this.scrollViewItemsToBottom(),250)})}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(s){s.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return r.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(s){return!!(s.dir!==void 0?s.dir==="rtl":this.chatWrapperEl&&getComputedStyle(this.chatWrapperEl).direction==="rtl")}renderViewItems(){const s=this.viewItems.length-1;return this.viewItems.map((e,t)=>{if(e.type==="date-marker")return i.createElement(g,{item:e,key:t});if(e.type==="message-group")return i.createElement(I,{group:e,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:t===s,key:t,message:this.props.message||l.defaultProps.message});if(e.type==="attachment-group")return i.createElement(d,{group:e,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===s,key:t});if(e.type==="action-group")return i.createElement(m,{group:e,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===s,key:t})})}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(s){return s.length>0?u.convertMsgsToViewItems(s):[]}};l.propTypes={messages:o.arrayOf(o.object),user:o.object,messageTemplate:o.any,attachmentTemplate:o.any,width:o.oneOfType([o.string,o.number]),onMessageSend:o.func,onActionExecute:o.func,dir:o.string,messageBox:o.any},l.defaultProps={messages:[],dateFormat:"g",message:T.ChatMessage};let h=l;exports.Chat=h;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@progress/kendo-react-common"),o=require("prop-types"),p=require("react"),u=require("../ViewItem.js"),m=require("./ActionGroup.js"),d=require("./AttachmentGroup.js"),g=require("./DateMarker.js"),I=require("./MessageGroup.js"),f=require("./NewMessage.js"),T=require("./ChatMessage.js"),w=require("../package-metadata.js"),c=require("../messages/index.js"),y=require("@progress/kendo-react-intl");function k(n){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>n[e]})}}return s.default=n,Object.freeze(s)}const i=k(p),l=class l extends i.Component{constructor(s){super(s),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 a=this.state.selectedItemIndex!==null?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===r.Keys.up?a===null?t=0:a>0&&(t=a-1):e.keyCode===r.Keys.down&&(a===null?t=0:a<this.viewItems.lastSelectionIndex&&(t=a+1)),t!==null&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{r.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(r.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value);break}this.newMsgComp.focusInput()}},this.showLicenseWatermark=!r.validatePackage(w.packageMetadata,{component:"Chat"}),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const s=y.provideLocalizationService(this);return i.createElement("div",{style:{width:this.props.width,position:"relative"},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>{this.chatWrapperEl=e}},i.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":s.toLanguageString(c.ariaLabelMessageList,c.messages[c.ariaLabelMessageList]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>{this.viewItemsWrapperEl=e}},i.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),i.createElement(f,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>{this.newMsgComp=e},placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}),this.showLicenseWatermark&&i.createElement(r.WatermarkOverlay,null))}componentDidMount(){this.setState({isFirstRender:!1},()=>{this.nextTickId=window.setTimeout(()=>this.scrollViewItemsToBottom(),250)})}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(s){s.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return r.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(s){return!!(s.dir!==void 0?s.dir==="rtl":this.chatWrapperEl&&getComputedStyle(this.chatWrapperEl).direction==="rtl")}renderViewItems(){const s=this.viewItems.length-1;return this.viewItems.map((e,t)=>{if(e.type==="date-marker")return i.createElement(g,{item:e,key:t});if(e.type==="message-group")return i.createElement(I,{group:e,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:t===s,key:t,message:this.props.message||l.defaultProps.message});if(e.type==="attachment-group")return i.createElement(d,{group:e,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===s,key:t});if(e.type==="action-group")return i.createElement(m,{group:e,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===s,key:t})})}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(s){return s.length>0?u.convertMsgsToViewItems(s):[]}};l.propTypes={messages:o.arrayOf(o.object),user:o.object,messageTemplate:o.any,attachmentTemplate:o.any,width:o.oneOfType([o.string,o.number]),onMessageSend:o.func,onActionExecute:o.func,dir:o.string,messageBox:o.any},l.defaultProps={messages:[],dateFormat:"g",message:T.ChatMessage};let h=l;exports.Chat=h;
@@ -70,7 +70,9 @@ const a = class a extends i.Component {
70
70
  style: { width: this.props.width, position: "relative" },
71
71
  onKeyDown: this.onKeyDown,
72
72
  className: this.getClassNames(),
73
- ref: (e) => this.chatWrapperEl = e
73
+ ref: (e) => {
74
+ this.chatWrapperEl = e;
75
+ }
74
76
  },
75
77
  /* @__PURE__ */ i.createElement(
76
78
  "div",
@@ -87,7 +89,9 @@ const a = class a extends i.Component {
87
89
  onScroll: (e) => {
88
90
  this.scrollToBottomOnLoadingData = e.currentTarget.scrollTop === e.currentTarget.scrollHeight - e.currentTarget.clientHeight;
89
91
  },
90
- ref: (e) => this.viewItemsWrapperEl = e
92
+ ref: (e) => {
93
+ this.viewItemsWrapperEl = e;
94
+ }
91
95
  },
92
96
  /* @__PURE__ */ i.createElement("div", { className: "k-message-list-content" }, this.renderViewItems())
93
97
  ),
@@ -97,7 +101,9 @@ const a = class a extends i.Component {
97
101
  user: this.props.user,
98
102
  onMessageSend: this.onMessageSend,
99
103
  isDirectionRightToLeft: this.isDirectionRightToLeft,
100
- ref: (e) => this.newMsgComp = e,
104
+ ref: (e) => {
105
+ this.newMsgComp = e;
106
+ },
101
107
  placeholder: this.props.placeholder,
102
108
  MessageBox: this.props.messageBox,
103
109
  toolbar: this.props.toolbar,
@@ -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 l=require("react"),p=require("@progress/kendo-react-common"),o=require("@progress/kendo-react-intl"),c=require("./base/FocusableUponSelection.js");function m(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>s[i]})}}return e.default=s,Object.freeze(e)}const t=m(l),n=class n extends c.FocusableUponSelection{render(){return t.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>this.elementToFocus=e},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?t.createElement("div",{className:"k-chat-bubble"},t.createElement("div",{className:"k-typing-indicator"},t.createElement("span",null),t.createElement("span",null),t.createElement("span",null))):this.props.template?t.createElement(this.props.template,{item:this.props.item}):this.props.item.text?t.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=t.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},o.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=t.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return p.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}};n.defaultProps={dateFormat:"g",tabIndex:-1};let r=n;o.registerForIntl(r);exports.ChatMessage=r;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),p=require("@progress/kendo-react-common"),o=require("@progress/kendo-react-intl"),c=require("./base/FocusableUponSelection.js");function m(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>s[i]})}}return e.default=s,Object.freeze(e)}const t=m(l),n=class n extends c.FocusableUponSelection{render(){return t.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>{this.elementToFocus=e}},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?t.createElement("div",{className:"k-chat-bubble"},t.createElement("div",{className:"k-typing-indicator"},t.createElement("span",null),t.createElement("span",null),t.createElement("span",null))):this.props.template?t.createElement(this.props.template,{item:this.props.item}):this.props.item.text?t.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=t.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},o.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=t.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return p.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}};n.defaultProps={dateFormat:"g",tabIndex:-1};let r=n;o.registerForIntl(r);exports.ChatMessage=r;
@@ -21,7 +21,9 @@ const i = class i extends n {
21
21
  tabIndex: this.props.tabIndex,
22
22
  onClick: () => this.props.onRequestSelection(this.props.item.selectionIndex),
23
23
  onFocus: () => this.props.onRequestSelection(this.props.item.selectionIndex),
24
- ref: (t) => this.elementToFocus = t
24
+ ref: (t) => {
25
+ this.elementToFocus = t;
26
+ }
25
27
  },
26
28
  this.getTimestampView(),
27
29
  this.getMainView(),
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";const c=require("@progress/kendo-react-common"),p=require("react"),h=require("./ChatToolbar.js"),l=require("@progress/kendo-react-buttons"),u=require("@progress/kendo-svg-icons"),g=require("@progress/kendo-react-intl"),n=require("../messages/index.js");function m(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}return e.default=a,Object.freeze(e)}const t=m(p);class f extends t.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=t.createRef(),this.onInputKeyDown=e=>{switch(e.key){case"Enter":return this.sendMessage(e);case"F10":return this.openToolbar(e);default:return}},this.sendMessage=e=>{if(this.props.onMessageSend&&this.inputEl!==null){const s=this.inputEl.value;if(s){const o={author:this.props.user,text:s,timestamp:new Date};this.props.onMessageSend(o,e)}}this.inputEl!==null&&(this.inputEl.value=null)},this.openToolbar=e=>{this.toolbarBtnRef.current!==null&&(e.preventDefault(),this.props.onToolbarActionButtonClick(!this.props.showToolbar,e))}}render(){const e=g.provideLocalizationService(this),s=t.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:r=>this.inputEl=r,"aria-label":e.toLanguageString(n.newMessageMessageInput,n.messages[n.newMessageMessageInput])}),o=t.createElement(l.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:u.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),i=t.createElement(l.Button,{ref:this.toolbarBtnRef,fillMode:"flat",themeColor:"base",icon:"more-horizontal",svgIcon:u.moreHorizontalIcon,onClick:r=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,r),"aria-label":e.toLanguageString(n.newMessageOptionsButton,n.messages[n.newMessageOptionsButton])});return t.createElement(t.Fragment,null,t.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?t.createElement(this.props.MessageBox,{messageInput:s,sendButton:o,toolbarButton:i}):t.createElement(t.Fragment,null,s,t.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),t.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&i,o))),this.props.showToolbar&&t.createElement(h.ChatToolbar,null,this.props.toolbar))}focusInput(){this.inputEl!==null&&this.inputEl.focus()}getClassNames(){return c.classNames("k-input-inner",{"k-focus":this.state.focused})}}module.exports=f;
8
+ "use strict";const c=require("@progress/kendo-react-common"),p=require("react"),h=require("./ChatToolbar.js"),l=require("@progress/kendo-react-buttons"),u=require("@progress/kendo-svg-icons"),g=require("@progress/kendo-react-intl"),n=require("../messages/index.js");function m(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}return e.default=a,Object.freeze(e)}const t=m(p);class f extends t.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=t.createRef(),this.onInputKeyDown=e=>{switch(e.key){case"Enter":return this.sendMessage(e);case"F10":return this.openToolbar(e);default:return}},this.sendMessage=e=>{if(this.props.onMessageSend&&this.inputEl!==null){const s=this.inputEl.value;if(s){const o={author:this.props.user,text:s,timestamp:new Date};this.props.onMessageSend(o,e)}}this.inputEl!==null&&(this.inputEl.value=null)},this.openToolbar=e=>{this.toolbarBtnRef.current!==null&&(e.preventDefault(),this.props.onToolbarActionButtonClick(!this.props.showToolbar,e))}}render(){const e=g.provideLocalizationService(this),s=t.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:r=>{this.inputEl=r},"aria-label":e.toLanguageString(n.newMessageMessageInput,n.messages[n.newMessageMessageInput])}),o=t.createElement(l.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:u.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),i=t.createElement(l.Button,{ref:this.toolbarBtnRef,fillMode:"flat",themeColor:"base",icon:"more-horizontal",svgIcon:u.moreHorizontalIcon,onClick:r=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,r),"aria-label":e.toLanguageString(n.newMessageOptionsButton,n.messages[n.newMessageOptionsButton])});return t.createElement(t.Fragment,null,t.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?t.createElement(this.props.MessageBox,{messageInput:s,sendButton:o,toolbarButton:i}):t.createElement(t.Fragment,null,s,t.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),t.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&i,o))),this.props.showToolbar&&t.createElement(h.ChatToolbar,null,this.props.toolbar))}focusInput(){this.inputEl!==null&&this.inputEl.focus()}getClassNames(){return c.classNames("k-input-inner",{"k-focus":this.state.focused})}}module.exports=f;
@@ -50,7 +50,9 @@ class x extends e.Component {
50
50
  onKeyDown: this.onInputKeyDown,
51
51
  onFocus: () => this.setState({ focused: !0 }),
52
52
  onBlur: () => this.setState({ focused: !1 }),
53
- ref: (n) => this.inputEl = n,
53
+ ref: (n) => {
54
+ this.inputEl = n;
55
+ },
54
56
  "aria-label": t.toLanguageString(
55
57
  l,
56
58
  a[l]
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl"),require("prop-types"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-inputs")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-intl","prop-types","@progress/kendo-svg-icons","@progress/kendo-react-buttons","@progress/kendo-react-layout","@progress/kendo-react-inputs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactIntl,e.PropTypes,e.KendoSvgIcons,e.KendoReactButtons,e.KendoReactLayout,e.KendoReactInputs)}(this,(function(e,t,s,n,o,a,r,i,l){"use strict";function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var p=c(t);let m=class extends p.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}};const u=class extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>this.elementToFocus=e},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?p.createElement("div",{className:"k-chat-bubble"},p.createElement("div",{className:"k-typing-indicator"},p.createElement("span",null),p.createElement("span",null),p.createElement("span",null))):this.props.template?p.createElement(this.props.template,{item:this.props.item}):this.props.item.text?p.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=p.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},n.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=p.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return s.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}};u.defaultProps={dateFormat:"g",tabIndex:-1};let h=u;n.registerForIntl(h);const d=(e,t)=>e&&t.author&&e.id===t.author.id,g=e=>e[e.length-1],I=e=>(t,s,n)=>{const o=n===e-1;return((e,t)=>{const s=t.timestamp,n=g(e);if(s&&(!n||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(s,n.timestamp))){const t={type:"date-marker",timestamp:s,trackBy:s.getTime()};e.push(t)}})(t,s),((e,t,s)=>{const n=g(e);let o;t.typing&&!s||(n&&"message-group"===n.type&&(o=n.messages),o&&d(t.author,g(o))?o.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,s,o),s.attachments&&s.attachments.length>1&&t.push({type:"attachment-group",attachments:s.attachments,attachmentLayout:s.attachmentLayout,timestamp:s.timestamp,trackBy:s}),s.suggestedActions&&o&&t.push({type:"action-group",actions:s.suggestedActions,timestamp:s.timestamp,trackBy:s}),t};let k=class extends m{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===s.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return s.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}},v=class extends p.Component{constructor(){super(...arguments),this.state={selectedItemIndex:null},this.onRequestContainerSelection=()=>this.props.onRequestSelection(this.props.group.selectionIndex),this.onKeyDown=e=>{let t,n,o=null;this.isKeyboardNavigationLeftRight?(t=s.Keys.left,n=s.Keys.right):(t=s.Keys.up,n=s.Keys.down),e.keyCode===t?o=this.navigate(!1):e.keyCode===n&&(o=this.navigate(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())}}static getDerivedStateFromProps(e,t){return e.selected||null===t.selectedItemIndex?e.selected&&null===t.selectedItemIndex?{selectedItemIndex:0}:null:{selectedItemIndex:null}}navigate(e,t=0){let s=null;const n=this.state.selectedItemIndex;return e?null===n?s=t:n<this.getLastSelectionIndex()&&(s=n+1):null===n?s=0:n>0&&(s=n-1),null!==s&&this.setState({selectedItemIndex:s}),s}get isKeyboardNavigationLeftRight(){return!0}getLastSelectionIndex(){let e=-1;if("action-group"===this.props.group.type){const t=this.props.group;e=t.actions?t.actions.length-1:-1}else if("attachment-group"===this.props.group.type){const t=this.props.group;e=t.attachments?t.attachments.length-1:-1}return e}};class E extends v{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return p.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map(((t,s)=>p.createElement(k,{item:t,onActionExecute:this.props.onActionExecute,selected:s===this.state.selectedItemIndex,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,key:s}))))}getClassNames(){return s.classNames("k-quick-replies")}}class y extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>this.elementToFocus=e},this.props.template?p.createElement(this.props.template,{item:this.props.item}):p.createElement("div",{className:"k-card"},p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(void 0!==this.props.tabbable)return this.props.tabbable?0:-1}getClassNames(){return s.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?p.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?p.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return 0===this.props.item.contentType.indexOf("image/")?p.createElement("img",{src:this.props.item.content}):this.props.item.content}}class f extends v{render(){const e=this.isCardDeckLayout(this.props),t=p.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map(((e,t)=>p.createElement(y,{item:e,template:this.props.itemTemplate,selected:t===this.state.selectedItemIndex,tabbable:this.props.isLastGroup&&t===this.state.selectedItemIndex,isFirstItemInGroup:0===t,isLastItemInGroup:t===this.getLastItemIndex(),onClick:()=>this.onAttachmentClick(t),key:t}))));return e?p.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:this.onKeyDown},this.getLeftScrollBtn(),t,this.getRightScrollBtn()):t}get isKeyboardNavigationLeftRight(){return this.isCardDeckLayout(this.props)}getLastItemIndex(){return this.props.group.attachments.length-1}getLeftScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex&&(e=p.createElement(r.Button,{icon:"chevron-left",onClick:()=>this.onNavigateBtnClick(!1),svgIcon:a.chevronLeftIcon})),e}getRightScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex!==this.getLastItemIndex()&&(e=p.createElement(r.Button,{icon:"chevron-right",onClick:()=>this.onNavigateBtnClick(!0),svgIcon:a.chevronRightIcon})),e}onAttachmentClick(e){this.onRequestContainerSelection(),this.setState({selectedItemIndex:e})}onNavigateBtnClick(e){this.onRequestContainerSelection(),this.navigate(e,1)}isCardDeckLayout(e){return"list"!==e.group.attachmentLayout}getClassNames(){return s.classNames({"k-card-list":this.props.group.attachmentLayout,"k-card-deck":this.isCardDeckLayout(this.props)})}}let C=class extends p.Component{render(){const e=this.props.item;return p.createElement("div",{className:"k-timestamp"},n.provideIntlService(this).formatDate(e.timestamp,"D"))}};n.registerForIntl(C);const w="newMessage.sendButton",b="newMessage.optionsButton",x="newMessage.messageInput",N="avatar.alt",T="messageList.ariaLabel",S="aIPrompt.noOutputs",R={[w]:"Send",[b]:"Options",[x]:"Message",[N]:"Avatar",[T]:"Message list",[S]:"No output from AI available"};class L extends p.Component{render(){const{avatarUrl:e,avatarAltText:t,name:s}=this.props.group.author,o=n.provideLocalizationService(this);return p.createElement("div",{className:this.getMsgGroupClassNames()},s&&p.createElement("p",{className:"k-author"},s),e&&p.createElement(i.Avatar,{type:"image"},p.createElement("img",{src:e,alt:void 0!==t?t:o.toLanguageString(N,R[N])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return s.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":d(this.props.user,this.props.group.messages[0])})}getGroupMessagesView(){const e=this.props.group.messages.length-1;return this.props.group.messages.map(((t,s)=>{const n=[p.createElement(this.props.message,{item:t,template:this.props.itemTemplate,selected:t.selectionIndex===this.props.selectedItemIndex,onRequestSelection:this.props.onRequestSelection,tabIndex:s===e&&this.props.isLastGroup?0:-1,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,isOnlyItemInGroup:0===e,key:s})];return t.attachments&&1===t.attachments.length&&n.push(p.createElement(y,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${s}`})),n}))}}const B=p.forwardRef(((e,t)=>{const{className:n,...o}=e,a=p.useRef(null),i=p.useRef(null);p.useImperativeHandle(i,(()=>({element:a.current,props:e}))),p.useImperativeHandle(t,(()=>i.current));const l=p.useMemo((()=>s.classNames("k-chat-toolbar k-toolbar",n)),[n]);return p.useEffect((()=>{null!==a.current&&s.focusFirstFocusableChild(a.current,[...s.TABBABLE_ELEMENTS])}),[]),p.createElement(r.Toolbar,{id:e.id,ref:e=>{e&&(a.current=e.element)},className:l,...o},p.createElement("div",{className:"k-button-list k-toolbar-group"},e.children))}));B.displayName="KendoReactChatToolbar";class D extends p.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=p.createRef(),this.onInputKeyDown=e=>{switch(e.key){case"Enter":return this.sendMessage(e);case"F10":return this.openToolbar(e);default:return}},this.sendMessage=e=>{if(this.props.onMessageSend&&null!==this.inputEl){const t=this.inputEl.value;if(t){const s={author:this.props.user,text:t,timestamp:new Date};this.props.onMessageSend(s,e)}}null!==this.inputEl&&(this.inputEl.value=null)},this.openToolbar=e=>{null!==this.toolbarBtnRef.current&&(e.preventDefault(),this.props.onToolbarActionButtonClick(!this.props.showToolbar,e))}}render(){const e=n.provideLocalizationService(this),t=p.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:e=>this.inputEl=e,"aria-label":e.toLanguageString(x,R[x])}),s=p.createElement(r.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:a.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(w,R[w]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),o=p.createElement(r.Button,{ref:this.toolbarBtnRef,fillMode:"flat",themeColor:"base",icon:"more-horizontal",svgIcon:a.moreHorizontalIcon,onClick:e=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,e),"aria-label":e.toLanguageString(b,R[b])});return p.createElement(p.Fragment,null,p.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?p.createElement(this.props.MessageBox,{messageInput:t,sendButton:s,toolbarButton:o}):p.createElement(p.Fragment,null,t,p.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),p.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&o,s))),this.props.showToolbar&&p.createElement(B,null,this.props.toolbar))}focusInput(){null!==this.inputEl&&this.inputEl.focus()}getClassNames(){return s.classNames("k-input-inner",{"k-focus":this.state.focused})}}const V={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"10.2.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},M=class e extends p.Component{constructor(e){super(e),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.showLicenseWatermark=!1,this.onFocus=()=>{clearTimeout(this.timeoutIdForChatLosingFocus)},this.onBlur=()=>{this.timeoutIdForChatLosingFocus=window.setTimeout((()=>{this.setState({selectedItemIndex:null})}),0)},this.onSelectionRequested=e=>{this.setState({selectedItemIndex:e})},this.onKeyDown=e=>{let t=null;const n=null!==this.state.selectedItemIndex?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===s.Keys.up?null===n?t=0:n>0&&(t=n-1):e.keyCode===s.Keys.down&&(null===n?t=0:n<this.viewItems.lastSelectionIndex&&(t=n+1)),null!==t&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{s.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(s.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value)}this.newMsgComp.focusInput()}},this.showLicenseWatermark=!s.validatePackage(V,{component:"Chat"}),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const e=n.provideLocalizationService(this);return p.createElement("div",{style:{width:this.props.width,position:"relative"},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>this.chatWrapperEl=e},p.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":e.toLanguageString(T,R[T]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>this.viewItemsWrapperEl=e},p.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),p.createElement(D,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>this.newMsgComp=e,placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}),this.showLicenseWatermark&&p.createElement(s.WatermarkOverlay,null))}componentDidMount(){this.setState({isFirstRender:!1},(()=>{this.nextTickId=window.setTimeout((()=>this.scrollViewItemsToBottom()),250)}))}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(e){e.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return s.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(e){return!!(void 0!==e.dir?"rtl"===e.dir:this.chatWrapperEl&&"rtl"===getComputedStyle(this.chatWrapperEl).direction)}renderViewItems(){const t=this.viewItems.length-1;return this.viewItems.map(((s,n)=>"date-marker"===s.type?p.createElement(C,{item:s,key:n}):"message-group"===s.type?p.createElement(L,{group:s,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:n===t,key:n,message:this.props.message||e.defaultProps.message}):"attachment-group"===s.type?p.createElement(f,{group:s,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):"action-group"===s.type?p.createElement(E,{group:s,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):void 0))}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(e){return e.length>0?(e=>{const t=e.slice().reduce(I(e.length),[]);return function(e){let t=0;e.forEach((e=>{"message-group"===e.type?e.messages.forEach((e=>{e.selectionIndex=t++})):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)})),e.lastSelectionIndex=t-1}(t),t})(e):[]}};M.propTypes={messages:o.arrayOf(o.object),user:o.object,messageTemplate:o.any,attachmentTemplate:o.any,width:o.oneOfType([o.string,o.number]),onMessageSend:o.func,onActionExecute:o.func,dir:o.string,messageBox:o.any},M.defaultProps={messages:[],dateFormat:"g",message:h};let A=M;class F extends p.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{s.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return p.createElement("div",{className:"k-card"},p.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),p.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map(((e,t)=>p.createElement("span",{className:"k-card-action",key:t},p.createElement(r.Button,{fillMode:"flat",onClick:t=>this.onBtnClick(e,t)},e.title))))}getTitleView(){let e=null;return this.props.title&&(e=p.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=p.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}const K=e=>{const{activeView:s,toolbarItems:n,activeViewChange:o}=e;return t.createElement("div",{className:"k-prompt-header"},t.createElement(r.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map((e=>t.isValidElement(e)?e:t.createElement(r.Button,{key:e.name,className:s===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>(e=>{null==o||o.call(null,e)})(e.name)},e.buttonText)))))},q=t.forwardRef(((e,s)=>{const{children:n}=e;return t.createElement("div",{className:"k-prompt-content",ref:s},t.createElement("div",{className:"k-prompt-view"},n))}));q.displayName="KendoReactAIPromptContent";const P=e=>{const{children:s}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},s))},O=t.createContext([{},()=>{}]),G=()=>t.useContext(O),z=e=>{const[t]=G();return t.activeView===e.name?e.children:null},W=e=>{const[s,n]=t.useState(!0),{children:o,title:i}=e;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(r.Button,{fillMode:"flat",svgIcon:s?a.chevronUpIcon:a.chevronDownIcon,title:i,onClick:()=>n(!s)},i),s&&t.createElement("div",{className:"k-prompt-expander-content"},o))},U={name:"prompt-view",buttonText:"Ask AI",buttonIcon:a.sparklesIcon},H={name:"Output view",buttonText:"Output",buttonIcon:a.commentIcon},j={name:"Commands view",buttonIcon:a.moreHorizontalIcon},$=e=>null==e?void 0:e.map((e=>t.createElement(i.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&$(e.children||[]))));e.AIPrompt=e=>{const{activeView:n,toolbarItems:o,children:a,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l,style:c,dir:p,className:m,...u}=e,h=o||[U,H],[d,g]=t.useState({activeView:n}),I={...d,activeView:n,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l};return t.createElement(O.Provider,{value:[I,e=>{g(e)}]},t.createElement("div",{className:s.classNames("k-prompt",m),style:c,dir:p,...u},t.createElement(K,{activeView:I.activeView,toolbarItems:h,activeViewChange:r}),a))},e.AIPromptCommandsView=e=>{const{commands:s}=e,[n]=G();return t.createElement(z,{name:j.name},t.createElement(q,null,t.createElement("div",{className:"k-prompt-view"},t.createElement(i.PanelBar,{onSelect:e=>{var t,s,o;const a=null==(s=null==(t=e.target)?void 0:t.props)?void 0:s.data;null!=(o=a.children)&&o.length||n.onCommandExecute&&n.onCommandExecute.call(null,a)},selected:""},$(null!=s?s:[])))))},e.AIPromptContent=q,e.AIPromptFooter=P,e.AIPromptOutputView=e=>{const[s,o]=t.useState(""),l=t.useRef(null),[c]=G(),{outputs:p,showOutputRating:m,outputCard:u}=e,{header:h,body:d,actions:g}=u||{},I=n.useLocalization(),k=(e,t)=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),v()},v=()=>{l&&l.current&&l.current.scrollTo({top:0,behavior:"smooth"})};return t.createElement(z,{name:H.name},t.createElement(q,{ref:l},t.createElement("div",{className:"k-card-list"},p&&p.length>0?p.map(((e,n)=>t.createElement(i.Card,{key:`${e.id}_${n}`},t.createElement(i.CardHeader,null,h?h(e):t.createElement(t.Fragment,null,e.title&&t.createElement(i.CardTitle,null,e.title),e.subTitle&&t.createElement(i.CardSubtitle,null,e.subTitle))),t.createElement(i.CardBody,null,d?d(e):e.responseContent),t.createElement(i.CardActions,null,g?g(e):t.createElement(t.Fragment,null,t.createElement(r.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:s===e.id?a.copyIcon:a.checkIcon,"aria-hidden":"true",onClick:()=>(e=>{null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),o(e.id),setTimeout((()=>{o("")}),1e3)})(e)},"Copy"),t.createElement(r.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:a.rotateIcon,"aria-hidden":"true",onClick:()=>(e=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),v()})(e)},"Retry"),m&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(r.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:a.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"positive")}),t.createElement(r.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:a.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"negative")}))))))):t.createElement(i.Card,null,t.createElement(i.CardBody,null,I.toLanguageString(S,R[S]))))))},e.AIPromptView=e=>{const{promptInput:n=l.TextArea,generateButton:o=r.Button,promptValue:i,promptSuggestions:c}=e,[p,m]=t.useState(i||""),[u]=G(),[h,d]=s.useCustomComponent(o),[g,I]=s.useCustomComponent(n),k={title:"Generate",svgIcon:a.sparklesIcon},v=Object.keys(d).length>0?d:k,E=Object.keys(I).length>0?I:{placeholder:"Ask or generate content with AI ...",rows:2};return t.createElement(z,{name:U.name},t.createElement(q,null,t.createElement(g,{value:p,onChange:e=>{m(e.target.value)},...E}),c&&c.length>0&&t.createElement(W,{title:"Prompt Suggestions"},c.map((e=>t.createElement("div",{key:e,className:"k-prompt-suggestion",onClick:()=>(e=>{m(e)})(e)},e))))),t.createElement(P,null,t.createElement(h,{themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:()=>{u.onPromptRequest&&u.onPromptRequest.call(null,p),m("")},...v},"Generate")))},e.AIPromptViewRender=z,e.Chat=A,e.ChatMessage=h,e.HeroCard=F,e.PromptHeader=K,e.commandsViewDefaults=j,e.outputViewDefaults=H,e.promptViewDefaults=U}));
15
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl"),require("prop-types"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-inputs")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-intl","prop-types","@progress/kendo-svg-icons","@progress/kendo-react-buttons","@progress/kendo-react-layout","@progress/kendo-react-inputs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactIntl,e.PropTypes,e.KendoSvgIcons,e.KendoReactButtons,e.KendoReactLayout,e.KendoReactInputs)}(this,(function(e,t,s,n,o,a,r,i,l){"use strict";function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var p=c(t);let m=class extends p.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}};const u=class extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>{this.elementToFocus=e}},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?p.createElement("div",{className:"k-chat-bubble"},p.createElement("div",{className:"k-typing-indicator"},p.createElement("span",null),p.createElement("span",null),p.createElement("span",null))):this.props.template?p.createElement(this.props.template,{item:this.props.item}):this.props.item.text?p.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=p.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},n.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=p.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return s.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}};u.defaultProps={dateFormat:"g",tabIndex:-1};let h=u;n.registerForIntl(h);const d=(e,t)=>e&&t.author&&e.id===t.author.id,g=e=>e[e.length-1],I=e=>(t,s,n)=>{const o=n===e-1;return((e,t)=>{const s=t.timestamp,n=g(e);if(s&&(!n||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(s,n.timestamp))){const t={type:"date-marker",timestamp:s,trackBy:s.getTime()};e.push(t)}})(t,s),((e,t,s)=>{const n=g(e);let o;t.typing&&!s||(n&&"message-group"===n.type&&(o=n.messages),o&&d(t.author,g(o))?o.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,s,o),s.attachments&&s.attachments.length>1&&t.push({type:"attachment-group",attachments:s.attachments,attachmentLayout:s.attachmentLayout,timestamp:s.timestamp,trackBy:s}),s.suggestedActions&&o&&t.push({type:"action-group",actions:s.suggestedActions,timestamp:s.timestamp,trackBy:s}),t};let k=class extends m{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===s.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return p.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>{this.elementToFocus=e},onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return s.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}},v=class extends p.Component{constructor(){super(...arguments),this.state={selectedItemIndex:null},this.onRequestContainerSelection=()=>this.props.onRequestSelection(this.props.group.selectionIndex),this.onKeyDown=e=>{let t,n,o=null;this.isKeyboardNavigationLeftRight?(t=s.Keys.left,n=s.Keys.right):(t=s.Keys.up,n=s.Keys.down),e.keyCode===t?o=this.navigate(!1):e.keyCode===n&&(o=this.navigate(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())}}static getDerivedStateFromProps(e,t){return e.selected||null===t.selectedItemIndex?e.selected&&null===t.selectedItemIndex?{selectedItemIndex:0}:null:{selectedItemIndex:null}}navigate(e,t=0){let s=null;const n=this.state.selectedItemIndex;return e?null===n?s=t:n<this.getLastSelectionIndex()&&(s=n+1):null===n?s=0:n>0&&(s=n-1),null!==s&&this.setState({selectedItemIndex:s}),s}get isKeyboardNavigationLeftRight(){return!0}getLastSelectionIndex(){let e=-1;if("action-group"===this.props.group.type){const t=this.props.group;e=t.actions?t.actions.length-1:-1}else if("attachment-group"===this.props.group.type){const t=this.props.group;e=t.attachments?t.attachments.length-1:-1}return e}};class E extends v{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return p.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map(((t,s)=>p.createElement(k,{item:t,onActionExecute:this.props.onActionExecute,selected:s===this.state.selectedItemIndex,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,key:s}))))}getClassNames(){return s.classNames("k-quick-replies")}}class y extends m{render(){return p.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>{this.elementToFocus=e}},this.props.template?p.createElement(this.props.template,{item:this.props.item}):p.createElement("div",{className:"k-card"},p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(void 0!==this.props.tabbable)return this.props.tabbable?0:-1}getClassNames(){return s.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?p.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?p.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return 0===this.props.item.contentType.indexOf("image/")?p.createElement("img",{src:this.props.item.content}):this.props.item.content}}class f extends v{render(){const e=this.isCardDeckLayout(this.props),t=p.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map(((e,t)=>p.createElement(y,{item:e,template:this.props.itemTemplate,selected:t===this.state.selectedItemIndex,tabbable:this.props.isLastGroup&&t===this.state.selectedItemIndex,isFirstItemInGroup:0===t,isLastItemInGroup:t===this.getLastItemIndex(),onClick:()=>this.onAttachmentClick(t),key:t}))));return e?p.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:this.onKeyDown},this.getLeftScrollBtn(),t,this.getRightScrollBtn()):t}get isKeyboardNavigationLeftRight(){return this.isCardDeckLayout(this.props)}getLastItemIndex(){return this.props.group.attachments.length-1}getLeftScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex&&(e=p.createElement(r.Button,{icon:"chevron-left",onClick:()=>this.onNavigateBtnClick(!1),svgIcon:a.chevronLeftIcon})),e}getRightScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex!==this.getLastItemIndex()&&(e=p.createElement(r.Button,{icon:"chevron-right",onClick:()=>this.onNavigateBtnClick(!0),svgIcon:a.chevronRightIcon})),e}onAttachmentClick(e){this.onRequestContainerSelection(),this.setState({selectedItemIndex:e})}onNavigateBtnClick(e){this.onRequestContainerSelection(),this.navigate(e,1)}isCardDeckLayout(e){return"list"!==e.group.attachmentLayout}getClassNames(){return s.classNames({"k-card-list":this.props.group.attachmentLayout,"k-card-deck":this.isCardDeckLayout(this.props)})}}let C=class extends p.Component{render(){const e=this.props.item;return p.createElement("div",{className:"k-timestamp"},n.provideIntlService(this).formatDate(e.timestamp,"D"))}};n.registerForIntl(C);const w="newMessage.sendButton",b="newMessage.optionsButton",x="newMessage.messageInput",N="avatar.alt",T="messageList.ariaLabel",S="aIPrompt.noOutputs",R={[w]:"Send",[b]:"Options",[x]:"Message",[N]:"Avatar",[T]:"Message list",[S]:"No output from AI available"};class L extends p.Component{render(){const{avatarUrl:e,avatarAltText:t,name:s}=this.props.group.author,o=n.provideLocalizationService(this);return p.createElement("div",{className:this.getMsgGroupClassNames()},s&&p.createElement("p",{className:"k-author"},s),e&&p.createElement(i.Avatar,{type:"image"},p.createElement("img",{src:e,alt:void 0!==t?t:o.toLanguageString(N,R[N])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return s.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":d(this.props.user,this.props.group.messages[0])})}getGroupMessagesView(){const e=this.props.group.messages.length-1;return this.props.group.messages.map(((t,s)=>{const n=[p.createElement(this.props.message,{item:t,template:this.props.itemTemplate,selected:t.selectionIndex===this.props.selectedItemIndex,onRequestSelection:this.props.onRequestSelection,tabIndex:s===e&&this.props.isLastGroup?0:-1,isFirstItemInGroup:0===s,isLastItemInGroup:s===e,isOnlyItemInGroup:0===e,key:s})];return t.attachments&&1===t.attachments.length&&n.push(p.createElement(y,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${s}`})),n}))}}const B=p.forwardRef(((e,t)=>{const{className:n,...o}=e,a=p.useRef(null),i=p.useRef(null);p.useImperativeHandle(i,(()=>({element:a.current,props:e}))),p.useImperativeHandle(t,(()=>i.current));const l=p.useMemo((()=>s.classNames("k-chat-toolbar k-toolbar",n)),[n]);return p.useEffect((()=>{null!==a.current&&s.focusFirstFocusableChild(a.current,[...s.TABBABLE_ELEMENTS])}),[]),p.createElement(r.Toolbar,{id:e.id,ref:e=>{e&&(a.current=e.element)},className:l,...o},p.createElement("div",{className:"k-button-list k-toolbar-group"},e.children))}));B.displayName="KendoReactChatToolbar";class D extends p.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.toolbarBtnRef=p.createRef(),this.onInputKeyDown=e=>{switch(e.key){case"Enter":return this.sendMessage(e);case"F10":return this.openToolbar(e);default:return}},this.sendMessage=e=>{if(this.props.onMessageSend&&null!==this.inputEl){const t=this.inputEl.value;if(t){const s={author:this.props.user,text:t,timestamp:new Date};this.props.onMessageSend(s,e)}}null!==this.inputEl&&(this.inputEl.value=null)},this.openToolbar=e=>{null!==this.toolbarBtnRef.current&&(e.preventDefault(),this.props.onToolbarActionButtonClick(!this.props.showToolbar,e))}}render(){const e=n.provideLocalizationService(this),t=p.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:e=>{this.inputEl=e},"aria-label":e.toLanguageString(x,R[x])}),s=p.createElement(r.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:a.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(w,R[w]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),o=p.createElement(r.Button,{ref:this.toolbarBtnRef,fillMode:"flat",themeColor:"base",icon:"more-horizontal",svgIcon:a.moreHorizontalIcon,onClick:e=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,e),"aria-label":e.toLanguageString(b,R[b])});return p.createElement(p.Fragment,null,p.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?p.createElement(this.props.MessageBox,{messageInput:t,sendButton:s,toolbarButton:o}):p.createElement(p.Fragment,null,t,p.createElement("span",{className:"k-input-separator k-input-separator-vertical"}),p.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},this.props.toolbar&&o,s))),this.props.showToolbar&&p.createElement(B,null,this.props.toolbar))}focusInput(){null!==this.inputEl&&this.inputEl.focus()}getClassNames(){return s.classNames("k-input-inner",{"k-focus":this.state.focused})}}const V={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"10.2.0-develop.11",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},M=class e extends p.Component{constructor(e){super(e),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.showLicenseWatermark=!1,this.onFocus=()=>{clearTimeout(this.timeoutIdForChatLosingFocus)},this.onBlur=()=>{this.timeoutIdForChatLosingFocus=window.setTimeout((()=>{this.setState({selectedItemIndex:null})}),0)},this.onSelectionRequested=e=>{this.setState({selectedItemIndex:e})},this.onKeyDown=e=>{let t=null;const n=null!==this.state.selectedItemIndex?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===s.Keys.up?null===n?t=0:n>0&&(t=n-1):e.keyCode===s.Keys.down&&(null===n?t=0:n<this.viewItems.lastSelectionIndex&&(t=n+1)),null!==t&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{s.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(s.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value)}this.newMsgComp.focusInput()}},this.showLicenseWatermark=!s.validatePackage(V,{component:"Chat"}),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const e=n.provideLocalizationService(this);return p.createElement("div",{style:{width:this.props.width,position:"relative"},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>{this.chatWrapperEl=e}},p.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":e.toLanguageString(T,R[T]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>{this.viewItemsWrapperEl=e}},p.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),p.createElement(D,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>{this.newMsgComp=e},placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}),this.showLicenseWatermark&&p.createElement(s.WatermarkOverlay,null))}componentDidMount(){this.setState({isFirstRender:!1},(()=>{this.nextTickId=window.setTimeout((()=>this.scrollViewItemsToBottom()),250)}))}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(e){e.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return s.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(e){return!!(void 0!==e.dir?"rtl"===e.dir:this.chatWrapperEl&&"rtl"===getComputedStyle(this.chatWrapperEl).direction)}renderViewItems(){const t=this.viewItems.length-1;return this.viewItems.map(((s,n)=>"date-marker"===s.type?p.createElement(C,{item:s,key:n}):"message-group"===s.type?p.createElement(L,{group:s,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:n===t,key:n,message:this.props.message||e.defaultProps.message}):"attachment-group"===s.type?p.createElement(f,{group:s,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):"action-group"===s.type?p.createElement(E,{group:s,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:s.selectionIndex===this.state.selectedItemIndex,isLastGroup:n===t,key:n}):void 0))}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(e){return e.length>0?(e=>{const t=e.slice().reduce(I(e.length),[]);return function(e){let t=0;e.forEach((e=>{"message-group"===e.type?e.messages.forEach((e=>{e.selectionIndex=t++})):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)})),e.lastSelectionIndex=t-1}(t),t})(e):[]}};M.propTypes={messages:o.arrayOf(o.object),user:o.object,messageTemplate:o.any,attachmentTemplate:o.any,width:o.oneOfType([o.string,o.number]),onMessageSend:o.func,onActionExecute:o.func,dir:o.string,messageBox:o.any},M.defaultProps={messages:[],dateFormat:"g",message:h};let A=M;class F extends p.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{s.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return p.createElement("div",{className:"k-card"},p.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),p.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),p.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map(((e,t)=>p.createElement("span",{className:"k-card-action",key:t},p.createElement(r.Button,{fillMode:"flat",onClick:t=>this.onBtnClick(e,t)},e.title))))}getTitleView(){let e=null;return this.props.title&&(e=p.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=p.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}const K=e=>{const{activeView:s,toolbarItems:n,activeViewChange:o}=e;return t.createElement("div",{className:"k-prompt-header"},t.createElement(r.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map((e=>t.isValidElement(e)?e:t.createElement(r.Button,{key:e.name,className:s===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>(e=>{null==o||o.call(null,e)})(e.name)},e.buttonText)))))},q=t.forwardRef(((e,s)=>{const{children:n}=e;return t.createElement("div",{className:"k-prompt-content",ref:s},t.createElement("div",{className:"k-prompt-view"},n))}));q.displayName="KendoReactAIPromptContent";const P=e=>{const{children:s}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},s))},O=t.createContext([{},()=>{}]),G=()=>t.useContext(O),z=e=>{const[t]=G();return t.activeView===e.name?e.children:null},W=e=>{const[s,n]=t.useState(!0),{children:o,title:i}=e;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(r.Button,{fillMode:"flat",svgIcon:s?a.chevronUpIcon:a.chevronDownIcon,title:i,onClick:()=>n(!s)},i),s&&t.createElement("div",{className:"k-prompt-expander-content"},o))},U={name:"prompt-view",buttonText:"Ask AI",buttonIcon:a.sparklesIcon},H={name:"Output view",buttonText:"Output",buttonIcon:a.commentIcon},j={name:"Commands view",buttonIcon:a.moreHorizontalIcon},$=e=>null==e?void 0:e.map((e=>t.createElement(i.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&$(e.children||[]))));e.AIPrompt=e=>{const{activeView:n,toolbarItems:o,children:a,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l,style:c,dir:p,className:m,...u}=e,h=o||[U,H],[d,g]=t.useState({activeView:n}),I={...d,activeView:n,onActiveViewChange:r,onPromptRequest:i,onCommandExecute:l};return t.createElement(O.Provider,{value:[I,e=>{g(e)}]},t.createElement("div",{className:s.classNames("k-prompt",m),style:c,dir:p,...u},t.createElement(K,{activeView:I.activeView,toolbarItems:h,activeViewChange:r}),a))},e.AIPromptCommandsView=e=>{const{commands:s}=e,[n]=G();return t.createElement(z,{name:j.name},t.createElement(q,null,t.createElement("div",{className:"k-prompt-view"},t.createElement(i.PanelBar,{onSelect:e=>{var t,s,o;const a=null==(s=null==(t=e.target)?void 0:t.props)?void 0:s.data;null!=(o=a.children)&&o.length||n.onCommandExecute&&n.onCommandExecute.call(null,a)},selected:""},$(null!=s?s:[])))))},e.AIPromptContent=q,e.AIPromptFooter=P,e.AIPromptOutputView=e=>{const[s,o]=t.useState(""),l=t.useRef(null),[c]=G(),{outputs:p,showOutputRating:m,outputCard:u}=e,{header:h,body:d,actions:g}=u||{},I=n.useLocalization(),k=(e,t)=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),v()},v=()=>{l&&l.current&&l.current.scrollTo({top:0,behavior:"smooth"})};return t.createElement(z,{name:H.name},t.createElement(q,{ref:l},t.createElement("div",{className:"k-card-list"},p&&p.length>0?p.map(((e,n)=>t.createElement(i.Card,{key:`${e.id}_${n}`},t.createElement(i.CardHeader,null,h?h(e):t.createElement(t.Fragment,null,e.title&&t.createElement(i.CardTitle,null,e.title),e.subTitle&&t.createElement(i.CardSubtitle,null,e.subTitle))),t.createElement(i.CardBody,null,d?d(e):e.responseContent),t.createElement(i.CardActions,null,g?g(e):t.createElement(t.Fragment,null,t.createElement(r.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:s===e.id?a.copyIcon:a.checkIcon,"aria-hidden":"true",onClick:()=>(e=>{null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),o(e.id),setTimeout((()=>{o("")}),1e3)})(e)},"Copy"),t.createElement(r.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:a.rotateIcon,"aria-hidden":"true",onClick:()=>(e=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),v()})(e)},"Retry"),m&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(r.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:a.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"positive")}),t.createElement(r.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:a.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>k(e,"negative")}))))))):t.createElement(i.Card,null,t.createElement(i.CardBody,null,I.toLanguageString(S,R[S]))))))},e.AIPromptView=e=>{const{promptInput:n=l.TextArea,generateButton:o=r.Button,promptValue:i,promptSuggestions:c}=e,[p,m]=t.useState(i||""),[u]=G(),[h,d]=s.useCustomComponent(o),[g,I]=s.useCustomComponent(n),k={title:"Generate",svgIcon:a.sparklesIcon},v=Object.keys(d).length>0?d:k,E=Object.keys(I).length>0?I:{placeholder:"Ask or generate content with AI ...",rows:2};return t.createElement(z,{name:U.name},t.createElement(q,null,t.createElement(g,{value:p,onChange:e=>{m(e.target.value)},...E}),c&&c.length>0&&t.createElement(W,{title:"Prompt Suggestions"},c.map((e=>t.createElement("div",{key:e,className:"k-prompt-suggestion",onClick:()=>(e=>{m(e)})(e)},e))))),t.createElement(P,null,t.createElement(h,{themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:()=>{u.onPromptRequest&&u.onPromptRequest.call(null,p),m("")},...v},"Generate")))},e.AIPromptViewRender=z,e.Chat=A,e.ChatMessage=h,e.HeroCard=F,e.PromptHeader=K,e.commandsViewDefaults=j,e.outputViewDefaults=H,e.promptViewDefaults=U}));
package/index.d.mts CHANGED
@@ -10,7 +10,7 @@ import { ButtonProps } from '@progress/kendo-react-buttons';
10
10
  import { CustomComponent } from '@progress/kendo-react-common';
11
11
  import { default as default_2 } from 'prop-types';
12
12
  import { default as default_3 } from 'react';
13
- import { JSX as JSX_2 } from 'react/jsx-runtime';
13
+ import { JSX } from 'react/jsx-runtime';
14
14
  import * as React_2 from 'react';
15
15
  import { SVGIcon } from '@progress/kendo-svg-icons';
16
16
  import { SVGIcon as SVGIcon_2 } from '@progress/kendo-react-common';
@@ -52,7 +52,7 @@ export declare type ActionType = 'openUrl' | 'reply' | 'call' | any;
52
52
  /**
53
53
  * Represents the KendoReact AIPrompt component.
54
54
  */
55
- export declare const AIPrompt: (props: AIPromptProps) => JSX_2.Element;
55
+ export declare const AIPrompt: (props: AIPromptProps) => JSX.Element;
56
56
 
57
57
  /**
58
58
  * The fields of the AIPromptOutputView card prop.
@@ -75,7 +75,7 @@ declare interface AIPromptCardInterface {
75
75
  /**
76
76
  * The props of the AIPromptCommandsView component.
77
77
  */
78
- export declare const AIPromptCommandsView: (props: AIPromptCommandsViewProps) => JSX_2.Element;
78
+ export declare const AIPromptCommandsView: (props: AIPromptCommandsViewProps) => JSX.Element;
79
79
 
80
80
  /**
81
81
  * The props of the AIPromptCommandsView component.
@@ -109,7 +109,7 @@ declare interface AIPromptContentProps {
109
109
  /**
110
110
  * Represents the KendoReact AIPromptFooter component.
111
111
  */
112
- export declare const AIPromptFooter: (props: AIPromptFooterProps) => JSX_2.Element;
112
+ export declare const AIPromptFooter: (props: AIPromptFooterProps) => JSX.Element;
113
113
 
114
114
  /**
115
115
  * The props of the AIPromptFooter component.
@@ -132,35 +132,59 @@ declare interface AIPromptHeaderProps {
132
132
 
133
133
  export declare interface AIPromptOutputInterface {
134
134
  /**
135
- * The unique identifier of the command.
135
+ * Example usage of the `id` property:
136
+ * ```jsx
137
+ * const output = { id: 1, responseContent: 'Generated content' };
138
+ * ```
136
139
  */
137
140
  id: string | number;
138
141
  /**
139
- * An optional custom title for the prompt output.
142
+ * Example usage of the `title` property:
143
+ * ```jsx
144
+ * const output = { title: 'Generated Title', responseContent: 'Generated content' };
145
+ * ```
140
146
  */
141
147
  title?: string;
142
148
  /**
143
- * An optional custom sub title for the prompt output.
149
+ * Example usage of the `subTitle` property:
150
+ * ```jsx
151
+ * const output = { subTitle: 'Generated Subtitle', responseContent: 'Generated content' };
152
+ * ```
144
153
  */
145
154
  subTitle?: string;
146
155
  /**
147
- * The prompt that initiated the output generation.
156
+ * Example usage of the `prompt` property:
157
+ * ```jsx
158
+ * const output = { prompt: 'User prompt', responseContent: 'Generated content' };
159
+ * ```
148
160
  */
149
161
  prompt?: string;
150
162
  /**
151
- * The text content of the prompt output.
163
+ * Example usage of the `responseContent` property:
164
+ * ```jsx
165
+ * const output = { responseContent: 'Generated content' };
166
+ * ```
152
167
  */
153
168
  responseContent: string;
154
169
  /**
155
- * Specifies if the prompt generation was initiated via the retry button.
170
+ * Example usage of the `isRetry` property:
171
+ * ```jsx
172
+ * const output = { isRetry: true, responseContent: 'Generated content' };
173
+ * ```
156
174
  */
157
175
  isRetry?: boolean;
158
176
  /**
159
- * The prompt output rating.
177
+ * Example usage of the `ratingType` property:
178
+ * ```jsx
179
+ * const output = { ratingType: 'positive', responseContent: 'Generated content' };
180
+ * ```
160
181
  */
161
182
  ratingType?: string;
162
183
  /**
163
184
  * Optionally specifies a command, if the prompt generation was triggered via a command.
185
+ * ```jsx
186
+ * const output = { command: { name: 'Retry' }, responseContent: 'Generated content' };
187
+ * ```
164
188
  */
165
189
  command?: CommandInterface;
166
190
  }
@@ -168,7 +192,7 @@ export declare interface AIPromptOutputInterface {
168
192
  /**
169
193
  * Represents the KendoReact AIPromptOutputView component.
170
194
  */
171
- export declare const AIPromptOutputView: (props: AIPromptOutputViewProps) => JSX_2.Element;
195
+ export declare const AIPromptOutputView: (props: AIPromptOutputViewProps) => JSX.Element;
172
196
 
173
197
  /**
174
198
  * The props of the AIPromptOutputView component.
@@ -209,46 +233,75 @@ declare interface AIPromptOutputViewProps {
209
233
  */
210
234
  export declare interface AIPromptProps extends default_3.HTMLAttributes<HTMLElement> {
211
235
  /**
212
- * The styles that are applied to the component.
236
+ * Example usage of the `style` property:
237
+ * ```jsx
238
+ * <AIPrompt style={{ backgroundColor: 'lightblue' }} />
239
+ * ```
213
240
  */
214
241
  style?: default_3.CSSProperties;
215
242
  /**
216
- * Name of the active view.
243
+ * Example usage of the `activeView` property:
244
+ * ```jsx
245
+ * <AIPrompt activeView="promptView" />
246
+ * ```
217
247
  */
218
248
  activeView: typeof promptViewDefaults.name | typeof outputViewDefaults.name | typeof commandsViewDefaults.name | string;
219
249
  /**
220
- * Collection with items that will override the default Toolbar items.
250
+ * Example usage of the `toolbarItems` property:
251
+ * ```jsx
252
+ * <AIPrompt toolbarItems={[<CustomToolbarItem />]} />
253
+ * ```
221
254
  */
222
255
  toolbarItems?: (AIPromptToolbarItemInterface | default_3.ReactNode)[];
223
256
  /**
224
- * The collection of generated prompt outputs that will be rendered in the Output view.
257
+ * Example usage of the `outputs` property:
258
+ * ```jsx
259
+ * <AIPrompt outputs={[{ id: 1, responseContent: 'Generated content' }]} />
260
+ * ```
225
261
  */
226
262
  outputs?: AIPromptOutputInterface[];
227
263
  /**
228
- * Specifies the AIPrompt children elements.
264
+ * Example usage of the `children` property:
265
+ * ```jsx
266
+ * <AIPrompt>
267
+ * <div>Custom content</div>
268
+ * </AIPrompt>
269
+ * ```
229
270
  */
230
271
  children?: default_3.ReactNode;
231
272
  /**
232
- * The placeholder text for the Prompt view textarea.
273
+ * Example usage of the `promptPlaceholder` property:
274
+ * ```jsx
275
+ * <AIPrompt promptPlaceholder="Type your prompt here..." />
276
+ * ```
233
277
  */
234
278
  promptPlaceholder?: string;
235
279
  /**
236
- * Represents the `dir` HTML attribute.
280
+ * Example usage of the `dir` property:
281
+ * ```jsx
282
+ * <AIPrompt dir="rtl" />
283
+ * ```
237
284
  */
238
285
  dir?: string;
239
286
  /**
240
- * The onActiveViewChange event handler of the KendoReact AIPrompt component.
241
- * Fires when active view is changed. Exposes the name of the new active view as event data.
287
+ * Example usage of the `onActiveViewChange` property:
288
+ * ```jsx
289
+ * <AIPrompt onActiveViewChange={(name) => console.log('Active view changed to:', name)} />
290
+ * ```
242
291
  */
243
292
  onActiveViewChange?: (name: string) => void;
244
293
  /**
245
- * The onCommandExecute event handler of the KendoReact AIPrompt component.
246
- * Fires each time the user clicks a command in the Command view. Exposes the selected command as event data.
294
+ * Example usage of the `onCommandExecute` property:
295
+ * ```jsx
296
+ * <AIPrompt onCommandExecute={(command) => console.log('Command executed:', command)} />
297
+ * ```
247
298
  */
248
299
  onCommandExecute?: (command: CommandInterface) => void;
249
300
  /**
250
- * The onPromptRequest event handler of the KendoReact AIPrompt component.
251
- * Fires when user clicks the `Generate` button in the Prompt view.
301
+ * Example usage of the `onPromptRequest` property:
302
+ * ```jsx
303
+ * <AIPrompt onPromptRequest={(prompt) => console.log('Prompt requested:', prompt)} />
304
+ * ```
252
305
  */
253
306
  onPromptRequest?: (prompt?: string, outputItem?: AIPromptOutputInterface) => void;
254
307
  }
@@ -274,7 +327,7 @@ export declare interface AIPromptToolbarItemInterface {
274
327
  /**
275
328
  * The props of the AIPromptCommandsView component.
276
329
  */
277
- export declare const AIPromptView: (props: AIPromptViewProps) => JSX_2.Element;
330
+ export declare const AIPromptView: (props: AIPromptViewProps) => JSX.Element;
278
331
 
279
332
  /**
280
333
  * The properties of the AIPromptView component.
@@ -394,7 +447,7 @@ export declare class Chat extends React_2.Component<ChatProps, ChatState> {
394
447
  /**
395
448
  * @hidden
396
449
  */
397
- render(): JSX_2.Element;
450
+ render(): JSX.Element;
398
451
  /**
399
452
  * @hidden
400
453
  */
@@ -444,7 +497,7 @@ export declare class ChatMessage extends FocusableUponSelection<ChatMessageProps
444
497
  /**
445
498
  * @hidden
446
499
  */
447
- render(): JSX_2.Element;
500
+ render(): JSX.Element;
448
501
  private getMainView;
449
502
  private getTimestampView;
450
503
  private getStatusView;
@@ -458,15 +511,15 @@ export declare interface ChatMessageBoxProps {
458
511
  /**
459
512
  * Sets the input message of the Chat component.
460
513
  */
461
- messageInput: JSX.Element;
514
+ messageInput: React.ReactElement;
462
515
  /**
463
516
  * Sets the toolbar button of the Chat component.
464
517
  */
465
- toolbarButton: JSX.Element;
518
+ toolbarButton: React.ReactElement;
466
519
  /**
467
520
  * Sets the send button of the Chat component.
468
521
  */
469
- sendButton: JSX.Element;
522
+ sendButton: React.ReactElement;
470
523
  }
471
524
 
472
525
  /**
@@ -671,7 +724,7 @@ export declare class HeroCard extends React_2.Component<HeroCardProps, {}> {
671
724
  /**
672
725
  * @hidden
673
726
  */
674
- render(): JSX_2.Element;
727
+ render(): JSX.Element;
675
728
  private onBtnClick;
676
729
  private getActionsView;
677
730
  private getTitleView;
@@ -783,7 +836,7 @@ export declare const outputViewDefaults: AIPromptToolbarItemInterface;
783
836
  /**
784
837
  * @hidden
785
838
  */
786
- export declare const PromptHeader: (props: AIPromptHeaderProps) => JSX_2.Element;
839
+ export declare const PromptHeader: (props: AIPromptHeaderProps) => JSX.Element;
787
840
 
788
841
  /**
789
842
  * Specifies the default values for Prompt view Toolbar.
package/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ButtonProps } from '@progress/kendo-react-buttons';
10
10
  import { CustomComponent } from '@progress/kendo-react-common';
11
11
  import { default as default_2 } from 'prop-types';
12
12
  import { default as default_3 } from 'react';
13
- import { JSX as JSX_2 } from 'react/jsx-runtime';
13
+ import { JSX } from 'react/jsx-runtime';
14
14
  import * as React_2 from 'react';
15
15
  import { SVGIcon } from '@progress/kendo-svg-icons';
16
16
  import { SVGIcon as SVGIcon_2 } from '@progress/kendo-react-common';
@@ -52,7 +52,7 @@ export declare type ActionType = 'openUrl' | 'reply' | 'call' | any;
52
52
  /**
53
53
  * Represents the KendoReact AIPrompt component.
54
54
  */
55
- export declare const AIPrompt: (props: AIPromptProps) => JSX_2.Element;
55
+ export declare const AIPrompt: (props: AIPromptProps) => JSX.Element;
56
56
 
57
57
  /**
58
58
  * The fields of the AIPromptOutputView card prop.
@@ -75,7 +75,7 @@ declare interface AIPromptCardInterface {
75
75
  /**
76
76
  * The props of the AIPromptCommandsView component.
77
77
  */
78
- export declare const AIPromptCommandsView: (props: AIPromptCommandsViewProps) => JSX_2.Element;
78
+ export declare const AIPromptCommandsView: (props: AIPromptCommandsViewProps) => JSX.Element;
79
79
 
80
80
  /**
81
81
  * The props of the AIPromptCommandsView component.
@@ -109,7 +109,7 @@ declare interface AIPromptContentProps {
109
109
  /**
110
110
  * Represents the KendoReact AIPromptFooter component.
111
111
  */
112
- export declare const AIPromptFooter: (props: AIPromptFooterProps) => JSX_2.Element;
112
+ export declare const AIPromptFooter: (props: AIPromptFooterProps) => JSX.Element;
113
113
 
114
114
  /**
115
115
  * The props of the AIPromptFooter component.
@@ -132,35 +132,59 @@ declare interface AIPromptHeaderProps {
132
132
 
133
133
  export declare interface AIPromptOutputInterface {
134
134
  /**
135
- * The unique identifier of the command.
135
+ * Example usage of the `id` property:
136
+ * ```jsx
137
+ * const output = { id: 1, responseContent: 'Generated content' };
138
+ * ```
136
139
  */
137
140
  id: string | number;
138
141
  /**
139
- * An optional custom title for the prompt output.
142
+ * Example usage of the `title` property:
143
+ * ```jsx
144
+ * const output = { title: 'Generated Title', responseContent: 'Generated content' };
145
+ * ```
140
146
  */
141
147
  title?: string;
142
148
  /**
143
- * An optional custom sub title for the prompt output.
149
+ * Example usage of the `subTitle` property:
150
+ * ```jsx
151
+ * const output = { subTitle: 'Generated Subtitle', responseContent: 'Generated content' };
152
+ * ```
144
153
  */
145
154
  subTitle?: string;
146
155
  /**
147
- * The prompt that initiated the output generation.
156
+ * Example usage of the `prompt` property:
157
+ * ```jsx
158
+ * const output = { prompt: 'User prompt', responseContent: 'Generated content' };
159
+ * ```
148
160
  */
149
161
  prompt?: string;
150
162
  /**
151
- * The text content of the prompt output.
163
+ * Example usage of the `responseContent` property:
164
+ * ```jsx
165
+ * const output = { responseContent: 'Generated content' };
166
+ * ```
152
167
  */
153
168
  responseContent: string;
154
169
  /**
155
- * Specifies if the prompt generation was initiated via the retry button.
170
+ * Example usage of the `isRetry` property:
171
+ * ```jsx
172
+ * const output = { isRetry: true, responseContent: 'Generated content' };
173
+ * ```
156
174
  */
157
175
  isRetry?: boolean;
158
176
  /**
159
- * The prompt output rating.
177
+ * Example usage of the `ratingType` property:
178
+ * ```jsx
179
+ * const output = { ratingType: 'positive', responseContent: 'Generated content' };
180
+ * ```
160
181
  */
161
182
  ratingType?: string;
162
183
  /**
163
184
  * Optionally specifies a command, if the prompt generation was triggered via a command.
185
+ * ```jsx
186
+ * const output = { command: { name: 'Retry' }, responseContent: 'Generated content' };
187
+ * ```
164
188
  */
165
189
  command?: CommandInterface;
166
190
  }
@@ -168,7 +192,7 @@ export declare interface AIPromptOutputInterface {
168
192
  /**
169
193
  * Represents the KendoReact AIPromptOutputView component.
170
194
  */
171
- export declare const AIPromptOutputView: (props: AIPromptOutputViewProps) => JSX_2.Element;
195
+ export declare const AIPromptOutputView: (props: AIPromptOutputViewProps) => JSX.Element;
172
196
 
173
197
  /**
174
198
  * The props of the AIPromptOutputView component.
@@ -209,46 +233,75 @@ declare interface AIPromptOutputViewProps {
209
233
  */
210
234
  export declare interface AIPromptProps extends default_3.HTMLAttributes<HTMLElement> {
211
235
  /**
212
- * The styles that are applied to the component.
236
+ * Example usage of the `style` property:
237
+ * ```jsx
238
+ * <AIPrompt style={{ backgroundColor: 'lightblue' }} />
239
+ * ```
213
240
  */
214
241
  style?: default_3.CSSProperties;
215
242
  /**
216
- * Name of the active view.
243
+ * Example usage of the `activeView` property:
244
+ * ```jsx
245
+ * <AIPrompt activeView="promptView" />
246
+ * ```
217
247
  */
218
248
  activeView: typeof promptViewDefaults.name | typeof outputViewDefaults.name | typeof commandsViewDefaults.name | string;
219
249
  /**
220
- * Collection with items that will override the default Toolbar items.
250
+ * Example usage of the `toolbarItems` property:
251
+ * ```jsx
252
+ * <AIPrompt toolbarItems={[<CustomToolbarItem />]} />
253
+ * ```
221
254
  */
222
255
  toolbarItems?: (AIPromptToolbarItemInterface | default_3.ReactNode)[];
223
256
  /**
224
- * The collection of generated prompt outputs that will be rendered in the Output view.
257
+ * Example usage of the `outputs` property:
258
+ * ```jsx
259
+ * <AIPrompt outputs={[{ id: 1, responseContent: 'Generated content' }]} />
260
+ * ```
225
261
  */
226
262
  outputs?: AIPromptOutputInterface[];
227
263
  /**
228
- * Specifies the AIPrompt children elements.
264
+ * Example usage of the `children` property:
265
+ * ```jsx
266
+ * <AIPrompt>
267
+ * <div>Custom content</div>
268
+ * </AIPrompt>
269
+ * ```
229
270
  */
230
271
  children?: default_3.ReactNode;
231
272
  /**
232
- * The placeholder text for the Prompt view textarea.
273
+ * Example usage of the `promptPlaceholder` property:
274
+ * ```jsx
275
+ * <AIPrompt promptPlaceholder="Type your prompt here..." />
276
+ * ```
233
277
  */
234
278
  promptPlaceholder?: string;
235
279
  /**
236
- * Represents the `dir` HTML attribute.
280
+ * Example usage of the `dir` property:
281
+ * ```jsx
282
+ * <AIPrompt dir="rtl" />
283
+ * ```
237
284
  */
238
285
  dir?: string;
239
286
  /**
240
- * The onActiveViewChange event handler of the KendoReact AIPrompt component.
241
- * Fires when active view is changed. Exposes the name of the new active view as event data.
287
+ * Example usage of the `onActiveViewChange` property:
288
+ * ```jsx
289
+ * <AIPrompt onActiveViewChange={(name) => console.log('Active view changed to:', name)} />
290
+ * ```
242
291
  */
243
292
  onActiveViewChange?: (name: string) => void;
244
293
  /**
245
- * The onCommandExecute event handler of the KendoReact AIPrompt component.
246
- * Fires each time the user clicks a command in the Command view. Exposes the selected command as event data.
294
+ * Example usage of the `onCommandExecute` property:
295
+ * ```jsx
296
+ * <AIPrompt onCommandExecute={(command) => console.log('Command executed:', command)} />
297
+ * ```
247
298
  */
248
299
  onCommandExecute?: (command: CommandInterface) => void;
249
300
  /**
250
- * The onPromptRequest event handler of the KendoReact AIPrompt component.
251
- * Fires when user clicks the `Generate` button in the Prompt view.
301
+ * Example usage of the `onPromptRequest` property:
302
+ * ```jsx
303
+ * <AIPrompt onPromptRequest={(prompt) => console.log('Prompt requested:', prompt)} />
304
+ * ```
252
305
  */
253
306
  onPromptRequest?: (prompt?: string, outputItem?: AIPromptOutputInterface) => void;
254
307
  }
@@ -274,7 +327,7 @@ export declare interface AIPromptToolbarItemInterface {
274
327
  /**
275
328
  * The props of the AIPromptCommandsView component.
276
329
  */
277
- export declare const AIPromptView: (props: AIPromptViewProps) => JSX_2.Element;
330
+ export declare const AIPromptView: (props: AIPromptViewProps) => JSX.Element;
278
331
 
279
332
  /**
280
333
  * The properties of the AIPromptView component.
@@ -394,7 +447,7 @@ export declare class Chat extends React_2.Component<ChatProps, ChatState> {
394
447
  /**
395
448
  * @hidden
396
449
  */
397
- render(): JSX_2.Element;
450
+ render(): JSX.Element;
398
451
  /**
399
452
  * @hidden
400
453
  */
@@ -444,7 +497,7 @@ export declare class ChatMessage extends FocusableUponSelection<ChatMessageProps
444
497
  /**
445
498
  * @hidden
446
499
  */
447
- render(): JSX_2.Element;
500
+ render(): JSX.Element;
448
501
  private getMainView;
449
502
  private getTimestampView;
450
503
  private getStatusView;
@@ -458,15 +511,15 @@ export declare interface ChatMessageBoxProps {
458
511
  /**
459
512
  * Sets the input message of the Chat component.
460
513
  */
461
- messageInput: JSX.Element;
514
+ messageInput: React.ReactElement;
462
515
  /**
463
516
  * Sets the toolbar button of the Chat component.
464
517
  */
465
- toolbarButton: JSX.Element;
518
+ toolbarButton: React.ReactElement;
466
519
  /**
467
520
  * Sets the send button of the Chat component.
468
521
  */
469
- sendButton: JSX.Element;
522
+ sendButton: React.ReactElement;
470
523
  }
471
524
 
472
525
  /**
@@ -671,7 +724,7 @@ export declare class HeroCard extends React_2.Component<HeroCardProps, {}> {
671
724
  /**
672
725
  * @hidden
673
726
  */
674
- render(): JSX_2.Element;
727
+ render(): JSX.Element;
675
728
  private onBtnClick;
676
729
  private getActionsView;
677
730
  private getTitleView;
@@ -783,7 +836,7 @@ export declare const outputViewDefaults: AIPromptToolbarItemInterface;
783
836
  /**
784
837
  * @hidden
785
838
  */
786
- export declare const PromptHeader: (props: AIPromptHeaderProps) => JSX_2.Element;
839
+ export declare const PromptHeader: (props: AIPromptHeaderProps) => JSX.Element;
787
840
 
788
841
  /**
789
842
  * Specifies the default values for Prompt view Toolbar.
@@ -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: 1743432529,version:"10.2.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1745388323,version:"10.2.0-develop.11",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: 1743432529,
14
- version: "10.2.0-develop.1",
13
+ publishDate: 1745388323,
14
+ version: "10.2.0-develop.11",
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": "10.2.0-develop.1",
3
+ "version": "10.2.0-develop.11",
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.5.1",
29
- "@progress/kendo-react-buttons": "10.2.0-develop.1",
30
- "@progress/kendo-react-common": "10.2.0-develop.1",
31
- "@progress/kendo-react-intl": "10.2.0-develop.1",
32
- "@progress/kendo-react-inputs": "10.2.0-develop.1",
33
- "@progress/kendo-react-layout": "10.2.0-develop.1",
29
+ "@progress/kendo-react-buttons": "10.2.0-develop.11",
30
+ "@progress/kendo-react-common": "10.2.0-develop.11",
31
+ "@progress/kendo-react-intl": "10.2.0-develop.11",
32
+ "@progress/kendo-react-inputs": "10.2.0-develop.11",
33
+ "@progress/kendo-react-layout": "10.2.0-develop.11",
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": 1743432529,
62
+ "publishDate": 1745388323,
63
63
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
64
64
  }
65
65
  },