import _extends from "@babel/runtime/helpers/extends";
import "core-js/modules/es.array.concat.js";
import "core-js/modules/es.array.map.js";
import * as React from 'react';
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
import InfoCard from "./components/InfoCard/InfoCard";
import "./InfoCards.css";
var cn = cnCreate('mfui-9-info-cards');
var InfoCards = function InfoCards(_ref) {
  var className = _ref.className,
    classes = _ref.classes,
    items = _ref.items,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? 'medium' : _ref$size,
    _ref$imgPosition = _ref.imgPosition,
    imgPosition = _ref$imgPosition === void 0 ? 'top-left' : _ref$imgPosition,
    _ref$background = _ref.background,
    background = _ref$background === void 0 ? 'stroke' : _ref$background,
    dataAttrs = _ref.dataAttrs,
    rootRef = _ref.rootRef;
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
    className: cn({
      size: size,
      position: imgPosition,
      background: background
    }, [className, classes === null || classes === void 0 ? void 0 : classes.root]),
    ref: rootRef
  }), items.map(function (item, i) {
    return /*#__PURE__*/React.createElement(InfoCard, _extends({}, item, {
      className: classes === null || classes === void 0 ? void 0 : classes.card,
      size: size,
      imgPosition: imgPosition,
      background: background,
      dataAttrs: {
        root: filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.card, i + 1)
      },
      classes: {
        title: classes === null || classes === void 0 ? void 0 : classes.cardTitle
      },
      key: "".concat(item.title, "_").concat(i)
    }));
  }));
};
export default InfoCards;