"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useModal = void 0;

var _react = require("react");

var _contexts = require("./contexts");

var useModal = function useModal(_ref) {
  var component = _ref.component;
  var modalApi = (0, _react.useContext)(_contexts.ModalApiContext);
  var api = (0, _react.useMemo)(function () {
    return {
      openModal: function openModal(modalProps) {
        modalApi.openModal(component, modalProps);
      },
      closeModal: function closeModal() {
        modalApi.closeModal(component);
      }
    };
  }, [component, modalApi]);
  return api;
};

exports.useModal = useModal;