optimized-react-component-library-xyz123 2.8.9 → 2.8.11
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 +28 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -59
- 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
|
{
|
|
@@ -2034,6 +2036,8 @@ var RadioCollapseItem = ({
|
|
|
2034
2036
|
useEffect7(() => {
|
|
2035
2037
|
if (questionAnswer === value) {
|
|
2036
2038
|
setIsOpen(true);
|
|
2039
|
+
} else {
|
|
2040
|
+
setIsOpen(false);
|
|
2037
2041
|
}
|
|
2038
2042
|
}, [questionAnswer, value]);
|
|
2039
2043
|
return /* @__PURE__ */ jsx20("div", { className: "pts-radio-option", children: /* @__PURE__ */ jsxs16("div", { className: "pts-radio-collapse", children: [
|
|
@@ -2052,7 +2056,7 @@ var RadioCollapseItem = ({
|
|
|
2052
2056
|
}
|
|
2053
2057
|
),
|
|
2054
2058
|
/* @__PURE__ */ jsx20("label", { htmlFor: `${groupId}-option-${index}`, id: `${groupId}-label-${index}`, children: label }),
|
|
2055
|
-
optionText && optionText.length > 0 && /* @__PURE__ */ jsx20(
|
|
2059
|
+
optionText && optionText.length > 0 && questionAnswer === value && /* @__PURE__ */ jsx20(
|
|
2056
2060
|
"button",
|
|
2057
2061
|
{
|
|
2058
2062
|
className: `pts-radio-collapse-button ${isOpen ? "open" : ""}`,
|
|
@@ -2063,6 +2067,7 @@ var RadioCollapseItem = ({
|
|
|
2063
2067
|
"aria-controls": contentId,
|
|
2064
2068
|
"aria-label": buttonLabel,
|
|
2065
2069
|
"aria-describedby": isOpen ? contentId : void 0,
|
|
2070
|
+
tabIndex: questionAnswer === value ? 0 : -1,
|
|
2066
2071
|
children: /* @__PURE__ */ jsx20("span", { className: "pts-open-close-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx20(CollapseIcon, {}) : /* @__PURE__ */ jsx20(ExpandIcon, {}) })
|
|
2067
2072
|
}
|
|
2068
2073
|
)
|
|
@@ -2072,6 +2077,7 @@ var RadioCollapseItem = ({
|
|
|
2072
2077
|
{
|
|
2073
2078
|
className: `pts-radio-collapse-body ${isOpen ? "open" : "hidden"}`,
|
|
2074
2079
|
id: contentId,
|
|
2080
|
+
hidden: !isOpen,
|
|
2075
2081
|
role: "region",
|
|
2076
2082
|
"aria-labelledby": `${groupId}-label-${index}`,
|
|
2077
2083
|
inert: !isOpen,
|
|
@@ -3719,20 +3725,16 @@ var Navigation = ({
|
|
|
3719
3725
|
activatedLanguage = "sv",
|
|
3720
3726
|
menuLinks = [],
|
|
3721
3727
|
openButtonRef = null,
|
|
3722
|
-
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props })
|
|
3723
|
-
navigationCloseFocusId
|
|
3728
|
+
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx28("a", { ...props })
|
|
3724
3729
|
}) => {
|
|
3725
3730
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3726
3731
|
const navRef = useRef3(null);
|
|
3727
|
-
const firstVisitRef = useRef3(true);
|
|
3728
3732
|
const [openSubMenu, setOpenSubMenu] = useState9(null);
|
|
3729
3733
|
const handleSubMenu = (label) => {
|
|
3730
3734
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
3731
3735
|
};
|
|
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());
|
|
3736
|
+
const handleCloseButton = () => {
|
|
3737
|
+
setIsMenyOpen && setIsMenyOpen(false);
|
|
3736
3738
|
};
|
|
3737
3739
|
useEffect13(() => {
|
|
3738
3740
|
if (!isOpen || !navRef.current) return;
|
|
@@ -3742,9 +3744,7 @@ var Navigation = ({
|
|
|
3742
3744
|
const firstElement = focusableElements[0];
|
|
3743
3745
|
const lastElement = focusableElements[focusableElements.length - 1];
|
|
3744
3746
|
if (!firstElement || !lastElement) return;
|
|
3745
|
-
|
|
3746
|
-
firstElement.focus();
|
|
3747
|
-
});
|
|
3747
|
+
firstElement == null ? void 0 : firstElement.focus();
|
|
3748
3748
|
const handleKeyDown = (event) => {
|
|
3749
3749
|
var _a;
|
|
3750
3750
|
if (event.key === "Escape") {
|
|
@@ -3782,21 +3782,8 @@ var Navigation = ({
|
|
|
3782
3782
|
}
|
|
3783
3783
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
3784
3784
|
};
|
|
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
3785
|
return /* @__PURE__ */ jsxs24(Fragment18, { children: [
|
|
3799
|
-
/* @__PURE__ */ jsx28("div", { "aria-live": "polite", className: "sr-only", children:
|
|
3786
|
+
/* @__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
3787
|
/* @__PURE__ */ jsxs24(
|
|
3801
3788
|
"nav",
|
|
3802
3789
|
{
|
|
@@ -3805,13 +3792,12 @@ var Navigation = ({
|
|
|
3805
3792
|
"aria-label": activatedLanguage === "sv" ? "Huvudnavigation" : "Main navigation",
|
|
3806
3793
|
className: `pts-navigation-menu-container ${isOpen ? "open" : ""}`,
|
|
3807
3794
|
inert: !isOpen,
|
|
3808
|
-
"aria-expanded": isOpen,
|
|
3809
3795
|
children: [
|
|
3810
3796
|
/* @__PURE__ */ jsx28("div", { className: "pts-navigation-close-container ", id: "menu-close", children: /* @__PURE__ */ jsxs24(
|
|
3811
3797
|
"button",
|
|
3812
3798
|
{
|
|
3813
3799
|
className: "pts-navigation-close-button",
|
|
3814
|
-
onClick:
|
|
3800
|
+
onClick: handleCloseButton,
|
|
3815
3801
|
type: "button",
|
|
3816
3802
|
children: [
|
|
3817
3803
|
/* @__PURE__ */ jsx28("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx28(CloseIcon, {}) }),
|
|
@@ -3826,14 +3812,7 @@ var Navigation = ({
|
|
|
3826
3812
|
lang: activatedLanguage,
|
|
3827
3813
|
children: [
|
|
3828
3814
|
/* @__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
|
-
) }),
|
|
3815
|
+
/* @__PURE__ */ jsx28("span", { children: href && href.length === 0 ? /* @__PURE__ */ jsx28("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ jsx28(LinkComponent, { onClick: handleCloseButton, href, children: label[activatedLanguage] }) }),
|
|
3837
3816
|
children && /* @__PURE__ */ jsx28(
|
|
3838
3817
|
"button",
|
|
3839
3818
|
{
|
|
@@ -3856,14 +3835,7 @@ var Navigation = ({
|
|
|
3856
3835
|
className: "pts-sub-navigation-container",
|
|
3857
3836
|
id: "sub-menu-" + index,
|
|
3858
3837
|
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)) })
|
|
3838
|
+
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
3839
|
}
|
|
3868
3840
|
)
|
|
3869
3841
|
]
|
|
@@ -3939,11 +3911,11 @@ var NavigationHeader = ({
|
|
|
3939
3911
|
SetActivatedLanguage = () => {
|
|
3940
3912
|
},
|
|
3941
3913
|
linkComponent: LinkComponent = (props) => /* @__PURE__ */ jsx31("a", { ...props }),
|
|
3942
|
-
noLogoLink = false
|
|
3943
|
-
navigationCloseFocusId
|
|
3914
|
+
noLogoLink = false
|
|
3944
3915
|
}) => {
|
|
3945
3916
|
const logoLink = activatedLanguage === "en" ? "https://pts.se/en" : "https://pts.se/";
|
|
3946
3917
|
const hasHeadline = headline && headline.length > 0;
|
|
3918
|
+
const menuButtonFocusRef = useRef4(null);
|
|
3947
3919
|
const handleLanguageClick = () => {
|
|
3948
3920
|
if (activatedLanguage === "sv") {
|
|
3949
3921
|
SetActivatedLanguage("en");
|
|
@@ -3956,7 +3928,6 @@ var NavigationHeader = ({
|
|
|
3956
3928
|
else return "Svenska";
|
|
3957
3929
|
};
|
|
3958
3930
|
const [isMenuOpen, setIsMenuOpen] = useState11(false);
|
|
3959
|
-
const menuButtonFocusRef = useRef4(null);
|
|
3960
3931
|
const handleMenuClick = () => {
|
|
3961
3932
|
setIsMenuOpen((prev) => !prev);
|
|
3962
3933
|
};
|
|
@@ -4036,7 +4007,7 @@ var NavigationHeader = ({
|
|
|
4036
4007
|
)
|
|
4037
4008
|
] }) })
|
|
4038
4009
|
] }) }),
|
|
4039
|
-
useNavigationMenu && /* @__PURE__ */ jsx31(
|
|
4010
|
+
useNavigationMenu && /* @__PURE__ */ jsx31(
|
|
4040
4011
|
NavigationStandard_default,
|
|
4041
4012
|
{
|
|
4042
4013
|
activatedLanguage,
|
|
@@ -4044,10 +4015,9 @@ var NavigationHeader = ({
|
|
|
4044
4015
|
menuLinks,
|
|
4045
4016
|
isOpen: isMenuOpen,
|
|
4046
4017
|
openButtonRef: menuButtonFocusRef,
|
|
4047
|
-
linkComponent: LinkComponent
|
|
4048
|
-
navigationCloseFocusId
|
|
4018
|
+
linkComponent: LinkComponent
|
|
4049
4019
|
}
|
|
4050
|
-
)
|
|
4020
|
+
),
|
|
4051
4021
|
isMenuOpen && /* @__PURE__ */ jsx31(
|
|
4052
4022
|
"div",
|
|
4053
4023
|
{
|
|
@@ -4156,7 +4126,6 @@ var LinkStandard = ({
|
|
|
4156
4126
|
target: openTarget,
|
|
4157
4127
|
rel: openTarget === "_blank" ? "noopener noreferrer" : void 0,
|
|
4158
4128
|
"aria-label": ariaLabel || void 0,
|
|
4159
|
-
lang: activatedLanguage,
|
|
4160
4129
|
children: [
|
|
4161
4130
|
IconComponent && /* @__PURE__ */ jsx34("span", { className: `pts-link-icon-circle ${iconClass} ${customClass}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx34(IconComponent, {}) }),
|
|
4162
4131
|
/* @__PURE__ */ jsx34("span", { className: "pts-standard-link-text", children: linkTitle })
|
|
@@ -4176,15 +4145,15 @@ var LinkList = ({
|
|
|
4176
4145
|
}) => {
|
|
4177
4146
|
const uniqueId = useId();
|
|
4178
4147
|
return /* @__PURE__ */ jsx35("div", { className: "pts-linkList-container", children: /* @__PURE__ */ jsx35("ul", { children: linkArray && linkArray.map((link, index) => {
|
|
4179
|
-
var _a, _b
|
|
4148
|
+
var _a, _b;
|
|
4180
4149
|
return /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35(
|
|
4181
4150
|
LinkStandard_default,
|
|
4182
4151
|
{
|
|
4183
4152
|
url: link.url,
|
|
4184
4153
|
title: link.title,
|
|
4185
|
-
activatedLanguage:
|
|
4186
|
-
ariaLabel: (
|
|
4187
|
-
openTarget: (
|
|
4154
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv",
|
|
4155
|
+
ariaLabel: (_a = link.ariaLabel) != null ? _a : void 0,
|
|
4156
|
+
openTarget: (_b = link.openTarget) != null ? _b : "_blank",
|
|
4188
4157
|
linkComponent: LinkComponent
|
|
4189
4158
|
}
|
|
4190
4159
|
) }, uniqueId + "_" + index);
|
|
@@ -4219,7 +4188,7 @@ var Collapse = ({
|
|
|
4219
4188
|
"aria-controls": contentId,
|
|
4220
4189
|
children: [
|
|
4221
4190
|
`${isOpen ? closeLabel : openLabel} ${title}`,
|
|
4222
|
-
/* @__PURE__ */ jsx36("span", { className: "pts-
|
|
4191
|
+
/* @__PURE__ */ jsx36("span", { className: "pts-open-close-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx36(CollapseIcon, {}) : /* @__PURE__ */ jsx36(ExpandIcon, {}) })
|
|
4223
4192
|
]
|
|
4224
4193
|
}
|
|
4225
4194
|
),
|