"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.Tabs = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

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

var _Tabs = _interopRequireDefault(require("@material-ui/core/Tabs"));

var _Tab = _interopRequireDefault(require("@material-ui/core/Tab"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _core = require("@material-ui/core");

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }

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; } }

var Tabs = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2["default"])(Tabs, _React$Component);

  var _super = _createSuper(Tabs);

  function Tabs(props) {
    var _this;

    (0, _classCallCheck2["default"])(this, Tabs);
    _this = _super.call(this, props);
    (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleChange", function (event, value) {
      _this.setState({
        value: value
      });
    });
    _this.state = {
      value: 0
    };
    return _this;
  }

  (0, _createClass2["default"])(Tabs, [{
    key: "render",
    value: function render() {
      var value = this.state.value;
      var _this$props = this.props,
          children = _this$props.children,
          className = _this$props.className,
          contentClassName = _this$props.contentClassName,
          _this$props$contentSt = _this$props.contentStyle,
          contentStyle = _this$props$contentSt === void 0 ? {} : _this$props$contentSt,
          classes = _this$props.classes;
      var tabClasses = {
        root: classes.tabRoot
      };
      return /*#__PURE__*/_react["default"].createElement("div", {
        className: className
      }, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
        indicatorColor: "primary",
        value: value,
        onChange: this.handleChange
      }, _react["default"].Children.map(children, function (c, index) {
        return c && c.props.title ? /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
          classes: tabClasses,
          key: index,
          label: c.props.title
        }) : null;
      })), /*#__PURE__*/_react["default"].createElement("div", {
        className: contentClassName,
        style: contentStyle
      }, children[value]));
    }
  }]);
  return Tabs;
}(_react["default"].Component);

exports.Tabs = Tabs;
(0, _defineProperty2["default"])(Tabs, "propTypes", {
  classes: _propTypes["default"].object,
  className: _propTypes["default"].string,
  contentClassName: _propTypes["default"].string,
  contentStyle: _propTypes["default"].object,
  children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired
});

var _default = (0, _core.withStyles)(function () {
  return {
    tabRoot: {}
  };
})(Tabs);

exports["default"] = _default;
//# sourceMappingURL=index.js.map