"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _gridList = _interopRequireDefault(require("../../../organism/grid-list"));
var _brandCard = _interopRequireDefault(require("../../../molecule/brand-card"));
var _brandCardCreate = _interopRequireDefault(require("../../../molecule/brand-card-create"));
var _inputSearch = _interopRequireDefault(require("../../../atom/input-search"));
var _selectMultiple = _interopRequireDefault(require("../../../molecule/select-multiple"));
var _radioGroup = _interopRequireDefault(require("../../../atom/radio-group"));
var _layout = _interopRequireDefault(require("../layout"));
var _loader = _interopRequireDefault(require("../../../atom/loader"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const BrandList = (0, _layout.default)(props => {
  const {
    brands = [],
    create,
    search: {
      select,
      ...search
    } = {},
    filter,
    isLoading
  } = props;
  const brandCards = brands.map((brand, index) => {
    return /*#__PURE__*/_react.default.createElement("div", {
      key: brand.title,
      className: _style.default.brand
    }, /*#__PURE__*/_react.default.createElement(_brandCard.default, brand));
  });
  if (create) {
    brandCards.push(/*#__PURE__*/_react.default.createElement("div", {
      key: "new",
      className: _style.default.brand
    }, /*#__PURE__*/_react.default.createElement(_brandCardCreate.default, create)));
  }
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.container
  }, filter ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.filterBar
  }, /*#__PURE__*/_react.default.createElement(_radioGroup.default, filter)) : null, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.filters
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.searchBar
  }, /*#__PURE__*/_react.default.createElement(_inputSearch.default, _extends({}, search, {
    theme: "coorpmanager"
  }))), select ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.provider
  }, /*#__PURE__*/_react.default.createElement(_selectMultiple.default, _extends({}, select, {
    theme: "coorpmanager"
  }))) : null), isLoading ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.loader
  }, /*#__PURE__*/_react.default.createElement(_loader.default, {
    theme: "coorpmanager"
  })) : /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.wrapper
  }, /*#__PURE__*/_react.default.createElement(_gridList.default, null, brandCards)));
});
BrandList.propTypes = process.env.NODE_ENV !== "production" ? {
  brands: _propTypes.default.arrayOf(_propTypes.default.shape(_brandCard.default.propTypes)),
  filter: _propTypes.default.shape(_radioGroup.default.propTypes),
  search: _propTypes.default.shape(_inputSearch.default.propTypes),
  create: _propTypes.default.shape(_brandCardCreate.default.propTypes),
  isLoading: _propTypes.default.bool
} : {};
var _default = exports.default = BrandList;
//# sourceMappingURL=index.js.map