@sheinx/hooks 3.7.8-beta.4 → 3.7.8-beta.5

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.
@@ -142,20 +142,20 @@ var usePopup = function usePopup(props) {
142
142
  }
143
143
  };
144
144
  var handleMouseEnter = (0, _usePersistFn.default)(function (e) {
145
- var _targetEvents$onMouse, _targetRef$current;
145
+ var _targetEvents$onMouse, _targetRef$current, _popupRef$current2;
146
146
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse = targetEvents.onMouseEnter) === null || _targetEvents$onMouse === void 0 || _targetEvents$onMouse.call(targetEvents, e);
147
147
  if (trigger !== 'hover') return;
148
148
  var isParentContainsCurrent = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.contains(e.target);
149
- if (isParentContainsCurrent) {
149
+ if (isParentContainsCurrent || popupRef !== null && popupRef !== void 0 && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.target)) {
150
150
  handleHoverToggle(true);
151
151
  }
152
152
  });
153
153
  var handleMouseLeave = (0, _usePersistFn.default)(function (e) {
154
- var _targetEvents$onMouse2, _popupRef$current2;
154
+ var _targetEvents$onMouse2, _popupRef$current3;
155
155
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse2 = targetEvents.onMouseLeave) === null || _targetEvents$onMouse2 === void 0 || _targetEvents$onMouse2.call(targetEvents, e);
156
156
  if (trigger !== 'hover') return;
157
157
  // @ts-ignore
158
- if (e.relatedTarget instanceof HTMLElement && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.relatedTarget)) {
158
+ if (e.relatedTarget instanceof HTMLElement && (_popupRef$current3 = popupRef.current) !== null && _popupRef$current3 !== void 0 && _popupRef$current3.contains(e.relatedTarget)) {
159
159
  return;
160
160
  }
161
161
  handleHoverToggle(false);
@@ -135,20 +135,20 @@ var usePopup = function usePopup(props) {
135
135
  }
136
136
  };
137
137
  var handleMouseEnter = usePersistFn(function (e) {
138
- var _targetEvents$onMouse, _targetRef$current;
138
+ var _targetEvents$onMouse, _targetRef$current, _popupRef$current2;
139
139
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse = targetEvents.onMouseEnter) === null || _targetEvents$onMouse === void 0 || _targetEvents$onMouse.call(targetEvents, e);
140
140
  if (trigger !== 'hover') return;
141
141
  var isParentContainsCurrent = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.contains(e.target);
142
- if (isParentContainsCurrent) {
142
+ if (isParentContainsCurrent || popupRef !== null && popupRef !== void 0 && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.target)) {
143
143
  handleHoverToggle(true);
144
144
  }
145
145
  });
146
146
  var handleMouseLeave = usePersistFn(function (e) {
147
- var _targetEvents$onMouse2, _popupRef$current2;
147
+ var _targetEvents$onMouse2, _popupRef$current3;
148
148
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse2 = targetEvents.onMouseLeave) === null || _targetEvents$onMouse2 === void 0 || _targetEvents$onMouse2.call(targetEvents, e);
149
149
  if (trigger !== 'hover') return;
150
150
  // @ts-ignore
151
- if (e.relatedTarget instanceof HTMLElement && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.relatedTarget)) {
151
+ if (e.relatedTarget instanceof HTMLElement && (_popupRef$current3 = popupRef.current) !== null && _popupRef$current3 !== void 0 && _popupRef$current3.contains(e.relatedTarget)) {
152
152
  return;
153
153
  }
154
154
  handleHoverToggle(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.7.8-beta.4",
3
+ "version": "3.7.8-beta.5",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",