optimized-react-component-library-xyz123 2.10.2 → 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 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -847,7 +847,7 @@ interface NavigationHeaderProps {
|
|
|
847
847
|
linkComponent?: ElementType;
|
|
848
848
|
noLogoLink?: boolean;
|
|
849
849
|
navigationCloseFocusId?: string;
|
|
850
|
-
|
|
850
|
+
activePath?: string | null;
|
|
851
851
|
}
|
|
852
852
|
|
|
853
853
|
declare const NavigationHeader: FC<NavigationHeaderProps>;
|
|
@@ -860,7 +860,7 @@ interface NavigationProps {
|
|
|
860
860
|
openButtonRef: RefObject<HTMLButtonElement | null>;
|
|
861
861
|
linkComponent?: ElementType;
|
|
862
862
|
navigationCloseFocusId?: string;
|
|
863
|
-
|
|
863
|
+
activePath?: string | null;
|
|
864
864
|
}
|
|
865
865
|
type Locale = 'sv' | 'en';
|
|
866
866
|
type Label = Record<Locale, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -847,7 +847,7 @@ interface NavigationHeaderProps {
|
|
|
847
847
|
linkComponent?: ElementType;
|
|
848
848
|
noLogoLink?: boolean;
|
|
849
849
|
navigationCloseFocusId?: string;
|
|
850
|
-
|
|
850
|
+
activePath?: string | null;
|
|
851
851
|
}
|
|
852
852
|
|
|
853
853
|
declare const NavigationHeader: FC<NavigationHeaderProps>;
|
|
@@ -860,7 +860,7 @@ interface NavigationProps {
|
|
|
860
860
|
openButtonRef: RefObject<HTMLButtonElement | null>;
|
|
861
861
|
linkComponent?: ElementType;
|
|
862
862
|
navigationCloseFocusId?: string;
|
|
863
|
-
|
|
863
|
+
activePath?: string | null;
|
|
864
864
|
}
|
|
865
865
|
type Locale = 'sv' | 'en';
|
|
866
866
|
type Label = Record<Locale, string>;
|
package/dist/index.js
CHANGED
|
@@ -3967,7 +3967,7 @@ var Navigation = ({
|
|
|
3967
3967
|
openButtonRef = null,
|
|
3968
3968
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { ...props }),
|
|
3969
3969
|
navigationCloseFocusId,
|
|
3970
|
-
|
|
3970
|
+
activePath = null
|
|
3971
3971
|
}) => {
|
|
3972
3972
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3973
3973
|
const navRef = (0, import_react16.useRef)(null);
|
|
@@ -3982,11 +3982,18 @@ var Navigation = ({
|
|
|
3982
3982
|
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
3983
3983
|
};
|
|
3984
3984
|
(0, import_react16.useEffect)(() => {
|
|
3985
|
+
var _a, _b;
|
|
3985
3986
|
if (!isOpen || !navRef.current) {
|
|
3986
|
-
setOpenSubMenu(
|
|
3987
|
+
setOpenSubMenu(null);
|
|
3987
3988
|
return;
|
|
3988
3989
|
}
|
|
3989
|
-
|
|
3990
|
+
const defaultOpenSubMenu = activePath !== null ? (_b = (_a = menuLinks.find(
|
|
3991
|
+
(link) => {
|
|
3992
|
+
var _a2;
|
|
3993
|
+
return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.indexOf(activePath) !== -1);
|
|
3994
|
+
}
|
|
3995
|
+
)) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null : null;
|
|
3996
|
+
setOpenSubMenu(defaultOpenSubMenu);
|
|
3990
3997
|
const nav = navRef.current;
|
|
3991
3998
|
const focusableSelectors = 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])';
|
|
3992
3999
|
const focusableElements = nav.querySelectorAll(focusableSelectors);
|
|
@@ -3997,10 +4004,10 @@ var Navigation = ({
|
|
|
3997
4004
|
firstElement.focus();
|
|
3998
4005
|
});
|
|
3999
4006
|
const handleKeyDown = (event) => {
|
|
4000
|
-
var
|
|
4007
|
+
var _a2;
|
|
4001
4008
|
if (event.key === "Escape") {
|
|
4002
4009
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4003
|
-
(
|
|
4010
|
+
(_a2 = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a2.focus();
|
|
4004
4011
|
return;
|
|
4005
4012
|
}
|
|
4006
4013
|
if (event.key !== "Tab") return;
|
|
@@ -4046,7 +4053,7 @@ var Navigation = ({
|
|
|
4046
4053
|
);
|
|
4047
4054
|
});
|
|
4048
4055
|
}, [isOpen, activatedLanguage]);
|
|
4049
|
-
console.log(openSubMenu);
|
|
4056
|
+
console.log(openSubMenu, "tt");
|
|
4050
4057
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4051
4058
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
4052
4059
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
@@ -4193,7 +4200,7 @@ var NavigationHeader = ({
|
|
|
4193
4200
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("a", { ...props }),
|
|
4194
4201
|
noLogoLink = false,
|
|
4195
4202
|
navigationCloseFocusId,
|
|
4196
|
-
|
|
4203
|
+
activePath = null
|
|
4197
4204
|
}) => {
|
|
4198
4205
|
const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
|
|
4199
4206
|
const hasHeadline = headline && headline.length > 0;
|
|
@@ -4299,7 +4306,7 @@ var NavigationHeader = ({
|
|
|
4299
4306
|
openButtonRef: menuButtonFocusRef,
|
|
4300
4307
|
linkComponent: LinkComponent,
|
|
4301
4308
|
navigationCloseFocusId,
|
|
4302
|
-
|
|
4309
|
+
activePath
|
|
4303
4310
|
}
|
|
4304
4311
|
) }),
|
|
4305
4312
|
isMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|