/**
 * Kendo UI v2023.3.1114 (http://www.telerik.com/kendo-ui)
 * Copyright 2023 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
 *
 * Kendo UI commercial licenses may be obtained at
 * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
 * If you do not own a commercial license, this file shall be governed by the trial license terms.
 */
import"./kendo.html.button.js";import"./kendo.button.menu.js";var __meta__={id:"dropdownbutton",name:"DropDownButton",category:"web",description:"The DropDownButton allows the user to execute an action from a drop-down list.",depends:["button.menu","html.button"]};!function(e,n){var t=window.kendo,o=t.ui.Widget,i=".kendoDropDownButton",a=t.ui,l=t.keys,u=e.extend,r=t.html,s=t._outerWidth,d="aria-disabled",m="aria-label",p="aria-expanded",c="disabled",h="k-disabled",f="click",b="open",g="close",_="focus",k="k-menu-button",v="k-dropdown-button",w=o.extend({init:function(n,i){var a=this;i.enabled=!1!==i.enabled&&!e(n).prop(c),o.fn.init.call(a,n,i),a.wrapper=a.element,a._mainButton(),a._renderMenu(),a._enable(a.options.enabled),a._aria(),a._attachEvents(),t.notify(a),a._applyCssClasses()},options:{name:"DropDownButton",direction:"down",enabled:!0,items:[],rounded:"medium",size:"medium",fillMode:"solid",themeColor:"base",icon:null,popup:null,messages:{labelSuffix:"dropdownbutton"}},events:[f,b,g],_mainButton:function(){var e=this,n=u({},e.options,{type:e.element.attr("type")||"button"});delete n.click,e.element.addClass(k).addClass(v),r.renderButton(e.element,n)},_aria:function(){var e=this,n=e.element,t=e.menu;n.attr("aria-haspopup",t?"menu":null),n.attr(p,!t&&null),n.attr("aria-controls",t?t.list.attr("id"):null),n.attr(m)||n.attr(m,n.text()+" "+e.options.messages.labelSuffix)},_renderMenu:function(){var n=this,t=u({},n.options),o=e("<div></div>");delete t.click,delete t.name,t.items.length&&(n.menu=o.appendTo(document.body).kendoButtonMenu(u({mainButton:n.element,toggleTarget:n.element,menuOpen:n.menuOpenHandler.bind(n),menuClose:n.menuCloseHandler.bind(n),menuClick:n._click.bind(n)},t)).data("kendoButtonMenu"))},menuOpenHandler:function(e){var n=this,t=s(n.element);n.trigger(b,{target:n.element})?e.preventDefault():(e.sender.adjustPopupWidth(t),n.element.attr(p,!0))},menuCloseHandler:function(e){var n=this;n.trigger(g,{target:n.element})?e.preventDefault():(n.element.attr(p,!1),n.element.trigger(_))},_attachEvents:function(){var e=this;e.element.on("keydown"+i,e._keydown.bind(e))},_click:function(e){var n=e.id,t=e.target,o=e.originalEvent;this.menu.close(),this.trigger(f,{id:n,target:t,originalEvent:o})},_keydown:function(e){!this.element.is("."+h)||e.keyCode!==l.ENTER&&e.keyCode!==l.SPACEBAR||e.preventDefault()},focus:function(){this.element.trigger(_)},_enable:function(e,n){this.element.toggleClass(h,!e),e?this.element.removeAttr(d):this.element.attr(d,!e),n||this.element.attr(c,!e)},enable:function(e,n,t){var o=this;undefined===e&&(e=!0),n&&n.length?o.menu.enable(e,n):(o.options.enabled=e,o._enable(e,t),o.menu.enable(e))},hide:function(e){e&&e.length&&this.menu.hide(e)},show:function(e){e&&e.length&&this.menu.show(e)},open:function(){this.menu._popup.open()},close:function(){this.menu._popup.close()},items:function(){return this.menu.items()},setOptions:function(e){var n=this;o.fn.setOptions.call(n,e),(e.popup||e.items||e.size)&&(n.menu.destroy(),n._renderMenu()),n._mainButton(),n._aria()},destroy:function(){var e=this;e.menu.destroy(),e.element.off(i),o.fn.destroy.call(e)}});a.plugin(w)}(window.kendo.jQuery);var kendo$1=kendo;export{kendo$1 as default};
//# sourceMappingURL=kendo.dropdownbutton.js.map
