@rc-component/trigger 3.5.0 → 3.5.2

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/es/Popup/index.js CHANGED
@@ -68,7 +68,7 @@ const Popup = /*#__PURE__*/React.forwardRef((props, ref) => {
68
68
  return [mobile.mask, mobile.maskMotion, mobile.motion];
69
69
  }
70
70
  return [mask, maskMotion, motion];
71
- }, [mobile]);
71
+ }, [mobile, mask, maskMotion, motion]);
72
72
 
73
73
  // ======================= Container ========================
74
74
  const getPopupContainerNeedParams = getPopupContainer?.length > 0;
@@ -36,8 +36,8 @@ export default function useWinClick(open, clickToHide, targetEle, popupEle, mask
36
36
  }
37
37
 
38
38
  // Warning if target and popup not in same root
39
- if (process.env.NODE_ENV !== 'production') {
40
- const targetRoot = targetEle?.getRootNode?.();
39
+ if (process.env.NODE_ENV !== 'production' && targetEle) {
40
+ const targetRoot = targetEle.getRootNode?.();
41
41
  const popupRoot = popupEle.getRootNode?.();
42
42
  warning(targetRoot === popupRoot, `trigger element and popup element should in same shadow root.`);
43
43
  }
@@ -77,7 +77,7 @@ const Popup = /*#__PURE__*/React.forwardRef((props, ref) => {
77
77
  return [mobile.mask, mobile.maskMotion, mobile.motion];
78
78
  }
79
79
  return [mask, maskMotion, motion];
80
- }, [mobile]);
80
+ }, [mobile, mask, maskMotion, motion]);
81
81
 
82
82
  // ======================= Container ========================
83
83
  const getPopupContainerNeedParams = getPopupContainer?.length > 0;
@@ -43,8 +43,8 @@ function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable,
43
43
  }
44
44
 
45
45
  // Warning if target and popup not in same root
46
- if (process.env.NODE_ENV !== 'production') {
47
- const targetRoot = targetEle?.getRootNode?.();
46
+ if (process.env.NODE_ENV !== 'production' && targetEle) {
47
+ const targetRoot = targetEle.getRootNode?.();
48
48
  const popupRoot = popupEle.getRootNode?.();
49
49
  (0, _warning.warning)(targetRoot === popupRoot, `trigger element and popup element should in same shadow root.`);
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/trigger",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "base abstract trigger component for react",
5
5
  "engines": {
6
6
  "node": ">=8.x"