@beweco/aurora-ui 0.6.57-qa.63 → 0.6.57-qa.64

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,18 +4019,26 @@ 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
+ var target = event.target;
4023
4026
  if (dropdownRef.current &&
4024
- !dropdownRef.current.contains(event.target) &&
4027
+ !dropdownRef.current.contains(target) &&
4025
4028
  portalDropdownRef.current &&
4026
- !portalDropdownRef.current.contains(event.target)) {
4029
+ !portalDropdownRef.current.contains(target)) {
4027
4030
  setIsDropdownOpen(false);
4028
4031
  }
4029
4032
  };
4030
- if (isDropdownOpen) {
4033
+ // Defer listener registration to the next frame so the same
4034
+ // tap/click that opened the dropdown cannot immediately close it.
4035
+ var rafId = requestAnimationFrame(function () {
4036
+ document.addEventListener("pointerdown", handleClickOutside);
4031
4037
  document.addEventListener("mousedown", handleClickOutside);
4032
- }
4038
+ });
4033
4039
  return function () {
4040
+ cancelAnimationFrame(rafId);
4041
+ document.removeEventListener("pointerdown", handleClickOutside);
4034
4042
  document.removeEventListener("mousedown", handleClickOutside);
4035
4043
  };
4036
4044
  }, [isDropdownOpen]);
package/dist/index.esm.js CHANGED
@@ -4020,18 +4020,26 @@ 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
+ var target = event.target;
4024
4027
  if (dropdownRef.current &&
4025
- !dropdownRef.current.contains(event.target) &&
4028
+ !dropdownRef.current.contains(target) &&
4026
4029
  portalDropdownRef.current &&
4027
- !portalDropdownRef.current.contains(event.target)) {
4030
+ !portalDropdownRef.current.contains(target)) {
4028
4031
  setIsDropdownOpen(false);
4029
4032
  }
4030
4033
  };
4031
- if (isDropdownOpen) {
4034
+ // Defer listener registration to the next frame so the same
4035
+ // tap/click that opened the dropdown cannot immediately close it.
4036
+ var rafId = requestAnimationFrame(function () {
4037
+ document.addEventListener("pointerdown", handleClickOutside);
4032
4038
  document.addEventListener("mousedown", handleClickOutside);
4033
- }
4039
+ });
4034
4040
  return function () {
4041
+ cancelAnimationFrame(rafId);
4042
+ document.removeEventListener("pointerdown", handleClickOutside);
4035
4043
  document.removeEventListener("mousedown", handleClickOutside);
4036
4044
  };
4037
4045
  }, [isDropdownOpen]);
@@ -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,CA8O3C,CAAC;AAEF,eAAe,KAAK,CAAC"}
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,CAwP3C,CAAC;AAEF,eAAe,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beweco/aurora-ui",
3
- "version": "0.6.57-qa.63",
3
+ "version": "0.6.57-qa.64",
4
4
  "description": "Bewe Aurora UI Component Library",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",