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 { normalizeSize } from '../utils';
import { CLS_PREFIX } from '../../constants';

/**
 * `Skeleton` (or content-placeholder) is placeholder preview of content before the data gets loaded to reduce load-time frustration.
 * Skeleton is used for non-text components, images, media-objects, etc.
 * @since 3.28.0
 */
const Skeleton = ({
  width,
  maxWidth,
  height,
  style,
  component: Tag = 'span',
  className,
  baseClassName = `${CLS_PREFIX}skeleton`,
  ...props
}) => {
  const finalStyle = { ...style,
    width: normalizeSize(width),
    maxWidth: normalizeSize(maxWidth),
    height: normalizeSize(height)
  };
  return /*#__PURE__*/React.createElement(Tag, _extends({
    className: classNames(baseClassName, className),
    style: finalStyle
  }, props));
};

export default Skeleton;