import _extends from "@babel/runtime/helpers/esm/extends";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import { __rest } from "tslib";
import * as React from 'react';
import omit from "rc-util/es/omit";
import warning from '../_util/warning';
import Base from './Base';

var Text = function Text(_a, ref) {
  var ellipsis = _a.ellipsis,
      restProps = __rest(_a, ["ellipsis"]);

  var mergedEllipsis = React.useMemo(function () {
    if (ellipsis && _typeof(ellipsis) === 'object') {
      return omit(ellipsis, ['expandable', 'rows']);
    }

    return ellipsis;
  }, [ellipsis]);
  warning(_typeof(ellipsis) !== 'object' || !ellipsis || !('expandable' in ellipsis) && !('rows' in ellipsis), 'Typography.Text', '`ellipsis` do not support `expandable` or `rows` props.');
  return /*#__PURE__*/React.createElement(Base, _extends({
    ref: ref
  }, restProps, {
    ellipsis: mergedEllipsis,
    component: "span"
  }));
};

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