"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.Showcase = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _reactIntl = require("react-intl");
var _DistributionBar = require("./DistributionBar");
var _index = require("../../index");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var _default = exports.default = {
  title: 'Molecules / DistributionBar'
};
var StyledFlexbox = (0, _styledComponents.default)(_index.Flexbox).withConfig({
  displayName: "DistributionBarstories__StyledFlexbox",
  componentId: "sc-9o6juc-0"
})(["min-width:0;"]);
var StyledImage = _styledComponents.default.img.withConfig({
  displayName: "DistributionBarstories__StyledImage",
  componentId: "sc-9o6juc-1"
})(["width:24px;border-radius:50%;"]);
var Showcase = exports.Showcase = function Showcase() {
  var instrumentList = [{
    label: 'Unity Software Inc',
    link: 'linkto',
    country: 'NO',
    weight: 1000,
    currency: 'SEK'
  }, {
    label: 'Investor B',
    weight: 700
  }, {
    label: 'Volvo B',
    link: 'linkto',
    country: 'SE',
    weight: 500,
    currency: 'SEK'
  }, {
    label: 'Instrument 3',
    country: 'US',
    weight: 0,
    percentage: true
  }];
  var highestValue = Math.max.apply(Math, _toConsumableArray(instrumentList.map(function (instrument) {
    return instrument.weight;
  })));
  return _react.default.createElement(_reactIntl.IntlProvider, {
    locale: "en"
  }, _react.default.createElement(_index.Flexbox, {
    container: true,
    gap: 3,
    direction: "column"
  }, _react.default.createElement(_index.Flexbox, {
    container: true,
    item: true,
    direction: "column",
    gap: 1
  }, _react.default.createElement(_index.Typography, null, "Showcase different properties"), instrumentList.map(function (item) {
    return _react.default.createElement(_DistributionBar.DistributionBar, {
      key: item.label,
      label: item.link ? _react.default.createElement(_index.Link, {
        to: item.link,
        color: "inherit"
      }, item.label) : item.label,
      weight: item.weight / highestValue * 100,
      icon: item.country ? _react.default.createElement(_index.Flag, {
        size: "m",
        country: item.country
      }) : undefined
    }, _react.default.createElement(StyledFlexbox, {
      container: true
    }, _react.default.createElement(_index.TruncateWithTooltip, {
      label: _react.default.createElement(_index.Number, {
        value: item.weight,
        currency: item.currency
      })
    }, _react.default.createElement(_index.Typography, {
      type: "secondary",
      textAlign: "right"
    }, _react.default.createElement(_index.Number, {
      value: item.weight,
      currency: item.currency,
      percentage: item.percentage
    })))));
  })), _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, null, "Custom icon"), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: "Label",
    weight: 10,
    icon: _react.default.createElement(_index.Icon.Global16, null)
  })), _react.default.createElement(_index.Flexbox, {
    item: true,
    container: true,
    gap: 2,
    direction: "column"
  }, _react.default.createElement(_index.Typography, null, "Custom large image with adjusted padding"), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: "Cool cat company",
    weight: 0,
    iconPadding: {
      pl: 1
    },
    icon: _react.default.createElement(_index.Flexbox, {
      container: true,
      alignItems: "center",
      justifyContent: "center",
      height: "100%"
    }, _react.default.createElement(StyledImage, {
      alt: "Image of shareville cat",
      src: "https://shareville-static-test.s3.amazonaws.com/img/avatars/cat_120x120.jpg"
    }))
  }), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: "Tesla",
    weight: 100,
    iconPadding: {
      pl: 1
    },
    icon: _react.default.createElement(_index.Flexbox, {
      container: true,
      alignItems: "center",
      justifyContent: "center",
      height: "100%"
    }, _react.default.createElement(StyledImage, {
      alt: "Image of Tesla logo",
      src: "https://cdn.pixabay.com/photo/2022/08/25/00/32/tesla-logo-7408969_1280.png"
    }))
  }), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: "Apple",
    weight: 0,
    iconPadding: {
      pl: 1
    },
    icon: _react.default.createElement(_index.Flexbox, {
      container: true,
      alignItems: "center",
      justifyContent: "center",
      height: "100%"
    }, _react.default.createElement(StyledImage, {
      alt: "Image of Apple logo",
      src: "https://banner2.cleanpng.com/20180330/oke/kisspng-apple-logo-computer-icons-apple-logo-5abdfcd3232e52.3373911715224004671441.jpg"
    }))
  })), _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, null, "Link Name"), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: _react.default.createElement(_index.Link, {
      to: "/",
      color: "inherit"
    }, "Link to something"),
    weight: 0,
    icon: _react.default.createElement(_index.Flag, {
      size: "m",
      country: "SE"
    })
  })), _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, null, "Truncate name and truncated children"), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: "Loooooooooooooooooooong naaaaaaaaaaaame",
    weight: 0,
    icon: _react.default.createElement(_index.Flag, {
      size: "m",
      country: "SE"
    })
  }, _react.default.createElement(StyledFlexbox, {
    container: true,
    justifyContent: "flex-end"
  }, _react.default.createElement(_index.TruncateWithTooltip, {
    label: _react.default.createElement(_index.Number, {
      value: 10000000000000,
      currency: "SEK"
    })
  }, _react.default.createElement(_index.Typography, {
    type: "secondary",
    weight: "bold",
    textAlign: "right"
  }, _react.default.createElement(_index.Number, {
    value: 10000000000000,
    currency: "SEK"
  })))))), _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, null, "Space children"), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: "Instrument name 1",
    weight: 69,
    icon: _react.default.createElement(_index.Flag, {
      size: "m",
      country: "SE"
    })
  }, _react.default.createElement(_index.Flexbox, {
    container: true,
    width: "50%",
    justifyContent: "space-between"
  }, _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, {
    type: "secondary"
  }, "very start")), _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, {
    type: "secondary"
  }, "very end"))))), _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, null, "Multiple columns"), _react.default.createElement(_DistributionBar.DistributionBar, {
    label: "Instrument name 1 Instrument name 1 Instrument name 1 Instrument name 1",
    labelProps: {
      container: true,
      md: {
        gutter: 0
      }
    },
    weight: 70,
    icon: _react.default.createElement(_index.Flag, {
      size: "m",
      country: "SE"
    })
  }, _react.default.createElement(_index.Flexbox, {
    container: true
  }, _react.default.createElement("div", null, "GAV"), _react.default.createElement("div", null, "10%"), _react.default.createElement("div", null, "Another Column")))), _react.default.createElement(_index.Flexbox, {
    item: true
  }, _react.default.createElement(_index.Typography, null, "Animation Waterfall"), _react.default.createElement(_index.Flexbox, {
    container: true,
    direction: "column",
    gap: 2
  }, Array.from(Array(10).keys()).map(function (item, i) {
    return _react.default.createElement(_DistributionBar.DistributionBar, {
      key: "Instrument name ".concat(i + 1),
      label: "Instrument name ".concat(i + 1),
      weight: Math.floor(Math.random() * 101),
      delay: 0 + i / 5,
      icon: _react.default.createElement(_index.Flag, {
        size: "m",
        country: "SE"
      })
    }, _react.default.createElement(_index.Flexbox, {
      container: true,
      width: "81px",
      justifyContent: "flex-end"
    }, _react.default.createElement(_index.Number, {
      value: Math.floor(Math.random() * 101),
      percentage: true,
      decimals: 2
    })), _react.default.createElement(_index.Flexbox, {
      container: true,
      width: "81px",
      justifyContent: "flex-end"
    }, _react.default.createElement(_index.Number, {
      value: Math.floor(Math.random() * 101),
      percentage: true,
      decimals: 2
    })));
  })))));
};