optimized-react-component-library-xyz123 2.8.9 → 2.8.10
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 +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +23 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/darkMode.css +6 -4
- package/src/css/e-tjanst-root.css +2 -2
- package/src/css/questions.css +15 -4
- package/src/css/styles.css +18 -23
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: "16", viewBox: "0 0 16 16", 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: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx16(
|
|
1434
1434
|
"path",
|
|
1435
1435
|
{
|
|
1436
1436
|
fillRule: "evenodd",
|
|
@@ -1906,7 +1906,9 @@ import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
|
1906
1906
|
var TextBody = ({ data }) => {
|
|
1907
1907
|
return /* @__PURE__ */ jsxs15("div", { className: "pts-textBody-container", children: [
|
|
1908
1908
|
/* @__PURE__ */ jsxs15("div", { className: `${!data.body || !data.linksForMoreInfo ? "" : "pts-textbody-createspace"}`, children: [
|
|
1909
|
-
data.body && /* @__PURE__ */ jsx18("div", { dangerouslySetInnerHTML: { __html: DOMPurify5.sanitize(data.body
|
|
1909
|
+
data.body && /* @__PURE__ */ jsx18("div", { dangerouslySetInnerHTML: { __html: DOMPurify5.sanitize(data.body, {
|
|
1910
|
+
ALLOWED_ATTR: ["target", "href"]
|
|
1911
|
+
}) } }),
|
|
1910
1912
|
data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ jsx18("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ jsx18("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ jsxs15(
|
|
1911
1913
|
"a",
|
|
1912
1914
|
{
|
|
@@ -3719,20 +3721,16 @@ var Navigation = ({
|
|
|
3719
3721
|
activatedLanguage = "sv",
|
|
3720
3722
|
menuLinks = [],
|
|
3721
3723
|
openButtonRef = null,
|
|
3722
|
-
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props })
|
|
3723
|
-
navigationCloseFocusId
|
|
3724
|
+
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props })
|
|
3724
3725
|
}) => {
|
|
3725
3726
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3726
3727
|
const navRef = useRef3(null);
|
|
3727
|
-
const firstVisitRef = useRef3(true);
|
|
3728
3728
|
const [openSubMenu, setOpenSubMenu] = useState9(null);
|
|
3729
3729
|
const handleSubMenu = (label) => {
|
|
3730
3730
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
3731
3731
|
};
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3734
|
-
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3735
|
-
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
3732
|
+
const handleCloseButton = () => {
|
|
3733
|
+
setIsMenyOpen && setIsMenyOpen(false);
|
|
3736
3734
|
};
|
|
3737
3735
|
useEffect13(() => {
|
|
3738
3736
|
if (!isOpen || !navRef.current) return;
|
|
@@ -3742,9 +3740,7 @@ var Navigation = ({
|
|
|
3742
3740
|
const firstElement = focusableElements[0];
|
|
3743
3741
|
const lastElement = focusableElements[focusableElements.length - 1];
|
|
3744
3742
|
if (!firstElement || !lastElement) return;
|
|
3745
|
-
|
|
3746
|
-
firstElement.focus();
|
|
3747
|
-
});
|
|
3743
|
+
firstElement == null ? void 0 : firstElement.focus();
|
|
3748
3744
|
const handleKeyDown = (event) => {
|
|
3749
3745
|
var _a;
|
|
3750
3746
|
if (event.key === "Escape") {
|
|
@@ -3782,21 +3778,8 @@ var Navigation = ({
|
|
|
3782
3778
|
}
|
|
3783
3779
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
3784
3780
|
};
|
|
3785
|
-
const [instruction, setInstruction] = useState9("");
|
|
3786
|
-
useEffect13(() => {
|
|
3787
|
-
if (firstVisitRef.current) {
|
|
3788
|
-
firstVisitRef.current = false;
|
|
3789
|
-
return;
|
|
3790
|
-
}
|
|
3791
|
-
if (isOpen)
|
|
3792
|
-
requestAnimationFrame(() => {
|
|
3793
|
-
setInstruction(
|
|
3794
|
-
activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened"
|
|
3795
|
-
);
|
|
3796
|
-
});
|
|
3797
|
-
}, [isOpen, activatedLanguage]);
|
|
3798
3781
|
return /* @__PURE__ */ jsxs24(Fragment18, { children: [
|
|
3799
|
-
/* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children:
|
|
3782
|
+
/* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children: isOpen ? activatedLanguage === "sv" ? "Navigationsmenyn \xF6ppnades" : "Navigation menu opened" : activatedLanguage === "sv" ? "Navigationsmenyn st\xE4ngdes" : "Navigation menu closed" }),
|
|
3800
3783
|
/* @__PURE__ */ jsxs24(
|
|
3801
3784
|
"nav",
|
|
3802
3785
|
{
|
|
@@ -3805,13 +3788,12 @@ var Navigation = ({
|
|
|
3805
3788
|
"aria-label": activatedLanguage === "sv" ? "Huvudnavigation" : "Main navigation",
|
|
3806
3789
|
className: `pts-navigation-menu-container ${isOpen ? "open" : ""}`,
|
|
3807
3790
|
inert: !isOpen,
|
|
3808
|
-
"aria-expanded": isOpen,
|
|
3809
3791
|
children: [
|
|
3810
3792
|
/* @__PURE__ */ jsx28("div", { className: "pts-navigation-close-container ", id: "menu-close", children: /* @__PURE__ */ jsxs24(
|
|
3811
3793
|
"button",
|
|
3812
3794
|
{
|
|
3813
3795
|
className: "pts-navigation-close-button",
|
|
3814
|
-
onClick:
|
|
3796
|
+
onClick: handleCloseButton,
|
|
3815
3797
|
type: "button",
|
|
3816
3798
|
children: [
|
|
3817
3799
|
/* @__PURE__ */ jsx28("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx28(CloseIcon, {}) }),
|
|
@@ -3826,14 +3808,7 @@ var Navigation = ({
|
|
|
3826
3808
|
lang: activatedLanguage,
|
|
3827
3809
|
children: [
|
|
3828
3810
|
/* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsxs24("div", { className: "pts-navigation-button", children: [
|
|
3829
|
-
/* @__PURE__ */ jsx28("span", { children: href && href.length === 0 ? /* @__PURE__ */ jsx28("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ jsx28(
|
|
3830
|
-
LinkComponent,
|
|
3831
|
-
{
|
|
3832
|
-
onClick: () => handleMenuClick("link"),
|
|
3833
|
-
href,
|
|
3834
|
-
children: label[activatedLanguage]
|
|
3835
|
-
}
|
|
3836
|
-
) }),
|
|
3811
|
+
/* @__PURE__ */ jsx28("span", { children: href && href.length === 0 ? /* @__PURE__ */ jsx28("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ jsx28(LinkComponent, { onClick: handleCloseButton, href, children: label[activatedLanguage] }) }),
|
|
3837
3812
|
children && /* @__PURE__ */ jsx28(
|
|
3838
3813
|
"button",
|
|
3839
3814
|
{
|
|
@@ -3856,14 +3831,7 @@ var Navigation = ({
|
|
|
3856
3831
|
className: "pts-sub-navigation-container",
|
|
3857
3832
|
id: "sub-menu-" + index,
|
|
3858
3833
|
role: "region",
|
|
3859
|
-
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(
|
|
3860
|
-
LinkComponent,
|
|
3861
|
-
{
|
|
3862
|
-
onClick: () => handleMenuClick("link"),
|
|
3863
|
-
href: href2,
|
|
3864
|
-
children: label2[activatedLanguage]
|
|
3865
|
-
}
|
|
3866
|
-
) }, "nav-child-" + index2)) })
|
|
3834
|
+
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(LinkComponent, { onClick: handleCloseButton, href: href2, children: label2[activatedLanguage] }) }, "nav-child-" + index2)) })
|
|
3867
3835
|
}
|
|
3868
3836
|
)
|
|
3869
3837
|
]
|
|
@@ -3939,11 +3907,11 @@ var NavigationHeader = ({
|
|
|
3939
3907
|
SetActivatedLanguage = () => {
|
|
3940
3908
|
},
|
|
3941
3909
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx31("a", { ...props }),
|
|
3942
|
-
noLogoLink = false
|
|
3943
|
-
navigationCloseFocusId
|
|
3910
|
+
noLogoLink = false
|
|
3944
3911
|
}) => {
|
|
3945
3912
|
const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
|
|
3946
3913
|
const hasHeadline = headline && headline.length > 0;
|
|
3914
|
+
const menuButtonFocusRef = useRef4(null);
|
|
3947
3915
|
const handleLanguageClick = () => {
|
|
3948
3916
|
if (activatedLanguage === "sv") {
|
|
3949
3917
|
SetActivatedLanguage("en");
|
|
@@ -3956,7 +3924,6 @@ var NavigationHeader = ({
|
|
|
3956
3924
|
else return "Svenska";
|
|
3957
3925
|
};
|
|
3958
3926
|
const [isMenuOpen, setIsMenuOpen] = useState11(false);
|
|
3959
|
-
const menuButtonFocusRef = useRef4(null);
|
|
3960
3927
|
const handleMenuClick = () => {
|
|
3961
3928
|
setIsMenuOpen((prev) => !prev);
|
|
3962
3929
|
};
|
|
@@ -4036,7 +4003,7 @@ var NavigationHeader = ({
|
|
|
4036
4003
|
)
|
|
4037
4004
|
] }) })
|
|
4038
4005
|
] }) }),
|
|
4039
|
-
useNavigationMenu && /* @__PURE__ */ jsx31(
|
|
4006
|
+
useNavigationMenu && /* @__PURE__ */ jsx31(
|
|
4040
4007
|
NavigationStandard_default,
|
|
4041
4008
|
{
|
|
4042
4009
|
activatedLanguage,
|
|
@@ -4044,10 +4011,9 @@ var NavigationHeader = ({
|
|
|
4044
4011
|
menuLinks,
|
|
4045
4012
|
isOpen: isMenuOpen,
|
|
4046
4013
|
openButtonRef: menuButtonFocusRef,
|
|
4047
|
-
linkComponent: LinkComponent
|
|
4048
|
-
navigationCloseFocusId
|
|
4014
|
+
linkComponent: LinkComponent
|
|
4049
4015
|
}
|
|
4050
|
-
)
|
|
4016
|
+
),
|
|
4051
4017
|
isMenuOpen && /* @__PURE__ */ jsx31(
|
|
4052
4018
|
"div",
|
|
4053
4019
|
{
|
|
@@ -4156,7 +4122,6 @@ var LinkStandard = ({
|
|
|
4156
4122
|
target: openTarget,
|
|
4157
4123
|
rel: openTarget === "_blank" ? "noopener noreferrer" : void 0,
|
|
4158
4124
|
"aria-label": ariaLabel || void 0,
|
|
4159
|
-
lang: activatedLanguage,
|
|
4160
4125
|
children: [
|
|
4161
4126
|
IconComponent && /* @__PURE__ */ jsx34("span", { className: `pts-link-icon-circle ${iconClass} ${customClass}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx34(IconComponent, {}) }),
|
|
4162
4127
|
/* @__PURE__ */ jsx34("span", { className: "pts-standard-link-text", children: linkTitle })
|
|
@@ -4176,15 +4141,15 @@ var LinkList = ({
|
|
|
4176
4141
|
}) => {
|
|
4177
4142
|
const uniqueId = useId();
|
|
4178
4143
|
return /* @__PURE__ */ jsx35("div", { className: "pts-linkList-container", children: /* @__PURE__ */ jsx35("ul", { children: linkArray && linkArray.map((link, index) => {
|
|
4179
|
-
var _a, _b
|
|
4144
|
+
var _a, _b;
|
|
4180
4145
|
return /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35(
|
|
4181
4146
|
LinkStandard_default,
|
|
4182
4147
|
{
|
|
4183
4148
|
url: link.url,
|
|
4184
4149
|
title: link.title,
|
|
4185
|
-
activatedLanguage:
|
|
4186
|
-
ariaLabel: (
|
|
4187
|
-
openTarget: (
|
|
4150
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv",
|
|
4151
|
+
ariaLabel: (_a = link.ariaLabel) != null ? _a : void 0,
|
|
4152
|
+
openTarget: (_b = link.openTarget) != null ? _b : "_blank",
|
|
4188
4153
|
linkComponent: LinkComponent
|
|
4189
4154
|
}
|
|
4190
4155
|
) }, uniqueId + "_" + index);
|
|
@@ -4219,7 +4184,7 @@ var Collapse = ({
|
|
|
4219
4184
|
"aria-controls": contentId,
|
|
4220
4185
|
children: [
|
|
4221
4186
|
`${isOpen ? closeLabel : openLabel} ${title}`,
|
|
4222
|
-
/* @__PURE__ */ jsx36("span", { className: "pts-
|
|
4187
|
+
/* @__PURE__ */ jsx36("span", { className: "pts-open-close-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx36(CollapseIcon, {}) : /* @__PURE__ */ jsx36(ExpandIcon, {}) })
|
|
4223
4188
|
]
|
|
4224
4189
|
}
|
|
4225
4190
|
),
|