"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.MultiAutoInlineCheckboxFilter = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _MultiInlineCheckboxFilter = require("../MultiInlineCheckboxFilter");
var _MultiSelectCheckboxFilter = require("../MultiSelectCheckboxFilter");
var _FilterRenderingContext = require("../FilterRenderingContext");
var _useStaticListFilterCollection = require("../../hooks/useStaticListFilterCollection");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/MultiAutoInlineCheckboxFilter/MultiAutoInlineCheckboxFilter.tsx";
const MAX_INLINE_ITEMS = 10;
function _MultiAutoInlineCheckboxFilter(props) {
  const {
    maxInlineItems = MAX_INLINE_ITEMS,
    data,
    filter,
    ...rest
  } = props;
  const {
    location
  } = (0, _FilterRenderingContext.useFilterRenderingContext)();
  const shouldBeRenderedAsDropdown = location === 'toolbar' || data.length > maxInlineItems;
  const collection = (0, _useStaticListFilterCollection.useStaticListFilterCollection)(filter, data);
  return shouldBeRenderedAsDropdown ? /*#__PURE__*/_react.default.createElement(_MultiSelectCheckboxFilter.MultiSelectCheckboxFilter, (0, _extends2.default)({}, rest, {
    collection: collection,
    filter: filter,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 50,
      columnNumber: 5
    }
  })) : /*#__PURE__*/_react.default.createElement(_MultiInlineCheckboxFilter.MultiInlineCheckboxFilter, (0, _extends2.default)({}, rest, {
    filter: filter,
    data: data,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 56,
      columnNumber: 5
    }
  }));
}
const MultiAutoInlineCheckboxFilter = exports.MultiAutoInlineCheckboxFilter = (0, _mobxReactLite.observer)(_MultiAutoInlineCheckboxFilter);
//# sourceMappingURL=MultiAutoInlineCheckboxFilter.js.map