@beweco/aurora-ui 0.6.57-qa.64 → 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
|
@@ -4022,6 +4022,9 @@ var Phone = function (_a) {
|
|
|
4022
4022
|
if (!isDropdownOpen)
|
|
4023
4023
|
return;
|
|
4024
4024
|
var handleClickOutside = function (event) {
|
|
4025
|
+
// Ignore synthetic events (e.g. dispatched by scroll-close hooks)
|
|
4026
|
+
if (!event.isTrusted)
|
|
4027
|
+
return;
|
|
4025
4028
|
var target = event.target;
|
|
4026
4029
|
if (dropdownRef.current &&
|
|
4027
4030
|
!dropdownRef.current.contains(target) &&
|
|
@@ -4030,16 +4033,26 @@ var Phone = function (_a) {
|
|
|
4030
4033
|
setIsDropdownOpen(false);
|
|
4031
4034
|
}
|
|
4032
4035
|
};
|
|
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
|
+
};
|
|
4033
4044
|
// Defer listener registration to the next frame so the same
|
|
4034
4045
|
// tap/click that opened the dropdown cannot immediately close it.
|
|
4035
4046
|
var rafId = requestAnimationFrame(function () {
|
|
4036
4047
|
document.addEventListener("pointerdown", handleClickOutside);
|
|
4037
4048
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4049
|
+
window.addEventListener("scroll", handleScroll, { capture: true, passive: true });
|
|
4038
4050
|
});
|
|
4039
4051
|
return function () {
|
|
4040
4052
|
cancelAnimationFrame(rafId);
|
|
4041
4053
|
document.removeEventListener("pointerdown", handleClickOutside);
|
|
4042
4054
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4055
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
4043
4056
|
};
|
|
4044
4057
|
}, [isDropdownOpen]);
|
|
4045
4058
|
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
package/dist/index.esm.js
CHANGED
|
@@ -4023,6 +4023,9 @@ var Phone = function (_a) {
|
|
|
4023
4023
|
if (!isDropdownOpen)
|
|
4024
4024
|
return;
|
|
4025
4025
|
var handleClickOutside = function (event) {
|
|
4026
|
+
// Ignore synthetic events (e.g. dispatched by scroll-close hooks)
|
|
4027
|
+
if (!event.isTrusted)
|
|
4028
|
+
return;
|
|
4026
4029
|
var target = event.target;
|
|
4027
4030
|
if (dropdownRef.current &&
|
|
4028
4031
|
!dropdownRef.current.contains(target) &&
|
|
@@ -4031,16 +4034,26 @@ var Phone = function (_a) {
|
|
|
4031
4034
|
setIsDropdownOpen(false);
|
|
4032
4035
|
}
|
|
4033
4036
|
};
|
|
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
|
+
};
|
|
4034
4045
|
// Defer listener registration to the next frame so the same
|
|
4035
4046
|
// tap/click that opened the dropdown cannot immediately close it.
|
|
4036
4047
|
var rafId = requestAnimationFrame(function () {
|
|
4037
4048
|
document.addEventListener("pointerdown", handleClickOutside);
|
|
4038
4049
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4050
|
+
window.addEventListener("scroll", handleScroll, { capture: true, passive: true });
|
|
4039
4051
|
});
|
|
4040
4052
|
return function () {
|
|
4041
4053
|
cancelAnimationFrame(rafId);
|
|
4042
4054
|
document.removeEventListener("pointerdown", handleClickOutside);
|
|
4043
4055
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4056
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
4044
4057
|
};
|
|
4045
4058
|
}, [isDropdownOpen]);
|
|
4046
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"}
|