optimized-react-component-library-xyz123 2.8.2 → 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 +43 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -15
- 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);
|
|
@@ -3777,15 +3778,23 @@ var Navigation = ({
|
|
|
3777
3778
|
}
|
|
3778
3779
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
3779
3780
|
};
|
|
3780
|
-
const setInstruction = ()
|
|
3781
|
+
const [instruction, setInstruction] = useState9("");
|
|
3782
|
+
useEffect13(() => {
|
|
3781
3783
|
if (firstVisitRef.current) {
|
|
3782
3784
|
firstVisitRef.current = false;
|
|
3783
|
-
return
|
|
3785
|
+
return;
|
|
3786
|
+
}
|
|
3787
|
+
setInstruction(
|
|
3788
|
+
isOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed"
|
|
3789
|
+
);
|
|
3790
|
+
}, [isOpen, activatedLanguage]);
|
|
3791
|
+
const handleLinkKeyDown = (event) => {
|
|
3792
|
+
if (event.key === "Enter") {
|
|
3793
|
+
setKeyboardNavigationClose == null ? void 0 : setKeyboardNavigationClose();
|
|
3784
3794
|
}
|
|
3785
|
-
return isOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed";
|
|
3786
3795
|
};
|
|
3787
3796
|
return /* @__PURE__ */ jsxs24(Fragment18, { children: [
|
|
3788
|
-
/* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children:
|
|
3797
|
+
/* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
3789
3798
|
/* @__PURE__ */ jsxs24(
|
|
3790
3799
|
"nav",
|
|
3791
3800
|
{
|
|
@@ -3814,7 +3823,15 @@ var Navigation = ({
|
|
|
3814
3823
|
lang: activatedLanguage,
|
|
3815
3824
|
children: [
|
|
3816
3825
|
/* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsxs24("div", { className: "pts-navigation-button", children: [
|
|
3817
|
-
/* @__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
|
+
) }),
|
|
3818
3835
|
children && /* @__PURE__ */ jsx28(
|
|
3819
3836
|
"button",
|
|
3820
3837
|
{
|
|
@@ -3837,7 +3854,15 @@ var Navigation = ({
|
|
|
3837
3854
|
className: "pts-sub-navigation-container",
|
|
3838
3855
|
id: "sub-menu-" + index,
|
|
3839
3856
|
role: "region",
|
|
3840
|
-
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)) })
|
|
3841
3866
|
}
|
|
3842
3867
|
)
|
|
3843
3868
|
]
|
|
@@ -3932,14 +3957,14 @@ var NavigationHeader = ({
|
|
|
3932
3957
|
};
|
|
3933
3958
|
const [isMenuOpen, setIsMenuOpen] = useState11(false);
|
|
3934
3959
|
const [hasBeenOpen, setHasBeenOpen] = useState11(false);
|
|
3960
|
+
const shouldRestoreFocusRef = useRef4(false);
|
|
3935
3961
|
useEffect14(() => {
|
|
3936
3962
|
var _a;
|
|
3937
|
-
|
|
3938
|
-
if (!isMenuOpen && navigationCloseFocusId && hasBeenOpen) {
|
|
3963
|
+
if (!isMenuOpen && navigationCloseFocusId && hasBeenOpen && shouldRestoreFocusRef.current) {
|
|
3939
3964
|
(_a = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _a.focus();
|
|
3940
|
-
|
|
3965
|
+
shouldRestoreFocusRef.current = false;
|
|
3941
3966
|
}
|
|
3942
|
-
}, [isMenuOpen]);
|
|
3967
|
+
}, [isMenuOpen, navigationCloseFocusId, hasBeenOpen]);
|
|
3943
3968
|
const handleMenuClick = () => {
|
|
3944
3969
|
setIsMenuOpen((prev) => {
|
|
3945
3970
|
const open = !prev;
|
|
@@ -4033,7 +4058,10 @@ var NavigationHeader = ({
|
|
|
4033
4058
|
menuLinks,
|
|
4034
4059
|
isOpen: isMenuOpen,
|
|
4035
4060
|
openButtonRef: menuButtonFocusRef,
|
|
4036
|
-
linkComponent: LinkComponent
|
|
4061
|
+
linkComponent: LinkComponent,
|
|
4062
|
+
setKeyboardNavigationClose: () => {
|
|
4063
|
+
shouldRestoreFocusRef.current = true;
|
|
4064
|
+
}
|
|
4037
4065
|
}
|
|
4038
4066
|
),
|
|
4039
4067
|
isMenuOpen && /* @__PURE__ */ jsx31(
|
|
@@ -4207,7 +4235,7 @@ var Collapse = ({
|
|
|
4207
4235
|
"aria-controls": contentId,
|
|
4208
4236
|
children: [
|
|
4209
4237
|
`${isOpen ? closeLabel : openLabel} ${title}`,
|
|
4210
|
-
/* @__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, {}) })
|
|
4211
4239
|
]
|
|
4212
4240
|
}
|
|
4213
4241
|
),
|