'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var index = require('../../../utils/index.js');
var tokens = require('../tokens.js');
var RectSkeleton_styles = require('./RectSkeleton.styles.js');
var applySkeletonAnimation = require('../../../mixins/applySkeletonAnimation.js');
var applyRoundness = require('../../../mixins/applyRoundness.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

var _excluded = ["width", "height", "lighter", "customGradientColor", "roundness", "animationType", "customFadeInColor", "customFadeOutColor", "className"];
/**
 * Компонент для создания прямоугольного плейсхолдера.
 */
var RectSkeleton = /*#__PURE__*/React.forwardRef(function (_ref, outerRootRef) {
  var width = _ref.width,
    height = _ref.height,
    lighter = _ref.lighter,
    customGradientColor = _ref.customGradientColor,
    _ref$roundness = _ref.roundness,
    roundness = _ref$roundness === void 0 ? '16' : _ref$roundness,
    _ref$animationType = _ref.animationType,
    animationType = _ref$animationType === void 0 ? 'shimmer' : _ref$animationType,
    customFadeInColor = _ref.customFadeInColor,
    customFadeOutColor = _ref.customFadeOutColor,
    className = _ref.className,
    rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
  var animationClass = tokens.classes["".concat(animationType, "Animation")];
  var roundnessValue = applyRoundness.getRoundness({
    roundness: roundness
  });
  var skeletonGradientColor = applySkeletonAnimation.getSkeletonColor({
    lighter: lighter,
    customGradientColor: customGradientColor
  });
  return /*#__PURE__*/React__default.default.createElement(RectSkeleton_styles.StyledRectSkeleton, _rollupPluginBabelHelpers.extends({
    ref: outerRootRef,
    className: index.cx(className, animationClass),
    roundness: roundnessValue,
    gradientColor: skeletonGradientColor,
    customFadeInColor: customFadeInColor,
    customFadeOutColor: customFadeOutColor,
    width: Number.isNaN(Number(width)) ? String(width) : "".concat(width, "px"),
    height: Number.isNaN(Number(height)) ? String(height) : "".concat(height, "px")
  }, rest));
});

exports.RectSkeleton = RectSkeleton;
