@rc-component/trigger 2.0.0-0 → 2.0.0

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
@@ -147,7 +147,7 @@ var Popup = /*#__PURE__*/React.forwardRef(function (props, ref) {
147
147
  visible: open,
148
148
  onVisibleChanged: function onVisibleChanged(nextVisible) {
149
149
  var _motion$onVisibleChan;
150
- motion === null || motion === void 0 ? void 0 : (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 ? void 0 : _motion$onVisibleChan.call(motion, nextVisible);
150
+ motion === null || motion === void 0 || (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 || _motion$onVisibleChan.call(motion, nextVisible);
151
151
  _onVisibleChanged(nextVisible);
152
152
  }
153
153
  }), function (_ref, motionRef) {
@@ -118,13 +118,14 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
118
118
  var originTop = popupElement.style.top;
119
119
  var originRight = popupElement.style.right;
120
120
  var originBottom = popupElement.style.bottom;
121
+ var originOverflow = popupElement.style.overflow;
121
122
 
122
123
  // Placement
123
124
  var placementInfo = _objectSpread(_objectSpread({}, builtinPlacements[placement]), popupAlign);
124
125
 
125
126
  // placeholder element
126
127
  var placeholderElement = doc.createElement('div');
127
- (_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 ? void 0 : _popupElement$parentE.appendChild(placeholderElement);
128
+ (_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 || _popupElement$parentE.appendChild(placeholderElement);
128
129
  placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px");
129
130
  placeholderElement.style.top = "".concat(popupElement.offsetTop, "px");
130
131
  placeholderElement.style.position = popupPosition;
@@ -136,6 +137,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
136
137
  popupElement.style.top = '0';
137
138
  popupElement.style.right = 'auto';
138
139
  popupElement.style.bottom = 'auto';
140
+ popupElement.style.overflow = 'hidden';
139
141
 
140
142
  // Calculate align style, we should consider `transform` case
141
143
  var targetRect;
@@ -208,7 +210,8 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
208
210
  popupElement.style.top = originTop;
209
211
  popupElement.style.right = originRight;
210
212
  popupElement.style.bottom = originBottom;
211
- (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 ? void 0 : _popupElement$parentE2.removeChild(placeholderElement);
213
+ popupElement.style.overflow = originOverflow;
214
+ (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
212
215
 
213
216
  // Calculate scale
214
217
  var _scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1000) / 1000);
@@ -465,7 +468,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
465
468
  var minBottom = Math.min(popupBottom, targetBottom);
466
469
  var yCenter = (maxTop + minBottom) / 2;
467
470
  var nextArrowY = yCenter - popupTop;
468
- onPopupAlign === null || onPopupAlign === void 0 ? void 0 : onPopupAlign(popupEle, nextAlignInfo);
471
+ onPopupAlign === null || onPopupAlign === void 0 || onPopupAlign(popupEle, nextAlignInfo);
469
472
 
470
473
  // Additional calculate right & bottom position
471
474
  var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
@@ -1,85 +1,44 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { warning } from 'rc-util';
3
1
  import { getShadowRoot } from "rc-util/es/Dom/shadow";
4
- import raf from "rc-util/es/raf";
2
+ import { warning } from "rc-util/es/warning";
5
3
  import * as React from 'react';
6
4
  import { getWin } from "../util";
7
5
  export default function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
8
6
  var openRef = React.useRef(open);
9
-
10
- // Window click to hide should be lock to avoid trigger lock immediately
11
- var lockRef = React.useRef(false);
12
- if (openRef.current !== open) {
13
- lockRef.current = true;
14
- openRef.current = open;
15
- }
16
- React.useEffect(function () {
17
- var id = raf(function () {
18
- lockRef.current = false;
19
- });
20
- return function () {
21
- raf.cancel(id);
22
- };
23
- }, [open]);
7
+ openRef.current = open;
24
8
 
25
9
  // Click to hide is special action since click popup element should not hide
26
10
  React.useEffect(function () {
27
11
  if (clickToHide && popupEle && (!mask || maskClosable)) {
28
- var genClickEvents = function genClickEvents() {
29
- var clickInside = false;
30
-
31
- // User may mouseDown inside and drag out of popup and mouse up
32
- // Record here to prevent close
33
- var onWindowMouseDown = function onWindowMouseDown(_ref) {
34
- var target = _ref.target;
35
- clickInside = inPopupOrChild(target);
36
- };
37
- var onWindowClick = function onWindowClick(_ref2) {
38
- var target = _ref2.target;
39
- if (!lockRef.current && openRef.current && !clickInside && !inPopupOrChild(target)) {
40
- triggerOpen(false);
41
- }
42
- };
43
- return [onWindowMouseDown, onWindowClick];
12
+ var onTriggerClose = function onTriggerClose(_ref) {
13
+ var target = _ref.target;
14
+ if (openRef.current && !inPopupOrChild(target)) {
15
+ triggerOpen(false);
16
+ }
44
17
  };
45
-
46
- // Events
47
- var _genClickEvents = genClickEvents(),
48
- _genClickEvents2 = _slicedToArray(_genClickEvents, 2),
49
- onWinMouseDown = _genClickEvents2[0],
50
- onWinClick = _genClickEvents2[1];
51
- var _genClickEvents3 = genClickEvents(),
52
- _genClickEvents4 = _slicedToArray(_genClickEvents3, 2),
53
- onShadowMouseDown = _genClickEvents4[0],
54
- onShadowClick = _genClickEvents4[1];
55
18
  var win = getWin(popupEle);
56
- win.addEventListener('mousedown', onWinMouseDown, true);
57
- win.addEventListener('click', onWinClick, true);
58
- win.addEventListener('contextmenu', onWinClick, true);
19
+ win.addEventListener('mousedown', onTriggerClose, true);
20
+ win.addEventListener('contextmenu', onTriggerClose, true);
59
21
 
60
22
  // shadow root
61
23
  var targetShadowRoot = getShadowRoot(targetEle);
62
24
  if (targetShadowRoot) {
63
- targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
64
- targetShadowRoot.addEventListener('click', onShadowClick, true);
65
- targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
25
+ targetShadowRoot.addEventListener('mousedown', onTriggerClose, true);
26
+ targetShadowRoot.addEventListener('contextmenu', onTriggerClose, true);
66
27
  }
67
28
 
68
29
  // Warning if target and popup not in same root
69
30
  if (process.env.NODE_ENV !== 'production') {
70
31
  var _targetEle$getRootNod, _popupEle$getRootNode;
71
- var targetRoot = targetEle === null || targetEle === void 0 ? void 0 : (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
32
+ var targetRoot = targetEle === null || targetEle === void 0 || (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
72
33
  var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);
73
34
  warning(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
74
35
  }
75
36
  return function () {
76
- win.removeEventListener('mousedown', onWinMouseDown, true);
77
- win.removeEventListener('click', onWinClick, true);
78
- win.removeEventListener('contextmenu', onWinClick, true);
37
+ win.removeEventListener('mousedown', onTriggerClose, true);
38
+ win.removeEventListener('contextmenu', onTriggerClose, true);
79
39
  if (targetShadowRoot) {
80
- targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
81
- targetShadowRoot.removeEventListener('click', onShadowClick, true);
82
- targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
40
+ targetShadowRoot.removeEventListener('mousedown', onTriggerClose, true);
41
+ targetShadowRoot.removeEventListener('contextmenu', onTriggerClose, true);
83
42
  }
84
43
  };
85
44
  }
package/es/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import type { CSSMotionProps } from 'rc-motion';
2
2
  import * as React from 'react';
3
3
  import type { ActionType, AlignType, AnimationType, ArrowTypeOuter, BuildInPlacements, TransitionNameType } from './interface';
4
- export type { BuildInPlacements, AlignType, ActionType, ArrowTypeOuter as ArrowType, };
4
+ export type { ActionType, AlignType, ArrowTypeOuter as ArrowType, BuildInPlacements, };
5
5
  export interface TriggerRef {
6
+ nativeElement: HTMLElement;
6
7
  forceAlign: VoidFunction;
7
8
  }
8
9
  export interface TriggerProps {
package/es/index.js CHANGED
@@ -12,20 +12,21 @@ import useId from "rc-util/es/hooks/useId";
12
12
  import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect";
13
13
  import isMobile from "rc-util/es/isMobile";
14
14
  import * as React from 'react';
15
- import { flushSync } from 'react-dom';
15
+ import Popup from "./Popup";
16
+ import TriggerWrapper from "./TriggerWrapper";
16
17
  import TriggerContext from "./context";
17
18
  import useAction from "./hooks/useAction";
18
19
  import useAlign from "./hooks/useAlign";
19
20
  import useWatch from "./hooks/useWatch";
20
21
  import useWinClick from "./hooks/useWinClick";
21
- import Popup from "./Popup";
22
- import TriggerWrapper from "./TriggerWrapper";
23
22
  import { getAlignPopupClassName, getMotion } from "./util";
24
23
 
25
24
  // Removed Props List
26
25
  // Seems this can be auto
27
26
  // getDocument?: (element?: HTMLElement) => Document;
27
+
28
28
  // New version will not wrap popup with `rc-trigger-popup-content` when multiple children
29
+
29
30
  export function generateTrigger() {
30
31
  var PortalComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Portal;
31
32
  var Trigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -94,7 +95,7 @@ export function generateTrigger() {
94
95
  return {
95
96
  registerSubPopup: function registerSubPopup(id, subPopupEle) {
96
97
  subPopupElements.current[id] = subPopupEle;
97
- parentContext === null || parentContext === void 0 ? void 0 : parentContext.registerSubPopup(id, subPopupEle);
98
+ parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, subPopupEle);
98
99
  }
99
100
  };
100
101
  }, [parentContext]);
@@ -109,7 +110,7 @@ export function generateTrigger() {
109
110
  if (isDOM(node) && popupEle !== node) {
110
111
  setPopupEle(node);
111
112
  }
112
- parentContext === null || parentContext === void 0 ? void 0 : parentContext.registerSubPopup(id, node);
113
+ parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, node);
113
114
  });
114
115
 
115
116
  // =========================== Target ===========================
@@ -118,9 +119,13 @@ export function generateTrigger() {
118
119
  _React$useState6 = _slicedToArray(_React$useState5, 2),
119
120
  targetEle = _React$useState6[0],
120
121
  setTargetEle = _React$useState6[1];
122
+
123
+ // Used for forwardRef target. Not use internal
124
+ var externalForwardRef = React.useRef(null);
121
125
  var setTargetRef = useEvent(function (node) {
122
126
  if (isDOM(node) && targetEle !== node) {
123
127
  setTargetEle(node);
128
+ externalForwardRef.current = node;
124
129
  }
125
130
  });
126
131
 
@@ -160,15 +165,19 @@ export function generateTrigger() {
160
165
  }, [popupVisible]);
161
166
  var openRef = React.useRef(mergedOpen);
162
167
  openRef.current = mergedOpen;
168
+ var lastTriggerRef = React.useRef([]);
169
+ lastTriggerRef.current = [];
163
170
  var internalTriggerOpen = useEvent(function (nextOpen) {
171
+ var _lastTriggerRef$curre;
172
+ setMergedOpen(nextOpen);
173
+
164
174
  // Enter or Pointer will both trigger open state change
165
175
  // We only need take one to avoid duplicated change event trigger
166
- flushSync(function () {
167
- if (mergedOpen !== nextOpen) {
168
- setMergedOpen(nextOpen);
169
- onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextOpen);
170
- }
171
- });
176
+ // Use `lastTriggerRef` to record last open type
177
+ if (((_lastTriggerRef$curre = lastTriggerRef.current[lastTriggerRef.current.length - 1]) !== null && _lastTriggerRef$curre !== void 0 ? _lastTriggerRef$curre : mergedOpen) !== nextOpen) {
178
+ lastTriggerRef.current.push(nextOpen);
179
+ onPopupVisibleChange === null || onPopupVisibleChange === void 0 || onPopupVisibleChange(nextOpen);
180
+ }
172
181
  });
173
182
 
174
183
  // Trigger for delay
@@ -258,8 +267,11 @@ export function generateTrigger() {
258
267
  var baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
259
268
  return classNames(baseClassName, getPopupClassNameFromAlign === null || getPopupClassNameFromAlign === void 0 ? void 0 : getPopupClassNameFromAlign(alignInfo));
260
269
  }, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
270
+
271
+ // ============================ Refs ============================
261
272
  React.useImperativeHandle(ref, function () {
262
273
  return {
274
+ nativeElement: externalForwardRef.current,
263
275
  forceAlign: triggerAlign
264
276
  };
265
277
  });
@@ -289,7 +301,7 @@ export function generateTrigger() {
289
301
  var onVisibleChanged = function onVisibleChanged(visible) {
290
302
  setInMotion(false);
291
303
  onAlign();
292
- afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 ? void 0 : afterPopupVisibleChange(visible);
304
+ afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 || afterPopupVisibleChange(visible);
293
305
  };
294
306
 
295
307
  // We will trigger align when motion is in prepare
@@ -316,14 +328,14 @@ export function generateTrigger() {
316
328
  function wrapperAction(eventName, nextOpen, delay, preEvent) {
317
329
  cloneProps[eventName] = function (event) {
318
330
  var _originChildProps$eve;
319
- preEvent === null || preEvent === void 0 ? void 0 : preEvent(event);
331
+ preEvent === null || preEvent === void 0 || preEvent(event);
320
332
  triggerOpen(nextOpen, delay);
321
333
 
322
334
  // Pass to origin
323
335
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
324
336
  args[_key - 1] = arguments[_key];
325
337
  }
326
- (_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 ? void 0 : _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
338
+ (_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 || _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
327
339
  };
328
340
  }
329
341
 
@@ -342,7 +354,7 @@ export function generateTrigger() {
342
354
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
343
355
  args[_key2 - 1] = arguments[_key2];
344
356
  }
345
- (_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 ? void 0 : _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
357
+ (_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 || _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
346
358
  };
347
359
  }
348
360
 
@@ -362,9 +374,9 @@ export function generateTrigger() {
362
374
  wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
363
375
  setMousePosByEvent(event);
364
376
  });
365
- onPopupMouseEnter = function onPopupMouseEnter() {
377
+ onPopupMouseEnter = function onPopupMouseEnter(event) {
366
378
  // Only trigger re-open when popup is visible
367
- if (mergedOpen || inMotion) {
379
+ if ((mergedOpen || inMotion) && popupEle !== null && popupEle !== void 0 && popupEle.contains(event.target)) {
368
380
  triggerOpen(true, mouseEnterDelay);
369
381
  }
370
382
  };
@@ -374,7 +386,7 @@ export function generateTrigger() {
374
386
  cloneProps.onMouseMove = function (event) {
375
387
  var _originChildProps$onM;
376
388
  // setMousePosByEvent(event);
377
- (_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 ? void 0 : _originChildProps$onM.call(originChildProps, event);
389
+ (_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 || _originChildProps$onM.call(originChildProps, event);
378
390
  };
379
391
  }
380
392
  }
@@ -410,7 +422,7 @@ export function generateTrigger() {
410
422
  for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
411
423
  args[_key3 - 1] = arguments[_key3];
412
424
  }
413
- (_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 ? void 0 : _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
425
+ (_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 || _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
414
426
  };
415
427
  }
416
428
 
@@ -432,7 +444,7 @@ export function generateTrigger() {
432
444
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
433
445
  args[_key4] = arguments[_key4];
434
446
  }
435
- (_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 ? void 0 : _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
447
+ (_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
436
448
  restProps[eventName].apply(restProps, args);
437
449
  };
438
450
  }
package/es/mock.js CHANGED
@@ -11,12 +11,12 @@ var MockPortal = function MockPortal(_ref) {
11
11
  visible = _React$useState2[0],
12
12
  setVisible = _React$useState2[1];
13
13
  React.useEffect(function () {
14
- getContainer === null || getContainer === void 0 ? void 0 : getContainer();
14
+ getContainer === null || getContainer === void 0 || getContainer();
15
15
  });
16
16
  React.useEffect(function () {
17
17
  if (open) {
18
18
  setVisible(true);
19
- } else if (!open && autoDestroy) {
19
+ } else if (autoDestroy) {
20
20
  setVisible(false);
21
21
  }
22
22
  }, [open, autoDestroy]);
@@ -15,5 +15,4 @@ var PopupContent = /*#__PURE__*/React.memo(function (_ref) {
15
15
  if (process.env.NODE_ENV !== 'production') {
16
16
  PopupContent.displayName = 'PopupContent';
17
17
  }
18
- var _default = PopupContent;
19
- exports.default = _default;
18
+ var _default = exports.default = PopupContent;
@@ -155,7 +155,7 @@ var Popup = /*#__PURE__*/React.forwardRef(function (props, ref) {
155
155
  visible: open,
156
156
  onVisibleChanged: function onVisibleChanged(nextVisible) {
157
157
  var _motion$onVisibleChan;
158
- motion === null || motion === void 0 ? void 0 : (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 ? void 0 : _motion$onVisibleChan.call(motion, nextVisible);
158
+ motion === null || motion === void 0 || (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 || _motion$onVisibleChan.call(motion, nextVisible);
159
159
  _onVisibleChanged(nextVisible);
160
160
  }
161
161
  }), function (_ref, motionRef) {
@@ -190,5 +190,4 @@ var Popup = /*#__PURE__*/React.forwardRef(function (props, ref) {
190
190
  if (process.env.NODE_ENV !== 'production') {
191
191
  Popup.displayName = 'Popup';
192
192
  }
193
- var _default = Popup;
194
- exports.default = _default;
193
+ var _default = exports.default = Popup;
@@ -24,5 +24,4 @@ var TriggerWrapper = /*#__PURE__*/React.forwardRef(function (props, ref) {
24
24
  if (process.env.NODE_ENV !== 'production') {
25
25
  TriggerWrapper.displayName = 'TriggerWrapper';
26
26
  }
27
- var _default = TriggerWrapper;
28
- exports.default = _default;
27
+ var _default = exports.default = TriggerWrapper;
package/lib/context.js CHANGED
@@ -7,5 +7,4 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var TriggerContext = /*#__PURE__*/React.createContext(null);
10
- var _default = TriggerContext;
11
- exports.default = _default;
10
+ var _default = exports.default = TriggerContext;
@@ -126,13 +126,14 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
126
126
  var originTop = popupElement.style.top;
127
127
  var originRight = popupElement.style.right;
128
128
  var originBottom = popupElement.style.bottom;
129
+ var originOverflow = popupElement.style.overflow;
129
130
 
130
131
  // Placement
131
132
  var placementInfo = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, builtinPlacements[placement]), popupAlign);
132
133
 
133
134
  // placeholder element
134
135
  var placeholderElement = doc.createElement('div');
135
- (_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 ? void 0 : _popupElement$parentE.appendChild(placeholderElement);
136
+ (_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 || _popupElement$parentE.appendChild(placeholderElement);
136
137
  placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px");
137
138
  placeholderElement.style.top = "".concat(popupElement.offsetTop, "px");
138
139
  placeholderElement.style.position = popupPosition;
@@ -144,6 +145,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
144
145
  popupElement.style.top = '0';
145
146
  popupElement.style.right = 'auto';
146
147
  popupElement.style.bottom = 'auto';
148
+ popupElement.style.overflow = 'hidden';
147
149
 
148
150
  // Calculate align style, we should consider `transform` case
149
151
  var targetRect;
@@ -216,7 +218,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
216
218
  popupElement.style.top = originTop;
217
219
  popupElement.style.right = originRight;
218
220
  popupElement.style.bottom = originBottom;
219
- (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 ? void 0 : _popupElement$parentE2.removeChild(placeholderElement);
221
+ popupElement.style.overflow = originOverflow;
222
+ (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
220
223
 
221
224
  // Calculate scale
222
225
  var _scaleX = (0, _util.toNum)(Math.round(popupWidth / parseFloat(width) * 1000) / 1000);
@@ -473,7 +476,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
473
476
  var minBottom = Math.min(popupBottom, targetBottom);
474
477
  var yCenter = (maxTop + minBottom) / 2;
475
478
  var nextArrowY = yCenter - popupTop;
476
- onPopupAlign === null || onPopupAlign === void 0 ? void 0 : onPopupAlign(popupEle, nextAlignInfo);
479
+ onPopupAlign === null || onPopupAlign === void 0 || onPopupAlign(popupEle, nextAlignInfo);
477
480
 
478
481
  // Additional calculate right & bottom position
479
482
  var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
@@ -1,93 +1,51 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = useWinClick;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _rcUtil = require("rc-util");
11
8
  var _shadow = require("rc-util/lib/Dom/shadow");
12
- var _raf = _interopRequireDefault(require("rc-util/lib/raf"));
9
+ var _warning = require("rc-util/lib/warning");
13
10
  var React = _interopRequireWildcard(require("react"));
14
11
  var _util = require("../util");
15
12
  function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
16
13
  var openRef = React.useRef(open);
17
-
18
- // Window click to hide should be lock to avoid trigger lock immediately
19
- var lockRef = React.useRef(false);
20
- if (openRef.current !== open) {
21
- lockRef.current = true;
22
- openRef.current = open;
23
- }
24
- React.useEffect(function () {
25
- var id = (0, _raf.default)(function () {
26
- lockRef.current = false;
27
- });
28
- return function () {
29
- _raf.default.cancel(id);
30
- };
31
- }, [open]);
14
+ openRef.current = open;
32
15
 
33
16
  // Click to hide is special action since click popup element should not hide
34
17
  React.useEffect(function () {
35
18
  if (clickToHide && popupEle && (!mask || maskClosable)) {
36
- var genClickEvents = function genClickEvents() {
37
- var clickInside = false;
38
-
39
- // User may mouseDown inside and drag out of popup and mouse up
40
- // Record here to prevent close
41
- var onWindowMouseDown = function onWindowMouseDown(_ref) {
42
- var target = _ref.target;
43
- clickInside = inPopupOrChild(target);
44
- };
45
- var onWindowClick = function onWindowClick(_ref2) {
46
- var target = _ref2.target;
47
- if (!lockRef.current && openRef.current && !clickInside && !inPopupOrChild(target)) {
48
- triggerOpen(false);
49
- }
50
- };
51
- return [onWindowMouseDown, onWindowClick];
19
+ var onTriggerClose = function onTriggerClose(_ref) {
20
+ var target = _ref.target;
21
+ if (openRef.current && !inPopupOrChild(target)) {
22
+ triggerOpen(false);
23
+ }
52
24
  };
53
-
54
- // Events
55
- var _genClickEvents = genClickEvents(),
56
- _genClickEvents2 = (0, _slicedToArray2.default)(_genClickEvents, 2),
57
- onWinMouseDown = _genClickEvents2[0],
58
- onWinClick = _genClickEvents2[1];
59
- var _genClickEvents3 = genClickEvents(),
60
- _genClickEvents4 = (0, _slicedToArray2.default)(_genClickEvents3, 2),
61
- onShadowMouseDown = _genClickEvents4[0],
62
- onShadowClick = _genClickEvents4[1];
63
25
  var win = (0, _util.getWin)(popupEle);
64
- win.addEventListener('mousedown', onWinMouseDown, true);
65
- win.addEventListener('click', onWinClick, true);
66
- win.addEventListener('contextmenu', onWinClick, true);
26
+ win.addEventListener('mousedown', onTriggerClose, true);
27
+ win.addEventListener('contextmenu', onTriggerClose, true);
67
28
 
68
29
  // shadow root
69
30
  var targetShadowRoot = (0, _shadow.getShadowRoot)(targetEle);
70
31
  if (targetShadowRoot) {
71
- targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
72
- targetShadowRoot.addEventListener('click', onShadowClick, true);
73
- targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
32
+ targetShadowRoot.addEventListener('mousedown', onTriggerClose, true);
33
+ targetShadowRoot.addEventListener('contextmenu', onTriggerClose, true);
74
34
  }
75
35
 
76
36
  // Warning if target and popup not in same root
77
37
  if (process.env.NODE_ENV !== 'production') {
78
38
  var _targetEle$getRootNod, _popupEle$getRootNode;
79
- var targetRoot = targetEle === null || targetEle === void 0 ? void 0 : (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
39
+ var targetRoot = targetEle === null || targetEle === void 0 || (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
80
40
  var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);
81
- (0, _rcUtil.warning)(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
41
+ (0, _warning.warning)(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
82
42
  }
83
43
  return function () {
84
- win.removeEventListener('mousedown', onWinMouseDown, true);
85
- win.removeEventListener('click', onWinClick, true);
86
- win.removeEventListener('contextmenu', onWinClick, true);
44
+ win.removeEventListener('mousedown', onTriggerClose, true);
45
+ win.removeEventListener('contextmenu', onTriggerClose, true);
87
46
  if (targetShadowRoot) {
88
- targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
89
- targetShadowRoot.removeEventListener('click', onShadowClick, true);
90
- targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
47
+ targetShadowRoot.removeEventListener('mousedown', onTriggerClose, true);
48
+ targetShadowRoot.removeEventListener('contextmenu', onTriggerClose, true);
91
49
  }
92
50
  };
93
51
  }
package/lib/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import type { CSSMotionProps } from 'rc-motion';
2
2
  import * as React from 'react';
3
3
  import type { ActionType, AlignType, AnimationType, ArrowTypeOuter, BuildInPlacements, TransitionNameType } from './interface';
4
- export type { BuildInPlacements, AlignType, ActionType, ArrowTypeOuter as ArrowType, };
4
+ export type { ActionType, AlignType, ArrowTypeOuter as ArrowType, BuildInPlacements, };
5
5
  export interface TriggerRef {
6
+ nativeElement: HTMLElement;
6
7
  forceAlign: VoidFunction;
7
8
  }
8
9
  export interface TriggerProps {
package/lib/index.js CHANGED
@@ -20,14 +20,13 @@ var _useId = _interopRequireDefault(require("rc-util/lib/hooks/useId"));
20
20
  var _useLayoutEffect = _interopRequireDefault(require("rc-util/lib/hooks/useLayoutEffect"));
21
21
  var _isMobile = _interopRequireDefault(require("rc-util/lib/isMobile"));
22
22
  var React = _interopRequireWildcard(require("react"));
23
- var _reactDom = require("react-dom");
23
+ var _Popup = _interopRequireDefault(require("./Popup"));
24
+ var _TriggerWrapper = _interopRequireDefault(require("./TriggerWrapper"));
24
25
  var _context = _interopRequireDefault(require("./context"));
25
26
  var _useAction3 = _interopRequireDefault(require("./hooks/useAction"));
26
27
  var _useAlign3 = _interopRequireDefault(require("./hooks/useAlign"));
27
28
  var _useWatch = _interopRequireDefault(require("./hooks/useWatch"));
28
29
  var _useWinClick = _interopRequireDefault(require("./hooks/useWinClick"));
29
- var _Popup = _interopRequireDefault(require("./Popup"));
30
- var _TriggerWrapper = _interopRequireDefault(require("./TriggerWrapper"));
31
30
  var _util = require("./util");
32
31
  var _excluded = ["prefixCls", "children", "action", "showAction", "hideAction", "popupVisible", "defaultPopupVisible", "onPopupVisibleChange", "afterPopupVisibleChange", "mouseEnterDelay", "mouseLeaveDelay", "focusDelay", "blurDelay", "mask", "maskClosable", "getPopupContainer", "forceRender", "autoDestroy", "destroyPopupOnHide", "popup", "popupClassName", "popupStyle", "popupPlacement", "builtinPlacements", "popupAlign", "zIndex", "stretch", "getPopupClassNameFromAlign", "fresh", "alignPoint", "onPopupClick", "onPopupAlign", "arrow", "popupMotion", "maskMotion", "popupTransitionName", "popupAnimation", "maskTransitionName", "maskAnimation", "className", "getTriggerDOMNode"];
33
32
  // Removed Props List
@@ -104,7 +103,7 @@ function generateTrigger() {
104
103
  return {
105
104
  registerSubPopup: function registerSubPopup(id, subPopupEle) {
106
105
  subPopupElements.current[id] = subPopupEle;
107
- parentContext === null || parentContext === void 0 ? void 0 : parentContext.registerSubPopup(id, subPopupEle);
106
+ parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, subPopupEle);
108
107
  }
109
108
  };
110
109
  }, [parentContext]);
@@ -119,7 +118,7 @@ function generateTrigger() {
119
118
  if ((0, _findDOMNode.isDOM)(node) && popupEle !== node) {
120
119
  setPopupEle(node);
121
120
  }
122
- parentContext === null || parentContext === void 0 ? void 0 : parentContext.registerSubPopup(id, node);
121
+ parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, node);
123
122
  });
124
123
 
125
124
  // =========================== Target ===========================
@@ -128,9 +127,13 @@ function generateTrigger() {
128
127
  _React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
129
128
  targetEle = _React$useState6[0],
130
129
  setTargetEle = _React$useState6[1];
130
+
131
+ // Used for forwardRef target. Not use internal
132
+ var externalForwardRef = React.useRef(null);
131
133
  var setTargetRef = (0, _useEvent.default)(function (node) {
132
134
  if ((0, _findDOMNode.isDOM)(node) && targetEle !== node) {
133
135
  setTargetEle(node);
136
+ externalForwardRef.current = node;
134
137
  }
135
138
  });
136
139
 
@@ -170,15 +173,19 @@ function generateTrigger() {
170
173
  }, [popupVisible]);
171
174
  var openRef = React.useRef(mergedOpen);
172
175
  openRef.current = mergedOpen;
176
+ var lastTriggerRef = React.useRef([]);
177
+ lastTriggerRef.current = [];
173
178
  var internalTriggerOpen = (0, _useEvent.default)(function (nextOpen) {
179
+ var _lastTriggerRef$curre;
180
+ setMergedOpen(nextOpen);
181
+
174
182
  // Enter or Pointer will both trigger open state change
175
183
  // We only need take one to avoid duplicated change event trigger
176
- (0, _reactDom.flushSync)(function () {
177
- if (mergedOpen !== nextOpen) {
178
- setMergedOpen(nextOpen);
179
- onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextOpen);
180
- }
181
- });
184
+ // Use `lastTriggerRef` to record last open type
185
+ if (((_lastTriggerRef$curre = lastTriggerRef.current[lastTriggerRef.current.length - 1]) !== null && _lastTriggerRef$curre !== void 0 ? _lastTriggerRef$curre : mergedOpen) !== nextOpen) {
186
+ lastTriggerRef.current.push(nextOpen);
187
+ onPopupVisibleChange === null || onPopupVisibleChange === void 0 || onPopupVisibleChange(nextOpen);
188
+ }
182
189
  });
183
190
 
184
191
  // Trigger for delay
@@ -268,8 +275,11 @@ function generateTrigger() {
268
275
  var baseClassName = (0, _util.getAlignPopupClassName)(builtinPlacements, prefixCls, alignInfo, alignPoint);
269
276
  return (0, _classnames.default)(baseClassName, getPopupClassNameFromAlign === null || getPopupClassNameFromAlign === void 0 ? void 0 : getPopupClassNameFromAlign(alignInfo));
270
277
  }, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
278
+
279
+ // ============================ Refs ============================
271
280
  React.useImperativeHandle(ref, function () {
272
281
  return {
282
+ nativeElement: externalForwardRef.current,
273
283
  forceAlign: triggerAlign
274
284
  };
275
285
  });
@@ -299,7 +309,7 @@ function generateTrigger() {
299
309
  var onVisibleChanged = function onVisibleChanged(visible) {
300
310
  setInMotion(false);
301
311
  onAlign();
302
- afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 ? void 0 : afterPopupVisibleChange(visible);
312
+ afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 || afterPopupVisibleChange(visible);
303
313
  };
304
314
 
305
315
  // We will trigger align when motion is in prepare
@@ -326,14 +336,14 @@ function generateTrigger() {
326
336
  function wrapperAction(eventName, nextOpen, delay, preEvent) {
327
337
  cloneProps[eventName] = function (event) {
328
338
  var _originChildProps$eve;
329
- preEvent === null || preEvent === void 0 ? void 0 : preEvent(event);
339
+ preEvent === null || preEvent === void 0 || preEvent(event);
330
340
  triggerOpen(nextOpen, delay);
331
341
 
332
342
  // Pass to origin
333
343
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
334
344
  args[_key - 1] = arguments[_key];
335
345
  }
336
- (_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 ? void 0 : _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
346
+ (_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 || _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
337
347
  };
338
348
  }
339
349
 
@@ -352,7 +362,7 @@ function generateTrigger() {
352
362
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
353
363
  args[_key2 - 1] = arguments[_key2];
354
364
  }
355
- (_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 ? void 0 : _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
365
+ (_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 || _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
356
366
  };
357
367
  }
358
368
 
@@ -372,9 +382,9 @@ function generateTrigger() {
372
382
  wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
373
383
  setMousePosByEvent(event);
374
384
  });
375
- onPopupMouseEnter = function onPopupMouseEnter() {
385
+ onPopupMouseEnter = function onPopupMouseEnter(event) {
376
386
  // Only trigger re-open when popup is visible
377
- if (mergedOpen || inMotion) {
387
+ if ((mergedOpen || inMotion) && popupEle !== null && popupEle !== void 0 && popupEle.contains(event.target)) {
378
388
  triggerOpen(true, mouseEnterDelay);
379
389
  }
380
390
  };
@@ -384,7 +394,7 @@ function generateTrigger() {
384
394
  cloneProps.onMouseMove = function (event) {
385
395
  var _originChildProps$onM;
386
396
  // setMousePosByEvent(event);
387
- (_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 ? void 0 : _originChildProps$onM.call(originChildProps, event);
397
+ (_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 || _originChildProps$onM.call(originChildProps, event);
388
398
  };
389
399
  }
390
400
  }
@@ -420,7 +430,7 @@ function generateTrigger() {
420
430
  for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
421
431
  args[_key3 - 1] = arguments[_key3];
422
432
  }
423
- (_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 ? void 0 : _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
433
+ (_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 || _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
424
434
  };
425
435
  }
426
436
 
@@ -442,7 +452,7 @@ function generateTrigger() {
442
452
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
443
453
  args[_key4] = arguments[_key4];
444
454
  }
445
- (_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 ? void 0 : _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
455
+ (_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
446
456
  restProps[eventName].apply(restProps, args);
447
457
  };
448
458
  }
@@ -526,5 +536,4 @@ function generateTrigger() {
526
536
  }
527
537
  return Trigger;
528
538
  }
529
- var _default = generateTrigger(_portal.default);
530
- exports.default = _default;
539
+ var _default = exports.default = generateTrigger(_portal.default);
package/lib/mock.js CHANGED
@@ -19,16 +19,15 @@ var MockPortal = function MockPortal(_ref) {
19
19
  visible = _React$useState2[0],
20
20
  setVisible = _React$useState2[1];
21
21
  React.useEffect(function () {
22
- getContainer === null || getContainer === void 0 ? void 0 : getContainer();
22
+ getContainer === null || getContainer === void 0 || getContainer();
23
23
  });
24
24
  React.useEffect(function () {
25
25
  if (open) {
26
26
  setVisible(true);
27
- } else if (!open && autoDestroy) {
27
+ } else if (autoDestroy) {
28
28
  setVisible(false);
29
29
  }
30
30
  }, [open, autoDestroy]);
31
31
  return visible ? children : null;
32
32
  };
33
- var _default = (0, _index.generateTrigger)(MockPortal);
34
- exports.default = _default;
33
+ var _default = exports.default = (0, _index.generateTrigger)(MockPortal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/trigger",
3
- "version": "2.0.0-0",
3
+ "version": "2.0.0",
4
4
  "description": "base abstract trigger component for react",
5
5
  "engines": {
6
6
  "node": ">=8.x"
@@ -33,7 +33,7 @@
33
33
  "start": "dumi dev",
34
34
  "build": "dumi build",
35
35
  "compile": "father build && lessc assets/index.less assets/index.css",
36
- "prepublishOnly": "npm run compile && np --yolo --no-publish --branch feat/@rc-component/dom-align",
36
+ "prepublishOnly": "npm run compile && np --yolo --no-publish",
37
37
  "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
38
38
  "test": "rc-test",
39
39
  "coverage": "rc-test --coverage",
@@ -41,29 +41,30 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rc-component/father-plugin": "^1.0.0",
44
- "@testing-library/jest-dom": "^5.16.4",
45
- "@testing-library/react": "^13.0.0",
44
+ "@testing-library/jest-dom": "^6.1.4",
45
+ "@testing-library/react": "^14.0.0",
46
46
  "@types/classnames": "^2.2.10",
47
- "@types/jest": "^26.0.15",
48
- "@types/react": "^16.8.19",
47
+ "@types/jest": "^29.5.2",
48
+ "@types/node": "^20.11.6",
49
+ "@types/react": "^18.0.0",
49
50
  "@types/react-dom": "^18.0.11",
51
+ "@umijs/fabric": "^4.0.1",
50
52
  "cross-env": "^7.0.1",
51
53
  "dumi": "^2.1.0",
52
- "eslint": "^7.0.0",
54
+ "eslint": "^8.51.0",
53
55
  "father": "^4.0.0",
54
- "less": "^3.10.3",
55
- "np": "^8.0.4",
56
+ "less": "^4.2.0",
57
+ "np": "^9.0.0",
56
58
  "rc-test": "^7.0.13",
57
59
  "react": "^18.0.0",
58
60
  "react-dom": "^18.0.0",
59
- "regenerator-runtime": "^0.13.7",
60
- "typescript": "^4.0.0"
61
+ "regenerator-runtime": "^0.14.0",
62
+ "typescript": "^5.1.6"
61
63
  },
62
64
  "dependencies": {
63
65
  "@babel/runtime": "^7.23.2",
64
66
  "@rc-component/portal": "^1.1.0",
65
67
  "classnames": "^2.3.2",
66
- "rc-align": "5.0.0-0",
67
68
  "rc-motion": "^2.0.0",
68
69
  "rc-resize-observer": "^1.3.1",
69
70
  "rc-util": "^5.38.0"
@@ -71,9 +72,5 @@
71
72
  "peerDependencies": {
72
73
  "react": ">=16.9.0",
73
74
  "react-dom": ">=16.9.0"
74
- },
75
- "resolutions": {
76
- "@types/react": "^16.9.0",
77
- "@types/react-dom": "^16.9.0"
78
75
  }
79
76
  }