import { defineComponent, ref, onMounted, provide, reactive, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot } from 'vue';
import '../../../tokens/index.mjs';
import '../../../hooks/index.mjs';
import { radioGroupProps } from './radio-group.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { radioGroupKey } from '../../../tokens/radio.mjs';

const _sfc_main = defineComponent({
  name: "PsRadioGroup",
  props: radioGroupProps,
  setup(props) {
    const ns = useNamespace("radio");
    const radioGroupRef = ref();
    onMounted(() => {
      const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
      const firstLabel = radios[0];
      if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
        firstLabel.tabIndex = 0;
      }
    });
    provide(radioGroupKey, reactive({
      ...toRefs(props)
    }));
    return {
      ns,
      radioGroupRef
    };
  }
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return openBlock(), createElementBlock("div", {
    ref: "radioGroupRef",
    class: normalizeClass(_ctx.ns.b("group")),
    role: "radiogroup"
  }, [
    renderSlot(_ctx.$slots, "default")
  ], 2);
}
var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/meng/workspace/element-ps/packages/components/radio/src/radio-group.vue"]]);

export { RadioGroup as default };
//# sourceMappingURL=radio-group2.mjs.map
