"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.FormPageActionsBar = void 0;
exports._FormPageActionsBar = _FormPageActionsBar;
var _designSystem = require("@wix/design-system");
var _react = _interopRequireDefault(require("react"));
var _react2 = require("@wix/bex-core/react");
var _providers = require("../../providers");
var _mobxReactLite = require("mobx-react-lite");
var _bexCore = require("@wix/bex-core");
var _useIsMobile = require("../../hooks/useIsMobile");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/FormPage/FormPageActionsBar.tsx";
function _FormPageActionsBar({
  moreActions,
  onCancel,
  onSave,
  actionsBarConfig
}) {
  var _actionsBarConfig$sav;
  const {
    translate: t,
    initTask
  } = (0, _react2.useWixPatternsContainer)();
  const state = (0, _providers.useFormPageContext)();
  const isMobile = (0, _useIsMobile.useIsMobile)();
  if (!initTask.status.isSuccess) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    gap: "SP2",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 32,
      columnNumber: 5
    }
  }, isMobile ? undefined : moreActions, /*#__PURE__*/_react.default.createElement(_designSystem.Button, {
    priority: "secondary",
    fullWidth: isMobile,
    size: isMobile ? 'small' : 'medium',
    dataHook: "form-page-cancel-btn",
    onClick: onCancel,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 34,
      columnNumber: 7
    }
  }, t('cairo.entityPage.header.cancel.CTA')), /*#__PURE__*/_react.default.createElement(_designSystem.Button, {
    fullWidth: isMobile,
    size: isMobile ? 'small' : 'medium',
    dataHook: "form-page-save-btn",
    onClick: onSave,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 43,
      columnNumber: 7
    }
  }, state.submitTask.status.isLoading ? /*#__PURE__*/_react.default.createElement(_designSystem.Loader, {
    size: "tiny",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 50,
      columnNumber: 11
    }
  }) : t(_bexCore.ctaKeys[(actionsBarConfig == null || (_actionsBarConfig$sav = actionsBarConfig.saveCta) == null ? void 0 : _actionsBarConfig$sav.text) ?? 'SAVE'])));
}
const FormPageActionsBar = exports.FormPageActionsBar = (0, _mobxReactLite.observer)(_FormPageActionsBar);
//# sourceMappingURL=FormPageActionsBar.js.map