"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.CmsFieldForm = void 0;
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _BasicsSection = require("./Sections/BasicsSection");
var _ValidationAndDefaultsSection = require("./Sections/ValidationAndDefaultsSection");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CmsFieldManagement/CmsFieldForm.tsx";
const _CmsFieldForm = ({
  state
}) => {
  return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    direction: "vertical",
    gap: "SP2",
    width: 530,
    maxHeight: 600,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 15,
      columnNumber: 5
    }
  }, state.errorToastConfig && /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    position: "absolute",
    top: "24px",
    left: "49%",
    transform: "translateX(-50%)",
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 17,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.FloatingNotification, {
    dataHook: "cms-field-modal-error-state",
    type: "destructive",
    prefixIcon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.InfoCircle, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 26,
        columnNumber: 25
      }
    }),
    text: state.errorToastConfig.message,
    textButtonProps: state.errorToastConfig.action && {
      label: state.errorToastConfig.action.text,
      onClick: () => {
        var _state$errorToastConf;
        return (_state$errorToastConf = state.errorToastConfig) == null || (_state$errorToastConf = _state$errorToastConf.action) == null || _state$errorToastConf.onClick == null ? void 0 : _state$errorToastConf.onClick();
      }
    },
    onClose: () => state.setErrorToastConfig(undefined),
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 23,
      columnNumber: 11
    }
  })), !state.errorToastConfig && state.showValidationError && /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    position: "absolute",
    top: "24px",
    left: "49%",
    transform: "translateX(-50%)",
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 40,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.FloatingNotification, {
    type: "destructive",
    prefixIcon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.InfoCircle, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 48,
        columnNumber: 25
      }
    }),
    text: state.validationErrorMessage,
    onClose: state.hideValidationError,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 46,
      columnNumber: 11
    }
  })), /*#__PURE__*/_react.default.createElement(_BasicsSection.BasicsSection, {
    state: state,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 55,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.Divider, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 56,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_ValidationAndDefaultsSection.ValidationAndDefaultsSection, {
    state: state,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 58,
      columnNumber: 7
    }
  }));
};
const CmsFieldForm = exports.CmsFieldForm = (0, _mobxReactLite.observer)(_CmsFieldForm);
//# sourceMappingURL=CmsFieldForm.js.map