pge-front-common 14.1.13 → 14.1.14
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/lib/components/InformativeBox/index.type.d.ts +6 -6
- package/lib/index.d.ts +5 -5
- package/lib/index.esm.js +20 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8488,10 +8488,27 @@ var Blanket = function (props) { return (React.createElement("div", __assign({ s
|
|
|
8488
8488
|
} }, props))); };
|
|
8489
8489
|
var Dropdown = function (_a) {
|
|
8490
8490
|
var children = _a.children, isOpen = _a.isOpen, target = _a.target, onClose = _a.onClose;
|
|
8491
|
-
|
|
8491
|
+
var dropdownRef = React.useRef(null);
|
|
8492
|
+
React.useEffect(function () {
|
|
8493
|
+
var handleClickOutside = function (event) {
|
|
8494
|
+
if (dropdownRef.current &&
|
|
8495
|
+
!dropdownRef.current.contains(event.target)) {
|
|
8496
|
+
onClose();
|
|
8497
|
+
}
|
|
8498
|
+
};
|
|
8499
|
+
if (isOpen) {
|
|
8500
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
8501
|
+
}
|
|
8502
|
+
else {
|
|
8503
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
8504
|
+
}
|
|
8505
|
+
return function () {
|
|
8506
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
8507
|
+
};
|
|
8508
|
+
}, [isOpen, onClose]);
|
|
8509
|
+
return (React.createElement("div", { ref: dropdownRef, style: { position: "relative", width: "100%" } },
|
|
8492
8510
|
target,
|
|
8493
|
-
isOpen ? React.createElement(Menu, null, children) : null
|
|
8494
|
-
isOpen ? React.createElement(Blanket, { onClick: onClose }) : null));
|
|
8511
|
+
isOpen ? React.createElement(Menu, null, children) : null));
|
|
8495
8512
|
};
|
|
8496
8513
|
function isArrayContained(subset, superset) {
|
|
8497
8514
|
return subset.every(function (subItem) {
|