optimized-react-component-library-xyz123 2.10.2 → 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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3882,7 +3882,7 @@ var Navigation = ({
|
|
|
3882
3882
|
openButtonRef = null,
|
|
3883
3883
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx30("a", { ...props }),
|
|
3884
3884
|
navigationCloseFocusId,
|
|
3885
|
-
|
|
3885
|
+
activePath = null
|
|
3886
3886
|
}) => {
|
|
3887
3887
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3888
3888
|
const navRef = useRef3(null);
|
|
@@ -3896,12 +3896,24 @@ var Navigation = ({
|
|
|
3896
3896
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3897
3897
|
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
3898
3898
|
};
|
|
3899
|
+
useEffect13(() => {
|
|
3900
|
+
var _a, _b;
|
|
3901
|
+
if (!isOpen) {
|
|
3902
|
+
setOpenSubMenu(null);
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
const defaultOpenSubMenu = activePath == null ? null : (_b = (_a = menuLinks.find(
|
|
3906
|
+
(link) => {
|
|
3907
|
+
var _a2;
|
|
3908
|
+
return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.includes(activePath));
|
|
3909
|
+
}
|
|
3910
|
+
)) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
3911
|
+
setOpenSubMenu(defaultOpenSubMenu);
|
|
3912
|
+
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
3899
3913
|
useEffect13(() => {
|
|
3900
3914
|
if (!isOpen || !navRef.current) {
|
|
3901
|
-
setOpenSubMenu(activeSubMenu);
|
|
3902
3915
|
return;
|
|
3903
3916
|
}
|
|
3904
|
-
setOpenSubMenu(activeSubMenu);
|
|
3905
3917
|
const nav = navRef.current;
|
|
3906
3918
|
const focusableSelectors = 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])';
|
|
3907
3919
|
const focusableElements = nav.querySelectorAll(focusableSelectors);
|
|
@@ -3961,7 +3973,6 @@ var Navigation = ({
|
|
|
3961
3973
|
);
|
|
3962
3974
|
});
|
|
3963
3975
|
}, [isOpen, activatedLanguage]);
|
|
3964
|
-
console.log(openSubMenu);
|
|
3965
3976
|
return /* @__PURE__ */ jsxs26(Fragment20, { children: [
|
|
3966
3977
|
/* @__PURE__ */ jsx30("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
3967
3978
|
/* @__PURE__ */ jsxs26(
|
|
@@ -4108,7 +4119,7 @@ var NavigationHeader = ({
|
|
|
4108
4119
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx33("a", { ...props }),
|
|
4109
4120
|
noLogoLink = false,
|
|
4110
4121
|
navigationCloseFocusId,
|
|
4111
|
-
|
|
4122
|
+
activePath = null
|
|
4112
4123
|
}) => {
|
|
4113
4124
|
const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
|
|
4114
4125
|
const hasHeadline = headline && headline.length > 0;
|
|
@@ -4214,7 +4225,7 @@ var NavigationHeader = ({
|
|
|
4214
4225
|
openButtonRef: menuButtonFocusRef,
|
|
4215
4226
|
linkComponent: LinkComponent,
|
|
4216
4227
|
navigationCloseFocusId,
|
|
4217
|
-
|
|
4228
|
+
activePath
|
|
4218
4229
|
}
|
|
4219
4230
|
) }),
|
|
4220
4231
|
isMenuOpen && /* @__PURE__ */ jsx33(
|