@beweco/aurora-ui 0.6.57-qa.63 → 0.6.57-qa.65
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.cjs.js
CHANGED
|
@@ -4019,19 +4019,40 @@ var Phone = function (_a) {
|
|
|
4019
4019
|
}
|
|
4020
4020
|
}, [isDropdownOpen]);
|
|
4021
4021
|
React.useEffect(function () {
|
|
4022
|
+
if (!isDropdownOpen)
|
|
4023
|
+
return;
|
|
4022
4024
|
var handleClickOutside = function (event) {
|
|
4025
|
+
// Ignore synthetic events (e.g. dispatched by scroll-close hooks)
|
|
4026
|
+
if (!event.isTrusted)
|
|
4027
|
+
return;
|
|
4028
|
+
var target = event.target;
|
|
4023
4029
|
if (dropdownRef.current &&
|
|
4024
|
-
!dropdownRef.current.contains(
|
|
4030
|
+
!dropdownRef.current.contains(target) &&
|
|
4025
4031
|
portalDropdownRef.current &&
|
|
4026
|
-
!portalDropdownRef.current.contains(
|
|
4032
|
+
!portalDropdownRef.current.contains(target)) {
|
|
4027
4033
|
setIsDropdownOpen(false);
|
|
4028
4034
|
}
|
|
4029
4035
|
};
|
|
4030
|
-
|
|
4036
|
+
// Close on scroll outside the dropdown (e.g. parent container scrolls)
|
|
4037
|
+
var handleScroll = function (event) {
|
|
4038
|
+
var _a;
|
|
4039
|
+
var target = event.target;
|
|
4040
|
+
if (target && ((_a = portalDropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)))
|
|
4041
|
+
return;
|
|
4042
|
+
setIsDropdownOpen(false);
|
|
4043
|
+
};
|
|
4044
|
+
// Defer listener registration to the next frame so the same
|
|
4045
|
+
// tap/click that opened the dropdown cannot immediately close it.
|
|
4046
|
+
var rafId = requestAnimationFrame(function () {
|
|
4047
|
+
document.addEventListener("pointerdown", handleClickOutside);
|
|
4031
4048
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4032
|
-
|
|
4049
|
+
window.addEventListener("scroll", handleScroll, { capture: true, passive: true });
|
|
4050
|
+
});
|
|
4033
4051
|
return function () {
|
|
4052
|
+
cancelAnimationFrame(rafId);
|
|
4053
|
+
document.removeEventListener("pointerdown", handleClickOutside);
|
|
4034
4054
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4055
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
4035
4056
|
};
|
|
4036
4057
|
}, [isDropdownOpen]);
|
|
4037
4058
|
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
package/dist/index.esm.js
CHANGED
|
@@ -4020,19 +4020,40 @@ var Phone = function (_a) {
|
|
|
4020
4020
|
}
|
|
4021
4021
|
}, [isDropdownOpen]);
|
|
4022
4022
|
useEffect(function () {
|
|
4023
|
+
if (!isDropdownOpen)
|
|
4024
|
+
return;
|
|
4023
4025
|
var handleClickOutside = function (event) {
|
|
4026
|
+
// Ignore synthetic events (e.g. dispatched by scroll-close hooks)
|
|
4027
|
+
if (!event.isTrusted)
|
|
4028
|
+
return;
|
|
4029
|
+
var target = event.target;
|
|
4024
4030
|
if (dropdownRef.current &&
|
|
4025
|
-
!dropdownRef.current.contains(
|
|
4031
|
+
!dropdownRef.current.contains(target) &&
|
|
4026
4032
|
portalDropdownRef.current &&
|
|
4027
|
-
!portalDropdownRef.current.contains(
|
|
4033
|
+
!portalDropdownRef.current.contains(target)) {
|
|
4028
4034
|
setIsDropdownOpen(false);
|
|
4029
4035
|
}
|
|
4030
4036
|
};
|
|
4031
|
-
|
|
4037
|
+
// Close on scroll outside the dropdown (e.g. parent container scrolls)
|
|
4038
|
+
var handleScroll = function (event) {
|
|
4039
|
+
var _a;
|
|
4040
|
+
var target = event.target;
|
|
4041
|
+
if (target && ((_a = portalDropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)))
|
|
4042
|
+
return;
|
|
4043
|
+
setIsDropdownOpen(false);
|
|
4044
|
+
};
|
|
4045
|
+
// Defer listener registration to the next frame so the same
|
|
4046
|
+
// tap/click that opened the dropdown cannot immediately close it.
|
|
4047
|
+
var rafId = requestAnimationFrame(function () {
|
|
4048
|
+
document.addEventListener("pointerdown", handleClickOutside);
|
|
4032
4049
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4033
|
-
|
|
4050
|
+
window.addEventListener("scroll", handleScroll, { capture: true, passive: true });
|
|
4051
|
+
});
|
|
4034
4052
|
return function () {
|
|
4053
|
+
cancelAnimationFrame(rafId);
|
|
4054
|
+
document.removeEventListener("pointerdown", handleClickOutside);
|
|
4035
4055
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4056
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
4036
4057
|
};
|
|
4037
4058
|
}, [isDropdownOpen]);
|
|
4038
4059
|
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOrD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/components/phone/Phone.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOrD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoQ3C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|