@mw-kit/mw-ui 1.7.76 → 1.7.77

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
@@ -656,14 +656,18 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
656
656
  setRef = _useState[1];
657
657
 
658
658
  var getPosition = React.useCallback(function () {
659
+ if (props.position) return props.position;
659
660
  if (!ref) return null;
660
661
 
661
- var _ref = boundRef ? {
662
- offsetTop: boundRef.offsetTop,
663
- offsetLeft: boundRef.offsetLeft,
664
- width: boundRef.offsetWidth,
665
- height: boundRef.offsetHeight
666
- } : {
662
+ var _ref = boundRef ? function () {
663
+ var rect = boundRef.getBoundingClientRect();
664
+ return {
665
+ offsetTop: rect.top,
666
+ offsetLeft: rect.left,
667
+ width: boundRef.offsetWidth,
668
+ height: boundRef.offsetHeight
669
+ };
670
+ }() : {
667
671
  offsetTop: 0,
668
672
  offsetLeft: 0,
669
673
  width: window.innerWidth,
@@ -694,9 +698,9 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
694
698
 
695
699
  return _newPosition;
696
700
  }
697
- }, [ref, boundRef]);
701
+ }, [ref, boundRef, props.position]);
698
702
 
699
- var _useState2 = React.useState(props.position || getPosition),
703
+ var _useState2 = React.useState(getPosition),
700
704
  position = _useState2[0],
701
705
  setPosition = _useState2[1];
702
706
 
@@ -704,7 +708,6 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
704
708
  return ref;
705
709
  });
706
710
  React.useEffect(function () {
707
- if (props.position) return;
708
711
  setPosition(getPosition);
709
712
  }, [getPosition]);
710
713
  var htmlProps = filterObject(props, ['center', 'position', 'children', 'content']);