@particle-academy/react-fancy 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4775,9 +4775,12 @@ function useOutsideClick(ref, handler, enabled = true) {
4775
4775
  if (!el || el.contains(event.target)) return;
4776
4776
  handler(event);
4777
4777
  };
4778
- document.addEventListener("mousedown", listener);
4779
- document.addEventListener("touchstart", listener);
4778
+ const raf = requestAnimationFrame(() => {
4779
+ document.addEventListener("mousedown", listener);
4780
+ document.addEventListener("touchstart", listener);
4781
+ });
4780
4782
  return () => {
4783
+ cancelAnimationFrame(raf);
4781
4784
  document.removeEventListener("mousedown", listener);
4782
4785
  document.removeEventListener("touchstart", listener);
4783
4786
  };