@rkmodules/rules 0.0.177 → 0.0.179
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.css +1 -0
- package/dist/index.cjs.js +16 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.mjs +16 -1
- package/dist/index.esm.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.esm.css
CHANGED
package/dist/index.esm.mjs
CHANGED
|
@@ -7055,6 +7055,7 @@ function Control(_a) {
|
|
|
7055
7055
|
|
|
7056
7056
|
function Menu(_a) {
|
|
7057
7057
|
var handle = _a.handle, children = _a.children;
|
|
7058
|
+
var menuRef = React.useRef(null);
|
|
7058
7059
|
var _b = __read(React.useState(false), 2), open = _b[0], setOpen = _b[1];
|
|
7059
7060
|
var handleOpen = function () {
|
|
7060
7061
|
setOpen(!open);
|
|
@@ -7062,7 +7063,21 @@ function Menu(_a) {
|
|
|
7062
7063
|
var handleClose = function () {
|
|
7063
7064
|
setOpen(false);
|
|
7064
7065
|
};
|
|
7065
|
-
|
|
7066
|
+
React.useEffect(function () {
|
|
7067
|
+
if (!open)
|
|
7068
|
+
return;
|
|
7069
|
+
var handleClickOutside = function (event) {
|
|
7070
|
+
var _a;
|
|
7071
|
+
if (!((_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
7072
|
+
setOpen(false);
|
|
7073
|
+
}
|
|
7074
|
+
};
|
|
7075
|
+
document.addEventListener("click", handleClickOutside);
|
|
7076
|
+
return function () {
|
|
7077
|
+
document.removeEventListener("click", handleClickOutside);
|
|
7078
|
+
};
|
|
7079
|
+
}, [open]);
|
|
7080
|
+
return (React.createElement("div", { ref: menuRef, className: styles$2.Menu },
|
|
7066
7081
|
React.createElement("div", { onClick: handleOpen }, handle),
|
|
7067
7082
|
open && (React.createElement("div", { className: styles$2.MenuCanvas, onClick: handleClose }, children))));
|
|
7068
7083
|
}
|