"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 _BasicsSection = require("./Sections/BasicsSection");
var _ValidationAndDefaultsSection = require("./Sections/ValidationAndDefaultsSection");
var _StatusToastFromConfig = require("../StatusToastFromConfig");
var _CmsFieldFormStCss = require("./CmsFieldForm.st.css.js");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CmsFieldManagement/CmsFieldForm.tsx";
const _CmsFieldForm = ({
  state
}) => {
  const validationToastConfig = state.showValidationError ? {
    message: state.validationErrorMessage,
    type: 'ERROR'
  } : undefined;
  const activeToastConfig = state.errorToastConfig ?? validationToastConfig;
  const onCloseToast = state.errorToastConfig ? () => state.setErrorToastConfig(undefined) : state.hideValidationError;
  return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    direction: "vertical",
    maxHeight: 600,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 24,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.ToastContainer, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 25,
      columnNumber: 7
    }
  }, activeToastConfig && /*#__PURE__*/_react.default.createElement(_StatusToastFromConfig.StatusToastFromConfig, {
    config: activeToastConfig,
    onClose: onCloseToast,
    dataHook: state.errorToastConfig ? 'cms-field-modal-error-state' : 'cms-field-modal-validation-state',
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 27,
      columnNumber: 11
    }
  })), /*#__PURE__*/_react.default.createElement(_BasicsSection.BasicsSection, {
    state: state,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 39,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    className: _CmsFieldFormStCss.classes.fullBleedDivider,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 40,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Divider, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 41,
      columnNumber: 9
    }
  })), /*#__PURE__*/_react.default.createElement(_ValidationAndDefaultsSection.ValidationAndDefaultsSection, {
    state: state,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 43,
      columnNumber: 7
    }
  }));
};
const CmsFieldForm = exports.CmsFieldForm = (0, _mobxReactLite.observer)(_CmsFieldForm);
//# sourceMappingURL=CmsFieldForm.js.map