"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DistributionBar = void 0;
var _react = _interopRequireDefault(require("react"));
var _framerMotion = require("framer-motion");
var _index = require("../../index");
var _DistributionBar = require("./DistributionBar.styled");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var DistributionBar = exports.DistributionBar = function DistributionBar(_ref) {
  var iconFromProps = _ref.icon,
    iconPadding = _ref.iconPadding,
    label = _ref.label,
    labelProps = _ref.labelProps,
    weight = _ref.weight,
    children = _ref.children,
    _ref$delay = _ref.delay,
    delay = _ref$delay === void 0 ? 0 : _ref$delay;
  return _react.default.createElement(_DistributionBar.StyledFlexbox, {
    container: true,
    alignItems: "center",
    justifyContent: "space-between",
    height: 8,
    width: "100%",
    gap: 2
  }, _react.default.createElement(_DistributionBar.Item, _extends({
    item: true,
    container: true,
    alignItems: "center",
    gap: 3,
    height: "100%"
  }, labelProps), _react.default.createElement(_index.Box, _extends({
    pl: (iconPadding === null || iconPadding === void 0 ? void 0 : iconPadding.pl) || 2
  }, iconPadding), iconFromProps || _react.default.createElement(_DistributionBar.StyledDot, {
    color: function color(t) {
      return t.color.buttonBackgroundHoverPrimary;
    }
  })), _react.default.createElement(_index.TruncateWithTooltip, {
    label: label
  }, label), _react.default.createElement(_DistributionBar.Bar, {
    as: _framerMotion.motion.div,
    initial: {
      width: '0'
    },
    animate: {
      width: "calc(".concat(weight, "% - 32px)")
    },
    transition: {
      type: 'linear',
      duration: 1,
      delay: delay
    }
  })), children);
};