"use strict";

exports.__esModule = true;
exports.useToolbarOverflowItems = useToolbarOverflowItems;
var _react = _interopRequireWildcard(require("react"));
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
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 useToolbarOverflowItems(state, props) {
  const {
    container,
    panels,
    exportState,
    importState
  } = state;
  const {
    translate: t
  } = container;
  return (0, _react.useMemo)(() => {
    const primaryItems = [];
    const secondaryItems = [];

    // Primary actions (rendered as Thumbnails)
    if (props.MoreFiltersButton) {
      primaryItems.push({
        text: t('cairo.toolbar.moreFiltersButton', {
          defaultValue: ''
        }),
        icon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.ContentFilter),
        onClick: () => panels.openSidePanel('filters'),
        dataHook: 'overflow-more-filters'
      });
    }
    if (props.customColumns) {
      primaryItems.push({
        text: t('cairo.table.custom-columns.button.cta', {
          defaultValue: ''
        }),
        icon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Adjust),
        onClick: () => panels.openSidePanel('customColumns'),
        dataHook: 'overflow-custom-columns'
      });
    }

    // Secondary actions (rendered as ListItemAction)
    if (props.multiLevelSorting) {
      secondaryItems.push({
        text: t('cairo.table.advanced-sorting.button.cta', {
          defaultValue: ''
        }),
        prefixIcon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.ChangeOrder),
        onClick: () => panels.openSidePanel('multiLevelSorting'),
        dataHook: 'overflow-multi-level-sorting'
      });
    }
    if (props.exportButton && exportState) {
      secondaryItems.push({
        text: t('cairo.export.export', {
          defaultValue: ''
        }),
        prefixIcon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.UploadExport),
        onClick: () => exportState.open(),
        dataHook: 'overflow-export'
      });
    }
    if (props.importButton && importState) {
      secondaryItems.push({
        text: t('cairo.import.import', {
          defaultValue: ''
        }),
        prefixIcon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.DownloadImport),
        onClick: () => importState.open(),
        dataHook: 'overflow-import'
      });
    }
    const layoutSwitchConfig = props.viewTypeState ? {
      viewTypeState: props.viewTypeState
    } : undefined;
    return {
      primaryItems,
      secondaryItems,
      layoutSwitchConfig
    };
  }, [props.customColumns, props.multiLevelSorting, props.exportButton, props.importButton, props.MoreFiltersButton, props.viewTypeState, t, panels, exportState, importState]);
}
//# sourceMappingURL=useToolbarOverflowItems.js.map