"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ArchivedItemsCTAButton = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _designSystem = require("@wix/design-system");
var _react = _interopRequireWildcard(require("react"));
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _react2 = require("@wix/bex-core/react");
var _mobxReactLite = require("mobx-react-lite");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/ArchivedItemsPanel/ArchivedItemsCTAButton.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); }
// Lazy load the ArchivedItemsPanel - only loads when panel is opened
const ArchivedItemsPanel = /*#__PURE__*/(0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./ArchivedItemsPanel'))).then(module => ({
  default: module.ArchivedItemsPanel
})));
function _ArchivedItemsCTAButton({
  dataExtension,
  onCloseSidePanel,
  dataHook = 'custom-columns',
  actionContainerProps
}) {
  const {
    translate: t
  } = (0, _react2.useWixPatternsContainer)();
  const style = (0, _react.useMemo)(() => ({
    display: 'flex',
    alignItems: 'center',
    gap: '8px'
  }), []);
  const handleOpenArchivedPanel = (0, _react.useCallback)(() => {
    dataExtension == null || dataExtension.openArchivedPanel();
  }, [dataExtension]);
  const handleCloseArchivedPanel = (0, _react.useCallback)(() => {
    dataExtension == null || dataExtension.closeArchivedPanel();
  }, [dataExtension]);
  const handleCloseAllPanels = (0, _react.useCallback)(() => {
    dataExtension == null || dataExtension.closeArchivedPanel();
    onCloseSidePanel();
  }, [dataExtension, onCloseSidePanel]);
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_designSystem.TableListItem, {
    onClick: handleOpenArchivedPanel,
    dataHook: `${dataHook}-archived-items-button`,
    showDivider: true,
    verticalPadding: "tiny",
    options: [{
      value: /*#__PURE__*/_react.default.createElement("div", {
        style: style,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 74,
          columnNumber: 15
        }
      }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Archive, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 75,
          columnNumber: 17
        }
      }), /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        weight: "thin",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 76,
          columnNumber: 17
        }
      }, t('cairo.table.custom-columns.section-divider')))
    }, {
      value: /*#__PURE__*/_react.default.createElement(_designSystem.Box, (0, _extends2.default)({}, actionContainerProps, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 84,
          columnNumber: 15
        }
      }), /*#__PURE__*/_react.default.createElement(_designSystem.IconButton, {
        size: "tiny",
        skin: "light",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 85,
          columnNumber: 17
        }
      }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.ChevronRight, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 86,
          columnNumber: 19
        }
      }))),
      align: 'right'
    }],
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 66,
      columnNumber: 7
    }
  }), (dataExtension == null ? void 0 : dataExtension.isArchivedPanelOpen) && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
    fallback: null,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 95,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(ArchivedItemsPanel, {
    dataExtension: dataExtension,
    items: dataExtension == null ? void 0 : dataExtension.archivedItems,
    onBackButtonClick: handleCloseArchivedPanel,
    onCloseButtonClick: handleCloseAllPanels,
    dataHook: dataHook,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 96,
      columnNumber: 11
    }
  })));
}
const ArchivedItemsCTAButton = exports.ArchivedItemsCTAButton = (0, _mobxReactLite.observer)(_ArchivedItemsCTAButton);
//# sourceMappingURL=ArchivedItemsCTAButton.js.map