optimized-react-component-library-xyz123 2.8.3 → 2.8.4
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/darkMode.css +2 -1
- package/src/css/styles.css +13 -2
package/dist/index.mjs
CHANGED
|
@@ -1421,7 +1421,7 @@ var MenuIcon = () => /* @__PURE__ */ jsxs13("svg", { width: "15", height: "15",
|
|
|
1421
1421
|
/* @__PURE__ */ jsx16("line", { x1: "0.666504", y1: "7", x2: "20.6665", y2: "7", stroke: "#6E3282", strokeWidth: "2" }),
|
|
1422
1422
|
/* @__PURE__ */ jsx16("line", { x1: "0.666504", y1: "13", x2: "20.6665", y2: "13", stroke: "#6E3282", strokeWidth: "2" })
|
|
1423
1423
|
] });
|
|
1424
|
-
var ExpandIcon = () => /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "
|
|
1424
|
+
var ExpandIcon = () => /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx16(
|
|
1425
1425
|
"path",
|
|
1426
1426
|
{
|
|
1427
1427
|
fillRule: "evenodd",
|
|
@@ -1430,7 +1430,7 @@ var ExpandIcon = () => /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/
|
|
|
1430
1430
|
fill: "white"
|
|
1431
1431
|
}
|
|
1432
1432
|
) });
|
|
1433
|
-
var CollapseIcon = () => /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "
|
|
1433
|
+
var CollapseIcon = () => /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx16(
|
|
1434
1434
|
"path",
|
|
1435
1435
|
{
|
|
1436
1436
|
fillRule: "evenodd",
|
|
@@ -3719,7 +3719,8 @@ var Navigation = ({
|
|
|
3719
3719
|
activatedLanguage = "sv",
|
|
3720
3720
|
menuLinks = [],
|
|
3721
3721
|
openButtonRef = null,
|
|
3722
|
-
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props })
|
|
3722
|
+
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props }),
|
|
3723
|
+
setKeyboardNavigationClose
|
|
3723
3724
|
}) => {
|
|
3724
3725
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3725
3726
|
const navRef = useRef3(null);
|
|
@@ -3787,6 +3788,11 @@ var Navigation = ({
|
|
|
3787
3788
|
isOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed"
|
|
3788
3789
|
);
|
|
3789
3790
|
}, [isOpen, activatedLanguage]);
|
|
3791
|
+
const handleLinkKeyDown = (event) => {
|
|
3792
|
+
if (event.key === "Enter") {
|
|
3793
|
+
setKeyboardNavigationClose == null ? void 0 : setKeyboardNavigationClose();
|
|
3794
|
+
}
|
|
3795
|
+
};
|
|
3790
3796
|
return /* @__PURE__ */ jsxs24(Fragment18, { children: [
|
|
3791
3797
|
/* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
3792
3798
|
/* @__PURE__ */ jsxs24(
|
|
@@ -3817,7 +3823,15 @@ var Navigation = ({
|
|
|
3817
3823
|
lang: activatedLanguage,
|
|
3818
3824
|
children: [
|
|
3819
3825
|
/* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsxs24("div", { className: "pts-navigation-button", children: [
|
|
3820
|
-
/* @__PURE__ */ jsx28("span", { children: href && href.length === 0 ? /* @__PURE__ */ jsx28("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ jsx28(
|
|
3826
|
+
/* @__PURE__ */ jsx28("span", { children: href && href.length === 0 ? /* @__PURE__ */ jsx28("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ jsx28(
|
|
3827
|
+
LinkComponent,
|
|
3828
|
+
{
|
|
3829
|
+
onClick: handleCloseButton,
|
|
3830
|
+
href,
|
|
3831
|
+
onKeyDown: handleLinkKeyDown,
|
|
3832
|
+
children: label[activatedLanguage]
|
|
3833
|
+
}
|
|
3834
|
+
) }),
|
|
3821
3835
|
children && /* @__PURE__ */ jsx28(
|
|
3822
3836
|
"button",
|
|
3823
3837
|
{
|
|
@@ -3840,7 +3854,15 @@ var Navigation = ({
|
|
|
3840
3854
|
className: "pts-sub-navigation-container",
|
|
3841
3855
|
id: "sub-menu-" + index,
|
|
3842
3856
|
role: "region",
|
|
3843
|
-
children: /* @__PURE__ */ jsx28("ul", { className: "pts-sub-navigation-list", lang: activatedLanguage, children: children.map(({ label: label2, href: href2 }, index2) => /* @__PURE__ */ jsx28("li", { className: "pts-sub-navigation-item", lang: activatedLanguage, children: /* @__PURE__ */ jsx28(
|
|
3857
|
+
children: /* @__PURE__ */ jsx28("ul", { className: "pts-sub-navigation-list", lang: activatedLanguage, children: children.map(({ label: label2, href: href2 }, index2) => /* @__PURE__ */ jsx28("li", { className: "pts-sub-navigation-item", lang: activatedLanguage, children: /* @__PURE__ */ jsx28(
|
|
3858
|
+
LinkComponent,
|
|
3859
|
+
{
|
|
3860
|
+
onClick: handleCloseButton,
|
|
3861
|
+
href: href2,
|
|
3862
|
+
onKeyDown: handleLinkKeyDown,
|
|
3863
|
+
children: label2[activatedLanguage]
|
|
3864
|
+
}
|
|
3865
|
+
) }, "nav-child-" + index2)) })
|
|
3844
3866
|
}
|
|
3845
3867
|
)
|
|
3846
3868
|
]
|
|
@@ -3935,14 +3957,14 @@ var NavigationHeader = ({
|
|
|
3935
3957
|
};
|
|
3936
3958
|
const [isMenuOpen, setIsMenuOpen] = useState11(false);
|
|
3937
3959
|
const [hasBeenOpen, setHasBeenOpen] = useState11(false);
|
|
3960
|
+
const shouldRestoreFocusRef = useRef4(false);
|
|
3938
3961
|
useEffect14(() => {
|
|
3939
3962
|
var _a;
|
|
3940
|
-
|
|
3941
|
-
if (!isMenuOpen && navigationCloseFocusId && hasBeenOpen) {
|
|
3963
|
+
if (!isMenuOpen && navigationCloseFocusId && hasBeenOpen && shouldRestoreFocusRef.current) {
|
|
3942
3964
|
(_a = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _a.focus();
|
|
3943
|
-
|
|
3965
|
+
shouldRestoreFocusRef.current = false;
|
|
3944
3966
|
}
|
|
3945
|
-
}, [isMenuOpen]);
|
|
3967
|
+
}, [isMenuOpen, navigationCloseFocusId, hasBeenOpen]);
|
|
3946
3968
|
const handleMenuClick = () => {
|
|
3947
3969
|
setIsMenuOpen((prev) => {
|
|
3948
3970
|
const open = !prev;
|
|
@@ -4036,7 +4058,10 @@ var NavigationHeader = ({
|
|
|
4036
4058
|
menuLinks,
|
|
4037
4059
|
isOpen: isMenuOpen,
|
|
4038
4060
|
openButtonRef: menuButtonFocusRef,
|
|
4039
|
-
linkComponent: LinkComponent
|
|
4061
|
+
linkComponent: LinkComponent,
|
|
4062
|
+
setKeyboardNavigationClose: () => {
|
|
4063
|
+
shouldRestoreFocusRef.current = true;
|
|
4064
|
+
}
|
|
4040
4065
|
}
|
|
4041
4066
|
),
|
|
4042
4067
|
isMenuOpen && /* @__PURE__ */ jsx31(
|
|
@@ -4210,7 +4235,7 @@ var Collapse = ({
|
|
|
4210
4235
|
"aria-controls": contentId,
|
|
4211
4236
|
children: [
|
|
4212
4237
|
`${isOpen ? closeLabel : openLabel} ${title}`,
|
|
4213
|
-
/* @__PURE__ */ jsx36("span", { className: "pts-open-close-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx36(CollapseIcon, {}) : /* @__PURE__ */ jsx36(ExpandIcon, {}) })
|
|
4238
|
+
/* @__PURE__ */ jsx36("span", { className: "pts-collapse-open-close-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx36(CollapseIcon, {}) : /* @__PURE__ */ jsx36(ExpandIcon, {}) })
|
|
4214
4239
|
]
|
|
4215
4240
|
}
|
|
4216
4241
|
),
|