import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _createSuper from "@babel/runtime/helpers/createSuper";
var _excluded = ["level", "children"];
import { __decorate } from "tslib";
import * as React from 'react';
import warning from '../../../es/_util/warning';
import { observer } from 'mobx-react';
import Base from './Base';
import { FormField } from '../field/FormField';

var tupleNum = function tupleNum() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }

  return args;
};

var TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5);

var Title = /*#__PURE__*/function (_FormField) {
  _inherits(Title, _FormField);

  var _super = _createSuper(Title);

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

    return _super.apply(this, arguments);
  }

  _createClass(Title, [{
    key: "renderWrapper",
    value: function renderWrapper() {
      var _this$props = this.props,
          _this$props$level = _this$props.level,
          level = _this$props$level === void 0 ? 1 : _this$props$level,
          children = _this$props.children,
          restProps = _objectWithoutProperties(_this$props, _excluded);

      var component;

      if (TITLE_ELE_LIST.indexOf(level) !== -1) {
        component = "h".concat(level);
      } else {
        warning(false, 'Typography.Title Title only accept `1 | 2 | 3 | 4 | 5` as `level` value.');
        component = 'h1';
      }

      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Base, _extends({}, restProps, {
        component: component
      }), this.processRenderer(this.getValue()) || children), this.renderFloatLabel());
    }
  }]);

  return Title;
}(FormField);

Title.displayName = 'Title';
Title.__PRO_TEXT = true;
Title.defaultProps = _objectSpread(_objectSpread({}, FormField.defaultProps), {}, {
  suffixCls: 'title'
});
Title = __decorate([observer], Title);
export default Title;
//# sourceMappingURL=Title.js.map
