optimized-react-component-library-xyz123 2.8.6 → 2.8.7

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
@@ -3719,8 +3719,8 @@ var Navigation = ({
3719
3719
  activatedLanguage = "sv",
3720
3720
  menuLinks = [],
3721
3721
  openButtonRef = null,
3722
- linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props })
3723
- //setKeyboardNavigationClose,
3722
+ linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props }),
3723
+ navigationCloseFocusId
3724
3724
  }) => {
3725
3725
  const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
3726
3726
  const navRef = useRef3(null);
@@ -3728,10 +3728,10 @@ var Navigation = ({
3728
3728
  const handleSubMenu = (label) => {
3729
3729
  setOpenSubMenu(openSubMenu === label ? null : label);
3730
3730
  };
3731
- const handleCloseButton = (type) => {
3731
+ const handleMenuClick = (typeOfInteraction) => {
3732
3732
  var _a, _b;
3733
- setIsMenyOpen && setIsMenyOpen(false);
3734
- type === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : (_b = document.getElementById("page-start")) == null ? void 0 : _b.focus();
3733
+ setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
3734
+ typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
3735
3735
  };
3736
3736
  useEffect13(() => {
3737
3737
  if (!isOpen || !navRef.current) return;
@@ -3794,7 +3794,7 @@ var Navigation = ({
3794
3794
  "button",
3795
3795
  {
3796
3796
  className: "pts-navigation-close-button",
3797
- onClick: () => handleCloseButton("close"),
3797
+ onClick: () => handleMenuClick("close"),
3798
3798
  type: "button",
3799
3799
  children: [
3800
3800
  /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx28(CloseIcon, {}) }),
@@ -3813,7 +3813,7 @@ var Navigation = ({
3813
3813
  LinkComponent,
3814
3814
  {
3815
3815
  onClick: () => {
3816
- handleCloseButton("link");
3816
+ handleMenuClick("link");
3817
3817
  },
3818
3818
  href,
3819
3819
  children: label[activatedLanguage]
@@ -3845,7 +3845,7 @@ var Navigation = ({
3845
3845
  LinkComponent,
3846
3846
  {
3847
3847
  onClick: () => {
3848
- handleCloseButton("link");
3848
+ handleMenuClick("link");
3849
3849
  },
3850
3850
  href: href2,
3851
3851
  children: label2[activatedLanguage]
@@ -3955,12 +3955,10 @@ var NavigationHeader = ({
3955
3955
  };
3956
3956
  const [instruction, setInstruction] = useState11("");
3957
3957
  useEffect14(() => {
3958
- if (!hasBeenOpen) {
3958
+ if (!isMenuOpen)
3959
3959
  return;
3960
- }
3961
- setInstruction(
3962
- isMenuOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed"
3963
- );
3960
+ const message = activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened";
3961
+ setInstruction(message);
3964
3962
  }, [isMenuOpen, activatedLanguage]);
3965
3963
  const getMenuLabel = () => {
3966
3964
  const labels = {
@@ -4049,8 +4047,7 @@ var NavigationHeader = ({
4049
4047
  isOpen: isMenuOpen,
4050
4048
  openButtonRef: menuButtonFocusRef,
4051
4049
  linkComponent: LinkComponent,
4052
- setKeyboardNavigationClose: () => {
4053
- }
4050
+ navigationCloseFocusId
4054
4051
  }
4055
4052
  )
4056
4053
  ] }),