"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

var _ = _interopRequireDefault(require(".."));

var _react = _interopRequireDefault(require("react"));

var _reactDom = _interopRequireDefault(require("react-dom"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var RadioGroup = _["default"].Group;
var list = [{
  value: 'apple',
  label: 'Apple',
  disabled: false
}, {
  value: 'pear',
  label: 'Pear'
}, {
  value: 'banana',
  label: 'banana'
}, {
  value: 'orange',
  label: 'Orange',
  disabled: true
}];
var typeList = [{
  value: 'outline',
  label: 'outline'
}, {
  value: 'solid',
  label: 'solid'
}, {
  value: 'container',
  label: 'container'
}];
var themeList = [{
  value: 'white',
  label: 'white'
}, {
  value: 'grey',
  label: 'grey'
}];

var ControlApp = /*#__PURE__*/function (_React$Component) {
  _inherits(ControlApp, _React$Component);

  var _super = _createSuper(ControlApp);

  function ControlApp(props) {
    var _this;

    _classCallCheck(this, ControlApp);

    _this = _super.call(this, props);

    _defineProperty(_assertThisInitialized(_this), "handletype", function (type) {
      _this.setState({
        type: type
      });
    });

    _defineProperty(_assertThisInitialized(_this), "handletheme", function (theme) {
      _this.setState({
        theme: theme
      });
    });

    _this.state = {
      value1: 'apple',
      value2: 'apple',
      value3: '',
      type: 'outline',
      theme: 'white'
    };
    _this.onNestChange = _this.onNestChange.bind(_assertThisInitialized(_this));
    _this.onSmallChange = _this.onSmallChange.bind(_assertThisInitialized(_this));
    _this.onMediumChange = _this.onMediumChange.bind(_assertThisInitialized(_this));
    return _this;
  }

  _createClass(ControlApp, [{
    key: "onSmallChange",
    value: function onSmallChange(value) {
      this.setState({
        value1: value
      });
    }
  }, {
    key: "onMediumChange",
    value: function onMediumChange(value) {
      this.setState({
        value2: value
      });
    }
  }, {
    key: "onNestChange",
    value: function onNestChange(value) {
      this.setState({
        value3: value
      });
    }
  }, {
    key: "render",
    value: function render() {
      return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", {
        style: {
          fontSize: 14
        }
      }, "choose type"), /*#__PURE__*/_react["default"].createElement(_["default"].Group, {
        defaultValue: "medium",
        dataSource: typeList,
        value: this.state.type,
        onChange: this.handletype
      }), /*#__PURE__*/_react["default"].createElement("p", {
        style: {
          fontSize: 14
        }
      }, "choose theme"), /*#__PURE__*/_react["default"].createElement(_["default"].Group, {
        defaultValue: "medium",
        dataSource: themeList,
        value: this.state.theme,
        onChange: this.handletheme
      }), /*#__PURE__*/_react["default"].createElement("div", {
        style: {
          background: this.state.theme === 'grey' ? '#f3f3f3' : '#fff',
          padding: '10px'
        }
      }, /*#__PURE__*/_react["default"].createElement("p", {
        style: {
          fontSize: 14
        }
      }, "xs size"), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
        dataSource: list,
        theme: this.state.theme,
        size: "xs",
        shape: "button",
        value: this.state.value1,
        onChange: this.onSmallChange,
        type: this.state.type
      }), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("p", {
        style: {
          fontSize: 14
        }
      }, "Small size"), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
        dataSource: list,
        shape: "button",
        size: "small",
        value: this.state.value1,
        onChange: this.onSmallChange,
        theme: this.state.theme,
        type: this.state.type
      }), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("p", {
        style: {
          fontSize: 14
        }
      }, "Medium size (default)"), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
        dataSource: list,
        shape: "button",
        size: "medium",
        value: this.state.value2,
        onChange: this.onMediumChange,
        theme: this.state.theme,
        type: this.state.type
      }), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("p", {
        style: {
          fontSize: 14
        }
      }, "Large size"), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
        shape: "button",
        size: "large",
        value: this.state.value3,
        onChange: this.onNestChange,
        theme: this.state.theme,
        type: this.state.type
      }, /*#__PURE__*/_react["default"].createElement(_["default"], {
        id: "banana",
        value: "banana"
      }, "Banana"), /*#__PURE__*/_react["default"].createElement(_["default"], {
        id: "watermelon",
        value: "watermelon"
      }, "Watermelon"), /*#__PURE__*/_react["default"].createElement(_["default"], {
        id: "peach",
        value: "peach"
      }, "Peach")), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("p", {
        style: {
          fontSize: 14
        }
      }, "Disabled and Selected-Disabled status"), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
        shape: "button",
        theme: this.state.theme,
        type: this.state.type,
        value: "banana",
        onChange: this.onNestChange
      }, /*#__PURE__*/_react["default"].createElement(_["default"], {
        id: "peach",
        disabled: true,
        value: "peach"
      }, "Peach"), /*#__PURE__*/_react["default"].createElement(_["default"], {
        id: "banana",
        disabled: true,
        value: "banana"
      }, "Banana"))));
    }
  }]);

  return ControlApp;
}(_react["default"].Component);

_reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(ControlApp, null), document.getElementById('radio-demo-7'));