x-ui-design 0.9.25 → 0.9.27
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.esm.js +8 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/lib/hooks/usePopupPosition.ts +12 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2691,6 +2691,12 @@ const usePopupPosition = ({
|
|
|
2691
2691
|
}
|
|
2692
2692
|
const _calculation = () => {
|
|
2693
2693
|
if (!popupRect?.width) {
|
|
2694
|
+
setOpen(false);
|
|
2695
|
+
setPopupPosition({});
|
|
2696
|
+
const timeout = setTimeout(() => {
|
|
2697
|
+
setOpen(true);
|
|
2698
|
+
clearTimeout(timeout);
|
|
2699
|
+
}, 0);
|
|
2694
2700
|
return;
|
|
2695
2701
|
}
|
|
2696
2702
|
switch (_placement) {
|
|
@@ -2733,7 +2739,7 @@ const usePopupPosition = ({
|
|
|
2733
2739
|
}
|
|
2734
2740
|
};
|
|
2735
2741
|
_calculation();
|
|
2736
|
-
}, [targetRef, popupContainer, popupRef
|
|
2742
|
+
}, [targetRef, popupContainer, popupRef, inBody, _placement, setOpen]);
|
|
2737
2743
|
useEffect(() => {
|
|
2738
2744
|
if (!open) {
|
|
2739
2745
|
return;
|
|
@@ -2754,7 +2760,7 @@ const usePopupPosition = ({
|
|
|
2754
2760
|
controller.abort();
|
|
2755
2761
|
setPopupPosition({});
|
|
2756
2762
|
};
|
|
2757
|
-
}, [open, targetRef,
|
|
2763
|
+
}, [open, targetRef, calculatePosition]);
|
|
2758
2764
|
return {
|
|
2759
2765
|
_placement,
|
|
2760
2766
|
popupStyle: {
|