optimized-react-component-library-xyz123 2.10.3 → 2.10.4
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.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3983,17 +3983,22 @@ var Navigation = ({
|
|
|
3983
3983
|
};
|
|
3984
3984
|
(0, import_react16.useEffect)(() => {
|
|
3985
3985
|
var _a, _b;
|
|
3986
|
-
if (!isOpen
|
|
3986
|
+
if (!isOpen) {
|
|
3987
3987
|
setOpenSubMenu(null);
|
|
3988
3988
|
return;
|
|
3989
3989
|
}
|
|
3990
|
-
const defaultOpenSubMenu = activePath
|
|
3990
|
+
const defaultOpenSubMenu = activePath == null ? null : (_b = (_a = menuLinks.find(
|
|
3991
3991
|
(link) => {
|
|
3992
3992
|
var _a2;
|
|
3993
|
-
return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.
|
|
3993
|
+
return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.includes(activePath));
|
|
3994
3994
|
}
|
|
3995
|
-
)) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null
|
|
3995
|
+
)) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
3996
3996
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
3997
|
+
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
3998
|
+
(0, import_react16.useEffect)(() => {
|
|
3999
|
+
if (!isOpen || !navRef.current) {
|
|
4000
|
+
return;
|
|
4001
|
+
}
|
|
3997
4002
|
const nav = navRef.current;
|
|
3998
4003
|
const focusableSelectors = 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])';
|
|
3999
4004
|
const focusableElements = nav.querySelectorAll(focusableSelectors);
|
|
@@ -4004,10 +4009,10 @@ var Navigation = ({
|
|
|
4004
4009
|
firstElement.focus();
|
|
4005
4010
|
});
|
|
4006
4011
|
const handleKeyDown = (event) => {
|
|
4007
|
-
var
|
|
4012
|
+
var _a;
|
|
4008
4013
|
if (event.key === "Escape") {
|
|
4009
4014
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4010
|
-
(
|
|
4015
|
+
(_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus();
|
|
4011
4016
|
return;
|
|
4012
4017
|
}
|
|
4013
4018
|
if (event.key !== "Tab") return;
|
|
@@ -4053,7 +4058,6 @@ var Navigation = ({
|
|
|
4053
4058
|
);
|
|
4054
4059
|
});
|
|
4055
4060
|
}, [isOpen, activatedLanguage]);
|
|
4056
|
-
console.log(openSubMenu, "tt");
|
|
4057
4061
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4058
4062
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
4059
4063
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|