import _extends from "babel-runtime/helpers/extends";
import _classCallCheck from "babel-runtime/helpers/classCallCheck";
import _createClass from "babel-runtime/helpers/createClass";
import _possibleConstructorReturn from "babel-runtime/helpers/possibleConstructorReturn";
import _inherits from "babel-runtime/helpers/inherits";
import React, { Component } from "react";
import AntdRadio from "antd/es/radio";
import "antd/es/radio/style";
import PagePoint from "../page-point/pagePointEnhanced";
import { ConfigConsumer } from "../config-provider";
var AntdRadioGroup = AntdRadio.Group,
    Button = AntdRadio.Button;

var Radio = function (_Component) {
    _inherits(Radio, _Component);

    function Radio() {
        _classCallCheck(this, Radio);

        return _possibleConstructorReturn(this, (Radio.__proto__ || Object.getPrototypeOf(Radio)).apply(this, arguments));
    }

    _createClass(Radio, [{
        key: "render",
        value: function render() {
            var _this2 = this;

            var children = this.props.children;

            return React.createElement(
                ConfigConsumer,
                null,
                function (_ref) {
                    var pagePoint = _ref.pagePoint;
                    return pagePoint ? React.createElement(PagePoint, _extends({ compType: "Radio" }, _this2.props, { render: function render(eventprops) {
                            return React.createElement(
                                AntdRadio,
                                _extends({}, _this2.props, eventprops, { "data-ui-role": "Radio" }),
                                children
                            );
                        } })) : React.createElement(
                        AntdRadio,
                        _this2.props,
                        children
                    );
                }
            );
        }
    }]);

    return Radio;
}(Component);

Radio.Button = Button;

var RadioGroup = function (_Component2) {
    _inherits(RadioGroup, _Component2);

    function RadioGroup() {
        _classCallCheck(this, RadioGroup);

        return _possibleConstructorReturn(this, (RadioGroup.__proto__ || Object.getPrototypeOf(RadioGroup)).apply(this, arguments));
    }

    _createClass(RadioGroup, [{
        key: "render",
        value: function render() {
            var _this4 = this;

            var children = this.props.children;

            return React.createElement(
                ConfigConsumer,
                null,
                function (_ref2) {
                    var pagePoint = _ref2.pagePoint;
                    return pagePoint ? React.createElement(PagePoint, _extends({ compType: "RadioGroup" }, _this4.props, { render: function render(eventprops) {
                            return React.createElement(
                                AntdRadioGroup,
                                _extends({}, _this4.props, eventprops, { "data-ui-role": "RadioGroup" }),
                                children
                            );
                        } })) : React.createElement(
                        AntdRadioGroup,
                        _this4.props,
                        children
                    );
                }
            );
        }
    }]);

    return RadioGroup;
}(Component);

Radio.Group = RadioGroup;
export default Radio;