optimized-react-component-library-xyz123 2.8.8 → 2.8.9

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.js CHANGED
@@ -3807,6 +3807,7 @@ var Navigation = ({
3807
3807
  }) => {
3808
3808
  const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
3809
3809
  const navRef = (0, import_react16.useRef)(null);
3810
+ const firstVisitRef = (0, import_react16.useRef)(true);
3810
3811
  const [openSubMenu, setOpenSubMenu] = (0, import_react16.useState)(null);
3811
3812
  const handleSubMenu = (label) => {
3812
3813
  setOpenSubMenu(openSubMenu === label ? null : label);
@@ -3864,82 +3865,98 @@ var Navigation = ({
3864
3865
  }
3865
3866
  return "\xD6ppna undermeny f\xF6r " + label["sv"];
3866
3867
  };
3867
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3868
- "nav",
3869
- {
3870
- id: "main-navigation",
3871
- ref: navRef,
3872
- "aria-label": activatedLanguage === "sv" ? "Huvudnavigation" : "Main navigation",
3873
- className: `pts-navigation-menu-container ${isOpen ? "open" : ""}`,
3874
- inert: !isOpen,
3875
- "aria-expanded": isOpen,
3876
- children: [
3877
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pts-navigation-close-container ", id: "menu-close", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3878
- "button",
3879
- {
3880
- className: "pts-navigation-close-button",
3881
- onClick: () => handleMenuClick("close"),
3882
- type: "button",
3883
- children: [
3884
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CloseIcon, {}) }),
3885
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pts-navigation-close-text", children: closeMenuText })
3886
- ]
3887
- }
3888
- ) }),
3889
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: "pts-navigation-link-list", lang: activatedLanguage, children: menuLinks && menuLinks.map(({ label, href, children }, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3890
- "li",
3891
- {
3892
- className: `pts-navigation-link ${openSubMenu === label[activatedLanguage] ? "open" : ""}`,
3893
- lang: activatedLanguage,
3894
- children: [
3895
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "pts-navigation-button", children: [
3896
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: href && href.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3897
- LinkComponent,
3898
- {
3899
- onClick: () => handleMenuClick("link"),
3900
- href,
3901
- children: label[activatedLanguage]
3902
- }
3903
- ) }),
3904
- children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3905
- "button",
3906
- {
3907
- className: `pts-navigation-link-expand-button`,
3908
- onClick: () => handleSubMenu(label[activatedLanguage]),
3909
- "aria-label": getSubMenuAriaLabel(label),
3910
- "aria-expanded": openSubMenu === label[activatedLanguage],
3911
- "aria-controls": "sub-menu-" + index,
3912
- type: "button",
3913
- id: "menu-button-" + index,
3914
- children: openSubMenu === label[activatedLanguage] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": true, className: "pts-contract-icon", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MinusIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": true, className: "pts-expand-icon", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddIcon, {}) })
3915
- }
3916
- )
3917
- ] }) }),
3918
- children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3919
- "div",
3920
- {
3921
- hidden: openSubMenu !== label[activatedLanguage],
3922
- "aria-hidden": openSubMenu !== label[activatedLanguage],
3923
- className: "pts-sub-navigation-container",
3924
- id: "sub-menu-" + index,
3925
- role: "region",
3926
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: "pts-sub-navigation-list", lang: activatedLanguage, children: children.map(({ label: label2, href: href2 }, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { className: "pts-sub-navigation-item", lang: activatedLanguage, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3868
+ const [instruction, setInstruction] = (0, import_react16.useState)("");
3869
+ (0, import_react16.useEffect)(() => {
3870
+ if (firstVisitRef.current) {
3871
+ firstVisitRef.current = false;
3872
+ return;
3873
+ }
3874
+ if (isOpen)
3875
+ requestAnimationFrame(() => {
3876
+ setInstruction(
3877
+ activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened"
3878
+ );
3879
+ });
3880
+ }, [isOpen, activatedLanguage]);
3881
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
3882
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
3883
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3884
+ "nav",
3885
+ {
3886
+ id: "main-navigation",
3887
+ ref: navRef,
3888
+ "aria-label": activatedLanguage === "sv" ? "Huvudnavigation" : "Main navigation",
3889
+ className: `pts-navigation-menu-container ${isOpen ? "open" : ""}`,
3890
+ inert: !isOpen,
3891
+ "aria-expanded": isOpen,
3892
+ children: [
3893
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pts-navigation-close-container ", id: "menu-close", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3894
+ "button",
3895
+ {
3896
+ className: "pts-navigation-close-button",
3897
+ onClick: () => handleMenuClick("close"),
3898
+ type: "button",
3899
+ children: [
3900
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CloseIcon, {}) }),
3901
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pts-navigation-close-text", children: closeMenuText })
3902
+ ]
3903
+ }
3904
+ ) }),
3905
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: "pts-navigation-link-list", lang: activatedLanguage, children: menuLinks && menuLinks.map(({ label, href, children }, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3906
+ "li",
3907
+ {
3908
+ className: `pts-navigation-link ${openSubMenu === label[activatedLanguage] ? "open" : ""}`,
3909
+ lang: activatedLanguage,
3910
+ children: [
3911
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "pts-navigation-button", children: [
3912
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: href && href.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3927
3913
  LinkComponent,
3928
3914
  {
3929
3915
  onClick: () => handleMenuClick("link"),
3930
- href: href2,
3931
- children: label2[activatedLanguage]
3916
+ href,
3917
+ children: label[activatedLanguage]
3932
3918
  }
3933
- ) }, "nav-child-" + index2)) })
3934
- }
3935
- )
3936
- ]
3937
- },
3938
- "nav-" + index
3939
- )) })
3940
- ]
3941
- }
3942
- ) });
3919
+ ) }),
3920
+ children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3921
+ "button",
3922
+ {
3923
+ className: `pts-navigation-link-expand-button`,
3924
+ onClick: () => handleSubMenu(label[activatedLanguage]),
3925
+ "aria-label": getSubMenuAriaLabel(label),
3926
+ "aria-expanded": openSubMenu === label[activatedLanguage],
3927
+ "aria-controls": "sub-menu-" + index,
3928
+ type: "button",
3929
+ id: "menu-button-" + index,
3930
+ children: openSubMenu === label[activatedLanguage] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": true, className: "pts-contract-icon", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MinusIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": true, className: "pts-expand-icon", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddIcon, {}) })
3931
+ }
3932
+ )
3933
+ ] }) }),
3934
+ children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3935
+ "div",
3936
+ {
3937
+ hidden: openSubMenu !== label[activatedLanguage],
3938
+ "aria-hidden": openSubMenu !== label[activatedLanguage],
3939
+ className: "pts-sub-navigation-container",
3940
+ id: "sub-menu-" + index,
3941
+ role: "region",
3942
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: "pts-sub-navigation-list", lang: activatedLanguage, children: children.map(({ label: label2, href: href2 }, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { className: "pts-sub-navigation-item", lang: activatedLanguage, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3943
+ LinkComponent,
3944
+ {
3945
+ onClick: () => handleMenuClick("link"),
3946
+ href: href2,
3947
+ children: label2[activatedLanguage]
3948
+ }
3949
+ ) }, "nav-child-" + index2)) })
3950
+ }
3951
+ )
3952
+ ]
3953
+ },
3954
+ "nav-" + index
3955
+ )) })
3956
+ ]
3957
+ }
3958
+ )
3959
+ ] });
3943
3960
  };
3944
3961
  var NavigationStandard_default = Navigation;
3945
3962