@particle-academy/react-fancy 3.4.2 → 3.4.3
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 +14 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, createContext, useId, useRef, useEffect, useState, useCallback, useMemo, Children, isValidElement, cloneElement,
|
|
1
|
+
import { forwardRef, createContext, useId, useRef, useEffect, useState, useCallback, useMemo, Children, isValidElement, cloneElement, useContext, Fragment as Fragment$1, useLayoutEffect } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import * as LucideIcons from 'lucide-react';
|
|
@@ -3244,21 +3244,21 @@ function useFloatingPosition(anchorRef, floatingRef, options = {}) {
|
|
|
3244
3244
|
if (!anchor || !floating) return;
|
|
3245
3245
|
const anchorRect = anchor.getBoundingClientRect();
|
|
3246
3246
|
const floatingRect = floating.getBoundingClientRect();
|
|
3247
|
-
|
|
3247
|
+
const next = getPosition(anchorRect, floatingRect, placement, offset);
|
|
3248
|
+
setPosition(
|
|
3249
|
+
(prev) => prev.x === next.x && prev.y === next.y && prev.placement === next.placement ? prev : next
|
|
3250
|
+
);
|
|
3248
3251
|
}, [anchorRef, floatingRef, placement, offset]);
|
|
3249
|
-
|
|
3250
|
-
if (
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
measure();
|
|
3260
|
-
return () => cancelAnimationFrame(raf);
|
|
3261
|
-
}, [update, enabled, floatingRef]);
|
|
3252
|
+
useEffect(() => {
|
|
3253
|
+
if (enabled) update();
|
|
3254
|
+
});
|
|
3255
|
+
useEffect(() => {
|
|
3256
|
+
if (!enabled) {
|
|
3257
|
+
setPosition(
|
|
3258
|
+
(prev) => prev.x === -9999 ? prev : { x: -9999, y: -9999, placement }
|
|
3259
|
+
);
|
|
3260
|
+
}
|
|
3261
|
+
}, [enabled, placement]);
|
|
3262
3262
|
useEffect(() => {
|
|
3263
3263
|
if (!enabled) return;
|
|
3264
3264
|
window.addEventListener("scroll", update, true);
|