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