@progress/kendo-vue-conversational-ui 8.1.0-develop.4 → 8.1.0-develop.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-vue-conversational-ui.js +1 -1
- package/index.d.mts +6 -0
- package/index.d.ts +6 -0
- package/index.js +1 -1
- package/index.mjs +28 -20
- package/messages/main.d.ts +25 -5
- package/messages/main.js +1 -1
- package/messages/main.mjs +20 -8
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -7
- package/prompt-box/Events.d.ts +76 -0
- package/prompt-box/FileBox.d.ts +60 -0
- package/prompt-box/FileBox.js +8 -0
- package/prompt-box/FileBox.mjs +140 -0
- package/prompt-box/PromptBox.d.ts +180 -0
- package/prompt-box/PromptBox.js +8 -0
- package/prompt-box/PromptBox.mjs +472 -0
- package/prompt-box/PromptBoxActionButton.d.ts +20 -0
- package/prompt-box/PromptBoxActionButton.js +8 -0
- package/prompt-box/PromptBoxActionButton.mjs +19 -0
- package/prompt-box/PromptBoxSpeechToTextButton.d.ts +20 -0
- package/prompt-box/PromptBoxSpeechToTextButton.js +8 -0
- package/prompt-box/PromptBoxSpeechToTextButton.mjs +19 -0
- package/prompt-box/PromptBoxUploadButton.d.ts +95 -0
- package/prompt-box/PromptBoxUploadButton.js +8 -0
- package/prompt-box/PromptBoxUploadButton.mjs +77 -0
- package/prompt-box/interfaces/PromptBoxProps.d.ts +197 -0
|
@@ -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("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-vue-layout"),require("@progress/kendo-vue-intl")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-buttons","@progress/kendo-svg-icons","@progress/kendo-vue-inputs","@progress/kendo-vue-layout","@progress/kendo-vue-intl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueConversationalUi={},e.Vue,e.KendoVueCommon,e.KendoVueButtons,e.KendoSVGIcons,e.KendoVueInputs,e.KendoVueLayout,e.KendoVueIntl)}(this,function(e,t,o,n,i,a,s,r){"use strict";function l(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const d=t.defineComponent({name:"KendoAIPromptHeader",props:{activeView:String,toolbarItems:Array,onActiveviewchange:Function},methods:{handleClick(e){this.$emit("activeviewchange",e)}},render(){let e;const{activeView:i,toolbarItems:a}=this.$props;return t.createVNode("div",{class:"k-prompt-header"},[t.createVNode(n.Toolbar,{overflow:"none",keyboardNavigation:!1,class:"k-toolbar-flat"},l(e=a.map(function(e){const a=o.getTemplate.call(this,{h:t.h,template:e.content,defaultRendering:null,additionalProps:{item:e}});return e.content?a:t.createVNode(n.Button,{type:"button",key:e.name,class:o.classNames("k-toolbar-item",{"k-selected":i===e.name}),size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,onClick:()=>this.handleClick(e.name)},{default:()=>[e.buttonText]})},this))?e:{default:()=>[e]})])}}),u={name:"Output view",buttonText:"Output",buttonIcon:i.commentIcon},c={name:"Commands view",buttonIcon:i.moreHorizontalIcon},p={name:"Prompt view",buttonText:"Ask AI",buttonIcon:i.sparklesIcon},m={name:"@progress/kendo-vue-conversational-ui",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:0,version:"8.1.0-develop.4",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"},h=t.defineComponent({name:"KendoAIPrompt",props:{activeView:{type:String,required:!0},dir:String,toolbarItems:Array,outputs:Array,promptPlaceholder:String,streaming:Boolean,loading:Boolean,suggestionsView:{type:String,default:"classic"}},provide(){return{kendoAIPrompt:this.$data.contextState}},data(){return{showLicenseWatermark:!1,licenseMessage:"",contextState:{activeView:this.$props.activeView,streaming:this.$props.streaming,loading:this.$props.loading,onCancel:this.onCancel,onActiveViewChange:this.onActiveViewChange,onPromptRequest:this.onPromptRequest,onCommandExecute:this.onCommandExecute,onStateAction:this.onStateAction,suggestionsView:this.$props.suggestionsView}}},watch:{activeView(e){this.contextState.activeView=e},streaming(e){this.contextState.streaming=e},loading(e){this.contextState.loading=e}},methods:{onStateAction(e){this.contextState.activeView=e.activeView},onActiveViewChange(e){this.$emit("activeviewchange",e)},onPromptRequest(e,t){this.$emit("promptrequest",e,t)},onCommandExecute(e){this.$emit("commandexecute",e)},onCancel(){this.$emit("cancel")}},render(){o.validatePackage(m),this.showLicenseWatermark=o.shouldShowValidationUI(m),this.licenseMessage=o.getLicenseMessage(m);const e=o.getDefaultSlots(this),{toolbarItems:n,dir:i}=this.$props,a=(n||[p,u]).map(e=>{const t=o.templateRendering.call(this,e.content,o.getListeners.call(this));return{...e,content:t}}),s=this.showLicenseWatermark?t.createVNode(o.WatermarkOverlay,{message:this.licenseMessage},null):null;return t.createVNode("div",{class:"k-prompt",dir:i},[t.createVNode(d,{activeView:this.contextState.activeView,toolbarItems:a,onActiveviewchange:this.onActiveViewChange},null),e,s])}}),g=t.defineComponent({name:"KendoAIPromptFooter",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-footer"},[t.createVNode("div",{class:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},[e])])}}),v=t.defineComponent({name:"KendoAIPromptContent",props:{onCancel:Function,streaming:Boolean},inject:{kendoAIPrompt:{default:null}},computed:{showFloatingButton(){var e;const t=(null==(e=this.kendoAIPrompt)?void 0:e.activeView)===u.name;return this.streaming&&t}},methods:{handleKeyDown(e){"Escape"===e.key&&this.showFloatingButton&&this.onCancel&&(e.preventDefault(),this.$props.onCancel())}},render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-content",onKeydown:this.handleKeyDown},[this.showFloatingButton&&t.createVNode(n.FloatingActionButton,{onClick:this.onCancel,svgIcon:i.stopSmIcon,size:"small",positionMode:"absolute",class:"k-prompt-stop-fab k-generating"},null),t.createVNode("div",{class:"k-prompt-view"},[e])])}}),k=t.defineComponent({name:"KendoAIPromptViewRender",inheritAttrs:!1,props:{name:String},inject:{kendoAIPrompt:{default:null}},render(){const e=o.getDefaultSlots(this);return this.kendoAIPrompt.activeView===this.$props.name?e:null}});function f(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const V=t.defineComponent({name:"KendoAIPromptExpander",props:{title:String},data:()=>({expanded:!0}),methods:{buttonClick(){this.expanded=!this.expanded}},render(){const e=o.getDefaultSlots(this),{title:a}=this.$props;return t.createVNode("div",{class:"k-prompt-expander"},[t.createVNode(n.Button,{type:"button",fillMode:"flat",svgIcon:this.expanded?i.chevronUpIcon:i.chevronDownIcon,title:a,onClick:this.buttonClick},f(a)?a:{default:()=>[a]}),this.expanded&&t.createVNode("div",{class:"k-prompt-expander-content"},[e])])}}),I=t.defineComponent({name:"KendoSuggestionGroup",props:{suggestions:{type:Array,required:!0},onSuggestionClick:{type:Function,required:!0},suggestionsView:{type:String,default:"classic"}},methods:{handleSuggestionClick(e,t){t.disabled||this.onSuggestionClick(e,t)},handleKeyDown(e,t){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),this.onSuggestionClick(e,t))}},render(){const{suggestions:e,suggestionsView:n}=this.$props,i=()=>e.map(e=>t.createVNode("span",{role:"button",tabindex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:t=>!e.disabled&&this.handleSuggestionClick(t,e),onKeydown:t=>!e.disabled&&this.handleKeyDown(t,e),key:e.id,title:e.description,class:o.classNames("classic"===n?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},[e.text]));return"classic"===n?i():t.createVNode("div",{role:"group",class:"k-suggestion-group"},[i()])}});function C(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const y=t.defineComponent({name:"KendoAIPromptView",props:{promptInput:[Object,String],generateButton:[Object,String],promptValue:String,promptSuggestions:Array,enableSpeechToText:[Boolean,Object]},inject:{kendoAIPrompt:{default:null}},computed:{computedValue(){return void 0!==this.$props.promptValue?this.$props.promptValue:this.value}},data:()=>({value:""}),methods:{handleOnRequest(){this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,this.computedValue),this.value=""},handleSuggestionSelect(e){this.value=e},onTextChange(e){this.value=e.value},onSpeechResult(e){if(e.isFinal&&e.alternatives.length>0){const t=e.alternatives[0].transcript,o=this.value,n=o&&!o.endsWith(" ")&&!o.endsWith("\n");this.value=o+(n?" ":"")+t}},onSpeechStart(){},onSpeechEnd(){},getButtonDisabledState(){const e=void 0!==this.$props.promptValue?this.$props.promptValue:this.value;return!(null!=e&&e.trim())}},render(){const e="Generate",{promptSuggestions:s,enableSpeechToText:r}=this.$props,l=o.templateRendering.call(this,this.$props.promptInput,o.getListeners.call(this)),d=t.createVNode(a.TextArea,{value:this.computedValue,onInput:this.onTextChange,placeholder:"Ask or generate content with AI ...",rows:2,class:"!k-flex-col",inputSuffix:()=>r?t.createVNode(t.Fragment,null,[t.createVNode(a.InputSeparator,{orientation:"horizontal"},null),t.createVNode("div",{class:"k-input-suffix k-input-suffix-horizontal"},[t.createVNode(n.SpeechToTextButton,t.mergeProps({fillMode:"flat",onStart:this.onSpeechStart,onEnd:this.onSpeechEnd,onResult:this.onSpeechResult},"object"==typeof r?r:{}),null)])]):null},null),u=o.getTemplate.call(this,{h:t.h,template:l,defaultRendering:d}),c=o.templateRendering.call(this,this.$props.generateButton,o.getListeners.call(this)),m=t.createVNode(n.Button,{type:"button",themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:this.handleOnRequest,disabled:this.getButtonDisabledState(),title:"Generate",svgIcon:i.sparklesIcon},C(e)?e:{default:()=>[e]}),h=o.getTemplate.call(this,{h:t.h,template:c,defaultRendering:m});return t.createVNode(k,{name:p.name},{default:()=>{var e,o;return[t.createVNode(v,{streaming:null==(e=this.kendoAIPrompt)?void 0:e.streaming,onCancel:null==(o=this.kendoAIPrompt)?void 0:o.onCancel},{default:()=>[u,s&&s.length>0&&t.createVNode(V,{title:"Prompt Suggestions"},{default:()=>{var e;return[t.createVNode(I,{suggestionsView:null==(e=this.kendoAIPrompt)?void 0:e.suggestionsView,suggestions:s.map((e,t)=>({id:t,text:e,description:e})),onSuggestionClick:(e,t)=>this.handleSuggestionSelect(t.text)},null)]}})]}),t.createVNode(g,null,C(h)?h:{default:()=>[h]})]}})}}),b="avatar.alt",w="messageList.ariaLabel",N="aIPrompt.noOutputs",S={[b]:"Avatar",[w]:"Message list",[N]:"No output from Ai available"};function A(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}let P=function(e){return e.positive="positive",e.negative="negative",e}({});const x=t.defineComponent({name:"KendoAIPromptOutputView",emits:{copy:null,retry:null,rating:null},props:{outputs:Array,outputCard:Object,showOutputRating:Boolean},inject:{kendoAIPrompt:{default:null},kendoLocalizationService:{default:null}},data:()=>({copiedIndex:-1,copyButtonIcon:i.copyIcon,contentRef:null}),methods:{retryPrompt(e){this.$emit("retry",e),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),this.scrollToTopOutput()},copyToClipboard(e,t){null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),this.copiedIndex=t,this.copyButtonIcon=i.checkIcon,this.$emit("copy",null==e?void 0:e.responseContent),setTimeout(()=>{this.copyButtonIcon=i.copyIcon,this.copiedIndex=-1},1e3)},outputRating(e,t){this.$emit("rating",e,t),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),this.scrollToTopOutput()},scrollToTopOutput(){var e,t;null==(t=null==(e=this.contentRef)?void 0:e.scrollTo)||t.call(e,{top:0,behavior:"smooth"})}},render(){let e;const{outputs:o,showOutputRating:a,outputCard:l}=this.$props,d=r.provideLocalizationService(this),{header:c,body:p,actions:m}=l||{},h=t.createVNode(s.Card,null,{default:()=>[t.createVNode(s.CardHeader,null,{default:()=>[t.createVNode(s.CardTitle,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}},null)]}),t.createVNode(s.CardSubtitle,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),t.createVNode(s.CardBody,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}},null)]}),t.createVNode(s.CardActions,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),g=null==o?void 0:o.map((e,o)=>t.createVNode(s.Card,{key:`${e.id}_${o}`,class:e.class},{default:()=>[t.createVNode(s.CardHeader,null,{default:()=>[c?c(e):t.createVNode(t.Fragment,null,[e.title&&t.createVNode(s.CardTitle,null,{default:()=>[e.title]}),e.subTitle&&t.createVNode(s.CardSubtitle,null,{default:()=>[e.subTitle]})])]}),t.createVNode(s.CardBody,null,{default:()=>[p?p(e):e.responseContent]}),t.createVNode(s.CardActions,null,{default:()=>[m?m(e):t.createVNode(t.Fragment,null,[t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:this.copiedIndex===o?this.copyButtonIcon:i.copyIcon,"aria-hidden":"true",onClick:()=>this.copyToClipboard(e,o)},{default:()=>["Copy"]}),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:i.arrowRotateCwIcon,"aria-hidden":"true",onClick:()=>this.retryPrompt(e)},{default:()=>["Retry"]}),a&&t.createVNode(t.Fragment,null,[t.createVNode("span",{class:"k-spacer"},null),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:i.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"positive")},null),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:i.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"negative")},null)])])]})]})),f=t.createVNode(s.Card,null,{default:()=>[t.createVNode(s.CardBody,null,A(e=d.toLanguageString(N,S[N]))?e:{default:()=>[e]})]});return t.createVNode(k,{name:u.name},{default:()=>{var e,o;return[t.createVNode(v,{ref:e=>this.contentRef=e,streaming:null==(e=this.kendoAIPrompt)?void 0:e.streaming,onCancel:null==(o=this.kendoAIPrompt)?void 0:o.onCancel},{default:()=>{var e,o;return[t.createVNode("div",{class:"k-card-list"},[(null==(e=this.kendoAIPrompt)?void 0:e.loading)&&h,g,(!g||0===g.length)&&!(null!=(o=this.kendoAIPrompt)&&o.loading)&&f])]}})]}})}}),R=t.defineComponent({name:"KendoAIPromptCommandsView",props:{commands:Array},inject:{kendoAIPrompt:{default:null}},render(){const{commands:e}=this.$props,o=e=>{var t;const o=e.target;(null==(t=o.items)||!t.length)&&this.kendoAIPrompt.onCommandExecute&&(this.$emit("commandexecute",o),this.kendoAIPrompt.onCommandExecute.call(null,o))};return t.createVNode(k,{name:c.name},{default:()=>{var n,i;return[t.createVNode(v,{streaming:null==(n=this.kendoAIPrompt)?void 0:n.streaming,onCancel:null==(i=this.kendoAIPrompt)?void 0:i.onCancel},{default:()=>[t.createVNode("div",{class:"k-prompt-view"},[t.createVNode(s.PanelBar,{onSelect:o,items:e},null)])]})]}})}});e.AIPrompt=h,e.AIPromptCommandsView=R,e.AIPromptContent=v,e.AIPromptFooter=g,e.AIPromptHeader=d,e.AIPromptOutputRating=P,e.AIPromptOutputView=x,e.AIPromptView=y,e.AIPromptViewRender=k,e.SuggestionGroup=I,e.commandsViewDefaults=c,e.outputViewDefaults=u,e.promptViewDefaults=p});
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-vue-layout"),require("@progress/kendo-vue-intl"),require("@progress/kendo-vue-upload")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-buttons","@progress/kendo-svg-icons","@progress/kendo-vue-inputs","@progress/kendo-vue-layout","@progress/kendo-vue-intl","@progress/kendo-vue-upload"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueConversationalUi={},e.Vue,e.KendoVueCommon,e.KendoVueButtons,e.KendoSVGIcons,e.KendoVueInputs,e.KendoVueLayout,e.KendoVueIntl,e.KendoVueUpload)}(this,function(e,t,o,n,i,s,l,r,a){"use strict";function u(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const d=t.defineComponent({name:"KendoAIPromptHeader",props:{activeView:String,toolbarItems:Array,onActiveviewchange:Function},methods:{handleClick(e){this.$emit("activeviewchange",e)}},render(){let e;const{activeView:i,toolbarItems:s}=this.$props;return t.createVNode("div",{class:"k-prompt-header"},[t.createVNode(n.Toolbar,{overflow:"none",keyboardNavigation:!1,class:"k-toolbar-flat"},u(e=s.map(function(e){const s=o.getTemplate.call(this,{h:t.h,template:e.content,defaultRendering:null,additionalProps:{item:e}});return e.content?s:t.createVNode(n.Button,{type:"button",key:e.name,class:o.classNames("k-toolbar-item",{"k-selected":i===e.name}),size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,onClick:()=>this.handleClick(e.name)},{default:()=>[e.buttonText]})},this))?e:{default:()=>[e]})])}}),c={name:"Output view",buttonText:"Output",buttonIcon:i.commentIcon},p={name:"Commands view",buttonIcon:i.moreHorizontalIcon},h={name:"Prompt view",buttonText:"Ask AI",buttonIcon:i.sparklesIcon},m={name:"@progress/kendo-vue-conversational-ui",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:0,version:"8.1.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"},g=t.defineComponent({name:"KendoAIPrompt",props:{activeView:{type:String,required:!0},dir:String,toolbarItems:Array,outputs:Array,promptPlaceholder:String,streaming:Boolean,loading:Boolean,suggestionsView:{type:String,default:"classic"}},provide(){return{kendoAIPrompt:this.$data.contextState}},data(){return{showLicenseWatermark:!1,licenseMessage:"",contextState:{activeView:this.$props.activeView,streaming:this.$props.streaming,loading:this.$props.loading,onCancel:this.onCancel,onActiveViewChange:this.onActiveViewChange,onPromptRequest:this.onPromptRequest,onCommandExecute:this.onCommandExecute,onStateAction:this.onStateAction,suggestionsView:this.$props.suggestionsView}}},watch:{activeView(e){this.contextState.activeView=e},streaming(e){this.contextState.streaming=e},loading(e){this.contextState.loading=e}},methods:{onStateAction(e){this.contextState.activeView=e.activeView},onActiveViewChange(e){this.$emit("activeviewchange",e)},onPromptRequest(e,t){this.$emit("promptrequest",e,t)},onCommandExecute(e){this.$emit("commandexecute",e)},onCancel(){this.$emit("cancel")}},render(){o.validatePackage(m),this.showLicenseWatermark=o.shouldShowValidationUI(m),this.licenseMessage=o.getLicenseMessage(m);const e=o.getDefaultSlots(this),{toolbarItems:n,dir:i}=this.$props,s=(n||[h,c]).map(e=>{const t=o.templateRendering.call(this,e.content,o.getListeners.call(this));return{...e,content:t}}),l=this.showLicenseWatermark?t.createVNode(o.WatermarkOverlay,{message:this.licenseMessage},null):null;return t.createVNode("div",{class:"k-prompt",dir:i},[t.createVNode(d,{activeView:this.contextState.activeView,toolbarItems:s,onActiveviewchange:this.onActiveViewChange},null),e,l])}}),f=t.defineComponent({name:"KendoAIPromptFooter",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-footer"},[t.createVNode("div",{class:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},[e])])}}),v=t.defineComponent({name:"KendoAIPromptContent",props:{onCancel:Function,streaming:Boolean},inject:{kendoAIPrompt:{default:null}},computed:{showFloatingButton(){var e;const t=(null==(e=this.kendoAIPrompt)?void 0:e.activeView)===c.name;return this.streaming&&t}},methods:{handleKeyDown(e){"Escape"===e.key&&this.showFloatingButton&&this.onCancel&&(e.preventDefault(),this.$props.onCancel())}},render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-content",onKeydown:this.handleKeyDown},[this.showFloatingButton&&t.createVNode(n.FloatingActionButton,{onClick:this.onCancel,svgIcon:i.stopSmIcon,size:"small",positionMode:"absolute",class:"k-prompt-stop-fab k-generating"},null),t.createVNode("div",{class:"k-prompt-view"},[e])])}}),k=t.defineComponent({name:"KendoAIPromptViewRender",inheritAttrs:!1,props:{name:String},inject:{kendoAIPrompt:{default:null}},render(){const e=o.getDefaultSlots(this);return this.kendoAIPrompt.activeView===this.$props.name?e:null}});function b(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const V=t.defineComponent({name:"KendoAIPromptExpander",props:{title:String},data:()=>({expanded:!0}),methods:{buttonClick(){this.expanded=!this.expanded}},render(){const e=o.getDefaultSlots(this),{title:s}=this.$props;return t.createVNode("div",{class:"k-prompt-expander"},[t.createVNode(n.Button,{type:"button",fillMode:"flat",svgIcon:this.expanded?i.chevronUpIcon:i.chevronDownIcon,title:s,onClick:this.buttonClick},b(s)?s:{default:()=>[s]}),this.expanded&&t.createVNode("div",{class:"k-prompt-expander-content"},[e])])}}),x=t.defineComponent({name:"KendoSuggestionGroup",props:{suggestions:{type:Array,required:!0},onSuggestionClick:{type:Function,required:!0},suggestionsView:{type:String,default:"classic"}},methods:{handleSuggestionClick(e,t){t.disabled||this.onSuggestionClick(e,t)},handleKeyDown(e,t){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),this.onSuggestionClick(e,t))}},render(){const{suggestions:e,suggestionsView:n}=this.$props,i=()=>e.map(e=>t.createVNode("span",{role:"button",tabindex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:t=>!e.disabled&&this.handleSuggestionClick(t,e),onKeydown:t=>!e.disabled&&this.handleKeyDown(t,e),key:e.id,title:e.description,class:o.classNames("classic"===n?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},[e.text]));return"classic"===n?i():t.createVNode("div",{role:"group",class:"k-suggestion-group"},[i()])}});function y(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const A=t.defineComponent({name:"KendoAIPromptView",props:{promptInput:[Object,String],generateButton:[Object,String],promptValue:String,promptSuggestions:Array,enableSpeechToText:[Boolean,Object]},inject:{kendoAIPrompt:{default:null}},computed:{computedValue(){return void 0!==this.$props.promptValue?this.$props.promptValue:this.value}},data:()=>({value:""}),methods:{handleOnRequest(){this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,this.computedValue),this.value=""},handleSuggestionSelect(e){this.value=e},onTextChange(e){this.value=e.value},onSpeechResult(e){if(e.isFinal&&e.alternatives.length>0){const t=e.alternatives[0].transcript,o=this.value,n=o&&!o.endsWith(" ")&&!o.endsWith("\n");this.value=o+(n?" ":"")+t}},onSpeechStart(){},onSpeechEnd(){},getButtonDisabledState(){const e=void 0!==this.$props.promptValue?this.$props.promptValue:this.value;return!(null!=e&&e.trim())}},render(){const e="Generate",{promptSuggestions:l,enableSpeechToText:r}=this.$props,a=o.templateRendering.call(this,this.$props.promptInput,o.getListeners.call(this)),u=t.createVNode(s.TextArea,{value:this.computedValue,onInput:this.onTextChange,placeholder:"Ask or generate content with AI ...",rows:2,class:"!k-flex-col",inputSuffix:()=>r?t.createVNode(t.Fragment,null,[t.createVNode(s.InputSeparator,{orientation:"horizontal"},null),t.createVNode("div",{class:"k-input-suffix k-input-suffix-horizontal"},[t.createVNode(n.SpeechToTextButton,t.mergeProps({fillMode:"flat",onStart:this.onSpeechStart,onEnd:this.onSpeechEnd,onResult:this.onSpeechResult},"object"==typeof r?r:{}),null)])]):null},null),d=o.getTemplate.call(this,{h:t.h,template:a,defaultRendering:u}),c=o.templateRendering.call(this,this.$props.generateButton,o.getListeners.call(this)),p=t.createVNode(n.Button,{type:"button",themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:this.handleOnRequest,disabled:this.getButtonDisabledState(),title:"Generate",svgIcon:i.sparklesIcon},y(e)?e:{default:()=>[e]}),m=o.getTemplate.call(this,{h:t.h,template:c,defaultRendering:p});return t.createVNode(k,{name:h.name},{default:()=>{var e,o;return[t.createVNode(v,{streaming:null==(e=this.kendoAIPrompt)?void 0:e.streaming,onCancel:null==(o=this.kendoAIPrompt)?void 0:o.onCancel},{default:()=>[d,l&&l.length>0&&t.createVNode(V,{title:"Prompt Suggestions"},{default:()=>{var e;return[t.createVNode(x,{suggestionsView:null==(e=this.kendoAIPrompt)?void 0:e.suggestionsView,suggestions:l.map((e,t)=>({id:t,text:e,description:e})),onSuggestionClick:(e,t)=>this.handleSuggestionSelect(t.text)},null)]}})]}),t.createVNode(f,null,y(m)?m:{default:()=>[m]})]}})}}),C="avatar.alt",S="messageList.ariaLabel",$="aIPrompt.noOutputs",I="promptBox.input",N="promptBox.sendButton",w="promptBox.attachFile",B="promptBox.removeFile",R="promptBox.stopGenerating",P="promptBox.ariaLabel",F={[C]:"Avatar",[S]:"Message list",[$]:"No output from Ai available",[I]:"Prompt",[N]:"Send",[w]:"Attach file",[B]:"Remove file",[R]:"Stop generating",[P]:"Prompt box"};function T(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}let O=function(e){return e.positive="positive",e.negative="negative",e}({});const z=t.defineComponent({name:"KendoAIPromptOutputView",emits:{copy:null,retry:null,rating:null},props:{outputs:Array,outputCard:Object,showOutputRating:Boolean},inject:{kendoAIPrompt:{default:null},kendoLocalizationService:{default:null}},data:()=>({copiedIndex:-1,copyButtonIcon:i.copyIcon,contentRef:null}),methods:{retryPrompt(e){this.$emit("retry",e),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),this.scrollToTopOutput()},copyToClipboard(e,t){null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),this.copiedIndex=t,this.copyButtonIcon=i.checkIcon,this.$emit("copy",null==e?void 0:e.responseContent),setTimeout(()=>{this.copyButtonIcon=i.copyIcon,this.copiedIndex=-1},1e3)},outputRating(e,t){this.$emit("rating",e,t),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),this.scrollToTopOutput()},scrollToTopOutput(){var e,t;null==(t=null==(e=this.contentRef)?void 0:e.scrollTo)||t.call(e,{top:0,behavior:"smooth"})}},render(){let e;const{outputs:o,showOutputRating:s,outputCard:a}=this.$props,u=r.provideLocalizationService(this),{header:d,body:p,actions:h}=a||{},m=t.createVNode(l.Card,null,{default:()=>[t.createVNode(l.CardHeader,null,{default:()=>[t.createVNode(l.CardTitle,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}},null)]}),t.createVNode(l.CardSubtitle,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),t.createVNode(l.CardBody,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}},null)]}),t.createVNode(l.CardActions,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),g=null==o?void 0:o.map((e,o)=>t.createVNode(l.Card,{key:`${e.id}_${o}`,class:e.class},{default:()=>[t.createVNode(l.CardHeader,null,{default:()=>[d?d(e):t.createVNode(t.Fragment,null,[e.title&&t.createVNode(l.CardTitle,null,{default:()=>[e.title]}),e.subTitle&&t.createVNode(l.CardSubtitle,null,{default:()=>[e.subTitle]})])]}),t.createVNode(l.CardBody,null,{default:()=>[p?p(e):e.responseContent]}),t.createVNode(l.CardActions,null,{default:()=>[h?h(e):t.createVNode(t.Fragment,null,[t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:this.copiedIndex===o?this.copyButtonIcon:i.copyIcon,"aria-hidden":"true",onClick:()=>this.copyToClipboard(e,o)},{default:()=>["Copy"]}),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:i.arrowRotateCwIcon,"aria-hidden":"true",onClick:()=>this.retryPrompt(e)},{default:()=>["Retry"]}),s&&t.createVNode(t.Fragment,null,[t.createVNode("span",{class:"k-spacer"},null),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:i.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"positive")},null),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:i.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"negative")},null)])])]})]})),f=t.createVNode(l.Card,null,{default:()=>[t.createVNode(l.CardBody,null,T(e=u.toLanguageString($,F[$]))?e:{default:()=>[e]})]});return t.createVNode(k,{name:c.name},{default:()=>{var e,o;return[t.createVNode(v,{ref:e=>this.contentRef=e,streaming:null==(e=this.kendoAIPrompt)?void 0:e.streaming,onCancel:null==(o=this.kendoAIPrompt)?void 0:o.onCancel},{default:()=>{var e,o;return[t.createVNode("div",{class:"k-card-list"},[(null==(e=this.kendoAIPrompt)?void 0:e.loading)&&m,g,(!g||0===g.length)&&!(null!=(o=this.kendoAIPrompt)&&o.loading)&&f])]}})]}})}}),L=t.defineComponent({name:"KendoAIPromptCommandsView",props:{commands:Array},inject:{kendoAIPrompt:{default:null}},render(){const{commands:e}=this.$props,o=e=>{var t;const o=e.target;(null==(t=o.items)||!t.length)&&this.kendoAIPrompt.onCommandExecute&&(this.$emit("commandexecute",o),this.kendoAIPrompt.onCommandExecute.call(null,o))};return t.createVNode(k,{name:p.name},{default:()=>{var n,i;return[t.createVNode(v,{streaming:null==(n=this.kendoAIPrompt)?void 0:n.streaming,onCancel:null==(i=this.kendoAIPrompt)?void 0:i.onCancel},{default:()=>[t.createVNode("div",{class:"k-prompt-view"},[t.createVNode(l.PanelBar,{onSelect:o,items:e},null)])]})]}})}}),M=t.defineComponent({name:"KendoPromptBoxActionButton",inheritAttrs:!1,render(){return t.createVNode(n.Button,this.$attrs,null)}}),E=t.defineComponent({name:"KendoPromptBoxSpeechToTextButton",inheritAttrs:!1,render(){return t.createVNode(n.SpeechToTextButton,this.$attrs,null)}}),j=t.defineComponent({name:"KendoPromptBoxUploadButton",inheritAttrs:!1,props:{onFilesAdd:Function,files:{type:Array,default:()=>[]},restrictions:Object,multiple:{type:Boolean,default:!0},accept:String,onSelectAttachments:Function,onRemoveAttachment:Function,_registerRemoveCallback:Function},setup(e){const o=t.ref(null);return t.watch(()=>e.onRemoveAttachment,t=>{e._registerRemoveCallback&&t&&e._registerRemoveCallback(t)},{immediate:!0}),t.onUnmounted(()=>{e._registerRemoveCallback&&e.onRemoveAttachment&&e._registerRemoveCallback(void 0)}),{uploadRef:o,handleFilesAdd:t=>{e.onFilesAdd&&e.onFilesAdd(t),e.onSelectAttachments&&e.onSelectAttachments({selectedFiles:t.affectedFiles,allFiles:t.newState})}}},render(){const{onFilesAdd:e,files:o,restrictions:i,multiple:s,accept:l,onSelectAttachments:r,onRemoveAttachment:u,_registerRemoveCallback:d,_uploadRef:c,...p}=this.$attrs;return t.createVNode(t.Fragment,null,[t.createVNode(n.Button,p,null),t.createVNode(a.Upload,{ref:e=>{this.uploadRef=e,c&&(c.value=e)},files:this.files,onAdd:this.handleFilesAdd,autoUpload:!1,restrictions:this.restrictions,multiple:this.multiple,accept:this.accept,class:"k-hidden"},null)])}}),H=e=>"."+(e.split(".").pop()||""),K=e=>{if(null==e)return"";if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${Number.parseFloat((e/Math.pow(1024,t)).toFixed(2))} ${["B","KB","MB","GB","TB"][t]}`},D=t.defineComponent({name:"KendoFileBox",props:{files:{type:Array,required:!0},onRemoveFile:{type:Function,required:!0},header:{type:[Object,Function,String],default:void 0}},inject:{kendoLocalizationService:{default:null}},data:()=>({canScrollRight:!1,canScrollLeft:!1,resizeObserver:null}),watch:{files:{handler(){t.nextTick(()=>{this.setupScrollListeners(),this.updateScrollState()})},deep:!0}},mounted(){t.nextTick(()=>{this.setupScrollListeners(),this.updateScrollState()})},beforeUnmount(){this.cleanupScrollListeners()},methods:{setupScrollListeners(){const e=this.$refs.scrollContainer;e?this._scrollContainer!==e&&(this.cleanupScrollListeners(),e.addEventListener("scroll",this.updateScrollState,{passive:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateScrollState()),this.resizeObserver.observe(e),this._scrollContainer=e):this.cleanupScrollListeners()},cleanupScrollListeners(){this._scrollContainer&&(this._scrollContainer.removeEventListener("scroll",this.updateScrollState),this._scrollContainer=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},updateScrollState(){const e=this.$refs.scrollContainer;if(!e)return;const{scrollLeft:t,scrollWidth:o,clientWidth:n}=e,i=0===t,s=t+n>=o-1;this.canScrollLeft=!i,this.canScrollRight=!s},handleRemoveFile(e,t){t.stopPropagation(),this.$props.onRemoveFile&&this.$props.onRemoveFile(e)}},render(){const e=r.provideLocalizationService(this),{files:s,header:l}=this.$props;if(0===s.length&&!l)return null;const a=o.getTemplate.call(this,{h:t.h,template:l,defaultRendering:null}),u=e.toLanguageString(B,F[B]),d=s.length>0&&t.createVNode("ul",{class:o.classNames("k-file-box-wrapper",{"k-file-box-wrapper-scrollable-start":this.canScrollRight,"k-file-box-wrapper-scrollable-end":this.canScrollLeft})},[t.createVNode("div",{class:"k-files-scroll",ref:"scrollContainer"},[s.map(e=>t.createVNode("li",{key:e.name,class:"k-file-box"},[t.createVNode(o.Icon,t.mergeProps({size:"xlarge"},o.getFileExtensionIcon(H(e.name))),null),t.createVNode("div",{class:"k-file-info"},[t.createVNode("span",{class:"k-file-name"},[e.name]),t.createVNode("span",{class:"k-file-size"},[K(e.size)])]),t.createVNode(n.Button,{fillMode:"flat",svgIcon:i.xMarkSmOutlineIcon,onClick:t=>this.handleRemoveFile(e.name,t),"aria-label":`${u} ${e.name}`,title:`${u} ${e.name}`},null)]))])]);return t.createVNode("div",{class:"k-prompt-box-header"},[a,d])}}),q="k-prompt-box",U=t.defineComponent({name:"KendoPromptBox",emits:{change:e=>!0,focus:e=>!0,blur:e=>!0,promptaction:e=>!0},props:{value:String,defaultValue:{type:String,default:""},mode:{type:String,default:"auto"},rows:{type:Number,default:1},maxTextAreaHeight:String,title:String,disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},placeholder:String,maxLength:Number,inputAttributes:Object,fillMode:String,topAffix:[Object,Function,String],startAffix:[Object,Function,String],endAffix:[Object,Function,String],header:[Object,Function,String],loading:{type:Boolean,default:!1},uploadButtonConfig:{type:[Boolean,Object],default:!1},speechToTextButtonConfig:{type:[Boolean,Object],default:!0},actionButtonConfig:{type:[Boolean,Object],default:!0},attachments:Array},inject:{kendoLocalizationService:{default:null}},created(){o.validatePackage(m),this._uploadRef=t.ref(null)},data(){return{stateValue:this.$props.defaultValue||"",stateFiles:[],hasExpanded:!1,initialHeight:0,minMultiRowHeight:0,isResizing:!1,previousValueLength:0,singleLineWidth:0,resizeObserver:null,resizeTimeout:null,onRemoveAttachmentCallback:null}},computed:{isControlled(){return void 0!==this.$props.value},currentValue(){return this.isControlled?this.$props.value||"":this.stateValue},isFilesControlled(){return void 0!==this.$props.attachments},currentFiles(){return this.isFilesControlled?this.$props.attachments||[]:this.stateFiles},canSendMessage(){var e;return!!(null!=(e=this.currentValue)&&e.trim()||this.currentFiles.length>0)},isMultilineLayout(){return"multi"===this.$props.mode||"auto"===this.$props.mode&&this.hasExpanded},hasBuiltInButtons(){return!1!==this.$props.uploadButtonConfig||!1!==this.$props.speechToTextButtonConfig||!1!==this.$props.actionButtonConfig},hasEndAffixOrButtons(){return!!this.$props.endAffix||this.hasBuiltInButtons},hasStartAffixOrEndAffixOrButtons(){return!!this.$props.startAffix||!!this.$props.endAffix||this.hasBuiltInButtons},effectiveRows(){return"auto"===this.$props.mode?1:this.$props.rows}},watch:{currentValue(e){if("single"===this.$props.mode)return;const t=(null==e?void 0:e.length)||0;requestAnimationFrame(()=>{const e=this.$refs.inputElement;e&&("multi"===this.$props.mode?this.resizeMultiMode(e):"auto"===this.$props.mode&&this.resizeAutoMode(e,t),this.previousValueLength=t)})},rows(){"single"!==this.$props.mode&&(this.captureInitialDimensions(),this.resize())},maxTextAreaHeight(){"single"!==this.$props.mode&&this.resize()},mode(){"single"!==this.$props.mode&&t.nextTick(()=>{this.captureInitialDimensions(),this.resize()})},hasExpanded(e){if("auto"===this.$props.mode&&e&&requestAnimationFrame(()=>{const e=this.$refs.inputElement;e&&(this.updateHeight(e),this.isResizing=!1)}),"auto"===this.$props.mode&&!e){const e=this.$refs.inputElement;e&&(e.style.height="",e.style.overflow="",this.isResizing=!1)}}},mounted(){"single"!==this.$props.mode&&this.captureInitialDimensions(),this.setupResizeObserver()},beforeUnmount(){this.cleanupResizeObserver()},methods:{captureInitialDimensions(){const e=this.$refs.inputElement;if(!e||"single"===this.$props.mode)return;const t=globalThis.getComputedStyle(e),o=Number.parseFloat(t.lineHeight)||20,n=Number.parseFloat(t.paddingTop)||0,i=Number.parseFloat(t.paddingBottom)||0;this.initialHeight=e.offsetHeight||o+n+i,this.minMultiRowHeight=o*this.$props.rows+n+i,"auto"===this.$props.mode&&!this.hasExpanded&&(this.singleLineWidth=e.offsetWidth)},calculateHeight(e){if(this.$props.maxTextAreaHeight){const t=Number.parseInt(this.$props.maxTextAreaHeight,10);if(e>t)return t}return Math.max(this.minMultiRowHeight,e)},resizeMultiMode(e){e.style.overflow="hidden",e.style.height=`${this.initialHeight}px`;const t=e.scrollHeight,o=this.calculateHeight(t);e.style.height=`${o}px`,this.$props.maxTextAreaHeight&&t>Number.parseInt(this.$props.maxTextAreaHeight,10)&&(e.style.overflow="")},updateHeight(e){e.style.overflow="hidden",e.style.height=`${this.initialHeight}px`;const t=e.scrollHeight,o=this.$props.maxTextAreaHeight?Math.min(t,Number.parseInt(this.$props.maxTextAreaHeight,10)):t;e.style.height=`${o}px`,this.$props.maxTextAreaHeight&&t>Number.parseInt(this.$props.maxTextAreaHeight,10)&&(e.style.overflow="")},shouldCollapse(e){if(this.singleLineWidth<=0)return!1;const t=e.style.height,o=e.style.width;e.style.overflow="hidden",e.style.width=`${this.singleLineWidth}px`,e.style.height=`${this.initialHeight}px`;const n=e.scrollWidth<=this.singleLineWidth&&e.scrollHeight<=this.initialHeight;return e.style.overflow="",e.style.width=o||"",e.style.height=t||"",n},resizeAutoMode(e,t){if(!this.isResizing){if((e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)&&!this.hasExpanded)return this.isResizing=!0,void(this.hasExpanded=!0);if(this.hasExpanded){this.updateHeight(e);t<this.previousValueLength&&this.shouldCollapse(e)&&(e.style.height="",this.isResizing=!0,this.hasExpanded=!1)}}},resize(){var e;if("single"===this.$props.mode)return;const t=this.$refs.inputElement;if(!t)return;const o=(null==(e=t.value)?void 0:e.length)||0;"multi"===this.$props.mode?this.resizeMultiMode(t):"auto"===this.$props.mode&&this.resizeAutoMode(t,o)},setupResizeObserver(){if("single"===this.$props.mode)return;const e=this.$refs.inputElement;e&&(this.resizeObserver=new ResizeObserver(()=>{this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{"auto"===this.$props.mode&&!this.hasExpanded&&this.captureInitialDimensions(),this.resize()},50)}),this.resizeObserver.observe(e))},cleanupResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null)},handleChange(e){const t=e.target.value;!this.isControlled&&!this.$props.disabled&&(this.stateValue=t),this.$props.disabled||this.$emit("change",{event:e,value:t}),"single"!==this.$props.mode&&this.resize()},handleFocus(e){this.$props.disabled||this.$emit("focus",{event:e})},handleBlur(e){this.$props.disabled||this.$emit("blur",{event:e})},handleButtonMouseDown(e){e.preventDefault()},handleActionButtonClick(e){this.$emit("promptaction",{event:e,value:this.currentValue,attachments:this.currentFiles}),this.isControlled||(this.stateValue=""),this.isFilesControlled||(this.stateFiles=[])},handleKeyDown(e){if("Enter"!==e.key||!e.shiftKey){if("ArrowUp"===e.key||"ArrowDown"===e.key)return void e.stopPropagation();if("Enter"===e.key){if(e.preventDefault(),this.$props.loading)return;this.canSendMessage&&this.handleActionButtonClick(e)}}},handleSpeechResult(e){var t;const{isFinal:o,alternatives:n}=e;if(n.length>0){const e=n[0];if(o){const t=this.$refs.inputElement,o=(null==t?void 0:t.value)||"",n=(o?`${o} `:"")+e.transcript;if(this.isControlled||(this.stateValue=n),!this.$props.disabled){const e={target:t,currentTarget:t};this.$emit("change",{event:e,value:n})}}}null==(t=this.$refs.inputElement)||t.focus()},handleUploadButtonClick(){const e=this._uploadRef.value;if(null!=e&&e.$el){const t=e.$el.querySelector('input[type="file"]');t&&t.click()}},onFilesSelect(e){var t;const o=Array.from(e.affectedFiles),n=this.$props.uploadButtonConfig,i="object"==typeof n&&n,s=i?i.onSelectAttachments:void 0;this.isFilesControlled||(this.stateFiles=[...this.stateFiles,...o]),s&&s({selectedFiles:e.affectedFiles,allFiles:e.newState}),null==(t=this.$refs.inputElement)||t.focus()},handleRemoveFile(e){this.isFilesControlled||(this.stateFiles=this.stateFiles.filter(t=>t.name!==e));const t=this.$props.uploadButtonConfig,o="object"==typeof t&&t,n=o?o.onRemoveAttachment:void 0;n&&(this.onRemoveAttachmentCallback=n),this.onRemoveAttachmentCallback&&this.onRemoveAttachmentCallback(e)},renderAffix:(e,t)=>e?"function"==typeof e?e(t):e:null},render(){const e=r.provideLocalizationService(this),{mode:n,fillMode:s,maxTextAreaHeight:l,disabled:a,readOnly:u,placeholder:d,title:c,maxLength:p,inputAttributes:h,topAffix:g,startAffix:f,endAffix:v,header:k,loading:b,speechToTextButtonConfig:V,actionButtonConfig:x,uploadButtonConfig:y}=this.$props,A={uploadButtonProps:{fillMode:"flat",svgIcon:i.paperclipOutlineAltRightIcon,size:"small",rounded:"full",onClick:this.handleUploadButtonClick,onFilesAdd:this.onFilesSelect,files:this.currentFiles,_uploadRef:this._uploadRef,"aria-label":e.toLanguageString(w,F[w]),title:e.toLanguageString(w,F[w]),_registerRemoveCallback:e=>{this.onRemoveAttachmentCallback=e||null}},speechToTextButtonProps:{fillMode:"flat",size:"small",rounded:"full",onResult:this.handleSpeechResult},actionButtonProps:{rounded:"full",size:"small",svgIcon:b?i.stopSmIcon:i.arrowUpOutlineIcon,class:b?"k-generating":"",onClick:this.handleActionButtonClick,onMousedown:this.handleButtonMouseDown,disabled:!b&&!this.canSendMessage,"aria-disabled":!b&&!this.canSendMessage,"aria-label":b?e.toLanguageString(R,F[R]):e.toLanguageString(N,F[N]),title:b?e.toLanguageString(R,F[R]):e.toLanguageString(N,F[N]),"aria-live":"polite"}},C=()=>{const e=!1!==V,o=!1!==x,n=!1!==y,i="object"==typeof V?V:void 0,s="object"==typeof y?y:{},{restrictions:l,multiple:r=!0,accept:a,onSelectAttachments:u,onRemoveAttachment:d,...c}=s,p={restrictions:l,multiple:r,accept:a},h="object"==typeof x?x:void 0;return t.createVNode(t.Fragment,null,[n&&t.createVNode(j,t.mergeProps({ref:"uploadButton"},A.uploadButtonProps,{restrictions:p.restrictions,multiple:p.multiple,accept:p.accept},c),null),e&&t.createVNode(E,t.mergeProps(A.speechToTextButtonProps,i),null),o&&t.createVNode(M,t.mergeProps(A.actionButtonProps,h),null)])},S={disabled:a,readOnly:u,placeholder:d,title:c,maxLength:p,"aria-label":e.toLanguageString(I,F[I]),value:this.currentValue,onKeydown:this.handleKeyDown,...h,onInput:this.handleChange,onFocus:this.handleFocus,onBlur:this.handleBlur,ref:"inputElement"};return t.createVNode("div",{"aria-label":e.toLanguageString(P,F[P]),class:o.classNames("k-input",q,{[`k-input-${s}`]:s,"k-disabled":a,"k-prompt-box-singleline":"single"===n,"k-prompt-box-multiline":this.isMultilineLayout})},[t.createVNode(D,{files:this.currentFiles,onRemoveFile:this.handleRemoveFile,header:o.templateRendering.call(this,k,o.getListeners.call(this))},null),"single"===n?(()=>t.createVNode("div",{class:`${q}-content`},[f&&t.createVNode("div",{class:`${q}-affix`},[this.renderAffix(f,A)]),t.createVNode("input",t.mergeProps(S,{class:o.classNames("k-input-inner",`${q}-input`)}),null),this.hasEndAffixOrButtons?t.createVNode("div",{class:`${q}-affix`},[v&&this.renderAffix(v,A),C()]):null]))():(()=>t.createVNode("div",{class:`${q}-content`},["multi"===n&&g&&t.createVNode("div",{class:`${q}-affix`},[this.renderAffix(g,A)]),"auto"===n&&f&&t.createVNode("div",{class:`${q}-affix`,style:{display:this.hasExpanded?"none":void 0}},[this.renderAffix(f,A)]),t.createVNode("textarea",t.mergeProps(S,{class:o.classNames("k-input-inner",`${q}-textarea`),rows:this.effectiveRows,style:l?{maxHeight:l}:{}},this.isMultilineLayout&&{"aria-multiline":"true"}),null),"auto"===n&&this.hasEndAffixOrButtons?t.createVNode("div",{class:`${q}-affix`,style:{display:this.hasExpanded?"none":void 0}},[v&&this.renderAffix(v,A),C()]):null,this.hasStartAffixOrEndAffixOrButtons?t.createVNode("div",{class:`${q}-affix`,style:{display:this.isMultilineLayout?void 0:"none"}},[f&&this.renderAffix(f,A),(f||v)&&t.createVNode("div",{class:"k-spacer"},null),v&&this.renderAffix(v,A),C()]):null]))(),o.shouldShowValidationUI(m)&&t.createVNode(o.WatermarkOverlay,{message:o.getLicenseMessage(m)},null)])}});e.AIPrompt=g,e.AIPromptCommandsView=L,e.AIPromptContent=v,e.AIPromptFooter=f,e.AIPromptHeader=d,e.AIPromptOutputRating=O,e.AIPromptOutputView=z,e.AIPromptView=A,e.AIPromptViewRender=k,e.PromptBox=U,e.PromptBoxActionButton=M,e.PromptBoxSpeechToTextButton=E,e.PromptBoxUploadButton=j,e.SuggestionGroup=x,e.commandsViewDefaults=p,e.outputViewDefaults=c,e.promptViewDefaults=h});
|
package/index.d.mts
CHANGED
|
@@ -15,3 +15,9 @@ export * from './ai-prompt/views/AIPromptCommandsView.js';
|
|
|
15
15
|
export * from './ai-prompt/views/AIPromptViewRender.js';
|
|
16
16
|
export * from './ai-prompt/views/constants.js';
|
|
17
17
|
export * from './chat/components/SuggestionGroup.js';
|
|
18
|
+
export * from './prompt-box/PromptBox.js';
|
|
19
|
+
export * from './prompt-box/interfaces/PromptBoxProps.js';
|
|
20
|
+
export * from './prompt-box/Events.js';
|
|
21
|
+
export * from './prompt-box/PromptBoxActionButton.js';
|
|
22
|
+
export * from './prompt-box/PromptBoxSpeechToTextButton.js';
|
|
23
|
+
export * from './prompt-box/PromptBoxUploadButton.js';
|
package/index.d.ts
CHANGED
|
@@ -15,3 +15,9 @@ export * from './ai-prompt/views/AIPromptCommandsView';
|
|
|
15
15
|
export * from './ai-prompt/views/AIPromptViewRender';
|
|
16
16
|
export * from './ai-prompt/views/constants';
|
|
17
17
|
export * from './chat/components/SuggestionGroup';
|
|
18
|
+
export * from './prompt-box/PromptBox';
|
|
19
|
+
export * from './prompt-box/interfaces/PromptBoxProps';
|
|
20
|
+
export * from './prompt-box/Events';
|
|
21
|
+
export * from './prompt-box/PromptBoxActionButton';
|
|
22
|
+
export * from './prompt-box/PromptBoxSpeechToTextButton';
|
|
23
|
+
export * from './prompt-box/PromptBoxUploadButton';
|
package/index.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ai-prompt/AIPrompt.js"),r=require("./ai-prompt/AIPromptHeader.js"),p=require("./ai-prompt/AIPromptFooter.js"),u=require("./ai-prompt/AIPromptContent.js"),m=require("./ai-prompt/views/AIPromptView.js"),o=require("./ai-prompt/views/AIPromptOutputView.js"),n=require("./ai-prompt/views/AIPromptCommandsView.js"),i=require("./ai-prompt/views/AIPromptViewRender.js"),t=require("./ai-prompt/views/constants.js"),P=require("./chat/components/SuggestionGroup.js"),s=require("./prompt-box/PromptBox.js"),A=require("./prompt-box/PromptBoxActionButton.js"),I=require("./prompt-box/PromptBoxSpeechToTextButton.js"),c=require("./prompt-box/PromptBoxUploadButton.js");exports.AIPrompt=e.AIPrompt;exports.AIPromptHeader=r.AIPromptHeader;exports.AIPromptFooter=p.AIPromptFooter;exports.AIPromptContent=u.AIPromptContent;exports.AIPromptView=m.AIPromptView;exports.AIPromptOutputRating=o.AIPromptOutputRating;exports.AIPromptOutputView=o.AIPromptOutputView;exports.AIPromptCommandsView=n.AIPromptCommandsView;exports.AIPromptViewRender=i.AIPromptViewRender;exports.commandsViewDefaults=t.commandsViewDefaults;exports.outputViewDefaults=t.outputViewDefaults;exports.promptViewDefaults=t.promptViewDefaults;exports.SuggestionGroup=P.SuggestionGroup;exports.PromptBox=s.PromptBox;exports.PromptBoxActionButton=A.PromptBoxActionButton;exports.PromptBoxSpeechToTextButton=I.PromptBoxSpeechToTextButton;exports.PromptBoxUploadButton=c.PromptBoxUploadButton;
|
package/index.mjs
CHANGED
|
@@ -5,28 +5,36 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { AIPrompt as
|
|
9
|
-
import { AIPromptHeader as
|
|
10
|
-
import { AIPromptFooter as
|
|
11
|
-
import { AIPromptContent as
|
|
12
|
-
import { AIPromptView as
|
|
13
|
-
import { AIPromptOutputRating as
|
|
8
|
+
import { AIPrompt as r } from "./ai-prompt/AIPrompt.mjs";
|
|
9
|
+
import { AIPromptHeader as e } from "./ai-prompt/AIPromptHeader.mjs";
|
|
10
|
+
import { AIPromptFooter as x } from "./ai-prompt/AIPromptFooter.mjs";
|
|
11
|
+
import { AIPromptContent as u } from "./ai-prompt/AIPromptContent.mjs";
|
|
12
|
+
import { AIPromptView as n } from "./ai-prompt/views/AIPromptView.mjs";
|
|
13
|
+
import { AIPromptOutputRating as A, AIPromptOutputView as I } from "./ai-prompt/views/AIPromptOutputView.mjs";
|
|
14
14
|
import { AIPromptCommandsView as w } from "./ai-prompt/views/AIPromptCommandsView.mjs";
|
|
15
|
-
import { AIPromptViewRender as
|
|
16
|
-
import { commandsViewDefaults as
|
|
17
|
-
import { SuggestionGroup as
|
|
15
|
+
import { AIPromptViewRender as V } from "./ai-prompt/views/AIPromptViewRender.mjs";
|
|
16
|
+
import { commandsViewDefaults as d, outputViewDefaults as l, promptViewDefaults as c } from "./ai-prompt/views/constants.mjs";
|
|
17
|
+
import { SuggestionGroup as D } from "./chat/components/SuggestionGroup.mjs";
|
|
18
|
+
import { PromptBox as O } from "./prompt-box/PromptBox.mjs";
|
|
19
|
+
import { PromptBoxActionButton as S } from "./prompt-box/PromptBoxActionButton.mjs";
|
|
20
|
+
import { PromptBoxSpeechToTextButton as h } from "./prompt-box/PromptBoxSpeechToTextButton.mjs";
|
|
21
|
+
import { PromptBoxUploadButton as G } from "./prompt-box/PromptBoxUploadButton.mjs";
|
|
18
22
|
export {
|
|
19
|
-
|
|
23
|
+
r as AIPrompt,
|
|
20
24
|
w as AIPromptCommandsView,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
O as
|
|
29
|
-
|
|
25
|
+
u as AIPromptContent,
|
|
26
|
+
x as AIPromptFooter,
|
|
27
|
+
e as AIPromptHeader,
|
|
28
|
+
A as AIPromptOutputRating,
|
|
29
|
+
I as AIPromptOutputView,
|
|
30
|
+
n as AIPromptView,
|
|
31
|
+
V as AIPromptViewRender,
|
|
32
|
+
O as PromptBox,
|
|
33
|
+
S as PromptBoxActionButton,
|
|
34
|
+
h as PromptBoxSpeechToTextButton,
|
|
35
|
+
G as PromptBoxUploadButton,
|
|
36
|
+
D as SuggestionGroup,
|
|
37
|
+
d as commandsViewDefaults,
|
|
30
38
|
l as outputViewDefaults,
|
|
31
|
-
|
|
39
|
+
c as promptViewDefaults
|
|
32
40
|
};
|
package/messages/main.d.ts
CHANGED
|
@@ -20,8 +20,28 @@ export declare const aIPromptNoOutputs = "aIPrompt.noOutputs";
|
|
|
20
20
|
/**
|
|
21
21
|
* @hidden
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export declare const promptBoxInput = "promptBox.input";
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export declare const promptBoxSendButton = "promptBox.sendButton";
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export declare const promptBoxAttachFile = "promptBox.attachFile";
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export declare const promptBoxRemoveFile = "promptBox.removeFile";
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
export declare const promptBoxStopGenerating = "promptBox.stopGenerating";
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
export declare const promptBoxAriaLabel = "promptBox.ariaLabel";
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
47
|
+
export declare const messages: Record<string, string>;
|
package/messages/main.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t="avatar.alt",o="messageList.ariaLabel",e="aIPrompt.noOutputs",p="promptBox.input",a="promptBox.sendButton",r="promptBox.attachFile",s="promptBox.removeFile",m="promptBox.stopGenerating",n="promptBox.ariaLabel",i={[t]:"Avatar",[o]:"Message list",[e]:"No output from Ai available",[p]:"Prompt",[a]:"Send",[r]:"Attach file",[s]:"Remove file",[m]:"Stop generating",[n]:"Prompt box"};exports.aIPromptNoOutputs=e;exports.ariaLabelMessageList=o;exports.avatarAlt=t;exports.messages=i;exports.promptBoxAriaLabel=n;exports.promptBoxAttachFile=r;exports.promptBoxInput=p;exports.promptBoxRemoveFile=s;exports.promptBoxSendButton=a;exports.promptBoxStopGenerating=m;
|
package/messages/main.mjs
CHANGED
|
@@ -5,14 +5,26 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
8
|
+
const t = "avatar.alt", o = "messageList.ariaLabel", p = "aIPrompt.noOutputs", a = "promptBox.input", e = "promptBox.sendButton", r = "promptBox.attachFile", s = "promptBox.removeFile", n = "promptBox.stopGenerating", m = "promptBox.ariaLabel", i = {
|
|
9
|
+
[t]: "Avatar",
|
|
10
|
+
[o]: "Message list",
|
|
11
|
+
[p]: "No output from Ai available",
|
|
12
|
+
[a]: "Prompt",
|
|
13
|
+
[e]: "Send",
|
|
14
|
+
[r]: "Attach file",
|
|
15
|
+
[s]: "Remove file",
|
|
16
|
+
[n]: "Stop generating",
|
|
17
|
+
[m]: "Prompt box"
|
|
12
18
|
};
|
|
13
19
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
p as aIPromptNoOutputs,
|
|
21
|
+
o as ariaLabelMessageList,
|
|
22
|
+
t as avatarAlt,
|
|
23
|
+
i as messages,
|
|
24
|
+
m as promptBoxAriaLabel,
|
|
25
|
+
r as promptBoxAttachFile,
|
|
26
|
+
a as promptBoxInput,
|
|
27
|
+
s as promptBoxRemoveFile,
|
|
28
|
+
e as promptBoxSendButton,
|
|
29
|
+
n as promptBoxStopGenerating
|
|
18
30
|
};
|
package/package-metadata.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-vue-conversational-ui",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-vue-conversational-ui",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate: 1774970627,version:"8.1.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "Kendo UI for Vue",
|
|
11
11
|
productCode: "KENDOUIVUE",
|
|
12
12
|
productCodes: ["KENDOUIVUE"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "8.1.0-develop.
|
|
13
|
+
publishDate: 1774970627,
|
|
14
|
+
version: "8.1.0-develop.6",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-vue-ui/my-license/"
|
|
16
16
|
};
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-vue-conversational-ui",
|
|
3
|
-
"version": "8.1.0-develop.
|
|
3
|
+
"version": "8.1.0-develop.6",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@progress/kendo-licensing": "^1.7.2",
|
|
28
|
-
"@progress/kendo-vue-buttons": "8.1.0-develop.
|
|
29
|
-
"@progress/kendo-vue-common": "8.1.0-develop.
|
|
30
|
-
"@progress/kendo-vue-intl": "8.1.0-develop.
|
|
31
|
-
"@progress/kendo-vue-inputs": "8.1.0-develop.
|
|
32
|
-
"@progress/kendo-vue-layout": "8.1.0-develop.
|
|
28
|
+
"@progress/kendo-vue-buttons": "8.1.0-develop.6",
|
|
29
|
+
"@progress/kendo-vue-common": "8.1.0-develop.6",
|
|
30
|
+
"@progress/kendo-vue-intl": "8.1.0-develop.6",
|
|
31
|
+
"@progress/kendo-vue-inputs": "8.1.0-develop.6",
|
|
32
|
+
"@progress/kendo-vue-layout": "8.1.0-develop.6",
|
|
33
|
+
"@progress/kendo-vue-popup": "8.1.0-develop.6",
|
|
34
|
+
"@progress/kendo-vue-upload": "8.1.0-develop.6",
|
|
33
35
|
"@progress/kendo-svg-icons": "^4.4.0",
|
|
34
36
|
"vue": "^3.0.2"
|
|
35
37
|
},
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"package": {
|
|
51
53
|
"productName": "Kendo UI for Vue",
|
|
52
54
|
"productCode": "KENDOUIVUE",
|
|
53
|
-
"publishDate":
|
|
55
|
+
"publishDate": 1774970627,
|
|
54
56
|
"licensingDocsUrl": "https://www.telerik.com/kendo-vue-ui/my-license/"
|
|
55
57
|
}
|
|
56
58
|
},
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { UploadFileInfo } from '@progress/kendo-vue-upload';
|
|
9
|
+
/**
|
|
10
|
+
* The arguments for the `blur` PromptBox event.
|
|
11
|
+
*/
|
|
12
|
+
export interface PromptBoxBlurEvent {
|
|
13
|
+
/**
|
|
14
|
+
* The native DOM event.
|
|
15
|
+
*/
|
|
16
|
+
event: FocusEvent;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The arguments for the `change` PromptBox event.
|
|
20
|
+
*/
|
|
21
|
+
export interface PromptBoxChangeEvent {
|
|
22
|
+
/**
|
|
23
|
+
* The native DOM event.
|
|
24
|
+
*/
|
|
25
|
+
event: Event;
|
|
26
|
+
/**
|
|
27
|
+
* The new value of the PromptBox.
|
|
28
|
+
*/
|
|
29
|
+
value: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The arguments for the `focus` PromptBox event.
|
|
33
|
+
*/
|
|
34
|
+
export interface PromptBoxFocusEvent {
|
|
35
|
+
/**
|
|
36
|
+
* The native DOM event.
|
|
37
|
+
*/
|
|
38
|
+
event: FocusEvent;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Event argument for the PromptBox `promptaction` event.
|
|
42
|
+
*/
|
|
43
|
+
export interface PromptBoxPromptActionEvent {
|
|
44
|
+
/**
|
|
45
|
+
* The native DOM event.
|
|
46
|
+
*/
|
|
47
|
+
event: Event;
|
|
48
|
+
/**
|
|
49
|
+
* The current value of the PromptBox when the action button is clicked.
|
|
50
|
+
* Allows accessing the message content without requiring controlled mode.
|
|
51
|
+
*/
|
|
52
|
+
value: string;
|
|
53
|
+
/**
|
|
54
|
+
* The currently attached files when the action button is clicked.
|
|
55
|
+
* Allows accessing attachments without requiring controlled mode.
|
|
56
|
+
*/
|
|
57
|
+
attachments: UploadFileInfo[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Event argument for the PromptBox `selectattachments` event.
|
|
61
|
+
* Fires when files are selected via the upload button.
|
|
62
|
+
*
|
|
63
|
+
* Provides both the newly selected files and the complete state for different use cases:
|
|
64
|
+
* - Use `selectedFiles` for validation, logging, or processing only the newly selected files
|
|
65
|
+
* - Use `allFiles` for state synchronization, displaying total file count, or updating UI with all files
|
|
66
|
+
*/
|
|
67
|
+
export interface PromptBoxSelectAttachmentsEvent {
|
|
68
|
+
/**
|
|
69
|
+
* The newly selected files from this selection event.
|
|
70
|
+
*/
|
|
71
|
+
selectedFiles: UploadFileInfo[];
|
|
72
|
+
/**
|
|
73
|
+
* All files currently in the PromptBox, including both previously selected and newly selected files.
|
|
74
|
+
*/
|
|
75
|
+
allFiles: UploadFileInfo[];
|
|
76
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { PropType } from 'vue';
|
|
9
|
+
import { UploadFileInfo } from '@progress/kendo-vue-upload';
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export interface FileBoxProps {
|
|
14
|
+
files: UploadFileInfo[];
|
|
15
|
+
onRemoveFile: (fileName: string) => void;
|
|
16
|
+
header?: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
* Displays the list of selected files with remove functionality.
|
|
21
|
+
*/
|
|
22
|
+
declare const FileBox: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
23
|
+
files: {
|
|
24
|
+
type: PropType<UploadFileInfo[]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
onRemoveFile: {
|
|
28
|
+
type: PropType<(fileName: string) => void>;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
header: {
|
|
32
|
+
type: PropType<any>;
|
|
33
|
+
default: any;
|
|
34
|
+
};
|
|
35
|
+
}>, {}, {
|
|
36
|
+
canScrollRight: boolean;
|
|
37
|
+
canScrollLeft: boolean;
|
|
38
|
+
resizeObserver: ResizeObserver;
|
|
39
|
+
}, {}, {
|
|
40
|
+
setupScrollListeners(): void;
|
|
41
|
+
cleanupScrollListeners(): void;
|
|
42
|
+
updateScrollState(): void;
|
|
43
|
+
handleRemoveFile(fileName: string, e: Event): void;
|
|
44
|
+
}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
45
|
+
files: {
|
|
46
|
+
type: PropType<UploadFileInfo[]>;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
onRemoveFile: {
|
|
50
|
+
type: PropType<(fileName: string) => void>;
|
|
51
|
+
required: true;
|
|
52
|
+
};
|
|
53
|
+
header: {
|
|
54
|
+
type: PropType<any>;
|
|
55
|
+
default: any;
|
|
56
|
+
};
|
|
57
|
+
}>> & Readonly<{}>, {
|
|
58
|
+
header: any;
|
|
59
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
60
|
+
export { FileBox };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),d=require("@progress/kendo-vue-buttons"),i=require("@progress/kendo-vue-common"),p=require("@progress/kendo-svg-icons"),h=require("@progress/kendo-vue-intl"),c=require("../messages/main.js"),S="k-prompt-box",m=1,f=e=>"."+(e.split(".").pop()||""),v=e=>{if(e==null)return"";if(e===0)return"0 B";const r=1024,s=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(e)/Math.log(r));return`${Number.parseFloat((e/Math.pow(r,o)).toFixed(2))} ${s[o]}`},g=t.defineComponent({name:"KendoFileBox",props:{files:{type:Array,required:!0},onRemoveFile:{type:Function,required:!0},header:{type:[Object,Function,String],default:void 0}},inject:{kendoLocalizationService:{default:null}},data(){return{canScrollRight:!1,canScrollLeft:!1,resizeObserver:null}},watch:{files:{handler(){t.nextTick(()=>{this.setupScrollListeners(),this.updateScrollState()})},deep:!0}},mounted(){t.nextTick(()=>{this.setupScrollListeners(),this.updateScrollState()})},beforeUnmount(){this.cleanupScrollListeners()},methods:{setupScrollListeners(){const e=this.$refs.scrollContainer;if(!e){this.cleanupScrollListeners();return}this._scrollContainer!==e&&(this.cleanupScrollListeners(),e.addEventListener("scroll",this.updateScrollState,{passive:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateScrollState()),this.resizeObserver.observe(e),this._scrollContainer=e)},cleanupScrollListeners(){this._scrollContainer&&(this._scrollContainer.removeEventListener("scroll",this.updateScrollState),this._scrollContainer=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},updateScrollState(){const e=this.$refs.scrollContainer;if(!e)return;const{scrollLeft:r,scrollWidth:s,clientWidth:o}=e,l=r===0,a=r+o>=s-m;this.canScrollLeft=!l,this.canScrollRight=!a},handleRemoveFile(e,r){r.stopPropagation(),this.$props.onRemoveFile&&this.$props.onRemoveFile(e)}},render(){const e=h.provideLocalizationService(this),{files:r,header:s}=this.$props;if(r.length===0&&!s)return null;const o=i.getTemplate.call(this,{h:t.h,template:s,defaultRendering:null}),l=e.toLanguageString(c.promptBoxRemoveFile,c.messages[c.promptBoxRemoveFile]),a=r.length>0&&t.createVNode("ul",{class:i.classNames("k-file-box-wrapper",{"k-file-box-wrapper-scrollable-start":this.canScrollRight,"k-file-box-wrapper-scrollable-end":this.canScrollLeft})},[t.createVNode("div",{class:"k-files-scroll",ref:"scrollContainer"},[r.map(n=>t.createVNode("li",{key:n.name,class:"k-file-box"},[t.createVNode(i.Icon,t.mergeProps({size:"xlarge"},i.getFileExtensionIcon(f(n.name))),null),t.createVNode("div",{class:"k-file-info"},[t.createVNode("span",{class:"k-file-name"},[n.name]),t.createVNode("span",{class:"k-file-size"},[v(n.size)])]),t.createVNode(d.Button,{fillMode:"flat",svgIcon:p.xMarkSmOutlineIcon,onClick:u=>this.handleRemoveFile(n.name,u),"aria-label":`${l} ${n.name}`,title:`${l} ${n.name}`},null)]))])]);return t.createVNode("div",{class:`${S}-header`},[o,a])}});exports.FileBox=g;
|