function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var __rest = this && this.__rest || function (s, e) {
  var t = {};

  for (var p in s) {
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  }

  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  }
  return t;
};

import * as React from 'react';
import warning from 'warning';
import Base from './Base';
import { tupleNum } from '../_util/type';
var TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5, 6, 7);

var Title = function Title(props) {
  var _props$level = props.level,
      level = _props$level === void 0 ? 1 : _props$level,
      restProps = __rest(props, ["level"]);

  var component;

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

  return /*#__PURE__*/React.createElement(Base, _extends({}, restProps, {
    subheading: level > 6,
    component: component
  }));
};

export default Title;