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

import { useContext } from 'react';
import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';
import OnDarkContext from '../OnDarkContext';
import { jsx as _jsx } from "react/jsx-runtime";
/**
 * `Text` component is used for displaying inline text. For text blocks use [Paragraph](#!/Paragraph).
 * @since 1.1.0
 */
const Text = _ref => {
  let {
    baseClassName = `${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 = useContext(OnDarkContext);
  return /*#__PURE__*/_jsx(Tag, {
    className: classNames(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
  });
};
export default Text;