optimized-react-component-library-xyz123 2.10.1 → 2.10.2

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 CHANGED
@@ -847,6 +847,7 @@ interface NavigationHeaderProps {
847
847
  linkComponent?: ElementType;
848
848
  noLogoLink?: boolean;
849
849
  navigationCloseFocusId?: string;
850
+ activeSubMenu?: string | null;
850
851
  }
851
852
 
852
853
  declare const NavigationHeader: FC<NavigationHeaderProps>;
@@ -859,6 +860,7 @@ interface NavigationProps {
859
860
  openButtonRef: RefObject<HTMLButtonElement | null>;
860
861
  linkComponent?: ElementType;
861
862
  navigationCloseFocusId?: string;
863
+ activeSubMenu?: string | null;
862
864
  }
863
865
  type Locale = 'sv' | 'en';
864
866
  type Label = Record<Locale, string>;
package/dist/index.d.ts CHANGED
@@ -847,6 +847,7 @@ interface NavigationHeaderProps {
847
847
  linkComponent?: ElementType;
848
848
  noLogoLink?: boolean;
849
849
  navigationCloseFocusId?: string;
850
+ activeSubMenu?: string | null;
850
851
  }
851
852
 
852
853
  declare const NavigationHeader: FC<NavigationHeaderProps>;
@@ -859,6 +860,7 @@ interface NavigationProps {
859
860
  openButtonRef: RefObject<HTMLButtonElement | null>;
860
861
  linkComponent?: ElementType;
861
862
  navigationCloseFocusId?: string;
863
+ activeSubMenu?: string | null;
862
864
  }
863
865
  type Locale = 'sv' | 'en';
864
866
  type Label = Record<Locale, string>;
package/dist/index.js CHANGED
@@ -3966,7 +3966,8 @@ var Navigation = ({
3966
3966
  menuLinks = [],
3967
3967
  openButtonRef = null,
3968
3968
  linkComponent: LinkComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { ...props }),
3969
- navigationCloseFocusId
3969
+ navigationCloseFocusId,
3970
+ activeSubMenu = null
3970
3971
  }) => {
3971
3972
  const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
3972
3973
  const navRef = (0, import_react16.useRef)(null);
@@ -3981,7 +3982,11 @@ var Navigation = ({
3981
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());
3982
3983
  };
3983
3984
  (0, import_react16.useEffect)(() => {
3984
- if (!isOpen || !navRef.current) return;
3985
+ if (!isOpen || !navRef.current) {
3986
+ setOpenSubMenu(activeSubMenu);
3987
+ return;
3988
+ }
3989
+ setOpenSubMenu(activeSubMenu);
3985
3990
  const nav = navRef.current;
3986
3991
  const focusableSelectors = 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])';
3987
3992
  const focusableElements = nav.querySelectorAll(focusableSelectors);
@@ -4041,6 +4046,7 @@ var Navigation = ({
4041
4046
  );
4042
4047
  });
4043
4048
  }, [isOpen, activatedLanguage]);
4049
+ console.log(openSubMenu);
4044
4050
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
4045
4051
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
4046
4052
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
@@ -4186,7 +4192,8 @@ var NavigationHeader = ({
4186
4192
  },
4187
4193
  linkComponent: LinkComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("a", { ...props }),
4188
4194
  noLogoLink = false,
4189
- navigationCloseFocusId
4195
+ navigationCloseFocusId,
4196
+ activeSubMenu = null
4190
4197
  }) => {
4191
4198
  const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
4192
4199
  const hasHeadline = headline && headline.length > 0;
@@ -4247,7 +4254,7 @@ var NavigationHeader = ({
4247
4254
  children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Logo_en, {}) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Logo_sv, {}) })
4248
4255
  }
4249
4256
  ) }),
4250
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: `${hasHeadline ? "pts-navigation-header-headline-container" : ""}`, children: hasHeadline && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "pts-site-headline", children: headline }) }),
4257
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: `${hasHeadline ? "pts-navigation-header-headline-container" : ""}`, children: hasHeadline && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "pts-site-headline", children: headline }) }),
4251
4258
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "pts-navigation-header-nav-container", children: (useLanguage || useNavigationMenu || useSearch) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4252
4259
  useSearch && !isMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { type: "button", onClick: handleSearchClick, children: [
4253
4260
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { "aria-hidden": "true", className: "pts-navigation-header-icons", children: getSearchIcon() }),
@@ -4291,7 +4298,8 @@ var NavigationHeader = ({
4291
4298
  isOpen: isMenuOpen,
4292
4299
  openButtonRef: menuButtonFocusRef,
4293
4300
  linkComponent: LinkComponent,
4294
- navigationCloseFocusId
4301
+ navigationCloseFocusId,
4302
+ activeSubMenu
4295
4303
  }
4296
4304
  ) }),
4297
4305
  isMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(