import _extends from "@babel/runtime/helpers/esm/extends";
import { __rest } from "tslib";
import * as React from 'react';
import warning from '../_util/warning';
import Base from './Base';
import { tupleNum } from '../_util/type';
var TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5);

var Title = function Title(props, ref) {
  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 = "h".concat(level);
  } else {
    warning(false, 'Typography.Title', 'Title only accept `1 | 2 | 3 | 4 | 5` as `level` value. And `5` need 4.6.0+ version.');
    component = 'h1';
  }

  return /*#__PURE__*/React.createElement(Base, _extends({
    ref: ref
  }, restProps, {
    component: component
  }));
};

export default /*#__PURE__*/React.forwardRef(Title);