"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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

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

var _classnames = _interopRequireDefault(require("classnames"));

var _constants = require("../../constants");

var _OnDarkContext = _interopRequireDefault(require("../OnDarkContext"));

// Copyright 1999-2020. Plesk International GmbH. All rights reserved.

/**
 * `Text` component is used for displaying inline text. For text blocks use [Paragraph](#!/Paragraph).
 * @since 1.1.0
 */
const Text = ({
  baseClassName = "".concat(_constants.CLS_PREFIX, "text"),
  className,
  children,
  component: Tag,
  intent,
  fontSize,
  bold = false,
  italic = false,
  mark = false,
  truncate = false,
  nowrap = false,
  ...props
}) => {
  if (!Tag) {
    Tag = mark ? 'mark' : 'span';
  }

  const onDark = (0, _react.useContext)(_OnDarkContext.default);
  return /*#__PURE__*/_react.default.createElement(Tag, (0, _extends2.default)({
    className: (0, _classnames.default)(baseClassName, {
      ["".concat(baseClassName, "--").concat(intent)]: intent,
      ["".concat(baseClassName, "--").concat(fontSize)]: fontSize,
      ["".concat(baseClassName, "--bold")]: bold,
      ["".concat(baseClassName, "--italic")]: italic,
      ["".concat(baseClassName, "--truncate")]: truncate,
      ["".concat(baseClassName, "--nowrap")]: nowrap,
      ["".concat(baseClassName, "--mark")]: mark,
      ["".concat(baseClassName, "--on-dark")]: onDark
    }, className)
  }, props), children);
};

var _default = Text;
exports.default = _default;