import _extends from "@babel/runtime/helpers/extends";
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
import React from 'react';
import classNames from 'classnames';
import Skeleton from './Skeleton';
import { CLS_PREFIX } from '../../constants';

/**
 * Skeleton for text-containing components. Is can be used inside Paragraph, as title, or single text
 * @since 3.28.0
 */
const SkeletonText = ({
  lines = 3,
  component: Tag = 'span',
  className,
  baseClassName = `${CLS_PREFIX}skeleton-text`,
  lineProps = {},
  ...props
}) => /*#__PURE__*/React.createElement(Tag, _extends({
  className: classNames(baseClassName, className)
}, props), Array.from({
  length: lines
}).map((_, key) => /*#__PURE__*/React.createElement(Skeleton // eslint-disable-next-line react/no-array-index-key
, _extends({
  key: key
}, lineProps, {
  className: classNames(`${baseClassName}__line`, lineProps === null || lineProps === void 0 ? void 0 : lineProps.className)
}))));

export default SkeletonText;