@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.js CHANGED
@@ -4465,9 +4465,12 @@ function useOutsideClick(ref, handler, enabled = true) {
4465
4465
  if (!el || el.contains(event.target)) return;
4466
4466
  handler(event);
4467
4467
  };
4468
- document.addEventListener("mousedown", listener);
4469
- document.addEventListener("touchstart", listener);
4468
+ const raf = requestAnimationFrame(() => {
4469
+ document.addEventListener("mousedown", listener);
4470
+ document.addEventListener("touchstart", listener);
4471
+ });
4470
4472
  return () => {
4473
+ cancelAnimationFrame(raf);
4471
4474
  document.removeEventListener("mousedown", listener);
4472
4475
  document.removeEventListener("touchstart", listener);
4473
4476
  };