import{a6 as o,bJ as e,aK as n,h as a,bK as s,a as t,w as l,o as i,Q as r,aw as d,a8 as u,ao as c,g as p,bL as b,bk as f}from"./index.9313841a.js";import{Q as m}from"./QBtnGroup.cd29c172.js";import{a as w}from"./QMenu.ee2e6e4d.js";const v=Object.keys(e);var g=o({name:"QBtnDropdown",props:{...e,...n,modelValue:Boolean,split:Boolean,dropdownIcon:String,contentClass:[Array,String,Object],contentStyle:[Array,String,Object],cover:Boolean,persistent:Boolean,noEscDismiss:Boolean,noRouteDismiss:Boolean,autoClose:Boolean,noRefocus:Boolean,noFocus:Boolean,menuAnchor:{type:String,default:"bottom end"},menuSelf:{type:String,default:"top end"},menuOffset:Array,disableMainBtn:Boolean,disableDropdown:Boolean,noIconAnimation:Boolean,toggleAriaLabel:String},emits:["update:modelValue","click","beforeShow","show","beforeHide","hide"],setup(o,{slots:e,emit:n}){const{proxy:g}=p(),h=a(o.modelValue),B=a(null),S=s(),q=t((()=>{const e={"aria-expanded":!0===h.value?"true":"false","aria-haspopup":"true","aria-controls":S.value,"aria-label":o.toggleAriaLabel||g.$q.lang.label[!0===h.value?"collapse":"expand"](o.label)};return(!0===o.disable||!1===o.split&&!0===o.disableMainBtn||!0===o.disableDropdown)&&(e["aria-disabled"]="true"),e})),D=t((()=>"q-btn-dropdown__arrow"+(!0===h.value&&!1===o.noIconAnimation?" rotate-180":"")+(!1===o.split?" q-btn-dropdown__arrow-container":""))),y=t((()=>b(o))),C=t((()=>function(o){return v.reduce(((e,n)=>{const a=o[n];return void 0!==a&&(e[n]=a),e}),{})}(o)));function A(o){h.value=!0,n("beforeShow",o)}function k(o){n("show",o),n("update:modelValue",!0)}function j(o){h.value=!1,n("beforeHide",o)}function x(o){n("hide",o),n("update:modelValue",!1)}function V(o){n("click",o)}function H(o){f(o),Q(),n("click",o)}function O(o){var e;null==(e=B.value)||e.show(o)}function Q(o){var e;null==(e=B.value)||e.hide(o)}return l((()=>o.modelValue),(o=>{var e;null==(e=B.value)||e[o?"show":"hide"]()})),l((()=>o.split),Q),Object.assign(g,{show:O,hide:Q,toggle:function(o){var e;null==(e=B.value)||e.toggle(o)}}),i((()=>{!0===o.modelValue&&O()})),()=>{const n=[r(d,{class:D.value,name:o.dropdownIcon||g.$q.iconSet.arrow.dropdown})];return!0!==o.disableDropdown&&n.push(r(w,{ref:B,id:S.value,class:o.contentClass,style:o.contentStyle,cover:o.cover,fit:!0,persistent:o.persistent,noEscDismiss:o.noEscDismiss,noRouteDismiss:o.noRouteDismiss,autoClose:o.autoClose,noFocus:o.noFocus,noRefocus:o.noRefocus,anchor:o.menuAnchor,self:o.menuSelf,offset:o.menuOffset,separateClosePopup:!0,transitionShow:o.transitionShow,transitionHide:o.transitionHide,transitionDuration:o.transitionDuration,onBeforeShow:A,onShow:k,onBeforeHide:j,onHide:x},e.default)),!1===o.split?r(c,{class:"q-btn-dropdown q-btn-dropdown--simple",...C.value,...q.value,disable:!0===o.disable||!0===o.disableMainBtn,noWrap:!0,round:!1,onClick:V},{default:()=>u(e.label,[]).concat(n),loading:e.loading}):r(m,{class:"q-btn-dropdown q-btn-dropdown--split no-wrap q-btn-item",rounded:o.rounded,square:o.square,...y.value,glossy:o.glossy,stretch:o.stretch},(()=>[r(c,{class:"q-btn-dropdown--current",...C.value,disable:!0===o.disable||!0===o.disableMainBtn,noWrap:!0,round:!1,onClick:H},{default:e.label,loading:e.loading}),r(c,{class:"q-btn-dropdown__arrow-container q-anchor--skip",...q.value,...y.value,disable:!0===o.disable||!0===o.disableDropdown,rounded:o.rounded,color:o.color,textColor:o.textColor,dense:o.dense,size:o.size,padding:o.padding,ripple:o.ripple},(()=>n))]))}}});export{g as Q};
