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 AntdCheckbox from "antd/es/checkbox";
import PagePoint from "../page-point/pagePointEnhanced";
import { ConfigConsumer } from "../config-provider";
import "antd/es/checkbox/style";
var AntdCheckboxGroup = AntdCheckbox.Group;

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

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

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

    _createClass(Checkbox, [{
        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: "Checkbox" }, _this2.props, { render: function render(eventprops) {
                            return React.createElement(
                                AntdCheckbox,
                                _extends({}, _this2.props, eventprops, { "data-ui-role": "Checkbox" }),
                                children
                            );
                        } })) : React.createElement(
                        AntdCheckbox,
                        _this2.props,
                        children
                    );
                }
            );
        }
    }]);

    return Checkbox;
}(Component);

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

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

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

    _createClass(CheckboxGroup, [{
        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: "CheckboxGroup" }, _this4.props, { render: function render(eventprops) {
                            return React.createElement(
                                AntdCheckboxGroup,
                                _extends({}, _this4.props, eventprops, { "data-ui-role": "CheckboxGroup" }),
                                children
                            );
                        } })) : React.createElement(
                        AntdCheckboxGroup,
                        _this4.props,
                        children
                    );
                }
            );
        }
    }]);

    return CheckboxGroup;
}(Component);

Checkbox.Group = CheckboxGroup;
export default Checkbox;