"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ReorderModeToolbarBase = exports.ReorderModeToolbar = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _react2 = require("@wix/bex-core/react");
var _ToolbarCollectionContext = require("../ToolbarCollectionContext");
var _initReordeModeState = require("../DragAndDrop/initReordeModeState");
var _ReorderModeDiscardChangesModal = require("./ReorderModeDiscardChangesModal");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CollectionToolbar/ReorderModeToolbar.tsx";
function _ReorderModeToolbar(props) {
  const {
    learnMoreUrl,
    reorderModeTitle,
    state
  } = props;
  const {
    translate: t
  } = (0, _react2.useWixPatternsContainer)();
  if (!state.reorderModeState) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar, {
    removeVerticalPadding: true,
    dataHook: "reorder-mode-toolbar",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 39,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.ItemGroup, {
    position: "start",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 40,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 41,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    gap: "SP1",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 42,
      columnNumber: 11
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
    size: "small",
    dataHook: "reorder-mode-toolbar-title",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 43,
      columnNumber: 13
    }
  }, reorderModeTitle || t('cairo.dragAndDrop.reorderMode.toolbar.title')), learnMoreUrl ? /*#__PURE__*/_react.default.createElement(_designSystem.TextButton, {
    dataHook: "reorder-mode-toolbar-learn-more-cta",
    underline: "always",
    size: "small",
    as: "a",
    rel: "noopener",
    target: "_blank",
    href: learnMoreUrl,
    onClick: () => {
      var _state$reorderModeSta;
      return (_state$reorderModeSta = state.reorderModeState) == null ? void 0 : _state$reorderModeSta.reportLearnMoreClickedBiEvent();
    },
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 48,
      columnNumber: 15
    }
  }, t('cairo.dragAndDrop.reorderMode.toolbar.title.learnMore')) : undefined))), /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.ItemGroup, {
    position: "end",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 66,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 67,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Button, {
    dataHook: "reorder-mode-toolbar-cancel-cta",
    priority: "secondary",
    onClick: () => {
      var _state$reorderModeSta2;
      (_state$reorderModeSta2 = state.reorderModeState) == null || _state$reorderModeSta2.onBulkCancel();
    },
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 68,
      columnNumber: 11
    }
  }, t('cairo.dragAndDrop.reorderMode.toolbar.cancel.cta')), /*#__PURE__*/_react.default.createElement(_ReorderModeDiscardChangesModal.ReorderModeDiscardChangesModal, {
    state: state.reorderModeState,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 77,
      columnNumber: 11
    }
  })), /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 79,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Button, {
    dataHook: "reorder-mode-toolbar-save-cta",
    onClick: () => {
      var _state$reorderModeSta3;
      (_state$reorderModeSta3 = state.reorderModeState) == null || _state$reorderModeSta3.onBulkSubmit();
    },
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 80,
      columnNumber: 11
    }
  }, t('cairo.dragAndDrop.reorderMode.toolbar.save.cta')))));
}
const ReorderModeToolbarBase = exports.ReorderModeToolbarBase = (0, _mobxReactLite.observer)(_ReorderModeToolbar);
const ReorderModeToolbar = props => {
  const state = (0, _ToolbarCollectionContext.useToolbarCollectionContext)();
  return /*#__PURE__*/_react.default.createElement(ReorderModeToolbarBase, (0, _extends2.default)({
    state: state
  }, props, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 101,
      columnNumber: 10
    }
  }));
};
exports.ReorderModeToolbar = ReorderModeToolbar;
ReorderModeToolbar.displayName = 'ReorderModeToolbar';
ReorderModeToolbar.setReorderModeState = _initReordeModeState.setReorderModeState;
//# sourceMappingURL=ReorderModeToolbar.js.map