"use strict";

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

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

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

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

var _propTypes = _interopRequireDefault(require("prop-types"));

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

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _injectE2E = _interopRequireDefault(require("../../Tools/injectE2E"));

var _interpolation = require("../../Tools/interpolation");

//  strict
var getTextTransform = function getTextTransform(props) {
  if (props.capitalize === true) {
    return 'capitalize';
  }

  if (props.uppercase === true) {
    return 'uppercase';
  }

  return 'none';
};

var Wrapper =
/*#__PURE__*/
_styledComponents.default.span.attrs(_injectE2E.default).withConfig({
  componentId: "sc-1ryi78w-0"
})(["\n  font-family: ", ";\n  font-weight: ", ";\n  font-size: ", ";\n  text-transform: ", ";\n  font-style: ", ";\n  color: ", ";\n  opacity: ", ";\n"], (0, _interpolation.theme)('fontPrimary'), (0, _interpolation.prop)('weight'), (0, _interpolation.prop)('size'), getTextTransform, function (props) {
  return props.italic === true ? 'italic' : 'normal';
}, (0, _interpolation.theme)('textColor'), (0, _interpolation.prop)('opacity'));

var Text = function Text(_ref) {
  var children = _ref.children,
      rest = (0, _objectWithoutProperties2.default)(_ref, ["children"]);
  return React.createElement(Wrapper, rest, children);
};

Text.propTypes = process.env.NODE_ENV !== "production" ? {
  capitalize: _propTypes.default.bool,
  children: _propTypes.default.node,
  e2e: _propTypes.default.string,
  italic: _propTypes.default.bool,
  opacity: _propTypes.default.number,
  size: _propTypes.default.string,
  uppercase: _propTypes.default.bool,
  weight: _propTypes.default.oneOf([100, 200, 300, 400, 500, 600, 700])
} : {};
Text.defaultProps = {
  capitalize: false,
  italic: false,
  opacity: 1,
  size: '1rem',
  uppercase: false,
  weight: 400
};
var _default = Text;
exports.default = _default;