"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../../common/mixins/input.cjs"),t=require("./radio-constants.cjs"),r=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),n=require("../validation-messages/validation-messages.cjs"),d={name:"DtRadio",components:{DtValidationMessages:n.default},mixins:[i.InputMixin,i.CheckableMixin,i.GroupableMixin,i.MessagesMixin],inheritAttrs:!1,props:{value:{type:[String,Number],default:""}},emits:["input","focusin","focusout"],computed:{inputValidationClass(){return t.RADIO_INPUT_VALIDATION_CLASSES[this.internalValidationState]},radioGroupValue(){var e;return(e=this.groupContext)==null?void 0:e.selectedValue},inputListeners(){return{...this.$listeners,input:()=>{},change:e=>this.emitValue(e.target.value)}},hasMessages(){return this.formattedMessages.length&&this.showMessages}},watch:{radioGroupValue:{immediate:!0,handler(e){this.hasGroup&&(this.internalChecked=e===this.value)}}},methods:{emitValue(e){e!==this.radioGroupValue&&(this.setGroupValue(e),this.$emit("input",e))}}};var o=function(){var s=this,a=s._self._c;return a("div",[a("label",{class:["d-radio-group",{"d-radio-group--disabled":s.internalDisabled}]},[a("div",{staticClass:"d-radio__input"},[a("input",s._g(s._b({class:["d-radio",s.inputValidationClass,s.inputClass],attrs:{name:s.internalName,disabled:s.internalDisabled,type:"radio"},domProps:{checked:s.internalChecked,value:s.value}},"input",s.$attrs,!1),s.inputListeners))]),a("div",s._b({class:[s.labelClass,"d-radio__copy d-radio__label"],attrs:{"data-qa":"radio-label"}},"div",s.labelChildProps,!1),[s._t("default",function(){return[s._v(s._s(s.label))]})],2)]),s.$slots.description||s.description||s.hasMessages?a("div",{staticClass:"d-radio__messages",attrs:{"data-qa":"radio-description-messages"}},[s.$slots.description||s.description?a("div",s._b({class:["d-description",s.descriptionClass],attrs:{"data-qa":"radio-description"}},"div",s.descriptionChildProps,!1),[s._t("description",function(){return[s._v(" "+s._s(s.description)+" ")]})],2):s._e(),a("dt-validation-messages",s._b({class:s.messagesClass,attrs:{"validation-messages":s.formattedMessages,"show-messages":s.showMessages,"data-qa":"dt-radio-validation-messages"}},"dt-validation-messages",s.messagesChildProps,!1))],1):s._e()])},l=[],u=r.n(d,o,l);const c=u.exports;exports.default=c;
//# sourceMappingURL=radio.cjs.map
