"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _constants = require("../../constants");
var _OnDarkContext = _interopRequireDefault(require("../OnDarkContext"));
var _jsxRuntime = require("react/jsx-runtime");
// Copyright 1999-2023. 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 = _ref => {
  let {
    baseClassName = `${_constants.CLS_PREFIX}text`,
    className,
    children,
    component: Tag,
    intent,
    fontSize,
    bold = false,
    italic = false,
    mark = false,
    truncate = false,
    nowrap = false,
    ...props
  } = _ref;
  if (!Tag) {
    Tag = mark ? 'mark' : 'span';
  }
  const onDark = (0, _react.useContext)(_OnDarkContext.default);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
    className: (0, _classnames.default)(baseClassName, {
      [`${baseClassName}--${intent}`]: intent,
      [`${baseClassName}--${fontSize}`]: fontSize,
      [`${baseClassName}--bold`]: bold,
      [`${baseClassName}--italic`]: italic,
      [`${baseClassName}--truncate`]: truncate,
      [`${baseClassName}--nowrap`]: nowrap,
      [`${baseClassName}--mark`]: mark,
      [`${baseClassName}--on-dark`]: onDark
    }, className),
    ...props,
    children: children
  });
};
var _default = exports.default = Text;