optimized-react-component-library-xyz123 2.10.1 → 2.10.3
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 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3881,7 +3881,8 @@ var Navigation = ({
|
|
|
3881
3881
|
menuLinks = [],
|
|
3882
3882
|
openButtonRef = null,
|
|
3883
3883
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx30("a", { ...props }),
|
|
3884
|
-
navigationCloseFocusId
|
|
3884
|
+
navigationCloseFocusId,
|
|
3885
|
+
activePath = null
|
|
3885
3886
|
}) => {
|
|
3886
3887
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3887
3888
|
const navRef = useRef3(null);
|
|
@@ -3896,7 +3897,18 @@ var Navigation = ({
|
|
|
3896
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());
|
|
3897
3898
|
};
|
|
3898
3899
|
useEffect13(() => {
|
|
3899
|
-
|
|
3900
|
+
var _a, _b;
|
|
3901
|
+
if (!isOpen || !navRef.current) {
|
|
3902
|
+
setOpenSubMenu(null);
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
const defaultOpenSubMenu = activePath !== null ? (_b = (_a = menuLinks.find(
|
|
3906
|
+
(link) => {
|
|
3907
|
+
var _a2;
|
|
3908
|
+
return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.indexOf(activePath) !== -1);
|
|
3909
|
+
}
|
|
3910
|
+
)) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null : null;
|
|
3911
|
+
setOpenSubMenu(defaultOpenSubMenu);
|
|
3900
3912
|
const nav = navRef.current;
|
|
3901
3913
|
const focusableSelectors = 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])';
|
|
3902
3914
|
const focusableElements = nav.querySelectorAll(focusableSelectors);
|
|
@@ -3907,10 +3919,10 @@ var Navigation = ({
|
|
|
3907
3919
|
firstElement.focus();
|
|
3908
3920
|
});
|
|
3909
3921
|
const handleKeyDown = (event) => {
|
|
3910
|
-
var
|
|
3922
|
+
var _a2;
|
|
3911
3923
|
if (event.key === "Escape") {
|
|
3912
3924
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3913
|
-
(
|
|
3925
|
+
(_a2 = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a2.focus();
|
|
3914
3926
|
return;
|
|
3915
3927
|
}
|
|
3916
3928
|
if (event.key !== "Tab") return;
|
|
@@ -3956,6 +3968,7 @@ var Navigation = ({
|
|
|
3956
3968
|
);
|
|
3957
3969
|
});
|
|
3958
3970
|
}, [isOpen, activatedLanguage]);
|
|
3971
|
+
console.log(openSubMenu, "tt");
|
|
3959
3972
|
return /* @__PURE__ */ jsxs26(Fragment20, { children: [
|
|
3960
3973
|
/* @__PURE__ */ jsx30("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
3961
3974
|
/* @__PURE__ */ jsxs26(
|
|
@@ -4101,7 +4114,8 @@ var NavigationHeader = ({
|
|
|
4101
4114
|
},
|
|
4102
4115
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx33("a", { ...props }),
|
|
4103
4116
|
noLogoLink = false,
|
|
4104
|
-
navigationCloseFocusId
|
|
4117
|
+
navigationCloseFocusId,
|
|
4118
|
+
activePath = null
|
|
4105
4119
|
}) => {
|
|
4106
4120
|
const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
|
|
4107
4121
|
const hasHeadline = headline && headline.length > 0;
|
|
@@ -4162,7 +4176,7 @@ var NavigationHeader = ({
|
|
|
4162
4176
|
children: /* @__PURE__ */ jsx33("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? /* @__PURE__ */ jsx33(Logo_en, {}) : /* @__PURE__ */ jsx33(Logo_sv, {}) })
|
|
4163
4177
|
}
|
|
4164
4178
|
) }),
|
|
4165
|
-
/* @__PURE__ */ jsx33("div", { className: `${hasHeadline ? "pts-navigation-header-headline-container" : ""}`, children: hasHeadline && /* @__PURE__ */ jsx33("
|
|
4179
|
+
/* @__PURE__ */ jsx33("div", { className: `${hasHeadline ? "pts-navigation-header-headline-container" : ""}`, children: hasHeadline && /* @__PURE__ */ jsx33("div", { className: "pts-site-headline", children: headline }) }),
|
|
4166
4180
|
/* @__PURE__ */ jsx33("div", { className: "pts-navigation-header-nav-container", children: (useLanguage || useNavigationMenu || useSearch) && /* @__PURE__ */ jsxs29(Fragment21, { children: [
|
|
4167
4181
|
useSearch && !isMenuOpen && /* @__PURE__ */ jsx33(Fragment21, { children: /* @__PURE__ */ jsxs29("button", { type: "button", onClick: handleSearchClick, children: [
|
|
4168
4182
|
/* @__PURE__ */ jsx33("span", { "aria-hidden": "true", className: "pts-navigation-header-icons", children: getSearchIcon() }),
|
|
@@ -4206,7 +4220,8 @@ var NavigationHeader = ({
|
|
|
4206
4220
|
isOpen: isMenuOpen,
|
|
4207
4221
|
openButtonRef: menuButtonFocusRef,
|
|
4208
4222
|
linkComponent: LinkComponent,
|
|
4209
|
-
navigationCloseFocusId
|
|
4223
|
+
navigationCloseFocusId,
|
|
4224
|
+
activePath
|
|
4210
4225
|
}
|
|
4211
4226
|
) }),
|
|
4212
4227
|
isMenuOpen && /* @__PURE__ */ jsx33(
|