'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 base = require('./variations/_size/base.js');
var base$1 = require('./variations/_view/base.js');
var LineSkeleton_styles = require('./LineSkeleton.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 = ["size", "lighter", "customGradientColor", "roundness", "animationType", "customFadeInColor", "customFadeOutColor", "view", "className"];
/**
 * Копонент-составляющая Скелетона
 */
var lineSkeletonRoot = function lineSkeletonRoot(Root) {
  return /*#__PURE__*/React.forwardRef(function (_ref, outerRootRef) {
    var size = _ref.size,
      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,
      view = _ref.view,
      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(Root, _rollupPluginBabelHelpers.extends({
      ref: outerRootRef,
      size: size,
      view: view
    }, rest), /*#__PURE__*/React__default.default.createElement(LineSkeleton_styles.StyledVisibleLine, {
      className: index.cx(className, animationClass),
      roundness: roundnessValue,
      gradientColor: skeletonGradientColor,
      customFadeInColor: customFadeInColor,
      customFadeOutColor: customFadeOutColor
    }));
  });
};
var lineSkeletonConfig = {
  name: 'LineSkeleton',
  tag: 'div',
  layout: lineSkeletonRoot,
  base: LineSkeleton_styles.base,
  variations: {
    size: {
      css: base.base
    },
    view: {
      css: base$1.base
    }
  },
  defaults: {}
};

exports.lineSkeletonConfig = lineSkeletonConfig;
exports.lineSkeletonRoot = lineSkeletonRoot;
