"use strict";

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

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

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

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

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

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

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

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

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

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

var _tslib = require("tslib");

var React = _interopRequireWildcard(require("react"));

var _warning = _interopRequireDefault(require("../../../lib/_util/warning"));

var _mobxReact = require("mobx-react");

var _Base = _interopRequireDefault(require("./Base"));

var _FormField2 = require("../field/FormField");

var _excluded = ["level", "children"];

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) {
  (0, _inherits2["default"])(Title, _FormField);

  var _super = (0, _createSuper2["default"])(Title);

  function Title() {
    (0, _classCallCheck2["default"])(this, Title);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(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 = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
      var component;

      if (TITLE_ELE_LIST.indexOf(level) !== -1) {
        component = "h".concat(level);
      } else {
        (0, _warning["default"])(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["default"], (0, _extends2["default"])({}, restProps, {
        component: component
      }), this.processRenderer(this.getValue()) || children), this.renderFloatLabel());
    }
  }]);
  return Title;
}(_FormField2.FormField);

Title.displayName = 'Title';
Title.__PRO_TEXT = true;
Title.defaultProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _FormField2.FormField.defaultProps), {}, {
  suffixCls: 'title'
});
Title = (0, _tslib.__decorate)([_mobxReact.observer], Title);
var _default = Title;
exports["default"] = _default;
//# sourceMappingURL=Title.js.map
