optimized-react-component-library-xyz123 0.1.113 → 0.1.114

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.js CHANGED
@@ -59,21 +59,7 @@ __export(index_exports, {
59
59
  TextFieldStandard: () => TextFieldStandard_default,
60
60
  TextHeadlineAndBodyStandard: () => TextHeadlineAndBodyStandard_default,
61
61
  ValidationCheckAllVisibleQuestion: () => ValidationCheckAllVisibleQuestion_default,
62
- ValidationErrorSummaryList: () => ValidationErrorSummaryList_default,
63
- createCookieConsent: () => createCookieConsent,
64
- createLanguageSlice: () => createLanguageSlice,
65
- createQuestionsSlice: () => createQuestionsSlice,
66
- focusElement: () => focusElement,
67
- getIdsGroupCheckValidationTypes: () => getIdsGroupCheckValidationTypes,
68
- isScriptLoaded: () => isScriptLoaded,
69
- makeLanguageSelectors: () => makeLanguageSelectors,
70
- makeQuestionsSelectors: () => makeQuestionsSelectors,
71
- removeScriptById: () => removeScriptById,
72
- toggleScriptByConsent: () => toggleScriptByConsent,
73
- useCookieConsent: () => useCookieConsent,
74
- useFormStatusModal: () => useFormStatusModal,
75
- useInputMethodDetection: () => useInputMethodDetection,
76
- usePTSPageTitle: () => usePTSPageTitle
62
+ ValidationErrorSummaryList: () => ValidationErrorSummaryList_default
77
63
  });
78
64
  module.exports = __toCommonJS(index_exports);
79
65
 
@@ -214,7 +200,7 @@ var PrevieMultipleCheckboxes = ({
214
200
  const previewId = `preview-${question.id}`;
215
201
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
216
202
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
217
- question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: question.options[0].label }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
203
+ question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: question.options[0].label }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
218
204
  var _a2;
219
205
  return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
220
206
  }).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
@@ -835,7 +821,7 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
835
821
  var DropFilesStandard_default = DropFiles;
836
822
 
837
823
  // src/NewInputComponentStandard/AddFilesStandard/ExploreFilesStandard.tsx
838
- var import_react4 = require("react");
824
+ var import_react4 = __toESM(require("react"));
839
825
  var import_clsx2 = __toESM(require("clsx"));
840
826
 
841
827
  // src/NewInputComponentStandard/AddFilesStandard/ScreenReaderErrors.tsx
@@ -843,7 +829,11 @@ var import_react3 = __toESM(require("react"));
843
829
  var import_jsx_runtime7 = require("react/jsx-runtime");
844
830
  var ScreenReaderErrors = ({
845
831
  errorMessageAddingFile,
846
- activatedLanguage
832
+ activatedLanguage,
833
+ removeUploadErrors,
834
+ putFocusOnButton = () => {
835
+ alert("no function");
836
+ }
847
837
  }) => {
848
838
  const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = import_react3.default.useState(false);
849
839
  const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react3.default.useState("");
@@ -859,7 +849,49 @@ var ScreenReaderErrors = ({
859
849
  setActivateErrorMessagesForScreenReader(true);
860
850
  }
861
851
  }, [errorMessageAddingFile]);
862
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: activateErrorMessagesForScreenReader && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "sr-only", "aria-atomic": "true", children: errorMessagesForScreenReader }) });
852
+ const handleRemoveErrors = () => {
853
+ const errorMessages = activatedLanguage === "sv" ? `Felmeddelande raderat.` : `Error message deleted.`;
854
+ setErrorMessagesForScreenReader(errorMessages);
855
+ removeUploadErrors();
856
+ putFocusOnButton();
857
+ setTimeout(() => {
858
+ setActivateErrorMessagesForScreenReader(false);
859
+ }, 1e3);
860
+ };
861
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
862
+ errorMessageAddingFile.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
863
+ "button",
864
+ {
865
+ onClick: handleRemoveErrors,
866
+ style: {
867
+ marginRight: "8px",
868
+ backgroundColor: "transparent",
869
+ border: "none",
870
+ textDecoration: "underline",
871
+ cursor: "pointer"
872
+ },
873
+ className: "errorMessageAddingFile",
874
+ "aria-label": activatedLanguage === "sv" ? "Ta bort felmeddelande f\xF6r uppladdning av filer" : "Remove error message for file uploads",
875
+ children: "Ta bort fel! / Remove errors!"
876
+ }
877
+ ),
878
+ activateErrorMessagesForScreenReader && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
879
+ "p",
880
+ {
881
+ role: "alert",
882
+ style: {
883
+ position: "absolute",
884
+ left: "-9999px",
885
+ top: "auto",
886
+ width: "1px",
887
+ height: "1px",
888
+ overflow: "hidden"
889
+ },
890
+ "aria-atomic": "true",
891
+ children: errorMessagesForScreenReader
892
+ }
893
+ )
894
+ ] });
863
895
  };
864
896
  var ScreenReaderErrors_default = ScreenReaderErrors;
865
897
 
@@ -867,6 +899,7 @@ var ScreenReaderErrors_default = ScreenReaderErrors;
867
899
  var import_jsx_runtime8 = require("react/jsx-runtime");
868
900
  var ExploreFiles = ({
869
901
  FilesSelected,
902
+ //UploadButtonText = 'upload files',
870
903
  numberOfFiles,
871
904
  allowedNumberOfFiles,
872
905
  activatedLanguage,
@@ -876,10 +909,28 @@ var ExploreFiles = ({
876
909
  errorId,
877
910
  questionObject,
878
911
  showErrors,
879
- errorMessageAddingFile
912
+ errorMessageAddingFile,
913
+ removeUploadErrors = () => {
914
+ alert("finns ingen funktion");
915
+ }
880
916
  }) => {
881
917
  const fileInputRef = (0, import_react4.useRef)(null);
882
918
  const buttonInputRef = (0, import_react4.useRef)(null);
919
+ const [showErrorMessagesForScreenReader, setShowErrorMessagesForScreenReader] = import_react4.default.useState(false);
920
+ const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react4.default.useState("");
921
+ (0, import_react4.useEffect)(() => {
922
+ const button = buttonInputRef.current;
923
+ if (!button) return;
924
+ const handleFocus = () => {
925
+ setShowErrorMessagesForScreenReader(!showErrorMessagesForScreenReader);
926
+ console.log("FOCUS!!");
927
+ console.log("Error messages for screen reader: " + errorMessageAddingFile);
928
+ };
929
+ button.addEventListener("focus", handleFocus);
930
+ return () => {
931
+ button.removeEventListener("focus", handleFocus);
932
+ };
933
+ }, []);
883
934
  const handleFiles = (event) => {
884
935
  const files = Array.from(event.target.files || []);
885
936
  FilesSelected(files);
@@ -889,18 +940,32 @@ var ExploreFiles = ({
889
940
  var _a;
890
941
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
891
942
  };
943
+ const handleRemoveErrors = () => {
944
+ const errorMessages = activatedLanguage === "sv" ? `Felmeddelande raderat.` : `Error message deleted.`;
945
+ setErrorMessagesForScreenReader(errorMessages);
946
+ removeUploadErrors();
947
+ putFocusOnButton();
948
+ setTimeout(() => {
949
+ setShowErrorMessagesForScreenReader(false);
950
+ }, 1e3);
951
+ };
952
+ const putFocusOnButton = () => {
953
+ var _a;
954
+ (_a = buttonInputRef.current) == null ? void 0 : _a.focus();
955
+ };
892
956
  let addFilesInfoText = numberOfFiles > 0 ? activatedLanguage === "sv" ? `${numberOfFiles} filer valda (max ${allowedNumberOfFiles})` : `${numberOfFiles} files chosed (max ${allowedNumberOfFiles})` : activatedLanguage === "sv" ? "Ingen fil vald" : "No file chosen";
893
- const ariaLabelText = `${activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"} ${addFilesInfoText}`;
894
957
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "inputContainer", children: [
895
958
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
896
- "div",
959
+ "label",
897
960
  {
961
+ tabIndex: -1,
898
962
  className: (0, import_clsx2.default)(
899
963
  ["form-control"],
900
964
  "filePickLabel",
901
965
  showErrors && questionObject.error ? ["form-control error"] : ""
902
966
  ),
903
967
  id: labelId,
968
+ htmlFor: inputId,
904
969
  children: [
905
970
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
906
971
  "button",
@@ -911,34 +976,34 @@ var ExploreFiles = ({
911
976
  "filePickButton",
912
977
  showErrors && questionObject.error ? "filePickButton error" : ""
913
978
  ),
914
- "aria-describedby": `${aboutId} ${questionObject.hasValidationError ? errorId : ""}`.trim(),
915
- "aria-label": ariaLabelText,
979
+ "aria-describedby": `${aboutId} ${showErrors && questionObject.error ? errorId : ""}`.trim(),
980
+ "aria-label": `${activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"} ${addFilesInfoText}`,
916
981
  children: activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"
917
982
  }
918
983
  ),
919
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": true, className: "filePickText", children: addFilesInfoText }),
920
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { htmlFor: inputId, "aria-hidden": true, className: "invisible" })
984
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
985
+ "input",
986
+ {
987
+ ref: fileInputRef,
988
+ type: "file",
989
+ className: "invisible",
990
+ multiple: true,
991
+ onChange: handleFiles,
992
+ tabIndex: -1,
993
+ id: inputId
994
+ }
995
+ ),
996
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "filePickText", children: addFilesInfoText })
921
997
  ]
922
998
  }
923
999
  ),
924
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
925
- "input",
926
- {
927
- "aria-hidden": true,
928
- ref: fileInputRef,
929
- type: "file",
930
- className: "invisible",
931
- multiple: true,
932
- onChange: handleFiles,
933
- tabIndex: -1,
934
- id: inputId
935
- }
936
- ),
937
1000
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
938
1001
  ScreenReaderErrors_default,
939
1002
  {
940
1003
  errorMessageAddingFile,
941
- activatedLanguage
1004
+ removeUploadErrors,
1005
+ activatedLanguage,
1006
+ putFocusOnButton
942
1007
  }
943
1008
  )
944
1009
  ] }) });
@@ -972,12 +1037,11 @@ var SelectedFiles = ({
972
1037
  errorMessageAddingFile,
973
1038
  activatedLanguage,
974
1039
  numberOfFiles,
975
- setNumberOfFiles,
976
- removeUploadErrors
1040
+ setNumberOfFiles
977
1041
  }) => {
978
1042
  const theDiv = (0, import_react6.useRef)(null);
979
1043
  const remove = (file) => {
980
- let newFiles = questionObject.files.filter((f) => f !== file);
1044
+ let newFiles = questionObject.Files.filter((f) => f !== file);
981
1045
  const newCountOfFiles = newFiles.length;
982
1046
  setNumberOfFiles(newCountOfFiles);
983
1047
  const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
@@ -1003,54 +1067,58 @@ var SelectedFiles = ({
1003
1067
  };
1004
1068
  const windowWidth = useWindowWidth();
1005
1069
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1006
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
1007
- errorMessageAddingFile.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { "aria-hidden": true, className: "fileListUnorderedList", children: [
1008
- " ",
1009
- errorMessageAddingFile.map((errorObj, index) => {
1010
- const errorFileName = errorObj.FileName;
1011
- let mobileFirstFileName = errorObj.FileName.split(".").shift();
1012
- mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
1013
- const fileType = errorObj.FileName.split(".").pop();
1014
- mobileFirstFileName = mobileFirstFileName + "." + fileType;
1015
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react6.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "fileInList", children: [
1016
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_bootstrap.Row, { children: [
1017
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1018
- "span",
1019
- {
1020
- "aria-hidden": "true",
1021
- className: (0, import_clsx4.default)("uploadedDot", "uploadFailed"),
1022
- children: "!"
1023
- }
1024
- ) }),
1025
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "desktopFileName", children: errorObj.FileName }) }),
1026
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { className: "lastCol" })
1027
- ] }),
1028
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1029
- import_react_bootstrap.Col,
1070
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: errorMessageAddingFile.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { className: "fileListUnorderedList", "aria-label": "Valideringsfelmeddelanden f\xF6r uppladdade filer", children: [
1071
+ " ",
1072
+ errorMessageAddingFile.map((errorObj, index) => {
1073
+ const errorFileName = errorObj.FileName;
1074
+ let mobileFirstFileName = errorObj.FileName.split(".").shift();
1075
+ mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
1076
+ const fileType = errorObj.FileName.split(".").pop();
1077
+ mobileFirstFileName = mobileFirstFileName + "." + fileType;
1078
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react6.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fileInListContainer", role: "alert", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "fileInList", children: [
1079
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_bootstrap.Row, { children: [
1080
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1081
+ "span",
1030
1082
  {
1031
- style: {
1032
- width: "100%",
1033
- color: "#8e0039"
1034
- },
1035
- className: "errorMessageAddingFile",
1036
- ...activatedLanguage === "sv" ? {
1037
- "aria-label": `${errorFileName} ${errorObj.svMessage}`
1038
- } : {
1039
- "aria-label": `${errorFileName} ${errorObj.enMessage}`
1040
- },
1041
- children: activatedLanguage === "sv" ? errorObj.svMessage : errorObj.enMessage
1083
+ "aria-hidden": "true",
1084
+ className: (0, import_clsx4.default)("uploadedDot", "uploadFailed"),
1085
+ children: "!"
1042
1086
  }
1043
1087
  ) }),
1044
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { className: "makeSpace" }) })
1045
- ] }, index) }) }) }, `error-${errorObj.FileName}-${index}`) });
1046
- })
1047
- ] }),
1048
- errorMessageAddingFile.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { onClick: removeUploadErrors, className: "errorMessageAddingFile", children: [
1049
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "X" }),
1050
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: "Ta bort felmeddelande f\xF6r uppladdning av filer" })
1051
- ] })
1052
- ] }),
1053
- questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
1088
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "desktopFileName", children: errorObj.FileName }) }),
1089
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { className: "lastCol", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1090
+ "button",
1091
+ {
1092
+ className: "selectedFilesLinkButton",
1093
+ onClick: () => {
1094
+ removeError(index);
1095
+ },
1096
+ "aria-label": activatedLanguage === "sv" ? `St\xE4ng felmeddelandet f\xF6r ${errorFileName}` : `Close error message for ${errorFileName}`,
1097
+ children: activatedLanguage === "sv" ? "St\xE4ng" : "Close"
1098
+ }
1099
+ ) })
1100
+ ] }),
1101
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1102
+ import_react_bootstrap.Col,
1103
+ {
1104
+ style: {
1105
+ width: "100%",
1106
+ color: "#8e0039"
1107
+ },
1108
+ className: "errorMessageAddingFile",
1109
+ ...activatedLanguage === "sv" ? {
1110
+ "aria-label": `${errorFileName} ${errorObj.svMessage}`
1111
+ } : {
1112
+ "aria-label": `${errorFileName} ${errorObj.enMessage}`
1113
+ },
1114
+ children: activatedLanguage === "sv" ? errorObj.svMessage : errorObj.enMessage
1115
+ }
1116
+ ) }),
1117
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { className: "makeSpace" }) })
1118
+ ] }, index) }) }) }, `error-${errorObj.FileName}-${index}`) });
1119
+ })
1120
+ ] }) }),
1121
+ questionObject.Files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.Files.map((file, index) => {
1054
1122
  const indicatorfileName = file.FileName;
1055
1123
  let mobileFirstFileName = file.FileName.split(".").shift();
1056
1124
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
@@ -1081,12 +1149,13 @@ var SelectedFiles = ({
1081
1149
  mobileFirstFileName,
1082
1150
  " (",
1083
1151
  Math.ceil(file.FileSize / (1024 * 1024)),
1084
- " ",
1085
- "MB)"
1152
+ " MB)"
1086
1153
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "desktopFileName", children: [
1087
1154
  file.FileName,
1088
1155
  " (",
1089
- file.FileSize < 1024 * 1024 ? `${Math.round(file.FileSize / 1024)} kB` : `${(file.FileSize / (1024 * 1024)).toFixed(1)} MB`,
1156
+ file.FileSize < 1024 * 1024 ? `${Math.round(file.FileSize / 1024)} kB` : `${(file.FileSize / (1024 * 1024)).toFixed(
1157
+ 1
1158
+ )} MB`,
1090
1159
  ")"
1091
1160
  ] }) }),
1092
1161
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { className: "lastCol", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
@@ -1280,6 +1349,7 @@ var AddFiles = ({
1280
1349
  };
1281
1350
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1282
1351
  !showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "group", children: [
1352
+ !questionObject.hideQuestion && questionObject.questionLabel,
1283
1353
  questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1284
1354
  "p",
1285
1355
  {
@@ -1299,8 +1369,14 @@ var AddFiles = ({
1299
1369
  ),
1300
1370
  questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "error addfileserror", id: errorId, children: [
1301
1371
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1302
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1303
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
1372
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1373
+ "span",
1374
+ {
1375
+ "aria-label": `Felmeddelande. ${questionObject.validationDefaultMessesege}`,
1376
+ className: "errorText",
1377
+ children: questionObject.validationDefaultMessesege
1378
+ }
1379
+ )
1304
1380
  ] }),
1305
1381
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1306
1382
  ExploreFilesStandard_default,
@@ -1329,8 +1405,7 @@ var AddFiles = ({
1329
1405
  errorMessageAddingFile,
1330
1406
  activatedLanguage,
1331
1407
  numberOfFiles,
1332
- setNumberOfFiles,
1333
- removeUploadErrors: handleRemoveErrors
1408
+ setNumberOfFiles
1334
1409
  }
1335
1410
  )
1336
1411
  ] }) }),
@@ -1344,10 +1419,10 @@ var PreviewAddFiles = ({
1344
1419
  }) => {
1345
1420
  const previewId = `preview-${questionObject.Id}`;
1346
1421
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "pts-question-preview pts-addFiles-preview", id: `question-${previewId}`, children: [
1347
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { id: previewId, children: questionObject.Question }),
1348
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "pts-root-answer", children: questionObject.Files && questionObject.Files.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { "aria-labelledby": previewId, children: questionObject.Files.map((file, index) => {
1422
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { id: previewId, children: questionObject.Id ? questionObject.Question : activatedLanguage === "en" ? "Attached files" : "Bifogade filer" }),
1423
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "pts-root-answer", children: questionObject.Files && questionObject.Files.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { "aria-labelledby": previewId, className: "pts-preview-answer-list", children: questionObject.Files.map((file, index) => {
1349
1424
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: file.FileName }, `file-${index}-${file.FileName}`);
1350
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No attached files" : "Inga bifogade filer" }) })
1425
+ }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No attached files" : "Inga bifogade filer" }) })
1351
1426
  ] });
1352
1427
  };
1353
1428
 
@@ -1568,483 +1643,6 @@ function groupQuestionsByStepCategoryGroup(questions, steps, validationErrorsLis
1568
1643
  }
1569
1644
  var GroupQuestionsByStepCategoryGroup_default = groupQuestionsByStepCategoryGroup;
1570
1645
 
1571
- // src/NewHelpMethodsStandard/ApplicationContentSlice/applicationContentSlice.ts
1572
- var import_toolkit = require("@reduxjs/toolkit");
1573
- var pickLang = (cfg, lang) => {
1574
- var _a;
1575
- return (_a = cfg.languageSupport.find((l) => l.language === lang)) != null ? _a : cfg.languageSupport[0];
1576
- };
1577
- var createLanguageSlice = (initialConfig, options) => {
1578
- var _a;
1579
- const name = (_a = options == null ? void 0 : options.name) != null ? _a : "applicationContent";
1580
- const initialLang = pickLang(initialConfig, initialConfig.activatedLanguage);
1581
- const initialState = {
1582
- activatedLanguage: initialConfig.activatedLanguage,
1583
- languageSupport: initialConfig.languageSupport,
1584
- languageSupportLoaded: true,
1585
- backButton: initialLang.backButton,
1586
- forwardButton: initialLang.forwardButton,
1587
- sendButton: initialLang.sendButton
1588
- };
1589
- const slice = (0, import_toolkit.createSlice)({
1590
- name,
1591
- initialState,
1592
- reducers: {
1593
- setActivatedLanguage: (state, action) => {
1594
- state.activatedLanguage = action.payload;
1595
- const lang = pickLang(
1596
- { activatedLanguage: state.activatedLanguage, languageSupport: state.languageSupport },
1597
- action.payload
1598
- );
1599
- state.backButton = lang.backButton;
1600
- state.forwardButton = lang.forwardButton;
1601
- state.sendButton = lang.sendButton;
1602
- },
1603
- setLabelsFromLanguageEntry: (state, action) => {
1604
- state.backButton = action.payload.backButton;
1605
- state.forwardButton = action.payload.forwardButton;
1606
- state.sendButton = action.payload.sendButton;
1607
- },
1608
- replaceLanguageSupport: (state, action) => {
1609
- state.languageSupport = action.payload.languageSupport;
1610
- state.activatedLanguage = action.payload.activatedLanguage;
1611
- const lang = pickLang(action.payload, action.payload.activatedLanguage);
1612
- state.backButton = lang.backButton;
1613
- state.forwardButton = lang.forwardButton;
1614
- state.sendButton = lang.sendButton;
1615
- state.languageSupportLoaded = true;
1616
- }
1617
- }
1618
- });
1619
- return slice;
1620
- };
1621
- var makeLanguageSelectors = (selectSlice) => {
1622
- const selectState = selectSlice;
1623
- const selectActivatedLanguage = (state) => selectState(state).activatedLanguage;
1624
- const selectLanguageSupportLoaded = (state) => selectState(state).languageSupportLoaded;
1625
- const selectLanguageSupport = (state) => selectState(state).languageSupport;
1626
- const selectOverallContentState = (state) => selectState(state);
1627
- const selectOverallContentFromLanguageSupport = (0, import_toolkit.createSelector)(
1628
- [selectState, (_, activatedLanguage) => activatedLanguage],
1629
- (applicationContent, activatedLanguage) => {
1630
- const match = applicationContent.languageSupport.find(
1631
- (l) => l.language === activatedLanguage
1632
- );
1633
- if (!match) return { ...applicationContent };
1634
- return {
1635
- ...applicationContent,
1636
- backButton: match.backButton,
1637
- forwardButton: match.forwardButton,
1638
- sendButton: match.sendButton
1639
- };
1640
- }
1641
- );
1642
- return {
1643
- selectActivatedLanguage,
1644
- selectLanguageSupportLoaded,
1645
- selectLanguageSupport,
1646
- selectOverallContentState,
1647
- selectOverallContentFromLanguageSupport
1648
- };
1649
- };
1650
-
1651
- // src/NewHelpMethodsStandard/QuestionSlice/questionSlice.ts
1652
- var import_toolkit2 = require("@reduxjs/toolkit");
1653
- var createQuestionsSlice = (initialState, options) => {
1654
- var _a;
1655
- const slice = (0, import_toolkit2.createSlice)({
1656
- name: (_a = options == null ? void 0 : options.name) != null ? _a : "Form",
1657
- initialState,
1658
- reducers: {
1659
- AddApplicationContentFromLanguageSupport: (state, action) => {
1660
- state.applicationContent = action.payload;
1661
- state.questionsLoaded = true;
1662
- },
1663
- AddStepsFromLanguageSupport: (state, action) => {
1664
- state.steps = action.payload;
1665
- },
1666
- AddQuestionsFromLanguageSupport: (state, action) => {
1667
- state.questions = action.payload;
1668
- },
1669
- AddAnswer: (state, action) => {
1670
- state.questions = state.questions.map((qObject) => {
1671
- if (qObject.id === action.payload.id) {
1672
- return {
1673
- ...qObject,
1674
- answer: action.payload.answer
1675
- };
1676
- }
1677
- return qObject;
1678
- });
1679
- },
1680
- AddFiles: (state, action) => {
1681
- state.questions = state.questions.map((qObject) => {
1682
- if (qObject.id === action.payload.id) {
1683
- return {
1684
- ...qObject,
1685
- files: action.payload.files
1686
- };
1687
- }
1688
- return qObject;
1689
- });
1690
- },
1691
- RemoveAllQuestionsDisplayedInStep: (state, action) => {
1692
- const { activeStep } = action.payload;
1693
- state.questions = state.questions.map((qObject) => {
1694
- if (qObject.step >= activeStep) {
1695
- return {
1696
- ...qObject,
1697
- isDisplayed: false
1698
- };
1699
- }
1700
- return qObject;
1701
- });
1702
- },
1703
- AddQuestionDisplayed: (state, action) => {
1704
- state.questions = state.questions.map((qObject) => {
1705
- if (qObject.id === action.payload.id) {
1706
- return {
1707
- ...qObject,
1708
- isDisplayed: action.payload.isDisplayed
1709
- };
1710
- }
1711
- return qObject;
1712
- });
1713
- },
1714
- RemoveAllAnswersForward: (state, action) => {
1715
- state.questions = state.questions.map((qObject) => {
1716
- let questionExistInLinkedToQuestion = false;
1717
- if (qObject.dependsOnOtherQuestion !== void 0) {
1718
- questionExistInLinkedToQuestion = qObject.dependsOnOtherQuestion.some(
1719
- (innerArray) => innerArray.some((item) => item.LinkedToQuestionId === action.payload.id)
1720
- );
1721
- }
1722
- const shouldClear = qObject.id > action.payload.id && !qObject.isDisplayed && qObject.dependsOnOtherQuestion !== void 0 && questionExistInLinkedToQuestion;
1723
- if (shouldClear) {
1724
- return {
1725
- ...qObject,
1726
- answer: ""
1727
- };
1728
- }
1729
- return qObject;
1730
- });
1731
- }
1732
- },
1733
- extraReducers: (builder) => {
1734
- if (options == null ? void 0 : options.extraReducers) {
1735
- options.extraReducers(builder);
1736
- }
1737
- }
1738
- });
1739
- return slice;
1740
- };
1741
- var makeQuestionsSelectors = (selectSlice) => {
1742
- const selectStateQuestion = (state) => selectSlice(state);
1743
- const selectIsQuestionLoaded = (state) => selectSlice(state).questionsLoaded;
1744
- const selectApplicationContentFromLanguageSupport = (0, import_toolkit2.createSelector)(
1745
- [
1746
- (state) => selectSlice(state).applicationContent,
1747
- (_, activatedLanguage) => activatedLanguage
1748
- ],
1749
- (applicationContent, activatedLanguage) => {
1750
- var _a;
1751
- const languageSupport = (_a = applicationContent == null ? void 0 : applicationContent.languageSupport) == null ? void 0 : _a.find(
1752
- (lang) => lang.language === activatedLanguage
1753
- );
1754
- if (!languageSupport) {
1755
- return {
1756
- mainHeadline: "",
1757
- ingressBody: "",
1758
- linksForMoreInfo: [],
1759
- pageTitle: "",
1760
- textblocks: []
1761
- };
1762
- }
1763
- return {
1764
- mainHeadline: languageSupport.mainHeadline,
1765
- ingressBody: languageSupport.ingressBody,
1766
- linksForMoreInfo: languageSupport.linksForMoreInfo,
1767
- pageTitle: languageSupport.pageTitle,
1768
- textblocks: languageSupport.textblocks,
1769
- languageSupport: applicationContent == null ? void 0 : applicationContent.languageSupport
1770
- };
1771
- }
1772
- );
1773
- const selectStepFromLanguageSupport = (0, import_toolkit2.createSelector)(
1774
- [
1775
- (state) => selectSlice(state).steps,
1776
- (_, activatedLanguage) => activatedLanguage
1777
- ],
1778
- (steps, activatedLanguage) => {
1779
- return steps.map((stepperObject) => {
1780
- let languageSupport = stepperObject.languageSupport.find(
1781
- (lang) => lang.language === activatedLanguage
1782
- );
1783
- if (!languageSupport) {
1784
- languageSupport = {};
1785
- }
1786
- return {
1787
- ...stepperObject,
1788
- stepHeadline: languageSupport.stepHeadline,
1789
- stepDescription: languageSupport.stepDescription,
1790
- shortNameInStepper: languageSupport.shortNameInStepper,
1791
- shortNameInPreview: languageSupport.shortNameInPreview,
1792
- pageTitle: languageSupport.pageTitle
1793
- };
1794
- });
1795
- }
1796
- );
1797
- const selectQuestionFromLanguageSupport = (0, import_toolkit2.createSelector)(
1798
- [
1799
- (state) => selectSlice(state).questions,
1800
- (_, activatedLanguage) => activatedLanguage
1801
- ],
1802
- (questions, activatedLanguage) => {
1803
- return questions.map((qObject) => {
1804
- let languageSupport = qObject.languageSupport.find(
1805
- (lang) => lang.language === activatedLanguage
1806
- );
1807
- if (!languageSupport) {
1808
- languageSupport = {};
1809
- }
1810
- return {
1811
- ...qObject,
1812
- categoryLabel: languageSupport.categoryLabel,
1813
- categoryDescription: languageSupport.categoryDescription,
1814
- questionLabel: languageSupport.questionLabel,
1815
- previewLabel: languageSupport.previewLabel,
1816
- aboutText: languageSupport.aboutText,
1817
- options: languageSupport.options,
1818
- validationDefaultMessesege: languageSupport.validationDefaultMessesege,
1819
- validationSummaryLabel: languageSupport.validationSummaryLabel
1820
- };
1821
- });
1822
- }
1823
- );
1824
- return {
1825
- selectStateQuestion,
1826
- selectIsQuestionLoaded,
1827
- selectApplicationContentFromLanguageSupport,
1828
- selectStepFromLanguageSupport,
1829
- selectQuestionFromLanguageSupport
1830
- };
1831
- };
1832
-
1833
- // src/NewHelpMethodsStandard/CookieHandler/cookieHandler.ts
1834
- var getCookie = (name) => {
1835
- const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
1836
- return match ? match[2] : null;
1837
- };
1838
- var setCookie = (name, value, expirationDate) => {
1839
- let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
1840
- if (expirationDate) {
1841
- cookieString += `; expires=${expirationDate.toUTCString()}`;
1842
- }
1843
- if (window.location.protocol === "https:") {
1844
- cookieString += "; Secure";
1845
- }
1846
- document.cookie = cookieString;
1847
- };
1848
- var removeCookie = (name) => {
1849
- const pastDate = /* @__PURE__ */ new Date(0);
1850
- setCookie(name, "", pastDate);
1851
- };
1852
- var createCookieConsent = (config) => {
1853
- const { cookieName, choiceKey, expiryYears = 1 } = config;
1854
- const acceptCookies = () => {
1855
- const expires = /* @__PURE__ */ new Date();
1856
- expires.setFullYear(expires.getFullYear() + expiryYears);
1857
- setCookie(cookieName, "true", expires);
1858
- localStorage.setItem(cookieName, "true");
1859
- };
1860
- const rejectCookies = () => {
1861
- removeCookie(cookieName);
1862
- localStorage.removeItem(cookieName);
1863
- sessionStorage.setItem(choiceKey, "true");
1864
- };
1865
- const areCookiesAccepted = () => getCookie(cookieName) === "true";
1866
- const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === "true";
1867
- const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
1868
- return {
1869
- acceptCookies,
1870
- rejectCookies,
1871
- areCookiesAccepted,
1872
- hasChoiceBeenMade,
1873
- clearChoiceFromSession
1874
- };
1875
- };
1876
-
1877
- // src/NewHelpMethodsStandard/ScriptHandler/scriptHandler.ts
1878
- var toggleScriptByConsent = (consent, options) => {
1879
- if (typeof document === "undefined") return;
1880
- const existingScript = document.getElementById(options.id);
1881
- if (consent) {
1882
- if (!existingScript) {
1883
- const script = document.createElement("script");
1884
- script.id = options.id;
1885
- script.async = true;
1886
- script.src = options.src;
1887
- if (options.attributes) {
1888
- Object.entries(options.attributes).forEach(
1889
- ([key, value]) => script.setAttribute(key, value)
1890
- );
1891
- }
1892
- document.body.appendChild(script);
1893
- }
1894
- } else {
1895
- if (existingScript) {
1896
- existingScript.remove();
1897
- }
1898
- }
1899
- };
1900
- var isScriptLoaded = (id) => {
1901
- if (typeof document === "undefined") return false;
1902
- return !!document.getElementById(id);
1903
- };
1904
- var removeScriptById = (id) => {
1905
- if (typeof document === "undefined") return;
1906
- const el = document.getElementById(id);
1907
- if (el) el.remove();
1908
- };
1909
-
1910
- // src/NewHelpMethodsStandard/FocusElement/focusElement.ts
1911
- var focusElement = (target) => {
1912
- const element = typeof target === "string" ? document.getElementById(target) : target;
1913
- if (!element) return;
1914
- if (!element.hasAttribute("tabindex")) {
1915
- element.setAttribute("tabindex", "-1");
1916
- }
1917
- element.focus();
1918
- element.scrollIntoView({ behavior: "smooth" });
1919
- };
1920
-
1921
- // src/NewHelpMethodsStandard/GetIdsGroupCheckValidationTypes/getIdsGroupCheckValidationTypes.ts
1922
- var getIdsGroupCheckValidationTypes = (validationType) => {
1923
- if (!(validationType == null ? void 0 : validationType.length)) return [];
1924
- const ids = validationType.filter((t) => t.startsWith("groupCheck-")).flatMap((t) => t.split("-").slice(1)).map((s) => Number(s)).filter((n) => Number.isFinite(n));
1925
- return Array.from(new Set(ids));
1926
- };
1927
-
1928
- // src/NewHelpMethodsStandard/useFormStatusModal/useFormStatusModal.ts
1929
- var React7 = __toESM(require("react"));
1930
- var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
1931
- React7.useEffect(() => {
1932
- if (formStatus === "loading") {
1933
- handleModalOpen();
1934
- }
1935
- if (formStatus === "success" || formStatus === "failed") {
1936
- setTimeout(() => {
1937
- handleModalClose();
1938
- }, 1050);
1939
- const main = document.querySelector(mainSelector);
1940
- if (main) main.focus();
1941
- }
1942
- }, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
1943
- };
1944
-
1945
- // src/NewHelpMethodsStandard/usePTSPageTitle/usePTSPageTitle.ts
1946
- var import_react8 = require("react");
1947
- var usePTSPageTitle = ({
1948
- formStatus,
1949
- activeStep,
1950
- applicationContent,
1951
- thankYouBlock,
1952
- steps,
1953
- fallbackTitle = "PTS e-tj\xE4nst"
1954
- }) => {
1955
- const computedTitle = (0, import_react8.useMemo)(() => {
1956
- var _a, _b, _c, _d;
1957
- const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
1958
- const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
1959
- const stepTitle = (_d = (_c = steps == null ? void 0 : steps[Math.max(0, activeStep - 1)]) == null ? void 0 : _c.pageTitle) != null ? _d : "";
1960
- if (formStatus === "success" && thankYouPageTitle) return thankYouPageTitle;
1961
- if (activeStep === 0 && baseTitle) return baseTitle;
1962
- return stepTitle || baseTitle || fallbackTitle;
1963
- }, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
1964
- (0, import_react8.useEffect)(() => {
1965
- document.title = computedTitle;
1966
- }, [computedTitle]);
1967
- return computedTitle;
1968
- };
1969
-
1970
- // src/NewHelpMethodsStandard/useInputMethodDetection/useInputMethodDetection.ts
1971
- var import_react9 = require("react");
1972
- var useInputMethodDetection = ({
1973
- mouseClassName = "using-mouse",
1974
- keyboardToggleKey = "Tab"
1975
- } = {}) => {
1976
- (0, import_react9.useEffect)(() => {
1977
- const handleMouseDown = () => {
1978
- document.body.classList.add(mouseClassName);
1979
- };
1980
- const handleKeyDown = (event) => {
1981
- if (event.key === keyboardToggleKey) {
1982
- document.body.classList.remove(mouseClassName);
1983
- }
1984
- };
1985
- document.addEventListener("mousedown", handleMouseDown);
1986
- document.addEventListener("keydown", handleKeyDown);
1987
- return () => {
1988
- document.removeEventListener("mousedown", handleMouseDown);
1989
- document.removeEventListener("keydown", handleKeyDown);
1990
- };
1991
- }, [mouseClassName, keyboardToggleKey]);
1992
- };
1993
-
1994
- // src/NewHelpMethodsStandard/useCookieConsent/useCookieConsent.ts
1995
- var import_react10 = require("react");
1996
- var useCookieConsent = ({
1997
- cookieName,
1998
- choiceKey,
1999
- expiryYears = 1,
2000
- onConsentChange
2001
- }) => {
2002
- const {
2003
- acceptCookies,
2004
- rejectCookies,
2005
- areCookiesAccepted,
2006
- hasChoiceBeenMade,
2007
- clearChoiceFromSession
2008
- } = (0, import_react10.useMemo)(
2009
- () => createCookieConsent({
2010
- cookieName,
2011
- choiceKey,
2012
- expiryYears
2013
- }),
2014
- [cookieName, choiceKey, expiryYears]
2015
- );
2016
- const [showBanner, setShowBanner] = (0, import_react10.useState)(false);
2017
- const handleCookieStateChange = (0, import_react10.useCallback)(() => {
2018
- const cookiesNowAccepted = areCookiesAccepted();
2019
- if (onConsentChange) {
2020
- onConsentChange(cookiesNowAccepted);
2021
- }
2022
- setShowBanner(false);
2023
- }, [areCookiesAccepted, onConsentChange]);
2024
- (0, import_react10.useEffect)(() => {
2025
- const cookiesAccepted = areCookiesAccepted();
2026
- const choiceMade = hasChoiceBeenMade();
2027
- setShowBanner(!cookiesAccepted && !choiceMade);
2028
- if (cookiesAccepted && onConsentChange) {
2029
- onConsentChange(true);
2030
- }
2031
- const handleShowBannerEvent = () => {
2032
- clearChoiceFromSession();
2033
- setShowBanner(true);
2034
- };
2035
- window.addEventListener("showCookieBanner", handleShowBannerEvent);
2036
- return () => {
2037
- window.removeEventListener("showCookieBanner", handleShowBannerEvent);
2038
- };
2039
- }, [areCookiesAccepted, hasChoiceBeenMade, clearChoiceFromSession, onConsentChange]);
2040
- return {
2041
- showBanner,
2042
- handleCookieStateChange,
2043
- acceptCookies,
2044
- rejectCookies
2045
- };
2046
- };
2047
-
2048
1646
  // src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
2049
1647
  var import_jsx_runtime12 = require("react/jsx-runtime");
2050
1648
  var RenderQuestion = ({
@@ -2097,7 +1695,7 @@ var RenderQuestion = ({
2097
1695
  var RenderQuestion_default = RenderQuestion;
2098
1696
 
2099
1697
  // src/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.tsx
2100
- var import_react11 = __toESM(require("react"));
1698
+ var import_react8 = __toESM(require("react"));
2101
1699
  var import_jsx_runtime13 = require("react/jsx-runtime");
2102
1700
  var RenderQuestionGroup = ({
2103
1701
  questionArray,
@@ -2109,7 +1707,7 @@ var RenderQuestionGroup = ({
2109
1707
  AddQuestionDisplayed,
2110
1708
  hideValidationMessage
2111
1709
  }) => {
2112
- import_react11.default.useEffect(() => {
1710
+ import_react8.default.useEffect(() => {
2113
1711
  questionArray.forEach((question) => {
2114
1712
  if (question.visible && !question.isDisplayed) {
2115
1713
  AddQuestionDisplayed(question);
@@ -2117,7 +1715,7 @@ var RenderQuestionGroup = ({
2117
1715
  });
2118
1716
  }, [questionArray]);
2119
1717
  const questions = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: questionArray.map((question, index) => {
2120
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react11.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1718
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react8.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2121
1719
  RenderQuestion_default,
2122
1720
  {
2123
1721
  question,
@@ -2160,7 +1758,7 @@ var RenderQuestionGroup = ({
2160
1758
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "pts-root-question-group-div", children: questions });
2161
1759
  case "none":
2162
1760
  default:
2163
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react11.default.Fragment, { children: questions });
1761
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react8.default.Fragment, { children: questions });
2164
1762
  }
2165
1763
  };
2166
1764
  var RenderQuestionGroup_default = RenderQuestionGroup;
@@ -2260,7 +1858,7 @@ var EditPreviewLink = ({
2260
1858
  href: "#",
2261
1859
  onClick: (e) => {
2262
1860
  e.preventDefault();
2263
- changeStepHandler(step.step);
1861
+ changeStepHandler(step);
2264
1862
  },
2265
1863
  children: [
2266
1864
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
@@ -2298,6 +1896,7 @@ var Footer = ({ activatedLanguage = "sv" }) => {
2298
1896
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2299
1897
  "svg",
2300
1898
  {
1899
+ role: "img",
2301
1900
  "aria-label": activatedLanguage === "en" ? "PTS logotype" : "PTS logotyp",
2302
1901
  className: "pts-footer-logo",
2303
1902
  xmlns: "http://www.w3.org/2000/svg",
@@ -2323,56 +1922,63 @@ var Footer = ({ activatedLanguage = "sv" }) => {
2323
1922
  ]
2324
1923
  }
2325
1924
  ),
2326
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: "pts-footer-linkList", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("ul", { children: [
2327
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2328
- "a",
2329
- {
2330
- href: activatedLanguage === "en" ? "https://pts.se/en/contact/" : "https://www.pts.se/kontakt/",
2331
- target: "_blank",
2332
- rel: "noopener noreferrer",
2333
- children: [
2334
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Contact (opens in new tab)" : "PTS Kontakt (\xF6ppnas i ny flik)" }),
2335
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Contact" : "Kontakt" })
2336
- ]
2337
- }
2338
- ) }),
2339
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2340
- "a",
2341
- {
2342
- href: activatedLanguage === "en" ? "https://pts.se/en/gdpr" : "https://www.pts.se/gdpr/",
2343
- target: "_blank",
2344
- rel: "noopener noreferrer",
2345
- children: [
2346
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Processing of personal data (opens in new tab)" : "PTS Behandling av personuppgifter (\xF6ppnas i ny flik)" }),
2347
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Processing of personal data" : "Behandling av personuppgifter" })
2348
- ]
2349
- }
2350
- ) }),
2351
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2352
- "a",
2353
- {
2354
- href: activatedLanguage === "en" ? "https://pts.se/en/accessibility-eservices" : "https://www.pts.se/tillganglighet-etjanster",
2355
- target: "_blank",
2356
- rel: "noopener noreferrer",
2357
- children: [
2358
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Accessibility (opens in new tab)" : "PTS Tillg\xE4nglighetsredog\xF6relse (\xF6ppnas i ny flik)" }),
2359
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Accessibility" : "Tillg\xE4nglighetsredog\xF6relse" })
2360
- ]
2361
- }
2362
- ) }),
2363
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2364
- "a",
2365
- {
2366
- href: activatedLanguage === "en" ? "https://pts.se/en/cookies-eservices" : "https://www.pts.se/kakor-etjanster",
2367
- target: "_blank",
2368
- rel: "noopener noreferrer",
2369
- children: [
2370
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Cookies (opens in new tab)" : "PTS Kakor (\xF6ppnas i ny flik)" }),
2371
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Cookies" : "Kakor" })
2372
- ]
2373
- }
2374
- ) })
2375
- ] }) })
1925
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1926
+ "nav",
1927
+ {
1928
+ className: "pts-footer-linkList",
1929
+ "aria-label": activatedLanguage === "en" ? "Footer navigation" : "Sidfotsnavigering",
1930
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("ul", { children: [
1931
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1932
+ "a",
1933
+ {
1934
+ href: activatedLanguage === "en" ? "https://pts.se/en/contact/" : "https://www.pts.se/kontakt/",
1935
+ target: "_blank",
1936
+ rel: "noopener noreferrer",
1937
+ children: [
1938
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Contact (opens in new tab)" : "PTS Kontakt (\xF6ppnas i ny flik)" }),
1939
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Contact" : "Kontakt" })
1940
+ ]
1941
+ }
1942
+ ) }),
1943
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1944
+ "a",
1945
+ {
1946
+ href: activatedLanguage === "en" ? "https://pts.se/en/gdpr" : "https://www.pts.se/gdpr/",
1947
+ target: "_blank",
1948
+ rel: "noopener noreferrer",
1949
+ children: [
1950
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Processing of personal data (opens in new tab)" : "PTS Behandling av personuppgifter (\xF6ppnas i ny flik)" }),
1951
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Processing of personal data" : "Behandling av personuppgifter" })
1952
+ ]
1953
+ }
1954
+ ) }),
1955
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1956
+ "a",
1957
+ {
1958
+ href: activatedLanguage === "en" ? "https://pts.se/en/accessibility-eservices" : "https://www.pts.se/tillganglighet-etjanster",
1959
+ target: "_blank",
1960
+ rel: "noopener noreferrer",
1961
+ children: [
1962
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Accessibility (opens in new tab)" : "PTS Tillg\xE4nglighetsredog\xF6relse (\xF6ppnas i ny flik)" }),
1963
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Accessibility" : "Tillg\xE4nglighetsredog\xF6relse" })
1964
+ ]
1965
+ }
1966
+ ) }),
1967
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1968
+ "a",
1969
+ {
1970
+ href: activatedLanguage === "en" ? "https://pts.se/en/cookies-eservices" : "https://www.pts.se/kakor-etjanster",
1971
+ target: "_blank",
1972
+ rel: "noopener noreferrer",
1973
+ children: [
1974
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Cookies (opens in new tab)" : "PTS Kakor (\xF6ppnas i ny flik)" }),
1975
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Cookies" : "Kakor" })
1976
+ ]
1977
+ }
1978
+ ) })
1979
+ ] })
1980
+ }
1981
+ )
2376
1982
  ] });
2377
1983
  };
2378
1984
  var FooterStandard_default = Footer;
@@ -2788,14 +2394,12 @@ var Header = ({
2788
2394
  useLanguage && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2789
2395
  "button",
2790
2396
  {
2791
- lang: activatedLanguage === "en" ? "en" : "sv",
2397
+ "aria-label": activatedLanguage === "en" ? "Change language to Svenska" : "\xC4ndra spr\xE5k till English",
2792
2398
  className: "pts-languageButton",
2793
2399
  onClick: handleLanguageClick,
2794
2400
  children: [
2795
2401
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LanguageIcon, {}) }),
2796
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": "true", className: "pts-languageButton", children: getLanguageLabel() }),
2797
- activatedLanguage === "en" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sr-only", children: "\xC4ndra spr\xE5k till svenska" }),
2798
- activatedLanguage === "sv" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sr-only", children: "Change language to English" })
2402
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pts-languageButton", children: getLanguageLabel() })
2799
2403
  ]
2800
2404
  }
2801
2405
  )
@@ -2804,7 +2408,7 @@ var Header = ({
2804
2408
  var HeaderStandard_default = Header;
2805
2409
 
2806
2410
  // src/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.tsx
2807
- var import_react12 = require("react");
2411
+ var import_react9 = require("react");
2808
2412
  var import_dompurify4 = __toESM(require("dompurify"));
2809
2413
  var import_jsx_runtime18 = require("react/jsx-runtime");
2810
2414
  var cleanText = (text) => import_dompurify4.default.sanitize(text, { ADD_ATTR: ["target", "class"] });
@@ -2818,7 +2422,7 @@ var InfoOnly = ({
2818
2422
  tabIndex = -1,
2819
2423
  activatedLanguage = "sv"
2820
2424
  }) => {
2821
- (0, import_react12.useEffect)(() => {
2425
+ (0, import_react9.useEffect)(() => {
2822
2426
  handleSeenText(questionObject);
2823
2427
  }, []);
2824
2428
  const handleSeenText = (questionObject2) => {
@@ -2877,7 +2481,7 @@ var Modal = ({ showModal: isOpen, activatedLanguage = "" }) => {
2877
2481
  var ModalStandard_default = Modal;
2878
2482
 
2879
2483
  // src/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
2880
- var import_react13 = require("react");
2484
+ var import_react10 = require("react");
2881
2485
  var import_dompurify5 = __toESM(require("dompurify"));
2882
2486
  var import_jsx_runtime20 = require("react/jsx-runtime");
2883
2487
  var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
@@ -2885,8 +2489,9 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
2885
2489
  "section",
2886
2490
  {
2887
2491
  className: "pts-textHeadlineAndBody-container",
2492
+ "aria-labelledby": "textHeadlineAndBody-headline",
2888
2493
  children: [
2889
- data.headline && (0, import_react13.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
2494
+ data.headline && (0, import_react10.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
2890
2495
  data.body && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify5.default.sanitize(data.body) } }),
2891
2496
  data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2892
2497
  "a",
@@ -2894,6 +2499,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
2894
2499
  href: link.url,
2895
2500
  target: "_blank",
2896
2501
  rel: "noopener noreferrer",
2502
+ "aria-label": link.ariaLabel,
2897
2503
  children: [
2898
2504
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "MoreInfoIcon", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2899
2505
  "svg",
@@ -3063,24 +2669,7 @@ var ServiceHeadlineAndBodyStandard_default = ServiceHeadlineAndBody;
3063
2669
  // src/NewTextComponentStandard/SkipLinkStandard/SkipLinkStandard.tsx
3064
2670
  var import_jsx_runtime23 = require("react/jsx-runtime");
3065
2671
  var SkipLink = () => {
3066
- function scrollToMainContent() {
3067
- const container = document.getElementById(`main-content`);
3068
- if (container) {
3069
- container.scrollIntoView({ behavior: "smooth", block: "center" });
3070
- container.focus();
3071
- }
3072
- }
3073
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "pts-skipLink-container", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3074
- "a",
3075
- {
3076
- href: "#",
3077
- onClick: (e) => {
3078
- e.preventDefault();
3079
- scrollToMainContent();
3080
- },
3081
- children: "Till huvudinneh\xE5ll"
3082
- }
3083
- ) });
2672
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "pts-skipLink-container", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { href: "#main-content", children: "Till huvudinneh\xE5ll" }) });
3084
2673
  };
3085
2674
  var SkipLinkStandard_default = SkipLink;
3086
2675
 
@@ -3122,14 +2711,14 @@ var StepperButtons = ({
3122
2711
  var StepperButtonsStandard_default = StepperButtons;
3123
2712
 
3124
2713
  // src/NewTextComponentStandard/StepperStandard/StepperStandard.tsx
3125
- var import_react14 = __toESM(require("react"));
2714
+ var import_react11 = __toESM(require("react"));
3126
2715
  var import_jsx_runtime25 = require("react/jsx-runtime");
3127
2716
  var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
3128
2717
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
3129
2718
  const isActive = step.step === activeStep;
3130
2719
  const lastElement = arraySteps.length;
3131
2720
  const isDone = step.step < activeStep;
3132
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react14.default.Fragment, { children: [
2721
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react11.default.Fragment, { children: [
3133
2722
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "pts-stepper-step", children: [
3134
2723
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3135
2724
  "div",
@@ -3170,7 +2759,7 @@ var ValidationErrorSummaryList = ({
3170
2759
  validationErrorsList,
3171
2760
  formQuestions,
3172
2761
  activatedLanguage,
3173
- summaryText = activatedLanguage === "sv" ? "Du beh\xF6ver \xE5tg\xE4rda {count} {plural}" : "You need to adjust {count} {plural}"
2762
+ summaryText = "Du beh\xF6ver \xE5tg\xE4rda {count} {plural}"
3174
2763
  }) => {
3175
2764
  console.log(formQuestions);
3176
2765
  console.log(validationErrorsList);
@@ -3207,7 +2796,7 @@ var ValidationErrorSummaryList = ({
3207
2796
  if (!validationErrorsList.length) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, {});
3208
2797
  const filteredIds = filterIdsByGroupCheck(validationErrorsList, formQuestions);
3209
2798
  const count = filteredIds.length;
3210
- const title = summaryText.replace("{count}", count.toString()).replace("{plural}", activatedLanguage === "sv" ? count === 1 ? "sak" : "saker" : count === 1 ? "thing" : "things");
2799
+ const title = summaryText.replace("{count}", count.toString()).replace("{plural}", count === 1 ? "sak" : "saker");
3211
2800
  function getQuestionLabelById(id) {
3212
2801
  var _a;
3213
2802
  const found = formQuestions.find((item) => item.id === id);
@@ -3220,7 +2809,7 @@ var ValidationErrorSummaryList = ({
3220
2809
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("ul", { id: "errorSummary-ul", children: filteredIds.map((questionId, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3221
2810
  "a",
3222
2811
  {
3223
- href: "#",
2812
+ href: `#question-${questionId}`,
3224
2813
  onClick: (e) => {
3225
2814
  e.preventDefault();
3226
2815
  scrollToQuestion(questionId);
@@ -3334,20 +2923,5 @@ var CookieBanner_default = CookieBanner;
3334
2923
  TextFieldStandard,
3335
2924
  TextHeadlineAndBodyStandard,
3336
2925
  ValidationCheckAllVisibleQuestion,
3337
- ValidationErrorSummaryList,
3338
- createCookieConsent,
3339
- createLanguageSlice,
3340
- createQuestionsSlice,
3341
- focusElement,
3342
- getIdsGroupCheckValidationTypes,
3343
- isScriptLoaded,
3344
- makeLanguageSelectors,
3345
- makeQuestionsSelectors,
3346
- removeScriptById,
3347
- toggleScriptByConsent,
3348
- useCookieConsent,
3349
- useFormStatusModal,
3350
- useInputMethodDetection,
3351
- usePTSPageTitle
2926
+ ValidationErrorSummaryList
3352
2927
  });
3353
- //# sourceMappingURL=index.js.map