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