import{a7 as o,bG as e,aL as n,h as a,bH as s,a as l,w as t,o as i,Q as r,ax as d,a9 as u,ap as c,g as p,bI as b,bl as f}from"./index.3938ccd1.js";import{Q as m}from"./QBtnGroup.d4ecde5c.js";import{a as w}from"./QMenu.6d3c6154.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=l((()=>{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=l((()=>"q-btn-dropdown__arrow"+(!0===h.value&&!1===o.noIconAnimation?" rotate-180":"")+(!1===o.split?" q-btn-dropdown__arrow-container":""))),y=l((()=>b(o))),C=l((()=>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 x(o){n("show",o),n("update:modelValue",!0)}function j(o){h.value=!1,n("beforeHide",o)}function k(o){n("hide",o),n("update:modelValue",!1)}function H(o){n("click",o)}function V(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 t((()=>o.modelValue),(o=>{var e;null==(e=B.value)||e[o?"show":"hide"]()})),t((()=>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:x,onBeforeHide:j,onHide:k},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:H},{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:V},{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};
