"use strict";

exports.__esModule = true;
exports.CollectionToolbarActionsToolbarItemsGroup = void 0;
var _react = _interopRequireWildcard(require("react"));
var _designSystem = require("@wix/design-system");
var _SearchOrCustomFilter = require("./SearchOrCustomFilter");
var _InitialLoadingConditional = require("../InitialLoadingConditional");
var _CollectionToolbarSkeletonItem = require("./CollectionToolbarSkeletonItem");
var _ToolbarCollectionContext = require("../ToolbarCollectionContext");
var _mobxReactLite = require("mobx-react-lite");
var _useIsMobile = require("../../hooks/useIsMobile");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CollectionToolbar/CollectionToolbarActionsToolbarItemsGroup.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _CollectionToolbarActionsToolbarItemsGroup(props) {
  const {
    state,
    left,
    viewsToolbarItem,
    filtersElement,
    MoreFiltersButton,
    multiLevelSorting,
    customColumns,
    exportButton,
    search,
    showCustomColumnsOnTheLeft
  } = props;
  const toolbarState = (0, _ToolbarCollectionContext.useToolbarCollectionContext)();
  const searchChild = search && /*#__PURE__*/_react.default.createElement(_SearchOrCustomFilter.SearchOrCustomFilter, {
    state: state,
    search: search,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 30,
      columnNumber: 5
    }
  });
  const isMobile = (0, _useIsMobile.useIsMobile)();
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 36,
      columnNumber: 5
    }
  }, (!isMobile || !state._searchExpanded) && /*#__PURE__*/_react.default.createElement(_react.Fragment, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 38,
      columnNumber: 9
    }
  }, left ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, viewsToolbarItem && /*#__PURE__*/_react.default.createElement(_InitialLoadingConditional.InitialLoadingConditional, {
    state: toolbarState,
    loadingElement: /*#__PURE__*/_react.default.createElement(_CollectionToolbarSkeletonItem.CollectionToolbarSkeletonItem, {
      dataHook: "toolbar-views-skeleton",
      width: "100px",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 45,
        columnNumber: 21
      }
    }),
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 42,
      columnNumber: 17
    }
  }, viewsToolbarItem), filtersElement) : viewsToolbarItem ? filtersElement : undefined, MoreFiltersButton && /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 60,
      columnNumber: 13
    }
  }, /*#__PURE__*/_react.default.createElement(MoreFiltersButton, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 61,
      columnNumber: 15
    }
  })), customColumns && showCustomColumnsOnTheLeft && /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 65,
      columnNumber: 13
    }
  }, customColumns), multiLevelSorting && /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 68,
      columnNumber: 13
    }
  }, multiLevelSorting), exportButton && /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 71,
      columnNumber: 13
    }
  }, /*#__PURE__*/(0, _react.cloneElement)(exportButton, {
    toolbarType: 'default'
  })), customColumns && !showCustomColumnsOnTheLeft && /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 78,
      columnNumber: 13
    }
  }, customColumns)), searchChild);
}
const CollectionToolbarActionsToolbarItemsGroup = exports.CollectionToolbarActionsToolbarItemsGroup = (0, _mobxReactLite.observer)(_CollectionToolbarActionsToolbarItemsGroup);
//# sourceMappingURL=CollectionToolbarActionsToolbarItemsGroup.js.map