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.mjs
CHANGED
|
@@ -3898,17 +3898,22 @@ var Navigation = ({
|
|
|
3898
3898
|
};
|
|
3899
3899
|
useEffect13(() => {
|
|
3900
3900
|
var _a, _b;
|
|
3901
|
-
if (!isOpen
|
|
3901
|
+
if (!isOpen) {
|
|
3902
3902
|
setOpenSubMenu(null);
|
|
3903
3903
|
return;
|
|
3904
3904
|
}
|
|
3905
|
-
const defaultOpenSubMenu = activePath
|
|
3905
|
+
const defaultOpenSubMenu = activePath == null ? null : (_b = (_a = menuLinks.find(
|
|
3906
3906
|
(link) => {
|
|
3907
3907
|
var _a2;
|
|
3908
|
-
return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.
|
|
3908
|
+
return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.includes(activePath));
|
|
3909
3909
|
}
|
|
3910
|
-
)) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null
|
|
3910
|
+
)) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
3911
3911
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
3912
|
+
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
3913
|
+
useEffect13(() => {
|
|
3914
|
+
if (!isOpen || !navRef.current) {
|
|
3915
|
+
return;
|
|
3916
|
+
}
|
|
3912
3917
|
const nav = navRef.current;
|
|
3913
3918
|
const focusableSelectors = 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])';
|
|
3914
3919
|
const focusableElements = nav.querySelectorAll(focusableSelectors);
|
|
@@ -3919,10 +3924,10 @@ var Navigation = ({
|
|
|
3919
3924
|
firstElement.focus();
|
|
3920
3925
|
});
|
|
3921
3926
|
const handleKeyDown = (event) => {
|
|
3922
|
-
var
|
|
3927
|
+
var _a;
|
|
3923
3928
|
if (event.key === "Escape") {
|
|
3924
3929
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3925
|
-
(
|
|
3930
|
+
(_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus();
|
|
3926
3931
|
return;
|
|
3927
3932
|
}
|
|
3928
3933
|
if (event.key !== "Tab") return;
|
|
@@ -3968,7 +3973,6 @@ var Navigation = ({
|
|
|
3968
3973
|
);
|
|
3969
3974
|
});
|
|
3970
3975
|
}, [isOpen, activatedLanguage]);
|
|
3971
|
-
console.log(openSubMenu, "tt");
|
|
3972
3976
|
return /* @__PURE__ */ jsxs26(Fragment20, { children: [
|
|
3973
3977
|
/* @__PURE__ */ jsx30("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
3974
3978
|
/* @__PURE__ */ jsxs26(
|