"use strict";

exports.__esModule = true;
exports.ToolbarCollection = ToolbarCollection;
var _designSystem = require("@wix/design-system");
var _react = _interopRequireWildcard(require("react"));
var _assertComponentType = require("../assertComponentType");
var _CollectionToolbars = require("../CollectionToolbars");
var _checkConflictingToolbarProps = require("./checkConflictingToolbarProps");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/ToolbarCollection/ToolbarCollection.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 ToolbarCollection(props) {
  const {
    state,
    filters,
    title,
    tabs,
    views,
    extraToolbar,
    selectionToolbar,
    dragAndDropReorderModeToolbar,
    sticky: stickyProp,
    search,
    children,
    tableGridSwitchButton,
    exportButton,
    importButton,
    primaryActionButton,
    secondaryActions,
    moreActions,
    summaryBar,
    topNotification
  } = props;
  (0, _assertComponentType.assertComponentType)(views, 'CollectionViewsDropdown', 'views');
  (0, _checkConflictingToolbarProps.checkConflictingToolbarProps)(props);
  const {
    scrollableContentRef: scrollablePageRef
  } = (0, _designSystem.usePageScrollContext)();
  const [sticky, setSticky] = (0, _react.useState)(stickyProp ?? (scrollablePageRef == null ? void 0 : scrollablePageRef.current) != null);
  (0, _react.useEffect)(() => {
    setSticky(stickyProp ?? (scrollablePageRef == null ? void 0 : scrollablePageRef.current) != null);
  }, [stickyProp]);
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CollectionToolbars.CollectionToolbars, {
    sticky: sticky,
    state: state,
    search: search,
    views: views,
    title: title,
    tabs: tabs,
    filters: filters,
    selectionToolbar: selectionToolbar,
    dragAndDropReorderModeToolbar: dragAndDropReorderModeToolbar,
    extraToolbar: extraToolbar,
    tableGridSwitchButton: tableGridSwitchButton,
    exportButton: exportButton,
    importButton: importButton,
    primaryActionButton: primaryActionButton,
    secondaryActions: secondaryActions,
    moreActions: moreActions,
    summaryBar: summaryBar,
    topNotification: typeof topNotification === 'function' ? () => topNotification({
      query: state.collection.result.originQuery
    }) : topNotification,
    titleBar: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      width: "100%",
      borderTopColor: "D60",
      borderTopWidth: "1px",
      borderTopStyle: "solid",
      boxSizing: "border-box",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 387,
        columnNumber: 11
      }
    }),
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 362,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    dataHook: "toolbar-collection-content",
    width: "100%",
    direction: "vertical",
    minHeight: 0,
    flex: 1,
    verticalAlign: "middle",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 396,
      columnNumber: 7
    }
  }, children));
}
//# sourceMappingURL=ToolbarCollection.js.map