@progress/kendo-vue-buttons 8.4.0-develop.2 → 8.4.0-develop.3

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.
@@ -19,6 +19,8 @@ export interface ButtonItemProps {
19
19
  id?: string;
20
20
  textField?: string;
21
21
  role?: string;
22
+ first?: boolean;
23
+ last?: boolean;
22
24
  }
23
25
  /**
24
26
  * @hidden
@@ -32,6 +34,8 @@ declare const ButtonItem: import('vue').DefineComponent<import('vue').ExtractPro
32
34
  id: PropType<string>;
33
35
  textField: PropType<string>;
34
36
  role: PropType<string>;
37
+ first: PropType<boolean>;
38
+ last: PropType<boolean>;
35
39
  }>, {}, {}, {
36
40
  wrapperClass(): object;
37
41
  innerClass(): object;
@@ -50,6 +54,8 @@ declare const ButtonItem: import('vue').DefineComponent<import('vue').ExtractPro
50
54
  id: PropType<string>;
51
55
  textField: PropType<string>;
52
56
  role: PropType<string>;
57
+ first: PropType<boolean>;
58
+ last: PropType<boolean>;
53
59
  }>> & Readonly<{
54
60
  onClick?: (event: any, index: number) => any;
55
61
  onDown?: (event: any, index: number) => any;
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),o=require("@progress/kendo-vue-common"),l=t.defineComponent({name:"KendoButtonItem",emits:{click:(e,n)=>!0,down:(e,n)=>!0},props:{focused:Boolean,index:Number,item:Object,render:[String,Object,Function],dataItem:[String,Object],id:String,textField:String,role:String},computed:{wrapperClass(){return{"k-item":!0,"k-focus":this.$props.focused}},innerClass(){const{dataItem:e}=this.$props;return{"k-link k-menu-link":!0,"k-selected":e.selected,"k-disabled":e.disabled}}},methods:{onClick(e){this.$emit("click",e,this.$props.index)},onDown(e){this.$emit("down",e,this.$props.index)}},render(){const{dataItem:e,id:n,render:r}=this.$props,d=function(){const{textField:i,index:a}=this.$props,s=e.text!==void 0?e.text:i?e[i]:e,c=t.createVNode("span",{tabindex:-1,class:this.innerClass,key:"icon"},[e.icon||e.svgIcon?t.createVNode(o.Icon,{name:e.icon,icon:e.svgIcon,class:e.iconClass},null):e.iconClass&&t.createVNode("span",{class:e.iconClass,role:"presentation"},null),e.imageUrl&&t.createVNode("img",{class:"k-icon",alt:"",src:e.imageUrl,role:"presentation",key:"image"},null),s&&t.createVNode("span",{class:"k-menu-link-text"},[s])]);return o.getTemplate.call(this,{h:t.h,template:this.$props.dataItem.render||r,defaultRendering:c,additionalProps:{item:e,itemIndex:a,innerClass:this.innerClass,focused:this.focused}})};return t.createVNode("li",{id:n,class:this.wrapperClass,onClick:this.onClick,onMousedown:this.onDown,onPointerdown:this.onDown,role:"menuitem","aria-disabled":e.disabled||void 0},[d.call(this)])}});exports.ButtonItem=l;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),o=require("@progress/kendo-vue-common"),c=t.defineComponent({name:"KendoButtonItem",emits:{click:(e,n)=>!0,down:(e,n)=>!0},props:{focused:Boolean,index:Number,item:Object,render:[String,Object,Function],dataItem:[String,Object],id:String,textField:String,role:String,first:Boolean,last:Boolean},computed:{wrapperClass(){return{"k-item":!0,"k-menu-item":!0,"k-first":this.$props.first,"k-last":this.$props.last,"k-focus":this.$props.focused}},innerClass(){const{dataItem:e}=this.$props;return{"k-link k-menu-link":!0,"k-selected":e.selected,"k-disabled":e.disabled}}},methods:{onClick(e){this.$emit("click",e,this.$props.index)},onDown(e){this.$emit("down",e,this.$props.index)}},render(){const{dataItem:e,id:n,render:r}=this.$props,a=function(){const{textField:s,index:l}=this.$props,i=e.text!==void 0?e.text:s?e[s]:e,d=t.createVNode("span",{tabindex:-1,class:this.innerClass,key:"icon"},[e.icon||e.svgIcon?t.createVNode(o.Icon,{name:e.icon,icon:e.svgIcon,class:e.iconClass},null):e.iconClass&&t.createVNode("span",{class:e.iconClass,role:"presentation"},null),e.imageUrl&&t.createVNode("img",{class:"k-icon",alt:"",src:e.imageUrl,role:"presentation",key:"image"},null),i&&t.createVNode("span",{class:"k-menu-link-text"},[i])]);return o.getTemplate.call(this,{h:t.h,template:this.$props.dataItem.render||r,defaultRendering:d,additionalProps:{item:e,itemIndex:l,innerClass:this.innerClass,focused:this.focused}})};return t.createVNode("li",{id:n,class:this.wrapperClass,onClick:this.onClick,onMousedown:this.onDown,onPointerdown:this.onDown,role:"menuitem","aria-disabled":e.disabled||void 0},[a.call(this)])}});exports.ButtonItem=c;
@@ -5,9 +5,9 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { defineComponent as a, createVNode as t, h as c } from "vue";
8
+ import { defineComponent as d, createVNode as t, h as c } from "vue";
9
9
  import { Icon as m, getTemplate as p } from "@progress/kendo-vue-common";
10
- const x = /* @__PURE__ */ a({
10
+ const f = /* @__PURE__ */ d({
11
11
  name: "KendoButtonItem",
12
12
  emits: {
13
13
  click: (e, n) => !0,
@@ -21,12 +21,17 @@ const x = /* @__PURE__ */ a({
21
21
  dataItem: [String, Object],
22
22
  id: String,
23
23
  textField: String,
24
- role: String
24
+ role: String,
25
+ first: Boolean,
26
+ last: Boolean
25
27
  },
26
28
  computed: {
27
29
  wrapperClass() {
28
30
  return {
29
31
  "k-item": !0,
32
+ "k-menu-item": !0,
33
+ "k-first": this.$props.first,
34
+ "k-last": this.$props.last,
30
35
  "k-focus": this.$props.focused
31
36
  };
32
37
  },
@@ -56,9 +61,9 @@ const x = /* @__PURE__ */ a({
56
61
  render: o
57
62
  } = this.$props, r = function() {
58
63
  const {
59
- textField: i,
64
+ textField: s,
60
65
  index: l
61
- } = this.$props, s = e.text !== void 0 ? e.text : i ? e[i] : e, d = t("span", {
66
+ } = this.$props, i = e.text !== void 0 ? e.text : s ? e[s] : e, a = t("span", {
62
67
  tabindex: -1,
63
68
  class: this.innerClass,
64
69
  key: "icon"
@@ -75,13 +80,13 @@ const x = /* @__PURE__ */ a({
75
80
  src: e.imageUrl,
76
81
  role: "presentation",
77
82
  key: "image"
78
- }, null), s && t("span", {
83
+ }, null), i && t("span", {
79
84
  class: "k-menu-link-text"
80
- }, [s])]);
85
+ }, [i])]);
81
86
  return p.call(this, {
82
87
  h: c,
83
88
  template: this.$props.dataItem.render || o,
84
- defaultRendering: d,
89
+ defaultRendering: a,
85
90
  additionalProps: {
86
91
  item: e,
87
92
  itemIndex: l,
@@ -102,5 +107,5 @@ const x = /* @__PURE__ */ a({
102
107
  }
103
108
  });
104
109
  export {
105
- x as ButtonItem
110
+ f as ButtonItem
106
111
  };
@@ -97,10 +97,7 @@ declare const DropDownButton: import('vue').DefineComponent<import('vue').Extrac
97
97
  focusedIndex: number;
98
98
  }, {
99
99
  computedOpened(): boolean;
100
- wrapperClass(): {
101
- 'k-dropdown-button': boolean;
102
- 'k-focus': any;
103
- };
100
+ wrapperClass(): any;
104
101
  }, {
105
102
  element(): HTMLButtonElement | null;
106
103
  onKeyDown(event: any): void;
@@ -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 i=require("vue"),g=require("../Button.js"),s=require("@progress/kendo-vue-common"),y=require("./utils/navigation.js"),b=require("./ButtonItem.js"),k=require("@progress/kendo-vue-popup"),a=require("./utils/popup.js"),$=require("../package-metadata.js"),C=i.defineComponent({name:"KendoDropDownButton",emits:{focus:e=>!0,blur:e=>!0,itemclick:e=>!0,open:e=>!0,close:e=>!0},props:{accessKey:String,items:{type:Array,default:function(){return[]}},ariaLabel:String,text:String,textField:String,tabIndex:Number,disabled:Boolean,icon:String,svgIcon:Object,iconClass:String,imageUrl:String,popupSettings:Object,itemRender:[String,Object,Function],item:Function,size:String,rounded:String,fillMode:{type:String,validator:function(e){return["flat","link","outline","solid"].includes(e)}},themeColor:{type:String,validator:function(e){return["base","dark","error","info","inverse","light","primary","secondary","success","tertiary","warning"].includes(e)}},opened:{type:Boolean,default:void 0},buttonClass:String,dir:String},created(){this._blurTimeout=null,this._anchor=s.guid(),this.wrapper=null,this.mainButton=null,this.guid=s.guid(),this.buttonsData=[],s.validatePackage($.packageMetadata)},mounted(){this.mainButton=this.$refs[this._anchor],(this.$props.dir===void 0&&this.isRtl()||this.computedOpened)&&this.$forceUpdate()},updated(){this.focused&&this.element()&&(this.mainButton=this.$refs[this._anchor],this.mainButton.focus())},data(){return{currentOpened:!1,focused:!1,focusedIndex:-1}},computed:{computedOpened(){return this.$props.opened===void 0?this.currentOpened:this.$props.opened},wrapperClass(){return{"k-dropdown-button":!0,"k-focus":this.focused}}},setup(){return{kendoAnchorRef:i.ref(null)}},render(){const e=this.isRtl(),t=e?"rtl":void 0,{tabIndex:n,disabled:p}=this.$props,c=s.getDefaultSlots(this);this.buttonsData=this.$props.items;const h=function(){const{item:o,itemRender:r,textField:f}=this.$props;return this.buttonsData.length>0?this.buttonsData.map(function(u,d){const m=typeof u!="string"?{...u,render:s.templateRendering.call(this,u.render,s.getListeners.call(this))}:u;return i.createVNode(b.ButtonItem,{class:"k-menu-item",dataItem:m,textField:f,focused:this.focusedIndex===d,onClick:this.onItemClick,onDown:this.onItemDown,render:s.templateRendering.call(this,r,s.getListeners.call(this)),item:o,index:d,key:d,id:`${this.guid}-${d}`},null)},this):null},l=function(){const{popupSettings:o={},size:r}=this.$props;return i.createVNode(k.Popup,{anchor:this._anchor,show:this.computedOpened,animate:o.animate,popupClass:s.classNames("k-menu-popup",o.popupClass),anchorAlign:o.anchorAlign||a.getAnchorAlign(e),popupAlign:o.popupAlign||a.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[i.createVNode("ul",{class:`k-group k-menu-group k-reset k-menu-group-${s.kendoThemeMaps.sizeMap[r]||r}`,role:"menu",id:this.guid},[h.call(this)])]})};return i.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[i.createVNode(g.Button,{size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:this.onClickMainButton,onMousedown:this.mouseDown,disabled:p||void 0,tabIndex:n,accessKey:this.$props.accessKey,icon:this.$props.icon,svgIcon:this.$props.svgIcon,iconClass:this.$props.iconClass,class:this.$props.buttonClass,imageUrl:this.$props.imageUrl,dir:t,ref:this._anchor,type:"button","aria-disabled":p,"aria-haspopup":"menu","aria-expanded":this.computedOpened,"aria-label":this.$props.ariaLabel||`${this.$props.text||""} dropdownbutton`,"aria-controls":this.guid,"aria-activedescendant":this.focusedIndex!==void 0&&this.focusedIndex>=0?`${this.guid}-${this.focusedIndex}`:void 0},{default:()=>[this.$props.text,c]}),l.call(this)])},methods:{element(){return this.mainButton},onKeyDown(e){if(e.altKey){!this.computedOpened&&e.keyCode===s.Keys.down?(this.dispatchPopupEvent(e,!0),this.focusedIndex=0,this.currentOpened=!0):this.computedOpened&&e.keyCode===s.Keys.up&&(this.dispatchPopupEvent(e,!1),this.focusedIndex=-1,this.currentOpened=!1);return}if(e.keyCode===s.Keys.enter||e.keyCode===s.Keys.space?(this.focusedIndex!==void 0&&this.focusedIndex>=0&&this.dispatchClickEvent(e,this.focusedIndex),e.preventDefault(),this.focusedIndex=this.computedOpened?-1:0,this.currentOpened=!this.computedOpened,this.dispatchPopupEvent(e,this.currentOpened)):this.computedOpened&&e.keyCode===s.Keys.esc&&(this.focusedIndex=-1,this.currentOpened=!1,this.dispatchPopupEvent(e,this.currentOpened)),this.computedOpened){const t=y(this.focusedIndex,e.keyCode,e.altKey,this.buttonsData.length);this.focusedIndex=t;const n=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right;!e.altKey&&n&&e.preventDefault()}},onFocus(e){this.focused||(this.focused=!0,this.$emit("focus",{event:e})),this.focusedIndex=this.computedOpened?0:-1,clearTimeout(this._blurTimeout)},onBlur(e){clearTimeout(this._blurTimeout),this.createBlurTimeout(e)},createBlurTimeout(e){const t=this;this._blurTimeout=setTimeout(()=>{s.canUseDOM&&document.activeElement!==t.$el&&(t.focused=!1,t.focusedIndex=-1,t.$emit("blur",{event:e}),t.computedOpened&&(t.currentOpened=!1,t.dispatchPopupEvent(e,!1)))},200)},onItemClick(e,t){this.focusedIndex=-1,this.currentOpened=!1,this.dispatchClickEvent(e,t),this.dispatchPopupEvent(e,!1)},onItemDown(e){document.activeElement===this.element()&&e.preventDefault()},mouseDown(e){e.preventDefault()},dispatchClickEvent(e,t){this.isItemDisabled(t)||this.$emit("itemclick",{event:e,item:this.buttonsData[t],itemIndex:t})},onClickMainButton(e){if(!this.buttonsData.length)return;const t=!this.computedOpened;this.currentOpened=t,this.focused=!0,this.focusedIndex=t?0:-1,this.dispatchPopupEvent(e,t)},dispatchPopupEvent(e,t){const n={event:e};this.$emit(t?"open":"close",n)},isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.$props.disabled},isRtl(){return this.$props.dir!==void 0?this.$props.dir==="rtl":!!this.$el&&getComputedStyle(this.$el).direction==="rtl"}}});exports.DropDownButton=C;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),b=require("../Button.js"),s=require("@progress/kendo-vue-common"),$=require("./utils/navigation.js"),C=require("./ButtonItem.js"),k=require("@progress/kendo-vue-popup"),l=require("./utils/popup.js"),I=require("../package-metadata.js"),D=i.defineComponent({name:"KendoDropDownButton",emits:{focus:e=>!0,blur:e=>!0,itemclick:e=>!0,open:e=>!0,close:e=>!0},props:{accessKey:String,items:{type:Array,default:function(){return[]}},ariaLabel:String,text:String,textField:String,tabIndex:Number,disabled:Boolean,icon:String,svgIcon:Object,iconClass:String,imageUrl:String,popupSettings:Object,itemRender:[String,Object,Function],item:Function,size:String,rounded:String,fillMode:{type:String,validator:function(e){return["flat","link","outline","solid"].includes(e)}},themeColor:{type:String,validator:function(e){return["base","dark","error","info","inverse","light","primary","secondary","success","tertiary","warning"].includes(e)}},opened:{type:Boolean,default:void 0},buttonClass:String,dir:String},created(){this._blurTimeout=null,this._anchor=s.guid(),this.wrapper=null,this.mainButton=null,this.guid=s.guid(),this.buttonsData=[],s.validatePackage(I.packageMetadata)},mounted(){this.mainButton=this.$refs[this._anchor],(this.$props.dir===void 0&&this.isRtl()||this.computedOpened)&&this.$forceUpdate()},updated(){this.focused&&this.element()&&(this.mainButton=this.$refs[this._anchor],this.mainButton.focus())},data(){return{currentOpened:!1,focused:!1,focusedIndex:-1}},computed:{computedOpened(){return this.$props.opened===void 0?this.currentOpened:this.$props.opened},wrapperClass(){}},setup(){return{kendoAnchorRef:i.ref(null)}},render(){const e=this.isRtl(),t=e?"rtl":void 0,{tabIndex:n,disabled:d}=this.$props,c=s.getDefaultSlots(this);this.buttonsData=this.$props.items;const h=function(){const{item:o,itemRender:p,textField:g}=this.$props,a=this.buttonsData.length;return a>0?this.buttonsData.map(function(u,r){const y=typeof u!="string"?{...u,render:s.templateRendering.call(this,u.render,s.getListeners.call(this))}:u;return i.createVNode(C.ButtonItem,{dataItem:y,textField:g,focused:this.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:s.templateRendering.call(this,p,s.getListeners.call(this)),item:o,index:r,key:r,id:`${this.guid}-${r}`,first:r===0,last:r===a-1},null)},this):null},f=function(){const{popupSettings:o={},size:p}=this.$props;return i.createVNode(k.Popup,{anchor:this._anchor,show:this.computedOpened,animate:o.animate,popupClass:s.classNames("k-menu-popup",o.popupClass),anchorAlign:o.anchorAlign||l.getAnchorAlign(e),popupAlign:o.popupAlign||l.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[i.createVNode("ul",{class:"k-menu-group",role:"menu",id:this.guid},[h.call(this)])]})},m=this.$props.text||c?{default:()=>[this.$props.text,c]}:{};return i.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[i.createVNode(b.Button,{size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:this.onClickMainButton,onMousedown:this.mouseDown,disabled:d||void 0,tabIndex:n,accessKey:this.$props.accessKey,icon:this.$props.icon,svgIcon:this.$props.svgIcon,iconClass:this.$props.iconClass,class:s.classNames("k-menu-button",this.$props.buttonClass),imageUrl:this.$props.imageUrl,dir:t,ref:this._anchor,type:"button","aria-disabled":d||void 0,"aria-expanded":this.computedOpened,"aria-label":this.$props.ariaLabel||(this.$props.svgIcon||this.$props.icon||this.$props.iconClass?"Menu":void 0),"aria-controls":this.computedOpened?this.guid:void 0,"aria-activedescendant":this.computedOpened&&this.focusedIndex!==void 0&&this.focusedIndex>=0?`${this.guid}-${this.focusedIndex}`:void 0},m),f.call(this)])},methods:{element(){return this.mainButton},onKeyDown(e){if(e.altKey){!this.computedOpened&&e.keyCode===s.Keys.down?(this.dispatchPopupEvent(e,!0),this.focusedIndex=0,this.currentOpened=!0):this.computedOpened&&e.keyCode===s.Keys.up&&(this.dispatchPopupEvent(e,!1),this.focusedIndex=-1,this.currentOpened=!1);return}if(e.keyCode===s.Keys.enter||e.keyCode===s.Keys.space?(this.focusedIndex!==void 0&&this.focusedIndex>=0&&this.dispatchClickEvent(e,this.focusedIndex),e.preventDefault(),this.focusedIndex=this.computedOpened?-1:0,this.currentOpened=!this.computedOpened,this.dispatchPopupEvent(e,this.currentOpened)):this.computedOpened&&e.keyCode===s.Keys.esc&&(this.focusedIndex=-1,this.currentOpened=!1,this.dispatchPopupEvent(e,this.currentOpened)),this.computedOpened){const t=$(this.focusedIndex,e.keyCode,e.altKey,this.buttonsData.length);this.focusedIndex=t;const n=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right;!e.altKey&&n&&e.preventDefault()}},onFocus(e){this.focused||(this.focused=!0,this.$emit("focus",{event:e})),this.focusedIndex=this.computedOpened?0:-1,clearTimeout(this._blurTimeout)},onBlur(e){clearTimeout(this._blurTimeout),this.createBlurTimeout(e)},createBlurTimeout(e){const t=this;this._blurTimeout=setTimeout(()=>{s.canUseDOM&&document.activeElement!==t.$el&&(t.focused=!1,t.focusedIndex=-1,t.$emit("blur",{event:e}),t.computedOpened&&(t.currentOpened=!1,t.dispatchPopupEvent(e,!1)))},200)},onItemClick(e,t){this.focusedIndex=-1,this.currentOpened=!1,this.dispatchClickEvent(e,t),this.dispatchPopupEvent(e,!1)},onItemDown(e){document.activeElement===this.element()&&e.preventDefault()},mouseDown(e){e.preventDefault()},dispatchClickEvent(e,t){this.isItemDisabled(t)||this.$emit("itemclick",{event:e,item:this.buttonsData[t],itemIndex:t})},onClickMainButton(e){if(!this.buttonsData.length)return;const t=!this.computedOpened;this.currentOpened=t,this.focused=!0,this.focusedIndex=t?0:-1,this.dispatchPopupEvent(e,t)},dispatchPopupEvent(e,t){const n={event:e};this.$emit(t?"open":"close",n)},isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.$props.disabled},isRtl(){return this.$props.dir!==void 0?this.$props.dir==="rtl":!!this.$el&&getComputedStyle(this.$el).direction==="rtl"}}});exports.DropDownButton=D;
@@ -5,22 +5,22 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { defineComponent as $, createVNode as o, ref as k } from "vue";
9
- import { Button as C } from "../Button.mjs";
10
- import { canUseDOM as y, Keys as s, getDefaultSlots as I, guid as a, validatePackage as D, classNames as O, kendoThemeMaps as x, templateRendering as c, getListeners as h } from "@progress/kendo-vue-common";
11
- import w from "./utils/navigation.mjs";
12
- import { ButtonItem as S } from "./ButtonItem.mjs";
8
+ import { defineComponent as I, createVNode as r, ref as k } from "vue";
9
+ import { Button as O } from "../Button.mjs";
10
+ import { canUseDOM as D, Keys as s, getDefaultSlots as x, classNames as h, guid as l, validatePackage as w, templateRendering as f, getListeners as m } from "@progress/kendo-vue-common";
11
+ import S from "./utils/navigation.mjs";
12
+ import { ButtonItem as v } from "./ButtonItem.mjs";
13
13
  import { Popup as B } from "@progress/kendo-vue-popup";
14
- import { getPopupAlign as v, getAnchorAlign as E } from "./utils/popup.mjs";
15
- import { packageMetadata as K } from "../package-metadata.mjs";
16
- const U = /* @__PURE__ */ $({
14
+ import { getPopupAlign as E, getAnchorAlign as K } from "./utils/popup.mjs";
15
+ import { packageMetadata as P } from "../package-metadata.mjs";
16
+ const j = /* @__PURE__ */ I({
17
17
  name: "KendoDropDownButton",
18
18
  emits: {
19
- focus: (e) => !0,
20
- blur: (e) => !0,
21
- itemclick: (e) => !0,
22
- open: (e) => !0,
23
- close: (e) => !0
19
+ focus: (t) => !0,
20
+ blur: (t) => !0,
21
+ itemclick: (t) => !0,
22
+ open: (t) => !0,
23
+ close: (t) => !0
24
24
  },
25
25
  props: {
26
26
  accessKey: String,
@@ -46,14 +46,14 @@ const U = /* @__PURE__ */ $({
46
46
  rounded: String,
47
47
  fillMode: {
48
48
  type: String,
49
- validator: function(e) {
50
- return ["flat", "link", "outline", "solid"].includes(e);
49
+ validator: function(t) {
50
+ return ["flat", "link", "outline", "solid"].includes(t);
51
51
  }
52
52
  },
53
53
  themeColor: {
54
54
  type: String,
55
- validator: function(e) {
56
- return ["base", "dark", "error", "info", "inverse", "light", "primary", "secondary", "success", "tertiary", "warning"].includes(e);
55
+ validator: function(t) {
56
+ return ["base", "dark", "error", "info", "inverse", "light", "primary", "secondary", "success", "tertiary", "warning"].includes(t);
57
57
  }
58
58
  },
59
59
  opened: {
@@ -64,7 +64,7 @@ const U = /* @__PURE__ */ $({
64
64
  dir: String
65
65
  },
66
66
  created() {
67
- this._blurTimeout = null, this._anchor = a(), this.wrapper = null, this.mainButton = null, this.guid = a(), this.buttonsData = [], D(K);
67
+ this._blurTimeout = null, this._anchor = l(), this.wrapper = null, this.mainButton = null, this.guid = l(), this.buttonsData = [], w(P);
68
68
  },
69
69
  mounted() {
70
70
  this.mainButton = this.$refs[this._anchor], (this.$props.dir === void 0 && this.isRtl() || this.computedOpened) && this.$forceUpdate();
@@ -84,10 +84,6 @@ const U = /* @__PURE__ */ $({
84
84
  return this.$props.opened === void 0 ? this.currentOpened : this.$props.opened;
85
85
  },
86
86
  wrapperClass() {
87
- return {
88
- "k-dropdown-button": !0,
89
- "k-focus": this.focused
90
- };
91
87
  }
92
88
  },
93
89
  setup() {
@@ -96,155 +92,155 @@ const U = /* @__PURE__ */ $({
96
92
  };
97
93
  },
98
94
  render() {
99
- const e = this.isRtl(), t = e ? "rtl" : void 0, {
95
+ const t = this.isRtl(), e = t ? "rtl" : void 0, {
100
96
  tabIndex: i,
101
- disabled: p
102
- } = this.$props, l = I(this);
97
+ disabled: u
98
+ } = this.$props, p = x(this);
103
99
  this.buttonsData = this.$props.items;
104
- const f = function() {
100
+ const g = function() {
105
101
  const {
106
102
  item: n,
107
- itemRender: r,
108
- textField: g
109
- } = this.$props;
110
- return this.buttonsData.length > 0 ? this.buttonsData.map(function(d, u) {
111
- const b = typeof d != "string" ? {
103
+ itemRender: c,
104
+ textField: C
105
+ } = this.$props, a = this.buttonsData.length;
106
+ return a > 0 ? this.buttonsData.map(function(d, o) {
107
+ const y = typeof d != "string" ? {
112
108
  ...d,
113
- render: c.call(this, d.render, h.call(this))
109
+ render: f.call(this, d.render, m.call(this))
114
110
  } : d;
115
- return o(S, {
116
- class: "k-menu-item",
117
- dataItem: b,
118
- textField: g,
119
- focused: this.focusedIndex === u,
111
+ return r(v, {
112
+ dataItem: y,
113
+ textField: C,
114
+ focused: this.focusedIndex === o,
120
115
  onClick: this.onItemClick,
121
116
  onDown: this.onItemDown,
122
- render: c.call(this, r, h.call(this)),
117
+ render: f.call(this, c, m.call(this)),
123
118
  item: n,
124
- index: u,
125
- key: u,
126
- id: `${this.guid}-${u}`
119
+ index: o,
120
+ key: o,
121
+ id: `${this.guid}-${o}`,
122
+ first: o === 0,
123
+ last: o === a - 1
127
124
  }, null);
128
125
  }, this) : null;
129
- }, m = function() {
126
+ }, $ = function() {
130
127
  const {
131
128
  popupSettings: n = {},
132
- size: r
129
+ size: c
133
130
  } = this.$props;
134
- return o(B, {
131
+ return r(B, {
135
132
  anchor: this._anchor,
136
133
  show: this.computedOpened,
137
134
  animate: n.animate,
138
- popupClass: O("k-menu-popup", n.popupClass),
139
- anchorAlign: n.anchorAlign || E(e),
140
- popupAlign: n.popupAlign || v(e),
141
- style: e ? {
135
+ popupClass: h("k-menu-popup", n.popupClass),
136
+ anchorAlign: n.anchorAlign || K(t),
137
+ popupAlign: n.popupAlign || E(t),
138
+ style: t ? {
142
139
  direction: "rtl"
143
140
  } : void 0
144
141
  }, {
145
- default: () => [o("ul", {
146
- class: `k-group k-menu-group k-reset k-menu-group-${x.sizeMap[r] || r}`,
142
+ default: () => [r("ul", {
143
+ class: "k-menu-group",
147
144
  role: "menu",
148
145
  id: this.guid
149
- }, [f.call(this)])]
146
+ }, [g.call(this)])]
150
147
  });
151
- };
152
- return o("div", {
148
+ }, b = this.$props.text || p ? {
149
+ default: () => [this.$props.text, p]
150
+ } : {};
151
+ return r("div", {
153
152
  class: this.wrapperClass,
154
153
  onKeydown: this.onKeyDown,
155
154
  onFocusin: this.onFocus,
156
155
  onFocusout: this.onBlur,
157
- dir: t
158
- }, [o(C, {
156
+ dir: e
157
+ }, [r(O, {
159
158
  size: this.$props.size,
160
159
  rounded: this.$props.rounded,
161
160
  fillMode: this.$props.fillMode,
162
161
  themeColor: this.$props.themeColor,
163
162
  onClick: this.onClickMainButton,
164
163
  onMousedown: this.mouseDown,
165
- disabled: p || void 0,
164
+ disabled: u || void 0,
166
165
  tabIndex: i,
167
166
  accessKey: this.$props.accessKey,
168
167
  icon: this.$props.icon,
169
168
  svgIcon: this.$props.svgIcon,
170
169
  iconClass: this.$props.iconClass,
171
- class: this.$props.buttonClass,
170
+ class: h("k-menu-button", this.$props.buttonClass),
172
171
  imageUrl: this.$props.imageUrl,
173
- dir: t,
172
+ dir: e,
174
173
  ref: this._anchor,
175
174
  type: "button",
176
- "aria-disabled": p,
177
- "aria-haspopup": "menu",
175
+ "aria-disabled": u || void 0,
178
176
  "aria-expanded": this.computedOpened,
179
- "aria-label": this.$props.ariaLabel || `${this.$props.text || ""} dropdownbutton`,
180
- "aria-controls": this.guid,
181
- "aria-activedescendant": this.focusedIndex !== void 0 && this.focusedIndex >= 0 ? `${this.guid}-${this.focusedIndex}` : void 0
182
- }, {
183
- default: () => [this.$props.text, l]
184
- }), m.call(this)]);
177
+ "aria-label": this.$props.ariaLabel || (this.$props.svgIcon || this.$props.icon || this.$props.iconClass ? "Menu" : void 0),
178
+ "aria-controls": this.computedOpened ? this.guid : void 0,
179
+ "aria-activedescendant": this.computedOpened && this.focusedIndex !== void 0 && this.focusedIndex >= 0 ? `${this.guid}-${this.focusedIndex}` : void 0
180
+ }, b), $.call(this)]);
185
181
  },
186
182
  methods: {
187
183
  element() {
188
184
  return this.mainButton;
189
185
  },
190
- onKeyDown(e) {
191
- if (e.altKey) {
192
- !this.computedOpened && e.keyCode === s.down ? (this.dispatchPopupEvent(e, !0), this.focusedIndex = 0, this.currentOpened = !0) : this.computedOpened && e.keyCode === s.up && (this.dispatchPopupEvent(e, !1), this.focusedIndex = -1, this.currentOpened = !1);
186
+ onKeyDown(t) {
187
+ if (t.altKey) {
188
+ !this.computedOpened && t.keyCode === s.down ? (this.dispatchPopupEvent(t, !0), this.focusedIndex = 0, this.currentOpened = !0) : this.computedOpened && t.keyCode === s.up && (this.dispatchPopupEvent(t, !1), this.focusedIndex = -1, this.currentOpened = !1);
193
189
  return;
194
190
  }
195
- if (e.keyCode === s.enter || e.keyCode === s.space ? (this.focusedIndex !== void 0 && this.focusedIndex >= 0 && this.dispatchClickEvent(e, this.focusedIndex), e.preventDefault(), this.focusedIndex = this.computedOpened ? -1 : 0, this.currentOpened = !this.computedOpened, this.dispatchPopupEvent(e, this.currentOpened)) : this.computedOpened && e.keyCode === s.esc && (this.focusedIndex = -1, this.currentOpened = !1, this.dispatchPopupEvent(e, this.currentOpened)), this.computedOpened) {
196
- const t = w(this.focusedIndex, e.keyCode, e.altKey, this.buttonsData.length);
197
- this.focusedIndex = t;
198
- const i = e.keyCode === s.up || e.keyCode === s.down || e.keyCode === s.left || e.keyCode === s.right;
199
- !e.altKey && i && e.preventDefault();
191
+ if (t.keyCode === s.enter || t.keyCode === s.space ? (this.focusedIndex !== void 0 && this.focusedIndex >= 0 && this.dispatchClickEvent(t, this.focusedIndex), t.preventDefault(), this.focusedIndex = this.computedOpened ? -1 : 0, this.currentOpened = !this.computedOpened, this.dispatchPopupEvent(t, this.currentOpened)) : this.computedOpened && t.keyCode === s.esc && (this.focusedIndex = -1, this.currentOpened = !1, this.dispatchPopupEvent(t, this.currentOpened)), this.computedOpened) {
192
+ const e = S(this.focusedIndex, t.keyCode, t.altKey, this.buttonsData.length);
193
+ this.focusedIndex = e;
194
+ const i = t.keyCode === s.up || t.keyCode === s.down || t.keyCode === s.left || t.keyCode === s.right;
195
+ !t.altKey && i && t.preventDefault();
200
196
  }
201
197
  },
202
- onFocus(e) {
198
+ onFocus(t) {
203
199
  this.focused || (this.focused = !0, this.$emit("focus", {
204
- event: e
200
+ event: t
205
201
  })), this.focusedIndex = this.computedOpened ? 0 : -1, clearTimeout(this._blurTimeout);
206
202
  },
207
- onBlur(e) {
208
- clearTimeout(this._blurTimeout), this.createBlurTimeout(e);
203
+ onBlur(t) {
204
+ clearTimeout(this._blurTimeout), this.createBlurTimeout(t);
209
205
  },
210
- createBlurTimeout(e) {
211
- const t = this;
206
+ createBlurTimeout(t) {
207
+ const e = this;
212
208
  this._blurTimeout = setTimeout(() => {
213
- y && document.activeElement !== t.$el && (t.focused = !1, t.focusedIndex = -1, t.$emit("blur", {
214
- event: e
215
- }), t.computedOpened && (t.currentOpened = !1, t.dispatchPopupEvent(e, !1)));
209
+ D && document.activeElement !== e.$el && (e.focused = !1, e.focusedIndex = -1, e.$emit("blur", {
210
+ event: t
211
+ }), e.computedOpened && (e.currentOpened = !1, e.dispatchPopupEvent(t, !1)));
216
212
  }, 200);
217
213
  },
218
- onItemClick(e, t) {
219
- this.focusedIndex = -1, this.currentOpened = !1, this.dispatchClickEvent(e, t), this.dispatchPopupEvent(e, !1);
214
+ onItemClick(t, e) {
215
+ this.focusedIndex = -1, this.currentOpened = !1, this.dispatchClickEvent(t, e), this.dispatchPopupEvent(t, !1);
220
216
  },
221
- onItemDown(e) {
222
- document.activeElement === this.element() && e.preventDefault();
217
+ onItemDown(t) {
218
+ document.activeElement === this.element() && t.preventDefault();
223
219
  },
224
- mouseDown(e) {
225
- e.preventDefault();
220
+ mouseDown(t) {
221
+ t.preventDefault();
226
222
  },
227
- dispatchClickEvent(e, t) {
228
- this.isItemDisabled(t) || this.$emit("itemclick", {
229
- event: e,
230
- item: this.buttonsData[t],
231
- itemIndex: t
223
+ dispatchClickEvent(t, e) {
224
+ this.isItemDisabled(e) || this.$emit("itemclick", {
225
+ event: t,
226
+ item: this.buttonsData[e],
227
+ itemIndex: e
232
228
  });
233
229
  },
234
- onClickMainButton(e) {
230
+ onClickMainButton(t) {
235
231
  if (!this.buttonsData.length)
236
232
  return;
237
- const t = !this.computedOpened;
238
- this.currentOpened = t, this.focused = !0, this.focusedIndex = t ? 0 : -1, this.dispatchPopupEvent(e, t);
233
+ const e = !this.computedOpened;
234
+ this.currentOpened = e, this.focused = !0, this.focusedIndex = e ? 0 : -1, this.dispatchPopupEvent(t, e);
239
235
  },
240
- dispatchPopupEvent(e, t) {
236
+ dispatchPopupEvent(t, e) {
241
237
  const i = {
242
- event: e
238
+ event: t
243
239
  };
244
- this.$emit(t ? "open" : "close", i);
240
+ this.$emit(e ? "open" : "close", i);
245
241
  },
246
- isItemDisabled(e) {
247
- return this.buttonsData[e] ? this.buttonsData[e].disabled : this.$props.disabled;
242
+ isItemDisabled(t) {
243
+ return this.buttonsData[t] ? this.buttonsData[t].disabled : this.$props.disabled;
248
244
  },
249
245
  isRtl() {
250
246
  return this.$props.dir !== void 0 ? this.$props.dir === "rtl" : !!this.$el && getComputedStyle(this.$el).direction === "rtl";
@@ -252,5 +248,5 @@ const U = /* @__PURE__ */ $({
252
248
  }
253
249
  });
254
250
  export {
255
- U as DropDownButton
251
+ j as DropDownButton
256
252
  };
@@ -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 o=require("vue"),a=require("../Button.js"),i=require("@progress/kendo-vue-common"),b=require("./ButtonItem.js"),y=require("./utils/navigation.js"),k=require("@progress/kendo-vue-popup"),p=require("./utils/popup.js"),$=require("@progress/kendo-svg-icons"),C=require("../package-metadata.js"),I=o.defineComponent({name:"KendoSplitButton",emits:{focus:e=>!0,blur:e=>!0,buttonclick:e=>!0,itemclick:e=>!0,open:e=>!0,close:e=>!0},props:{accessKey:String,ariaLabel:String,text:String,items:{type:Array,default:function(){return[]}},textField:String,tabIndex:Number,disabled:Boolean,icon:String,svgIcon:Object,size:String,rounded:String,fillMode:{type:String,validator:function(e){return["flat","link","outline","solid"].includes(e)}},themeColor:{type:String,validator:function(e){return["base","dark","error","info","inverse","light","primary","secondary","success","tertiary","warning"].includes(e)}},opened:{type:Boolean,default:void 0},iconClass:String,imageUrl:String,popupSettings:Object,itemRender:[String,Function,Object],item:[String,Function,Object],className:String,buttonClass:String,dir:String},data(){return{focused:!1,focusedIndex:-1,currentOpened:!1}},created(){this._blurTimeout=null,this._anchor=i.guid(),this.mainButton=null,this.guid=i.guid(),this.buttonsData=[],i.validatePackage(C.packageMetadata)},mounted(){this.mainButton=this.$refs[this._anchor],(this.$props.dir===void 0&&this.isRtl()||this.computedOpened)&&this.$forceUpdate()},updated(){this.focused&&this.element()&&(this.mainButton=this.$refs[this._anchor],this.mainButton.focus())},computed:{computedOpened(){return this.$props.opened===void 0?this.currentOpened:this.$props.opened},wrapperClass(){return{"k-split-button":!0,"k-button-group":!0,"k-focus":this.focused}}},setup(){return{kendoAnchorRef:o.ref(null)}},render(){this.buttonsData=this.$props.items;const e=this.isRtl(),t=e?"rtl":void 0,{tabIndex:s,disabled:r}=this.$props,l=i.getDefaultSlots(this),h=function(){const{item:n,itemRender:u,textField:m}=this.$props;return this.buttonsData.length>0?this.buttonsData.map(function(d,c){const g=typeof d!="string"?{...d,render:i.templateRendering.call(this,d.render,i.getListeners.call(this))}:d;return o.createVNode(b.ButtonItem,{class:"k-menu-item",role:"menuitem",dataItem:g,textField:m,focused:this.focusedIndex===c,onClick:this.onItemClick,onDown:this.onItemDown,render:i.templateRendering.call(this,u,i.getListeners.call(this)),item:n,key:c,index:c,id:`${this.guid}-${c}`},null)},this):null},f=function(){const{popupSettings:n={},size:u}=this.$props;return o.createVNode(k.Popup,{anchor:this._anchor,show:this.computedOpened,animate:n.animate,popupClass:i.classNames("k-menu-popup",n.popupClass),anchorAlign:n.anchorAlign||p.getAnchorAlign(e),popupAlign:n.popupAlign||p.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[o.createVNode("ul",{class:`k-group k-menu-group k-reset k-menu-group-${i.kendoThemeMaps.sizeMap[u]||u}`,role:"menu",id:this.guid,"aria-labelledby":this._anchor},[h.call(this)])]})};return o.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[o.createVNode(a.Button,{size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:n=>this.onItemClick(n,-1),disabled:r||void 0,tabIndex:s,accessKey:this.$props.accessKey,class:this.$props.buttonClass,icon:this.$props.icon,svgIcon:this.$props.svgIcon,iconClass:this.$props.iconClass,imageUrl:this.$props.imageUrl,dir:t,id:this._anchor,ref:this._anchor,type:"button","aria-disabled":r,"aria-haspopup":"menu","aria-expanded":this.computedOpened,"aria-label":this.$props.ariaLabel||`${this.$props.text||""} splitbutton`,"aria-controls":this.guid,"aria-activedescendant":this.focusedIndex!==void 0&&this.focusedIndex>=0?`${this.guid}-${this.focusedIndex}`:void 0},{default:()=>[this.$props.text,l]}),o.createVNode(a.Button,{svgIcon:$.caretAltDownIcon,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,icon:"caret-alt-down",disabled:r||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMousedown:this.onDownSplitPart,onPointerdown:this.onDownSplitPart,dir:t,"aria-label":"menu toggling button"},null),f.call(this)])},methods:{element(){return this.mainButton},onKeyDown(e){if(e.altKey){!this.computedOpened&&e.keyCode===i.Keys.down?(this.dispatchPopupEvent(e,!0),this.focusedIndex=0,this.currentOpened=!0):this.computedOpened&&e.keyCode===i.Keys.up&&(this.dispatchPopupEvent(e,!1),this.focusedIndex=-1,this.currentOpened=!1);return}let t;if(e.keyCode===i.Keys.enter||e.keyCode===i.Keys.space?(e.preventDefault(),this.dispatchClickEvent(e,this.focusedIndex),this.focusedIndex!==void 0&&this.focusedIndex>=0&&(t={focusedIndex:this.computedOpened?-1:0,currentOpened:!this.computedOpened},this.dispatchPopupEvent(e,t.currentOpened))):this.computedOpened&&e.keyCode===i.Keys.esc&&(t={focusedIndex:-1,currentOpened:!1},this.dispatchPopupEvent(e,t.currentOpened)),this.computedOpened){const s=y(this.focusedIndex,e.keyCode,e.altKey,this.buttonsData.length);s!==this.focusedIndex&&(t=t||{},t.focusedIndex=s);const r=e.keyCode===i.Keys.up||e.keyCode===i.Keys.down||e.keyCode===i.Keys.left||e.keyCode===i.Keys.right;!e.altKey&&r&&e.preventDefault()}t&&(this.focusedIndex=t.focusedIndex,this.focused=t.focused,t.currentOpened!==void 0&&(this.currentOpened=t.currentOpened))},onFocus(e){this.focused||(this.$emit("focus",{event:e}),this.focused=!0),this.focusedIndex=-1,clearTimeout(this._blurTimeout)},onItemClick(e,t){const s=this.computedOpened;s&&(this.focusedIndex=0,this.currentOpened=!1),this.dispatchClickEvent(e,t),s&&this.dispatchPopupEvent(e,!1)},onBlur(e){clearTimeout(this._blurTimeout),this.createBlurTimeout(e)},createBlurTimeout(e){const t=this;this._blurTimeout=setTimeout(()=>{i.canUseDOM&&document.activeElement!==t.mainButton&&(t.focused=!1,t.focusedIndex=-1,t.$emit("blur",{event:e}),t.computedOpened&&(t.currentOpened=!1,t.dispatchPopupEvent(e,!1)))},200)},dispatchClickEvent(e,t){this.isItemDisabled(t)||(t===-1?this.$emit("buttonclick",{event:e}):this.$emit("itemclick",{event:e,component:this,item:this.buttonsData[t],itemIndex:t}))},onSplitPartClick(e){if(this.buttonsData.length){const t=!this.computedOpened;this.dispatchPopupEvent(e,t),this.focusedIndex=t?0:-1,this.currentOpened=t,this.focused=!0}},onDownSplitPart(e){e.preventDefault(),this.element()&&document.activeElement!==this.element()&&this.element().focus()},onItemDown(e){document.activeElement===this.element()&&e.preventDefault()},dispatchPopupEvent(e,t){const s={event:e};this.$emit(t?"open":"close",s)},isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.$props.disabled},isRtl(){return this.$props.dir!==void 0?this.$props.dir==="rtl":!!this.$el&&getComputedStyle(this.$el).direction==="rtl"}}});exports.SplitButton=I;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),l=require("../Button.js"),s=require("@progress/kendo-vue-common"),C=require("./ButtonItem.js"),$=require("./utils/navigation.js"),k=require("@progress/kendo-vue-popup"),h=require("./utils/popup.js"),O=require("@progress/kendo-svg-icons"),S=require("../package-metadata.js"),I=o.defineComponent({name:"KendoSplitButton",emits:{focus:e=>!0,blur:e=>!0,buttonclick:e=>!0,itemclick:e=>!0,open:e=>!0,close:e=>!0},props:{accessKey:String,ariaLabel:String,text:String,items:{type:Array,default:function(){return[]}},textField:String,tabIndex:Number,disabled:Boolean,icon:String,svgIcon:Object,size:String,rounded:String,fillMode:{type:String,validator:function(e){return["flat","link","outline","solid"].includes(e)}},themeColor:{type:String,validator:function(e){return["base","dark","error","info","inverse","light","primary","secondary","success","tertiary","warning"].includes(e)}},opened:{type:Boolean,default:void 0},iconClass:String,imageUrl:String,popupSettings:Object,itemRender:[String,Function,Object],item:[String,Function,Object],className:String,buttonClass:String,dir:String},data(){return{focused:!1,focusedIndex:-1,currentOpened:!1}},created(){this._blurTimeout=null,this._anchor=s.guid(),this.mainButton=null,this.guid=s.guid(),this.buttonsData=[],s.validatePackage(S.packageMetadata)},mounted(){this.mainButton=this.$refs[this._anchor],(this.$props.dir===void 0&&this.isRtl()||this.computedOpened)&&this.$forceUpdate()},updated(){this.focused&&this.element()&&(this.mainButton=this.$refs[this._anchor],this.mainButton.focus())},computed:{computedOpened(){return this.$props.opened===void 0?this.currentOpened:this.$props.opened},wrapperClass(){return{"k-split-button":!0,"k-button-group":!0,"k-focus":this.focused}}},setup(){return{kendoAnchorRef:o.ref(null)}},render(){this.buttonsData=this.$props.items;const e=this.isRtl(),t=e?"rtl":void 0,{tabIndex:i,disabled:u}=this.$props,c=s.getDefaultSlots(this),f=function(){const{item:n,itemRender:p,textField:b}=this.$props,a=this.buttonsData.length;return a>0?this.buttonsData.map(function(d,r){const y=typeof d!="string"?{...d,render:s.templateRendering.call(this,d.render,s.getListeners.call(this))}:d;return o.createVNode(C.ButtonItem,{role:"menuitem",dataItem:y,textField:b,focused:this.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:s.templateRendering.call(this,p,s.getListeners.call(this)),item:n,key:r,index:r,id:`${this.guid}-${r}`,first:r===0,last:r===a-1},null)},this):null},m=function(){const{popupSettings:n={},size:p}=this.$props;return o.createVNode(k.Popup,{anchor:this._anchor,show:this.computedOpened,animate:n.animate,popupClass:s.classNames("k-menu-popup",n.popupClass),anchorAlign:n.anchorAlign||h.getAnchorAlign(e),popupAlign:n.popupAlign||h.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[o.createVNode("ul",{class:"k-menu-group",role:"menu",id:this.guid},[f.call(this)])]})},g=this.$props.text||c?{default:()=>[this.$props.text,c]}:{};return o.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[o.createVNode(l.Button,{size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:n=>this.onItemClick(n,-1),disabled:u||void 0,tabIndex:i,accessKey:this.$props.accessKey,class:this.$props.buttonClass,icon:this.$props.icon,svgIcon:this.$props.svgIcon,iconClass:this.$props.iconClass,imageUrl:this.$props.imageUrl,dir:t,id:this._anchor,ref:this._anchor,type:"button","aria-disabled":u||void 0,"aria-label":this.$props.ariaLabel||(!this.$props.text&&!c&&(this.$props.svgIcon||this.$props.icon||this.$props.iconClass)?"Action":void 0)},g),o.createVNode(l.Button,{svgIcon:O.chevronDownIcon,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,icon:"chevron-down",class:"k-split-button-arrow",disabled:u||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMousedown:this.onDownSplitPart,onPointerdown:this.onDownSplitPart,dir:t,"aria-label":"Toggle dropdown","aria-expanded":this.computedOpened,"aria-controls":this.computedOpened?this.guid:void 0},null),m.call(this)])},methods:{element(){return this.mainButton},onKeyDown(e){if(e.altKey){!this.computedOpened&&e.keyCode===s.Keys.down?(this.dispatchPopupEvent(e,!0),this.focusedIndex=0,this.currentOpened=!0):this.computedOpened&&e.keyCode===s.Keys.up&&(this.dispatchPopupEvent(e,!1),this.focusedIndex=-1,this.currentOpened=!1);return}let t;if(e.keyCode===s.Keys.enter||e.keyCode===s.Keys.space?(e.preventDefault(),this.dispatchClickEvent(e,this.focusedIndex),this.focusedIndex!==void 0&&this.focusedIndex>=0&&(t={focusedIndex:this.computedOpened?-1:0,currentOpened:!this.computedOpened},this.dispatchPopupEvent(e,t.currentOpened))):this.computedOpened&&e.keyCode===s.Keys.esc&&(t={focusedIndex:-1,currentOpened:!1},this.dispatchPopupEvent(e,t.currentOpened)),this.computedOpened){const i=$(this.focusedIndex,e.keyCode,e.altKey,this.buttonsData.length);i!==this.focusedIndex&&(t=t||{},t.focusedIndex=i);const u=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right;!e.altKey&&u&&e.preventDefault()}t&&(this.focusedIndex=t.focusedIndex,this.focused=t.focused,t.currentOpened!==void 0&&(this.currentOpened=t.currentOpened))},onFocus(e){this.focused||(this.$emit("focus",{event:e}),this.focused=!0),this.focusedIndex=-1,clearTimeout(this._blurTimeout)},onItemClick(e,t){const i=this.computedOpened;i&&(this.focusedIndex=0,this.currentOpened=!1),this.dispatchClickEvent(e,t),i&&this.dispatchPopupEvent(e,!1)},onBlur(e){clearTimeout(this._blurTimeout),this.createBlurTimeout(e)},createBlurTimeout(e){const t=this;this._blurTimeout=setTimeout(()=>{s.canUseDOM&&document.activeElement!==t.mainButton&&(t.focused=!1,t.focusedIndex=-1,t.$emit("blur",{event:e}),t.computedOpened&&(t.currentOpened=!1,t.dispatchPopupEvent(e,!1)))},200)},dispatchClickEvent(e,t){this.isItemDisabled(t)||(t===-1?this.$emit("buttonclick",{event:e}):this.$emit("itemclick",{event:e,component:this,item:this.buttonsData[t],itemIndex:t}))},onSplitPartClick(e){if(this.buttonsData.length){const t=!this.computedOpened;this.dispatchPopupEvent(e,t),this.focusedIndex=t?0:-1,this.currentOpened=t,this.focused=!0}},onDownSplitPart(e){e.preventDefault(),this.element()&&document.activeElement!==this.element()&&this.element().focus()},onItemDown(e){document.activeElement===this.element()&&e.preventDefault()},dispatchPopupEvent(e,t){const i={event:e};this.$emit(t?"open":"close",i)},isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.$props.disabled},isRtl(){return this.$props.dir!==void 0?this.$props.dir==="rtl":!!this.$el&&getComputedStyle(this.$el).direction==="rtl"}}});exports.SplitButton=I;