import { useContext, useMemo } from 'react';
import { ModalApiContext } from './contexts';
export var useModal = function useModal(_ref) {
  var component = _ref.component;
  var modalApi = useContext(ModalApiContext);
  var api = useMemo(function () {
    return {
      openModal: function openModal(modalProps) {
        modalApi.openModal(component, modalProps);
      },
      closeModal: function closeModal() {
        modalApi.closeModal(component);
      }
    };
  }, [component, modalApi]);
  return api;
};