optimized-react-component-library-xyz123 2.8.1 → 2.8.3
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 +35 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/darkMode.css +1 -1
- package/src/css/styles.css +6 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3806,6 +3806,7 @@ var Navigation = ({
|
|
|
3806
3806
|
}) => {
|
|
3807
3807
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3808
3808
|
const navRef = (0, import_react16.useRef)(null);
|
|
3809
|
+
const firstVisitRef = (0, import_react16.useRef)(true);
|
|
3809
3810
|
const [openSubMenu, setOpenSubMenu] = (0, import_react16.useState)(null);
|
|
3810
3811
|
const handleSubMenu = (label) => {
|
|
3811
3812
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
@@ -3859,8 +3860,18 @@ var Navigation = ({
|
|
|
3859
3860
|
}
|
|
3860
3861
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
3861
3862
|
};
|
|
3863
|
+
const [instruction, setInstruction] = (0, import_react16.useState)("");
|
|
3864
|
+
(0, import_react16.useEffect)(() => {
|
|
3865
|
+
if (firstVisitRef.current) {
|
|
3866
|
+
firstVisitRef.current = false;
|
|
3867
|
+
return;
|
|
3868
|
+
}
|
|
3869
|
+
setInstruction(
|
|
3870
|
+
isOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed"
|
|
3871
|
+
);
|
|
3872
|
+
}, [isOpen, activatedLanguage]);
|
|
3862
3873
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
3863
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-live": "polite", className: "sr-only", children:
|
|
3874
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-live": "polite", className: "sr-only", children: instruction }),
|
|
3864
3875
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3865
3876
|
"nav",
|
|
3866
3877
|
{
|
|
@@ -3988,7 +3999,8 @@ var NavigationHeader = ({
|
|
|
3988
3999
|
SetActivatedLanguage = () => {
|
|
3989
4000
|
},
|
|
3990
4001
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("a", { ...props }),
|
|
3991
|
-
noLogoLink = false
|
|
4002
|
+
noLogoLink = false,
|
|
4003
|
+
navigationCloseFocusId
|
|
3992
4004
|
}) => {
|
|
3993
4005
|
const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
|
|
3994
4006
|
const hasHeadline = headline && headline.length > 0;
|
|
@@ -4005,8 +4017,23 @@ var NavigationHeader = ({
|
|
|
4005
4017
|
else return "Svenska";
|
|
4006
4018
|
};
|
|
4007
4019
|
const [isMenuOpen, setIsMenuOpen] = (0, import_react18.useState)(false);
|
|
4020
|
+
const [hasBeenOpen, setHasBeenOpen] = (0, import_react18.useState)(false);
|
|
4021
|
+
(0, import_react18.useEffect)(() => {
|
|
4022
|
+
var _a;
|
|
4023
|
+
console.log(navigationCloseFocusId);
|
|
4024
|
+
if (!isMenuOpen && navigationCloseFocusId && hasBeenOpen) {
|
|
4025
|
+
(_a = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _a.focus();
|
|
4026
|
+
console.log(navigationCloseFocusId, document.getElementById(navigationCloseFocusId));
|
|
4027
|
+
}
|
|
4028
|
+
}, [isMenuOpen]);
|
|
4008
4029
|
const handleMenuClick = () => {
|
|
4009
|
-
setIsMenuOpen((prev) =>
|
|
4030
|
+
setIsMenuOpen((prev) => {
|
|
4031
|
+
const open = !prev;
|
|
4032
|
+
if (open) {
|
|
4033
|
+
setHasBeenOpen(true);
|
|
4034
|
+
}
|
|
4035
|
+
return open;
|
|
4036
|
+
});
|
|
4010
4037
|
};
|
|
4011
4038
|
const getMenuLabel = () => {
|
|
4012
4039
|
const labels = {
|
|
@@ -4203,6 +4230,7 @@ var LinkStandard = ({
|
|
|
4203
4230
|
target: openTarget,
|
|
4204
4231
|
rel: openTarget === "_blank" ? "noopener noreferrer" : void 0,
|
|
4205
4232
|
"aria-label": ariaLabel || void 0,
|
|
4233
|
+
lang: activatedLanguage,
|
|
4206
4234
|
children: [
|
|
4207
4235
|
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: `pts-link-icon-circle ${iconClass} ${customClass}`, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(IconComponent, {}) }),
|
|
4208
4236
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "pts-standard-link-text", children: linkTitle })
|
|
@@ -4222,15 +4250,15 @@ var LinkList = ({
|
|
|
4222
4250
|
}) => {
|
|
4223
4251
|
const uniqueId = (0, import_react19.useId)();
|
|
4224
4252
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "pts-linkList-container", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("ul", { children: linkArray && linkArray.map((link, index) => {
|
|
4225
|
-
var _a, _b;
|
|
4253
|
+
var _a, _b, _c;
|
|
4226
4254
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4227
4255
|
LinkStandard_default,
|
|
4228
4256
|
{
|
|
4229
4257
|
url: link.url,
|
|
4230
4258
|
title: link.title,
|
|
4231
|
-
activatedLanguage: activatedLanguage != null ?
|
|
4232
|
-
ariaLabel: (
|
|
4233
|
-
openTarget: (
|
|
4259
|
+
activatedLanguage: (_a = link.activatedLanguage) != null ? _a : activatedLanguage,
|
|
4260
|
+
ariaLabel: (_b = link.ariaLabel) != null ? _b : void 0,
|
|
4261
|
+
openTarget: (_c = link.openTarget) != null ? _c : "_blank",
|
|
4234
4262
|
linkComponent: LinkComponent
|
|
4235
4263
|
}
|
|
4236
4264
|
) }, uniqueId + "_" + index);
|