import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
var _excluded = ["prefixCls"];
import { createVNode as _createVNode } from "vue";
import { defineComponent, inject } from 'vue';
import Radio, { radioProps } from './Radio';
import { getOptionProps, getSlot } from '../_util/props-util';
import { defaultConfigProvider } from '../config-provider';
export default defineComponent({
  name: 'ARadioButton',
  props: _objectSpread({}, radioProps),
  setup: function setup() {
    return {
      configProvider: inject('configProvider', defaultConfigProvider),
      radioGroupContext: inject('radioGroupContext', {})
    };
  },
  render: function render() {
    var _this = this;

    var props = getOptionProps(this);

    var customizePrefixCls = props.prefixCls,
        otherProps = _objectWithoutProperties(props, _excluded);

    var getPrefixCls = this.configProvider.getPrefixCls;
    var prefixCls = getPrefixCls('radio-button', customizePrefixCls);

    var rProps = _objectSpread({
      prefixCls: prefixCls
    }, otherProps);

    if (this.radioGroupContext) {
      rProps.onChange = this.radioGroupContext.onRadioChange;
      rProps.checked = props.value === this.radioGroupContext.stateValue;
      rProps.disabled = props.disabled || this.radioGroupContext.disabled;
    }

    return _createVNode(Radio, rProps, {
      default: function _default() {
        return [getSlot(_this)];
      }
    });
  }
});