import _extends from "@babel/runtime/helpers/extends";
import "core-js/modules/es.array.map.js";
import * as React from 'react';
import { Grid, GridColumn } from '@megafon/ui-core';
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
import getColumnConfig from "./helpers";
var cn = cnCreate('mfui-9-cards-box');
var CardsBox = function CardsBox(_ref) {
  var _ref$renderTwoColumns = _ref.renderTwoColumnsInRow,
    renderTwoColumnsInRow = _ref$renderTwoColumns === void 0 ? false : _ref$renderTwoColumns,
    dataAttrs = _ref.dataAttrs,
    children = _ref.children;
  return /*#__PURE__*/React.createElement("div", _extends({
    className: cn()
  }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement(Grid, {
    guttersBottom: "medium",
    guttersLeft: "medium"
  }, React.Children.map(children, function (child, i) {
    return /*#__PURE__*/React.createElement(GridColumn, _extends({
      dataAttrs: {
        root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.column
      }
    }, getColumnConfig(React.Children.count(children), i, renderTwoColumnsInRow)), child);
  })));
};
export default CardsBox;