Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../common/mixins/input.cjs`),r=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),i=require(`../validation-messages/validation-messages.cjs`),a=require(`./select-menu-constants.cjs`),o=require(`./select-menu-validators.cjs`);let s=require(`vue`);var c={compatConfig:{MODE:3},name:`DtSelectMenu`,components:{DtValidationMessages:i.default},mixins:[n.MessagesMixin],inheritAttrs:!1,props:{label:{type:String,default:``},description:{type:String,default:``},options:{type:Array,default:()=>[],validator:e=>o.optionsValidator(e)},size:{type:String,default:`md`,validator:e=>Object.keys(a.SELECT_SIZE_MODIFIERS).includes(e)},labelClass:{type:[String,Array,Object],default:``},descriptionClass:{type:[String,Array,Object],default:``},selectClass:{type:[String,Array,Object],default:``},optionClass:{type:[String,Array,Object],default:``},labelChildProps:{type:Object,default:()=>({})},descriptionChildProps:{type:Object,default:()=>({})},optionChildProps:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},rootClass:{type:[String,Object,Array],default:``},modelValue:{type:[String,Number],default:``}},emits:[`input`,`update:modelValue`,`change`],data(){return{LABEL_SIZE_MODIFIERS:e.LABEL_SIZE_MODIFIERS,DESCRIPTION_SIZE_MODIFIERS:e.DESCRIPTION_SIZE_MODIFIERS,SELECT_SIZE_MODIFIERS:a.SELECT_SIZE_MODIFIERS,SELECT_STATE_MODIFIERS:a.SELECT_STATE_MODIFIERS,hasSlotContent:t.hasSlotContent}},computed:{selectListeners(){return{input:()=>{},change:e=>this.emitValue(e.target.value,e)}},state(){return t.getValidationState(this.formattedMessages)},selectKey(){return t.getUniqueString()},descriptionKey(){return`select-${this.selectKey}-description`},labelAriaDetails(){return this.$slots.description||this.description?this.descriptionKey:this.$attrs[`aria-details`]}},mounted(){this.validateOptionsPresence()},beforeUpdate(){this.validateOptionsPresence()},methods:{removeClassStyleAttrs:t.removeClassStyleAttrs,addClassStyleAttrs:t.addClassStyleAttrs,emitValue(e,t){this.$emit(`update:modelValue`,e,t),this.$emit(`input`,e,t),this.$emit(`change`,e,t)},getOptionKey(e){return`select-${this.selectKey}-option-${e}`},validateOptionsPresence(){this.options?.length<1&&!this.$slots.default&&(0,s.warn)(`Options are expected to be provided via prop or slot`,this)}}},l=[`aria-details`],u=[`id`],d=[`disabled`,`value`],f=[`value`];function p(e,t,n,r,i,a){let o=(0,s.resolveComponent)(`dt-validation-messages`);return(0,s.openBlock)(),(0,s.createElementBlock)(`div`,(0,s.mergeProps)({class:n.rootClass},a.addClassStyleAttrs(e.$attrs)),[(0,s.createElementVNode)(`label`,null,[i.hasSlotContent(e.$slots.label)||n.label?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,(0,s.mergeProps)({key:0,"aria-details":a.labelAriaDetails,class:[`d-label`,i.LABEL_SIZE_MODIFIERS[n.size],n.labelClass]},n.labelChildProps,{"data-qa":`dt-select-label`}),[(0,s.renderSlot)(e.$slots,`label`,{},()=>[(0,s.createTextVNode)((0,s.toDisplayString)(n.label),1)])],16,l)):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.description)||n.description?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,(0,s.mergeProps)({key:1,id:a.descriptionKey,class:[`d-description`,i.DESCRIPTION_SIZE_MODIFIERS[n.size],n.descriptionClass]},n.descriptionChildProps,{"data-qa":`dt-select-description`}),[(0,s.renderSlot)(e.$slots,`description`,{},()=>[(0,s.createTextVNode)((0,s.toDisplayString)(n.description),1)])],16,u)):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,{class:(0,s.normalizeClass)([`d-select`,i.SELECT_SIZE_MODIFIERS[n.size],n.selectClass,{"d-select--disabled":n.disabled}]),"data-qa":`dt-select-wrapper`},[(0,s.createElementVNode)(`select`,(0,s.mergeProps)({ref:`selectElement`,class:[`d-select__input`,i.SELECT_STATE_MODIFIERS[a.state]]},a.removeClassStyleAttrs(e.$attrs),{"data-qa":`dt-select`,disabled:n.disabled,value:n.modelValue},(0,s.toHandlers)(a.selectListeners,!0)),[(0,s.renderSlot)(e.$slots,`default`,{},()=>[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(n.options,e=>((0,s.openBlock)(),(0,s.createElementBlock)(`option`,(0,s.mergeProps)({key:a.getOptionKey(e.value),value:e.value,class:n.optionClass},{ref_for:!0},n.optionChildProps),(0,s.toDisplayString)(e.label),17,f))),128))])],16,d)],2)]),(0,s.createVNode)(o,(0,s.mergeProps)({"validation-messages":e.formattedMessages,"show-messages":e.showMessages,class:e.messagesClass},e.messagesChildProps,{"data-qa":`dt-select-messages`}),null,16,[`validation-messages`,`show-messages`,`class`])],16)}var m=r.t(c,[[`render`,p]]);exports.default=m;
//# sourceMappingURL=select-menu.cjs.map