"use strict";const t=require("vue"),v=require("./CdxLabel.cjs"),$=require("./useLabelChecker.js"),V=require("./useModelWrapper.cjs"),c=require("./useGeneratedId.cjs"),k=require("./useFieldData.cjs"),p=require("./constants.js"),y=require("./_plugin-vue_export-helper.js"),h=p.makeStringTypeValidator(p.ValidationStatusTypes),I=t.defineComponent({name:"CdxRadio",components:{CdxLabel:v},props:{modelValue:{type:[String,Number,Boolean],default:""},inputValue:{type:[String,Number,Boolean],default:!1},name:{type:String,required:!0},disabled:{type:Boolean,default:!1},inline:{type:Boolean,default:!1},status:{type:String,default:"default",validator:h}},emits:["update:modelValue"],setup(e,{emit:o,slots:s,attrs:n}){var u;$.useLabelChecker((u=s.default)==null?void 0:u.call(s),n,"CdxRadio");const{computedDisabled:a,computedStatus:l}=k(t.toRef(e,"disabled"),t.toRef(e,"status")),d=t.computed(()=>({"cdx-radio--inline":e.inline,["cdx-radio--status-".concat(l.value)]:!0})),i=t.computed(()=>({"cdx-radio__custom-input--inline":e.inline})),r=t.ref(),m=c("radio"),f=c("description"),b=()=>{r.value.focus()},C=V(t.toRef(e,"modelValue"),o);return{rootClasses:d,computedDisabled:a,input:r,radioId:m,descriptionId:f,focusInput:b,wrappedModel:C,customInputClasses:i}}}),S={class:"cdx-radio__wrapper"},g=["id","aria-describedby","name","value","disabled"],B=t.createElementVNode("span",{class:"cdx-radio__icon"},null,-1);function q(e,o,s,n,a,l){const d=t.resolveComponent("cdx-label");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["cdx-radio",e.rootClasses])},[t.createElementVNode("div",S,[t.withDirectives(t.createElementVNode("input",{id:e.radioId,ref:"input","onUpdate:modelValue":o[0]||(o[0]=i=>e.wrappedModel=i),class:"cdx-radio__input",type:"radio","aria-describedby":e.$slots.description&&e.$slots.description().length>0?e.descriptionId:void 0,name:e.name,value:e.inputValue,disabled:e.computedDisabled},null,8,g),[[t.vModelRadio,e.wrappedModel]]),B,e.$slots.default&&e.$slots.default().length?(t.openBlock(),t.createBlock(d,{key:0,class:"cdx-radio__label","input-id":e.radioId,"description-id":e.$slots.description&&e.$slots.description().length>0?e.descriptionId:void 0,disabled:e.computedDisabled,onClick:e.focusInput},t.createSlots({default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:2},[e.$slots.description&&e.$slots.description().length>0?{name:"description",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"description")]),key:"0"}:void 0]),1032,["input-id","description-id","disabled","onClick"])):t.createCommentVNode("v-if",!0)]),e.$slots["custom-input"]?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cdx-radio__custom-input",e.customInputClasses])},[t.renderSlot(e.$slots,"custom-input")],2)):t.createCommentVNode("v-if",!0)],2)}const w=y._export_sfc(I,[["render",q]]);module.exports=w;
