optimized-react-component-library-xyz123 3.1.1 → 3.2.1
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 +1713 -20
- package/dist/index.d.ts +1713 -20
- package/dist/index.js +86 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -16
package/dist/index.mjs
CHANGED
|
@@ -516,7 +516,7 @@ var PreviewTextField = ({
|
|
|
516
516
|
};
|
|
517
517
|
|
|
518
518
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
519
|
-
import { useCallback, useEffect as
|
|
519
|
+
import { useCallback, useEffect as useEffect5, useState as useState7 } from "react";
|
|
520
520
|
import clsx3 from "clsx";
|
|
521
521
|
|
|
522
522
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -622,7 +622,7 @@ var ExploreFiles = ({
|
|
|
622
622
|
var _a;
|
|
623
623
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
624
624
|
};
|
|
625
|
-
|
|
625
|
+
const addFilesInfoText = numberOfFiles > 0 ? activatedLanguage === "sv" ? `${numberOfFiles} filer valda (max ${allowedNumberOfFiles})` : `${numberOfFiles} files chosed (max ${allowedNumberOfFiles})` : activatedLanguage === "sv" ? "Ingen fil vald" : "No file chosen";
|
|
626
626
|
const ariaLabelText = `${activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"} ${addFilesInfoText}`;
|
|
627
627
|
return /* @__PURE__ */ jsx9(Fragment8, { children: /* @__PURE__ */ jsxs8("div", { className: "inputContainer", children: [
|
|
628
628
|
/* @__PURE__ */ jsxs8(
|
|
@@ -680,7 +680,7 @@ var ExploreFiles = ({
|
|
|
680
680
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
681
681
|
|
|
682
682
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
683
|
-
import
|
|
683
|
+
import { useEffect as useEffect4, useState as useState6, useRef as useRef3 } from "react";
|
|
684
684
|
import { Col, Row } from "react-bootstrap";
|
|
685
685
|
|
|
686
686
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
@@ -710,7 +710,7 @@ var SelectedFiles = ({
|
|
|
710
710
|
}) => {
|
|
711
711
|
const theDiv = useRef3(null);
|
|
712
712
|
const remove = (file) => {
|
|
713
|
-
|
|
713
|
+
const newFiles = questionObject.files.filter((f) => f !== file);
|
|
714
714
|
const newCountOfFiles = newFiles.length;
|
|
715
715
|
setNumberOfFiles(newCountOfFiles);
|
|
716
716
|
let e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
|
|
@@ -721,7 +721,7 @@ var SelectedFiles = ({
|
|
|
721
721
|
};
|
|
722
722
|
const useWindowWidth = () => {
|
|
723
723
|
const [windowWidth2, setWindowWidth] = useState6(window.innerWidth);
|
|
724
|
-
|
|
724
|
+
useEffect4(() => {
|
|
725
725
|
const handleResize = () => {
|
|
726
726
|
setWindowWidth(window.innerWidth);
|
|
727
727
|
};
|
|
@@ -744,7 +744,7 @@ var SelectedFiles = ({
|
|
|
744
744
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
745
745
|
const fileType = errorObj.FileName.split(".").pop();
|
|
746
746
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
747
|
-
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
747
|
+
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(Fragment10, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
|
|
748
748
|
/* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsx11("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ jsx11("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
|
|
749
749
|
/* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(
|
|
750
750
|
Col,
|
|
@@ -758,7 +758,7 @@ var SelectedFiles = ({
|
|
|
758
758
|
children: activatedLanguage === "sv" ? errorObj.svMessage : errorObj.enMessage
|
|
759
759
|
}
|
|
760
760
|
) })
|
|
761
|
-
] }
|
|
761
|
+
] }) }) }) }) }, `error-${errorObj.FileName}-${index}`);
|
|
762
762
|
})
|
|
763
763
|
] }) }),
|
|
764
764
|
/* @__PURE__ */ jsx11("div", { className: "addFile-error-close-button", children: /* @__PURE__ */ jsx11(
|
|
@@ -791,60 +791,67 @@ var SelectedFiles = ({
|
|
|
791
791
|
}
|
|
792
792
|
) })
|
|
793
793
|
] }) }),
|
|
794
|
-
questionObject.files.length > 0 && /* @__PURE__ */ jsx11(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
fill: "none",
|
|
810
|
-
children: /* @__PURE__ */ jsx11(
|
|
811
|
-
"path",
|
|
794
|
+
questionObject.files.length > 0 && /* @__PURE__ */ jsx11(
|
|
795
|
+
"ul",
|
|
796
|
+
{
|
|
797
|
+
className: "fileListUnorderedList",
|
|
798
|
+
"aria-label": activatedLanguage === "en" ? "Uploaded files" : "Uppladdade filer",
|
|
799
|
+
children: questionObject.files.map((file, index) => {
|
|
800
|
+
const indicatorfileName = file.FileName;
|
|
801
|
+
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
802
|
+
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
803
|
+
const fileType = file.FileName.split(".").pop();
|
|
804
|
+
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
805
|
+
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(Fragment10, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
|
|
806
|
+
/* @__PURE__ */ jsxs9("div", { className: "fileItem", children: [
|
|
807
|
+
/* @__PURE__ */ jsx11(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx11(
|
|
808
|
+
"svg",
|
|
812
809
|
{
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
810
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
811
|
+
width: "8",
|
|
812
|
+
height: "8",
|
|
813
|
+
viewBox: "0 0 8 8",
|
|
814
|
+
fill: "none",
|
|
815
|
+
children: /* @__PURE__ */ jsx11(
|
|
816
|
+
"path",
|
|
817
|
+
{
|
|
818
|
+
d: "M1 4.65913L2.8 6.45913L7 1.35913",
|
|
819
|
+
stroke: "white",
|
|
820
|
+
strokeWidth: "1.5",
|
|
821
|
+
strokeLinecap: "round"
|
|
822
|
+
}
|
|
823
|
+
)
|
|
817
824
|
}
|
|
818
|
-
)
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
825
|
+
) }) }),
|
|
826
|
+
/* @__PURE__ */ jsx11(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsxs9("span", { className: "mobileFirstFileName", children: [
|
|
827
|
+
mobileFirstFileName,
|
|
828
|
+
" (",
|
|
829
|
+
Math.ceil(file.FileSize / (1024 * 1024)),
|
|
830
|
+
" ",
|
|
831
|
+
"MB)"
|
|
832
|
+
] }) : /* @__PURE__ */ jsxs9("span", { className: "desktopFileName", children: [
|
|
833
|
+
file.FileName,
|
|
834
|
+
" (",
|
|
835
|
+
/* @__PURE__ */ jsx11("span", { className: "fileSizeText", children: file.FileSize < 1024 * 1024 ? `${Math.round(file.FileSize / 1024)} kB` : `${(file.FileSize / (1024 * 1024)).toFixed(1)} MB` }),
|
|
836
|
+
" ",
|
|
837
|
+
")"
|
|
838
|
+
] }) }),
|
|
839
|
+
/* @__PURE__ */ jsx11(Col, { className: "lastCol", children: /* @__PURE__ */ jsx11(
|
|
840
|
+
"button",
|
|
841
|
+
{
|
|
842
|
+
className: "selectedFilesLinkButton",
|
|
843
|
+
onClick: () => remove(file),
|
|
844
|
+
"aria-label": activatedLanguage === "sv" ? `Radera ${indicatorfileName}` : `Delete ${indicatorfileName}`,
|
|
845
|
+
children: activatedLanguage === "sv" ? "Radera" : "Delete"
|
|
846
|
+
}
|
|
847
|
+
) })
|
|
848
|
+
] }),
|
|
849
|
+
showIndicator && /* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(Col, { style: { width: "100%", padding: 0 }, children: /* @__PURE__ */ jsx11(IndicatorStandard_default, { filename: indicatorfileName }) }) }),
|
|
850
|
+
/* @__PURE__ */ jsx11(Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ jsx11(Col, { className: "makeSpace" }) })
|
|
851
|
+
] }, index) }) }) }) }, `file-${file.FileName}-${index}`);
|
|
852
|
+
})
|
|
853
|
+
}
|
|
854
|
+
),
|
|
848
855
|
/* @__PURE__ */ jsx11("div", { ref: theDiv, className: "pts-clipboard-container" })
|
|
849
856
|
] });
|
|
850
857
|
};
|
|
@@ -895,14 +902,14 @@ var AddFiles = ({
|
|
|
895
902
|
const [errorMessageAddingFile, setErrorMessageAddingFile] = useState7([]);
|
|
896
903
|
const [newFiles, setNewFiles] = useState7([]);
|
|
897
904
|
const [dropFilesText, setDropFilesText] = useState7("Dra och sl\xE4pp dina filer h\xE4r");
|
|
898
|
-
|
|
905
|
+
useEffect5(() => {
|
|
899
906
|
if (activatedLanguage === "sv") {
|
|
900
907
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
901
908
|
} else {
|
|
902
909
|
setDropFilesText("Drag and drop your files here");
|
|
903
910
|
}
|
|
904
911
|
}, [activatedLanguage]);
|
|
905
|
-
|
|
912
|
+
useEffect5(() => {
|
|
906
913
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
907
914
|
setNumberOfFiles(questionObject.files.length);
|
|
908
915
|
}
|
|
@@ -997,7 +1004,7 @@ var AddFiles = ({
|
|
|
997
1004
|
reader.readAsDataURL(file);
|
|
998
1005
|
});
|
|
999
1006
|
};
|
|
1000
|
-
|
|
1007
|
+
useEffect5(() => {
|
|
1001
1008
|
if (newFiles.length > 0) {
|
|
1002
1009
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1003
1010
|
const e = {
|
|
@@ -1015,7 +1022,7 @@ var AddFiles = ({
|
|
|
1015
1022
|
setNumberOfFiles(newCount);
|
|
1016
1023
|
};
|
|
1017
1024
|
const removeOneError = (errorIndex) => {
|
|
1018
|
-
|
|
1025
|
+
const newErrors = errorMessageAddingFile.filter((e, index) => index !== errorIndex);
|
|
1019
1026
|
setErrorMessageAddingFile(newErrors);
|
|
1020
1027
|
};
|
|
1021
1028
|
const removeError = () => {
|
|
@@ -1117,7 +1124,7 @@ var PreviewAddFiles = ({
|
|
|
1117
1124
|
};
|
|
1118
1125
|
|
|
1119
1126
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1120
|
-
import { useEffect as
|
|
1127
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1121
1128
|
import DOMPurify3 from "dompurify";
|
|
1122
1129
|
import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1123
1130
|
var SingleCheckbox = ({
|
|
@@ -1132,7 +1139,7 @@ var SingleCheckbox = ({
|
|
|
1132
1139
|
const aboutId = `about-${question.id}`;
|
|
1133
1140
|
const errorId = `error-${question.id}`;
|
|
1134
1141
|
const [checked, setChecked] = useState8(false);
|
|
1135
|
-
|
|
1142
|
+
useEffect6(() => {
|
|
1136
1143
|
if (question.answer && question.answer === "true") {
|
|
1137
1144
|
setChecked(true);
|
|
1138
1145
|
} else {
|
|
@@ -1141,7 +1148,7 @@ var SingleCheckbox = ({
|
|
|
1141
1148
|
}, [question.answer]);
|
|
1142
1149
|
const handleInputChange = (event) => {
|
|
1143
1150
|
setChecked(event.target.checked);
|
|
1144
|
-
|
|
1151
|
+
const answer = event.target.checked ? "true" : "false";
|
|
1145
1152
|
const e = { target: { value: answer } };
|
|
1146
1153
|
handleQuestionInputChange(e, question);
|
|
1147
1154
|
};
|
|
@@ -2063,7 +2070,7 @@ var InfoOnlyStandard_default = InputInfoOnly;
|
|
|
2063
2070
|
import React9 from "react";
|
|
2064
2071
|
|
|
2065
2072
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2066
|
-
import { useEffect as
|
|
2073
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
2067
2074
|
import DOMPurify7 from "dompurify";
|
|
2068
2075
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2069
2076
|
var RadioCollapseItem = ({
|
|
@@ -2085,7 +2092,7 @@ var RadioCollapseItem = ({
|
|
|
2085
2092
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2086
2093
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2087
2094
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2088
|
-
|
|
2095
|
+
useEffect7(() => {
|
|
2089
2096
|
if (questionAnswer === value) {
|
|
2090
2097
|
setIsOpen(true);
|
|
2091
2098
|
} else {
|
|
@@ -2194,7 +2201,7 @@ var RadioWithInfo = ({
|
|
|
2194
2201
|
children: [
|
|
2195
2202
|
groupedOptionArray.map((group, g_index) => {
|
|
2196
2203
|
var _a2;
|
|
2197
|
-
|
|
2204
|
+
const subId = "subheading-" + g_index;
|
|
2198
2205
|
return /* @__PURE__ */ jsxs17(React9.Fragment, { children: [
|
|
2199
2206
|
/* @__PURE__ */ jsx21("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2200
2207
|
/* @__PURE__ */ jsx21("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
|
|
@@ -2214,7 +2221,8 @@ var RadioWithInfo = ({
|
|
|
2214
2221
|
questionIsMandatory: (_c2 = question.isQuestionMandatory) != null ? _c2 : false,
|
|
2215
2222
|
optionText: (_e = (_d = group.items.find((optionInfo) => optionInfo.value === option.value)) == null ? void 0 : _d.info) != null ? _e : "",
|
|
2216
2223
|
activatedLanguage
|
|
2217
|
-
}
|
|
2224
|
+
},
|
|
2225
|
+
questionId + groupId + index
|
|
2218
2226
|
);
|
|
2219
2227
|
}) })
|
|
2220
2228
|
] }, subId);
|
|
@@ -3038,7 +3046,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3038
3046
|
};
|
|
3039
3047
|
|
|
3040
3048
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3041
|
-
import { useMemo, useEffect as
|
|
3049
|
+
import { useMemo, useEffect as useEffect9 } from "react";
|
|
3042
3050
|
var usePTSPageTitle = ({
|
|
3043
3051
|
formStatus,
|
|
3044
3052
|
activeStep,
|
|
@@ -3056,19 +3064,19 @@ var usePTSPageTitle = ({
|
|
|
3056
3064
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3057
3065
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3058
3066
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3059
|
-
|
|
3067
|
+
useEffect9(() => {
|
|
3060
3068
|
document.title = computedTitle;
|
|
3061
3069
|
}, [computedTitle]);
|
|
3062
3070
|
return computedTitle;
|
|
3063
3071
|
};
|
|
3064
3072
|
|
|
3065
3073
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3066
|
-
import { useEffect as
|
|
3074
|
+
import { useEffect as useEffect10 } from "react";
|
|
3067
3075
|
var useInputMethodDetection = ({
|
|
3068
3076
|
mouseClassName = "using-mouse",
|
|
3069
3077
|
keyboardToggleKey = "Tab"
|
|
3070
3078
|
} = {}) => {
|
|
3071
|
-
|
|
3079
|
+
useEffect10(() => {
|
|
3072
3080
|
const handleMouseDown = () => {
|
|
3073
3081
|
document.body.classList.add(mouseClassName);
|
|
3074
3082
|
};
|
|
@@ -3087,7 +3095,7 @@ var useInputMethodDetection = ({
|
|
|
3087
3095
|
};
|
|
3088
3096
|
|
|
3089
3097
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3090
|
-
import { useCallback as useCallback2, useEffect as
|
|
3098
|
+
import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState10 } from "react";
|
|
3091
3099
|
var useCookieConsent = ({
|
|
3092
3100
|
cookieName,
|
|
3093
3101
|
choiceKey,
|
|
@@ -3116,7 +3124,7 @@ var useCookieConsent = ({
|
|
|
3116
3124
|
}
|
|
3117
3125
|
setShowBanner(false);
|
|
3118
3126
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3119
|
-
|
|
3127
|
+
useEffect11(() => {
|
|
3120
3128
|
const cookiesAccepted = areCookiesAccepted();
|
|
3121
3129
|
const choiceMade = hasChoiceBeenMade();
|
|
3122
3130
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3245,7 +3253,7 @@ var QuestionRenderer = ({
|
|
|
3245
3253
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3246
3254
|
|
|
3247
3255
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3248
|
-
import { useEffect as
|
|
3256
|
+
import { useEffect as useEffect12, Fragment as Fragment18 } from "react";
|
|
3249
3257
|
import { Fragment as Fragment19, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3250
3258
|
var QuestionGroup = ({
|
|
3251
3259
|
questions,
|
|
@@ -3257,6 +3265,13 @@ var QuestionGroup = ({
|
|
|
3257
3265
|
markQuestionAsDisplayed
|
|
3258
3266
|
}) => {
|
|
3259
3267
|
var _a, _b, _c;
|
|
3268
|
+
useEffect12(() => {
|
|
3269
|
+
questions.forEach((question) => {
|
|
3270
|
+
if (question.visible && !question.isDisplayed) {
|
|
3271
|
+
markQuestionAsDisplayed(question);
|
|
3272
|
+
}
|
|
3273
|
+
});
|
|
3274
|
+
}, [questions]);
|
|
3260
3275
|
if (!questions || questions.length === 0) {
|
|
3261
3276
|
return null;
|
|
3262
3277
|
}
|
|
@@ -3265,13 +3280,6 @@ var QuestionGroup = ({
|
|
|
3265
3280
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3266
3281
|
(e) => e.startsWith("groupCheck-")
|
|
3267
3282
|
);
|
|
3268
|
-
useEffect13(() => {
|
|
3269
|
-
questions.forEach((question) => {
|
|
3270
|
-
if (question.visible && !question.isDisplayed) {
|
|
3271
|
-
markQuestionAsDisplayed(question);
|
|
3272
|
-
}
|
|
3273
|
-
});
|
|
3274
|
-
}, [questions]);
|
|
3275
3283
|
const groupQuestions = /* @__PURE__ */ jsx25(Fragment19, { children: questions.map((question, index) => {
|
|
3276
3284
|
var _a2;
|
|
3277
3285
|
return /* @__PURE__ */ jsx25(Fragment18, { children: /* @__PURE__ */ jsx25(
|
|
@@ -3948,7 +3956,7 @@ var HeaderStandard_default = Header;
|
|
|
3948
3956
|
import { useRef as useRef5, useState as useState13 } from "react";
|
|
3949
3957
|
|
|
3950
3958
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
3951
|
-
import { useEffect as
|
|
3959
|
+
import { useEffect as useEffect13, useState as useState11, useRef as useRef4 } from "react";
|
|
3952
3960
|
import { Fragment as Fragment20, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3953
3961
|
var Navigation = ({
|
|
3954
3962
|
setIsMenyOpen,
|
|
@@ -3956,7 +3964,7 @@ var Navigation = ({
|
|
|
3956
3964
|
activatedLanguage = "sv",
|
|
3957
3965
|
menuLinks = [],
|
|
3958
3966
|
openButtonRef = null,
|
|
3959
|
-
linkComponent: LinkComponent =
|
|
3967
|
+
linkComponent: LinkComponent = "a",
|
|
3960
3968
|
navigationCloseFocusId,
|
|
3961
3969
|
activePath = null
|
|
3962
3970
|
}) => {
|
|
@@ -3970,9 +3978,13 @@ var Navigation = ({
|
|
|
3970
3978
|
const handleMenuClick = (typeOfInteraction) => {
|
|
3971
3979
|
var _a, _b;
|
|
3972
3980
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3973
|
-
typeOfInteraction === "close"
|
|
3981
|
+
if (typeOfInteraction === "close") {
|
|
3982
|
+
(_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus();
|
|
3983
|
+
} else if (navigationCloseFocusId) {
|
|
3984
|
+
(_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus();
|
|
3985
|
+
}
|
|
3974
3986
|
};
|
|
3975
|
-
|
|
3987
|
+
useEffect13(() => {
|
|
3976
3988
|
var _a, _b;
|
|
3977
3989
|
if (!isOpen) {
|
|
3978
3990
|
setOpenSubMenu(null);
|
|
@@ -3984,7 +3996,7 @@ var Navigation = ({
|
|
|
3984
3996
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
3985
3997
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
3986
3998
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
3987
|
-
|
|
3999
|
+
useEffect13(() => {
|
|
3988
4000
|
if (!isOpen || !navRef.current) {
|
|
3989
4001
|
return;
|
|
3990
4002
|
}
|
|
@@ -4035,7 +4047,7 @@ var Navigation = ({
|
|
|
4035
4047
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4036
4048
|
};
|
|
4037
4049
|
const [instruction, setInstruction] = useState11("");
|
|
4038
|
-
|
|
4050
|
+
useEffect13(() => {
|
|
4039
4051
|
if (firstVisitRef.current) {
|
|
4040
4052
|
firstVisitRef.current = false;
|
|
4041
4053
|
return;
|
|
@@ -4184,7 +4196,7 @@ var NavigationHeader = ({
|
|
|
4184
4196
|
menuLinks = void 0,
|
|
4185
4197
|
SetActivatedLanguage = () => {
|
|
4186
4198
|
},
|
|
4187
|
-
linkComponent: LinkComponent =
|
|
4199
|
+
linkComponent: LinkComponent = "a",
|
|
4188
4200
|
noLogoLink = false,
|
|
4189
4201
|
navigationCloseFocusId,
|
|
4190
4202
|
activePath = null
|
|
@@ -4389,7 +4401,6 @@ var LinkStandard = ({
|
|
|
4389
4401
|
}) => {
|
|
4390
4402
|
let iconClass = "";
|
|
4391
4403
|
const excelExtensions = ["xls", "xlsx", "xlsm", "xlsb", "xltx", "xltm", "xlam", "csv"];
|
|
4392
|
-
let linkTitle = title;
|
|
4393
4404
|
const getFileExtension = (url2) => {
|
|
4394
4405
|
const match = url2.match(/\.([a-zA-Z0-9]+)(?=$|\?|#)/);
|
|
4395
4406
|
return match ? match[1] : null;
|
|
@@ -4411,7 +4422,7 @@ var LinkStandard = ({
|
|
|
4411
4422
|
}
|
|
4412
4423
|
}
|
|
4413
4424
|
}
|
|
4414
|
-
linkTitle = fileExtension !== null ? `${title} (${fileExtension})` : title;
|
|
4425
|
+
const linkTitle = fileExtension !== null ? `${title} (${fileExtension})` : title;
|
|
4415
4426
|
return /* @__PURE__ */ jsx36("div", { className: "pts-standard-link", children: /* @__PURE__ */ jsxs31(
|
|
4416
4427
|
LinkComponent,
|
|
4417
4428
|
{
|
|
@@ -4469,7 +4480,8 @@ var Collapse = ({
|
|
|
4469
4480
|
customClass = ""
|
|
4470
4481
|
}) => {
|
|
4471
4482
|
const [isOpen, setIsOpen] = useState14(defaultOpen);
|
|
4472
|
-
const
|
|
4483
|
+
const generatedId = useId2();
|
|
4484
|
+
const uniqueId = id != null ? id : generatedId;
|
|
4473
4485
|
const contentId = `${uniqueId}-content`;
|
|
4474
4486
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
4475
4487
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj" : "Hide";
|