"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index = require("../../../hooks/use-namespace/index.js");
const useRadio = require("./use-radio.js");
const radioButton = require("./radio-button.js");
const Vue = require("vue");
const _hoisted_1 = [
  "value",
  "name",
  "disabled"
];
var radio_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElRadioButton",
  __name: "radio-button",
  props: radioButton.radioButtonProps,
  setup(__props) {
    const props = __props;
    const ns = index.useNamespace("radio");
    const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio.useRadio(props);
    const activeStyle = Vue.computed(() => {
      return {
        backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
        borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
        boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
        color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
      };
    });
    return (_ctx, _cache) => {
      var _a;
      return Vue.openBlock(), Vue.createElementBlock("label", { class: Vue.normalizeClass([
        Vue.unref(ns).b("button"),
        Vue.unref(ns).is("active", Vue.unref(modelValue) === Vue.unref(actualValue)),
        Vue.unref(ns).is("disabled", Vue.unref(disabled)),
        Vue.unref(ns).is("focus", Vue.unref(focus)),
        Vue.unref(ns).bm("button", Vue.unref(size))
      ]) }, [Vue.withDirectives(Vue.createElementVNode("input", {
        ref_key: "radioRef",
        ref: radioRef,
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => Vue.isRef(modelValue) ? modelValue.value = $event : null),
        class: Vue.normalizeClass(Vue.unref(ns).be("button", "original-radio")),
        value: Vue.unref(actualValue),
        type: "radio",
        name: __props.name || ((_a = Vue.unref(radioGroup)) == null ? void 0 : _a.name),
        disabled: Vue.unref(disabled),
        onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
        onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
        onClick: _cache[3] || (_cache[3] = Vue.withModifiers(() => {
        }, ["stop"]))
      }, null, 42, _hoisted_1), [[Vue.vModelRadio, Vue.unref(modelValue)]]), Vue.createElementVNode("span", {
        class: Vue.normalizeClass(Vue.unref(ns).be("button", "inner")),
        style: Vue.normalizeStyle(Vue.unref(modelValue) === Vue.unref(actualValue) ? activeStyle.value : {}),
        onKeydown: _cache[4] || (_cache[4] = Vue.withModifiers(() => {
        }, ["stop"]))
      }, [Vue.renderSlot(_ctx.$slots, "default", {}, () => [Vue.createTextVNode(Vue.toDisplayString(__props.label), 1)])], 38)], 2);
    };
  }
});
exports.default = radio_button_vue_vue_type_script_setup_true_lang_default;
