var _excluded = ["type", "size", "level", "center", "ellipsis", "className", "children", "strong", "underline", "disabled", "renderType", "delete"];

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

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React, { useContext } from 'react';
import clsx from 'clsx';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';

var TypographyBase = function TypographyBase(_ref) {
  var _ref2, _clsx;

  var type = _ref.type,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? 'md' : _ref$size,
      _ref$level = _ref.level,
      level = _ref$level === void 0 ? 4 : _ref$level,
      center = _ref.center,
      ellipsis = _ref.ellipsis,
      className = _ref.className,
      children = _ref.children,
      strong = _ref.strong,
      underline = _ref.underline,
      disabled = _ref.disabled,
      renderType = _ref.renderType,
      del = _ref.delete,
      props = _objectWithoutPropertiesLoose(_ref, _excluded);

  var _useContext = useContext(ConfigProviderContext),
      prefixCls = _useContext.prefixCls,
      createNamespace = _useContext.createNamespace;

  var _createNamespace = createNamespace('typography', prefixCls),
      bem = _createNamespace[0];

  var elli = ellipsis === true ? 1 : ellipsis;
  return /*#__PURE__*/React.createElement("div", _extends({
    className: clsx(className, bem([type, size, renderType, (_ref2 = {
      center: center,
      strong: strong,
      underline: underline,
      disabled: disabled,
      delete: del
    }, _ref2["l" + level] = renderType === 'title' && level, _ref2)]), (_clsx = {
      'rv-ellipsis': elli === 1
    }, _clsx["rv-multi-ellipsis--l" + elli] = elli && elli > 1, _clsx))
  }, props), children);
};

export default TypographyBase;