optimized-react-component-library-xyz123 2.8.1 → 2.8.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.mjs CHANGED
@@ -3708,7 +3708,7 @@ var Header = ({
3708
3708
  var HeaderStandard_default = Header;
3709
3709
 
3710
3710
  // src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
3711
- import { useRef as useRef4, useState as useState11 } from "react";
3711
+ import { useEffect as useEffect14, useRef as useRef4, useState as useState11 } from "react";
3712
3712
 
3713
3713
  // src/components/layout/NavigationStandard/NavigationStandard.tsx
3714
3714
  import { useEffect as useEffect13, useState as useState9, useRef as useRef3 } from "react";
@@ -3723,6 +3723,7 @@ var Navigation = ({
3723
3723
  }) => {
3724
3724
  const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
3725
3725
  const navRef = useRef3(null);
3726
+ const firstVisitRef = useRef3(true);
3726
3727
  const [openSubMenu, setOpenSubMenu] = useState9(null);
3727
3728
  const handleSubMenu = (label) => {
3728
3729
  setOpenSubMenu(openSubMenu === label ? null : label);
@@ -3776,8 +3777,15 @@ var Navigation = ({
3776
3777
  }
3777
3778
  return "\xD6ppna undermeny f\xF6r " + label["sv"];
3778
3779
  };
3780
+ const setInstruction = () => {
3781
+ if (firstVisitRef.current) {
3782
+ firstVisitRef.current = false;
3783
+ return "";
3784
+ }
3785
+ return isOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed";
3786
+ };
3779
3787
  return /* @__PURE__ */ jsxs24(Fragment18, { children: [
3780
- /* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children: isOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed" }),
3788
+ /* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children: setInstruction() }),
3781
3789
  /* @__PURE__ */ jsxs24(
3782
3790
  "nav",
3783
3791
  {
@@ -3905,7 +3913,8 @@ var NavigationHeader = ({
3905
3913
  SetActivatedLanguage = () => {
3906
3914
  },
3907
3915
  linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx31("a", { ...props }),
3908
- noLogoLink = false
3916
+ noLogoLink = false,
3917
+ navigationCloseFocusId
3909
3918
  }) => {
3910
3919
  const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
3911
3920
  const hasHeadline = headline && headline.length > 0;
@@ -3922,8 +3931,23 @@ var NavigationHeader = ({
3922
3931
  else return "Svenska";
3923
3932
  };
3924
3933
  const [isMenuOpen, setIsMenuOpen] = useState11(false);
3934
+ const [hasBeenOpen, setHasBeenOpen] = useState11(false);
3935
+ useEffect14(() => {
3936
+ var _a;
3937
+ console.log(navigationCloseFocusId);
3938
+ if (!isMenuOpen && navigationCloseFocusId && hasBeenOpen) {
3939
+ (_a = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _a.focus();
3940
+ console.log(navigationCloseFocusId, document.getElementById(navigationCloseFocusId));
3941
+ }
3942
+ }, [isMenuOpen]);
3925
3943
  const handleMenuClick = () => {
3926
- setIsMenuOpen((prev) => !prev);
3944
+ setIsMenuOpen((prev) => {
3945
+ const open = !prev;
3946
+ if (open) {
3947
+ setHasBeenOpen(true);
3948
+ }
3949
+ return open;
3950
+ });
3927
3951
  };
3928
3952
  const getMenuLabel = () => {
3929
3953
  const labels = {
@@ -4120,6 +4144,7 @@ var LinkStandard = ({
4120
4144
  target: openTarget,
4121
4145
  rel: openTarget === "_blank" ? "noopener noreferrer" : void 0,
4122
4146
  "aria-label": ariaLabel || void 0,
4147
+ lang: activatedLanguage,
4123
4148
  children: [
4124
4149
  IconComponent && /* @__PURE__ */ jsx34("span", { className: `pts-link-icon-circle ${iconClass} ${customClass}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx34(IconComponent, {}) }),
4125
4150
  /* @__PURE__ */ jsx34("span", { className: "pts-standard-link-text", children: linkTitle })
@@ -4139,15 +4164,15 @@ var LinkList = ({
4139
4164
  }) => {
4140
4165
  const uniqueId = useId();
4141
4166
  return /* @__PURE__ */ jsx35("div", { className: "pts-linkList-container", children: /* @__PURE__ */ jsx35("ul", { children: linkArray && linkArray.map((link, index) => {
4142
- var _a, _b;
4167
+ var _a, _b, _c;
4143
4168
  return /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35(
4144
4169
  LinkStandard_default,
4145
4170
  {
4146
4171
  url: link.url,
4147
4172
  title: link.title,
4148
- activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv",
4149
- ariaLabel: (_a = link.ariaLabel) != null ? _a : void 0,
4150
- openTarget: (_b = link.openTarget) != null ? _b : "_blank",
4173
+ activatedLanguage: (_a = link.activatedLanguage) != null ? _a : activatedLanguage,
4174
+ ariaLabel: (_b = link.ariaLabel) != null ? _b : void 0,
4175
+ openTarget: (_c = link.openTarget) != null ? _c : "_blank",
4151
4176
  linkComponent: LinkComponent
4152
4177
  }
4153
4178
  ) }, uniqueId + "_" + index);