x-ui-design 0.9.26 → 0.9.28

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 CHANGED
@@ -2660,6 +2660,15 @@ const usePopupPosition = ({
2660
2660
  }
2661
2661
  const popupRect = popupRef.current?.getBoundingClientRect();
2662
2662
  if (popupRect) {
2663
+ if (!popupRect?.width) {
2664
+ setOpen(false);
2665
+ setPopupPosition({});
2666
+ const timeout = setTimeout(() => {
2667
+ setOpen(true);
2668
+ clearTimeout(timeout);
2669
+ }, 10);
2670
+ return;
2671
+ }
2663
2672
  const availableSpace = {
2664
2673
  top: container.top - (popupRect.height + OFFSET),
2665
2674
  bottom: (inBody ? window.innerHeight : scrollableParents?.clientHeight || 0) - (container.bottom + popupRect.height + OFFSET),
@@ -2690,15 +2699,6 @@ const usePopupPosition = ({
2690
2699
  _setPlacement(newPlacement);
2691
2700
  }
2692
2701
  const _calculation = () => {
2693
- if (!popupRect?.width) {
2694
- setOpen(false);
2695
- setPopupPosition({});
2696
- const timeout = setTimeout(() => {
2697
- setOpen(false);
2698
- clearTimeout(timeout);
2699
- }, 0);
2700
- return;
2701
- }
2702
2702
  switch (_placement) {
2703
2703
  case "bottom":
2704
2704
  setPopupPosition({