import { useEffect } from 'react';
export var useClickOutside = function useClickOutside(refObject, callback) {
  var handleClickOutside = function handleClickOutside(e) {
    var _refObject$current;
    if (!(refObject !== null && refObject !== void 0 && (_refObject$current = refObject.current) !== null && _refObject$current !== void 0 && _refObject$current.contains(e.target))) {
      callback();
    }
  };
  useEffect(function () {
    document.addEventListener('mousedown', handleClickOutside);
    return function () {
      return document.removeEventListener('mousedown', handleClickOutside);
    };
  });
};