"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _MessageModalLayoutSt = require("./MessageModalLayout.st.css.js");
var _BaseModalLayout = _interopRequireDefault(require("../BaseModalLayout"));
var _deprecationLog = _interopRequireDefault(require("../utils/deprecationLog"));
var _excluded = ["theme", "actionsSize"],
  _excluded2 = ["children", "className"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/MessageModalLayout/MessageModalLayout.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var MessageModalLayout = _ref => {
  var {
      theme = 'standard',
      actionsSize = 'small'
    } = _ref,
    propsWithNoDefaults = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var _theme$actionsSize$pr = _objectSpread({
      theme,
      actionsSize
    }, propsWithNoDefaults),
    {
      children,
      className
    } = _theme$actionsSize$pr,
    restProps = (0, _objectWithoutProperties2.default)(_theme$actionsSize$pr, _excluded2);
  var {
    illustration,
    footnoteSkin
  } = restProps;
  var skin = restProps.skin || theme;
  var [showFooterDivider, setShowFooterDivider] = (0, _react.useState)(false);
  var onContentScrollAreaChanged = (0, _react.useCallback)(_ref2 => {
    var {
      area
    } = _ref2;
    var {
      y: scrollArea
    } = area;
    var newShowDivider = scrollArea === 'top' || scrollArea === 'middle';
    setShowFooterDivider(newShowDivider);
  }, []);
  (0, _react.useEffect)(() => {
    if (theme) {
      (0, _deprecationLog.default)('<MessageModalLayout/> - prop "theme" is deprecated and will be removed in next major release, please use "skin" property instead.');
    }
  }, [theme]);
  var hasIllustration = !!illustration;
  return /*#__PURE__*/_react.default.createElement(_BaseModalLayout.default, (0, _extends2.default)({}, restProps, {
    skin: skin,
    className: (0, _MessageModalLayoutSt.st)(_MessageModalLayoutSt.classes.root, {
      hasIllustration
    }, className),
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 40,
      columnNumber: 5
    }
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: _MessageModalLayoutSt.classes.topAreaContainer,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 45,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_BaseModalLayout.default.Illustration, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 46,
      columnNumber: 9
    }
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: _MessageModalLayoutSt.classes.contentAreaContainer,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 48,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_BaseModalLayout.default.Header, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 49,
      columnNumber: 11
    }
  }), /*#__PURE__*/_react.default.createElement(_BaseModalLayout.default.Content, {
    hideTopScrollDivider: hasIllustration,
    hideBottomScrollDivider: hasIllustration,
    scrollProps: {
      onScrollAreaChanged: hasIllustration && onContentScrollAreaChanged || undefined
    },
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 51,
      columnNumber: 11
    }
  }, children))), /*#__PURE__*/_react.default.createElement(_BaseModalLayout.default.Footer, {
    showFooterDivider: hasIllustration && showFooterDivider,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 64,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_BaseModalLayout.default.Footnote, {
    skin: footnoteSkin,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 68,
      columnNumber: 7
    }
  }));
};
MessageModalLayout.displayName = 'MessageModalLayout';
var _default = exports.default = MessageModalLayout;
//# sourceMappingURL=MessageModalLayout.js.map