import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { forwardRef } from 'react';
import { cx } from '../../../utils/index.js';
import { classes } from '../tokens.js';
import { base as base$1 } from './variations/_size/base.js';
import { base as base$2 } from './variations/_view/base.js';
import { StyledVisibleLine, base } from './LineSkeleton.styles.js';
import { getSkeletonColor } from '../../../mixins/applySkeletonAnimation.js';
import { getRoundness } from '../../../mixins/applyRoundness.js';

var _excluded = ["size", "lighter", "customGradientColor", "roundness", "animationType", "customFadeInColor", "customFadeOutColor", "view", "className"];
/**
 * Копонент-составляющая Скелетона
 */
var lineSkeletonRoot = function lineSkeletonRoot(Root) {
  return /*#__PURE__*/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 = _objectWithoutProperties(_ref, _excluded);
    var animationClass = classes["".concat(animationType, "Animation")];
    var roundnessValue = getRoundness({
      roundness: roundness
    });
    var skeletonGradientColor = getSkeletonColor({
      lighter: lighter,
      customGradientColor: customGradientColor
    });
    return /*#__PURE__*/React__default.createElement(Root, _extends({
      ref: outerRootRef,
      size: size,
      view: view
    }, rest), /*#__PURE__*/React__default.createElement(StyledVisibleLine, {
      className: cx(className, animationClass),
      roundness: roundnessValue,
      gradientColor: skeletonGradientColor,
      customFadeInColor: customFadeInColor,
      customFadeOutColor: customFadeOutColor
    }));
  });
};
var lineSkeletonConfig = {
  name: 'LineSkeleton',
  tag: 'div',
  layout: lineSkeletonRoot,
  base: base,
  variations: {
    size: {
      css: base$1
    },
    view: {
      css: base$2
    }
  },
  defaults: {}
};

export { lineSkeletonConfig, lineSkeletonRoot };
