"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../common/mixins/input.cjs"),l=require("./radio-constants.cjs"),i=require("../../common/utils/index.cjs"),s=require("vue"),n=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),d=require("../validation-messages/validation-messages.cjs"),u={compatConfig:{MODE:3},name:"DtRadio",components:{DtValidationMessages:d.default},mixins:[a.InputMixin,a.CheckableMixin,a.GroupableMixin,a.MessagesMixin],inheritAttrs:!1,props:{value:{type:[String,Number],default:""}},emits:["input","update:modelValue","focus","focusin","focusout","click"],data(){return{hasSlotContent:i.hasSlotContent}},computed:{inputValidationClass(){return l.RADIO_INPUT_VALIDATION_CLASSES[this.internalValidationState]},radioGroupValue(){var e;return(e=this.groupContext)==null?void 0:e.selectedValue},inputListeners(){return{input:()=>{},focusin:e=>this.$emit("focusin",e),focusout:e=>this.$emit("focusout",e),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:{removeClassStyleAttrs:i.removeClassStyleAttrs,addClassStyleAttrs:i.addClassStyleAttrs,emitValue(e){e!==this.radioGroupValue&&(this.setGroupValue(e),this.$emit("input",e),this.$emit("update:modelValue",e))}}},m={class:"d-radio__input"},c=["checked","name","value","disabled"],p={key:0,class:"d-radio__messages","data-qa":"radio-description-messages"};function h(e,C,o,V,v,t){const r=s.resolveComponent("dt-validation-messages");return s.openBlock(),s.createElementBlock("div",s.normalizeProps(s.guardReactiveProps(t.addClassStyleAttrs(e.$attrs))),[s.createElementVNode("label",{class:s.normalizeClass(["d-radio-group",{"d-radio-group--disabled":e.internalDisabled}])},[s.createElementVNode("div",m,[s.createElementVNode("input",s.mergeProps({checked:e.internalChecked,name:e.internalName,value:o.value,disabled:e.internalDisabled,type:"radio",class:["d-radio",t.inputValidationClass,e.inputClass]},t.removeClassStyleAttrs(e.$attrs),s.toHandlers(t.inputListeners,!0)),null,16,c)]),s.createElementVNode("div",s.mergeProps({class:[e.labelClass,"d-radio__copy d-radio__label"]},e.labelChildProps,{"data-qa":"radio-label"}),[s.renderSlot(e.$slots,"default",{},()=>[s.createTextVNode(s.toDisplayString(e.label),1)])],16)],2),e.$slots.description||e.description||t.hasMessages?(s.openBlock(),s.createElementBlock("div",p,[e.$slots.description||e.description?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,class:["d-description",e.descriptionClass]},e.descriptionChildProps,{"data-qa":"radio-description"}),[s.renderSlot(e.$slots,"description",{},()=>[s.createTextVNode(s.toDisplayString(e.description),1)])],16)):s.createCommentVNode("",!0),s.createVNode(r,s.mergeProps({"validation-messages":e.formattedMessages,"show-messages":e.showMessages,class:e.messagesClass},e.messagesChildProps,{"data-qa":"dt-radio-validation-messages"}),null,16,["validation-messages","show-messages","class"])])):s.createCommentVNode("",!0)],16)}const g=n._(u,[["render",h]]);exports.default=g;
//# sourceMappingURL=radio.cjs.map
