optimized-react-component-library-xyz123 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +91 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -485,6 +485,7 @@ var PreviewTextarea = ({
|
|
|
485
485
|
};
|
|
486
486
|
|
|
487
487
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
488
|
+
var import_react4 = require("react");
|
|
488
489
|
var import_dompurify2 = __toESM(require("dompurify"));
|
|
489
490
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
490
491
|
var TextFieldStandard = ({
|
|
@@ -498,10 +499,24 @@ var TextFieldStandard = ({
|
|
|
498
499
|
const inputId = `textField-${question.id}`;
|
|
499
500
|
const aboutId = `about-${question.id}`;
|
|
500
501
|
const errorId = `error-${question.id}`;
|
|
501
|
-
const
|
|
502
|
+
const [localAnswer, setLocalAnswer] = (0, import_react4.useState)((_a = question.answer) != null ? _a : "");
|
|
503
|
+
const lastSyncedAnswer = (0, import_react4.useRef)(question.answer);
|
|
504
|
+
(0, import_react4.useEffect)(() => {
|
|
505
|
+
if (question.answer && question.answer !== lastSyncedAnswer.current) {
|
|
506
|
+
setLocalAnswer(question.answer);
|
|
507
|
+
lastSyncedAnswer.current = question.answer;
|
|
508
|
+
}
|
|
509
|
+
}, [question.answer]);
|
|
510
|
+
const answerLength = (_b = localAnswer == null ? void 0 : localAnswer.length) != null ? _b : 0;
|
|
502
511
|
const maxLength = 100;
|
|
503
512
|
const isTooLong = answerLength > maxLength;
|
|
504
513
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
514
|
+
const handleOnChange = (e) => {
|
|
515
|
+
const value = e.target.value;
|
|
516
|
+
setLocalAnswer(value);
|
|
517
|
+
lastSyncedAnswer.current = value;
|
|
518
|
+
handleQuestionInputChange(e, question);
|
|
519
|
+
};
|
|
505
520
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
506
521
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
507
522
|
"div",
|
|
@@ -532,8 +547,8 @@ var TextFieldStandard = ({
|
|
|
532
547
|
inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
|
|
533
548
|
name: `question-name-${question.id}`,
|
|
534
549
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
535
|
-
onChange:
|
|
536
|
-
value:
|
|
550
|
+
onChange: handleOnChange,
|
|
551
|
+
value: localAnswer,
|
|
537
552
|
id: inputId,
|
|
538
553
|
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
539
554
|
required: question.isQuestionMandatory,
|
|
@@ -589,7 +604,7 @@ var PreviewTextField = ({
|
|
|
589
604
|
};
|
|
590
605
|
|
|
591
606
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
592
|
-
var
|
|
607
|
+
var import_react9 = require("react");
|
|
593
608
|
var import_clsx3 = __toESM(require("clsx"));
|
|
594
609
|
|
|
595
610
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -641,19 +656,19 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
641
656
|
var DropFilesStandard_default = DropFiles;
|
|
642
657
|
|
|
643
658
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
644
|
-
var
|
|
659
|
+
var import_react6 = require("react");
|
|
645
660
|
var import_clsx = __toESM(require("clsx"));
|
|
646
661
|
|
|
647
662
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
648
|
-
var
|
|
663
|
+
var import_react5 = __toESM(require("react"));
|
|
649
664
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
650
665
|
var ScreenReaderErrors = ({
|
|
651
666
|
errorMessageAddingFile,
|
|
652
667
|
activatedLanguage
|
|
653
668
|
}) => {
|
|
654
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
655
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
656
|
-
|
|
669
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = import_react5.default.useState(false);
|
|
670
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react5.default.useState("");
|
|
671
|
+
import_react5.default.useEffect(() => {
|
|
657
672
|
if (errorMessageAddingFile.length > 0) {
|
|
658
673
|
let errorMessages = "";
|
|
659
674
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -684,8 +699,8 @@ var ExploreFiles = ({
|
|
|
684
699
|
showErrors,
|
|
685
700
|
errorMessageAddingFile
|
|
686
701
|
}) => {
|
|
687
|
-
const fileInputRef = (0,
|
|
688
|
-
const buttonInputRef = (0,
|
|
702
|
+
const fileInputRef = (0, import_react6.useRef)(null);
|
|
703
|
+
const buttonInputRef = (0, import_react6.useRef)(null);
|
|
689
704
|
const handleFiles = (event) => {
|
|
690
705
|
const files = Array.from(event.target.files || []);
|
|
691
706
|
FilesSelected(files);
|
|
@@ -753,16 +768,16 @@ var ExploreFiles = ({
|
|
|
753
768
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
754
769
|
|
|
755
770
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
756
|
-
var
|
|
771
|
+
var import_react8 = __toESM(require("react"));
|
|
757
772
|
var import_react_bootstrap = require("react-bootstrap");
|
|
758
773
|
|
|
759
774
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
760
|
-
var
|
|
775
|
+
var import_react7 = require("react");
|
|
761
776
|
var import_clsx2 = __toESM(require("clsx"));
|
|
762
777
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
763
778
|
var Indicator = (filename) => {
|
|
764
|
-
const [uploadPercentage, setUploadPercentage] = (0,
|
|
765
|
-
const [uploadDone, setUploadDone] = (0,
|
|
779
|
+
const [uploadPercentage, setUploadPercentage] = (0, import_react7.useState)(0);
|
|
780
|
+
const [uploadDone, setUploadDone] = (0, import_react7.useState)(false);
|
|
766
781
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_clsx2.default)("uploadIndicator", "uploadDone") }) });
|
|
767
782
|
};
|
|
768
783
|
var IndicatorStandard_default = Indicator;
|
|
@@ -781,7 +796,7 @@ var SelectedFiles = ({
|
|
|
781
796
|
setNumberOfFiles,
|
|
782
797
|
removeUploadErrors
|
|
783
798
|
}) => {
|
|
784
|
-
const theDiv = (0,
|
|
799
|
+
const theDiv = (0, import_react8.useRef)(null);
|
|
785
800
|
const remove = (file) => {
|
|
786
801
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
787
802
|
const newCountOfFiles = newFiles.length;
|
|
@@ -793,8 +808,8 @@ var SelectedFiles = ({
|
|
|
793
808
|
removeFile(newCountOfFiles);
|
|
794
809
|
};
|
|
795
810
|
const useWindowWidth = () => {
|
|
796
|
-
const [windowWidth2, setWindowWidth] = (0,
|
|
797
|
-
(0,
|
|
811
|
+
const [windowWidth2, setWindowWidth] = (0, import_react8.useState)(window.innerWidth);
|
|
812
|
+
(0, import_react8.useEffect)(() => {
|
|
798
813
|
const handleResize = () => {
|
|
799
814
|
setWindowWidth(window.innerWidth);
|
|
800
815
|
};
|
|
@@ -817,7 +832,7 @@ var SelectedFiles = ({
|
|
|
817
832
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
818
833
|
const fileType = errorObj.FileName.split(".").pop();
|
|
819
834
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
820
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react8.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileInList", children: [
|
|
821
836
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
|
|
822
837
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
823
838
|
import_react_bootstrap.Col,
|
|
@@ -870,7 +885,7 @@ var SelectedFiles = ({
|
|
|
870
885
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
871
886
|
const fileType = file.FileName.split(".").pop();
|
|
872
887
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
873
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react8.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileInList", children: [
|
|
874
889
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileItem", children: [
|
|
875
890
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
876
891
|
"svg",
|
|
@@ -963,24 +978,24 @@ var AddFiles = ({
|
|
|
963
978
|
const errorId = `error-${questionObject.id}`;
|
|
964
979
|
const labelId = `label-${questionObject.id}`;
|
|
965
980
|
const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
|
|
966
|
-
const [numberOfFiles, setNumberOfFiles] = (0,
|
|
967
|
-
const [totalFileSize, setTotalFileSize] = (0,
|
|
968
|
-
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0,
|
|
969
|
-
const [newFiles, setNewFiles] = (0,
|
|
970
|
-
const [dropFilesText, setDropFilesText] = (0,
|
|
971
|
-
(0,
|
|
981
|
+
const [numberOfFiles, setNumberOfFiles] = (0, import_react9.useState)(0);
|
|
982
|
+
const [totalFileSize, setTotalFileSize] = (0, import_react9.useState)(0);
|
|
983
|
+
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0, import_react9.useState)([]);
|
|
984
|
+
const [newFiles, setNewFiles] = (0, import_react9.useState)([]);
|
|
985
|
+
const [dropFilesText, setDropFilesText] = (0, import_react9.useState)("Dra och sl\xE4pp dina filer h\xE4r");
|
|
986
|
+
(0, import_react9.useEffect)(() => {
|
|
972
987
|
if (activatedLanguage === "sv") {
|
|
973
988
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
974
989
|
} else {
|
|
975
990
|
setDropFilesText("Drag and drop your files here");
|
|
976
991
|
}
|
|
977
992
|
}, [activatedLanguage]);
|
|
978
|
-
(0,
|
|
993
|
+
(0, import_react9.useEffect)(() => {
|
|
979
994
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
980
995
|
setNumberOfFiles(questionObject.files.length);
|
|
981
996
|
}
|
|
982
997
|
}, []);
|
|
983
|
-
const onDrop = (0,
|
|
998
|
+
const onDrop = (0, import_react9.useCallback)(
|
|
984
999
|
(acceptedFiles) => {
|
|
985
1000
|
var _a2, _b2, _c;
|
|
986
1001
|
const validationErrors = [];
|
|
@@ -1070,7 +1085,7 @@ var AddFiles = ({
|
|
|
1070
1085
|
reader.readAsDataURL(file);
|
|
1071
1086
|
});
|
|
1072
1087
|
};
|
|
1073
|
-
(0,
|
|
1088
|
+
(0, import_react9.useEffect)(() => {
|
|
1074
1089
|
if (newFiles.length > 0) {
|
|
1075
1090
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1076
1091
|
const e = {
|
|
@@ -1190,7 +1205,7 @@ var PreviewAddFiles = ({
|
|
|
1190
1205
|
};
|
|
1191
1206
|
|
|
1192
1207
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1193
|
-
var
|
|
1208
|
+
var import_react10 = require("react");
|
|
1194
1209
|
var import_dompurify3 = __toESM(require("dompurify"));
|
|
1195
1210
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1196
1211
|
var SingleCheckbox = ({
|
|
@@ -1204,8 +1219,8 @@ var SingleCheckbox = ({
|
|
|
1204
1219
|
const inputId = `checkbox-${question.id}`;
|
|
1205
1220
|
const aboutId = `about-${question.id}`;
|
|
1206
1221
|
const errorId = `error-${question.id}`;
|
|
1207
|
-
const [checked, setChecked] = (0,
|
|
1208
|
-
(0,
|
|
1222
|
+
const [checked, setChecked] = (0, import_react10.useState)(false);
|
|
1223
|
+
(0, import_react10.useEffect)(() => {
|
|
1209
1224
|
if (question.answer && question.answer === "true") {
|
|
1210
1225
|
setChecked(true);
|
|
1211
1226
|
} else {
|
|
@@ -1281,7 +1296,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1281
1296
|
};
|
|
1282
1297
|
|
|
1283
1298
|
// src/components/text-blocks/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1284
|
-
var
|
|
1299
|
+
var import_react11 = require("react");
|
|
1285
1300
|
var import_dompurify4 = __toESM(require("dompurify"));
|
|
1286
1301
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1287
1302
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
@@ -1290,7 +1305,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
|
1290
1305
|
{
|
|
1291
1306
|
className: "pts-textHeadlineAndBody-container",
|
|
1292
1307
|
children: [
|
|
1293
|
-
data.headline && (0,
|
|
1308
|
+
data.headline && (0, import_react11.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
|
|
1294
1309
|
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify4.default.sanitize(data.body) } }),
|
|
1295
1310
|
data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1296
1311
|
"a",
|
|
@@ -2133,10 +2148,10 @@ var InputInfoOnly = ({
|
|
|
2133
2148
|
var InfoOnlyStandard_default = InputInfoOnly;
|
|
2134
2149
|
|
|
2135
2150
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
|
|
2136
|
-
var
|
|
2151
|
+
var import_react13 = __toESM(require("react"));
|
|
2137
2152
|
|
|
2138
2153
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2139
|
-
var
|
|
2154
|
+
var import_react12 = require("react");
|
|
2140
2155
|
var import_dompurify7 = __toESM(require("dompurify"));
|
|
2141
2156
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2142
2157
|
var RadioCollapseItem = ({
|
|
@@ -2152,13 +2167,13 @@ var RadioCollapseItem = ({
|
|
|
2152
2167
|
activatedLanguage = "sv",
|
|
2153
2168
|
initialOpen = false
|
|
2154
2169
|
}) => {
|
|
2155
|
-
const [isOpen, setIsOpen] = (0,
|
|
2170
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(initialOpen);
|
|
2156
2171
|
const contentId = `${questionId}-content-${index}`;
|
|
2157
2172
|
const buttonId = `${questionId}-button-${index}`;
|
|
2158
2173
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2159
2174
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2160
2175
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2161
|
-
(0,
|
|
2176
|
+
(0, import_react12.useEffect)(() => {
|
|
2162
2177
|
if (questionAnswer === value) {
|
|
2163
2178
|
setIsOpen(true);
|
|
2164
2179
|
} else {
|
|
@@ -2268,7 +2283,7 @@ var RadioWithInfo = ({
|
|
|
2268
2283
|
groupedOptionArray.map((group, g_index) => {
|
|
2269
2284
|
var _a2;
|
|
2270
2285
|
let subId = "subheading-" + g_index;
|
|
2271
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react13.default.Fragment, { children: [
|
|
2272
2287
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2273
2288
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
|
|
2274
2289
|
var _a3, _b2, _c2, _d, _e;
|
|
@@ -3091,9 +3106,9 @@ var getGroupCheckIds = (validationType) => {
|
|
|
3091
3106
|
var getGroupCheckIds_default = getGroupCheckIds;
|
|
3092
3107
|
|
|
3093
3108
|
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
3094
|
-
var
|
|
3109
|
+
var React10 = __toESM(require("react"));
|
|
3095
3110
|
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
3096
|
-
|
|
3111
|
+
React10.useEffect(() => {
|
|
3097
3112
|
if (formStatus === "loading") {
|
|
3098
3113
|
handleModalOpen();
|
|
3099
3114
|
}
|
|
@@ -3108,7 +3123,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3108
3123
|
};
|
|
3109
3124
|
|
|
3110
3125
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3111
|
-
var
|
|
3126
|
+
var import_react14 = require("react");
|
|
3112
3127
|
var usePTSPageTitle = ({
|
|
3113
3128
|
formStatus,
|
|
3114
3129
|
activeStep,
|
|
@@ -3117,7 +3132,7 @@ var usePTSPageTitle = ({
|
|
|
3117
3132
|
steps,
|
|
3118
3133
|
fallbackTitle = "PTS e-tj\xE4nst"
|
|
3119
3134
|
}) => {
|
|
3120
|
-
const computedTitle = (0,
|
|
3135
|
+
const computedTitle = (0, import_react14.useMemo)(() => {
|
|
3121
3136
|
var _a, _b, _c, _d;
|
|
3122
3137
|
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
3123
3138
|
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
@@ -3126,19 +3141,19 @@ var usePTSPageTitle = ({
|
|
|
3126
3141
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3127
3142
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3128
3143
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3129
|
-
(0,
|
|
3144
|
+
(0, import_react14.useEffect)(() => {
|
|
3130
3145
|
document.title = computedTitle;
|
|
3131
3146
|
}, [computedTitle]);
|
|
3132
3147
|
return computedTitle;
|
|
3133
3148
|
};
|
|
3134
3149
|
|
|
3135
3150
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3136
|
-
var
|
|
3151
|
+
var import_react15 = require("react");
|
|
3137
3152
|
var useInputMethodDetection = ({
|
|
3138
3153
|
mouseClassName = "using-mouse",
|
|
3139
3154
|
keyboardToggleKey = "Tab"
|
|
3140
3155
|
} = {}) => {
|
|
3141
|
-
(0,
|
|
3156
|
+
(0, import_react15.useEffect)(() => {
|
|
3142
3157
|
const handleMouseDown = () => {
|
|
3143
3158
|
document.body.classList.add(mouseClassName);
|
|
3144
3159
|
};
|
|
@@ -3157,7 +3172,7 @@ var useInputMethodDetection = ({
|
|
|
3157
3172
|
};
|
|
3158
3173
|
|
|
3159
3174
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3160
|
-
var
|
|
3175
|
+
var import_react16 = require("react");
|
|
3161
3176
|
var useCookieConsent = ({
|
|
3162
3177
|
cookieName,
|
|
3163
3178
|
choiceKey,
|
|
@@ -3170,7 +3185,7 @@ var useCookieConsent = ({
|
|
|
3170
3185
|
areCookiesAccepted,
|
|
3171
3186
|
hasChoiceBeenMade,
|
|
3172
3187
|
clearChoiceFromSession
|
|
3173
|
-
} = (0,
|
|
3188
|
+
} = (0, import_react16.useMemo)(
|
|
3174
3189
|
() => createCookieConsent({
|
|
3175
3190
|
cookieName,
|
|
3176
3191
|
choiceKey,
|
|
@@ -3178,15 +3193,15 @@ var useCookieConsent = ({
|
|
|
3178
3193
|
}),
|
|
3179
3194
|
[cookieName, choiceKey, expiryYears]
|
|
3180
3195
|
);
|
|
3181
|
-
const [showBanner, setShowBanner] = (0,
|
|
3182
|
-
const handleCookieStateChange = (0,
|
|
3196
|
+
const [showBanner, setShowBanner] = (0, import_react16.useState)(false);
|
|
3197
|
+
const handleCookieStateChange = (0, import_react16.useCallback)(() => {
|
|
3183
3198
|
const cookiesNowAccepted = areCookiesAccepted();
|
|
3184
3199
|
if (onConsentChange) {
|
|
3185
3200
|
onConsentChange(cookiesNowAccepted);
|
|
3186
3201
|
}
|
|
3187
3202
|
setShowBanner(false);
|
|
3188
3203
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3189
|
-
(0,
|
|
3204
|
+
(0, import_react16.useEffect)(() => {
|
|
3190
3205
|
const cookiesAccepted = areCookiesAccepted();
|
|
3191
3206
|
const choiceMade = hasChoiceBeenMade();
|
|
3192
3207
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3315,7 +3330,7 @@ var QuestionRenderer = ({
|
|
|
3315
3330
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3316
3331
|
|
|
3317
3332
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3318
|
-
var
|
|
3333
|
+
var import_react17 = require("react");
|
|
3319
3334
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3320
3335
|
var QuestionGroup = ({
|
|
3321
3336
|
questions,
|
|
@@ -3335,7 +3350,7 @@ var QuestionGroup = ({
|
|
|
3335
3350
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3336
3351
|
(e) => e.startsWith("groupCheck-")
|
|
3337
3352
|
);
|
|
3338
|
-
(0,
|
|
3353
|
+
(0, import_react17.useEffect)(() => {
|
|
3339
3354
|
questions.forEach((question) => {
|
|
3340
3355
|
if (question.visible && !question.isDisplayed) {
|
|
3341
3356
|
markQuestionAsDisplayed(question);
|
|
@@ -3343,7 +3358,7 @@ var QuestionGroup = ({
|
|
|
3343
3358
|
});
|
|
3344
3359
|
}, [questions]);
|
|
3345
3360
|
const groupQuestions = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: questions.map((question, index) => {
|
|
3346
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3347
3362
|
QuestionRenderer_default,
|
|
3348
3363
|
{
|
|
3349
3364
|
question,
|
|
@@ -3392,7 +3407,7 @@ var QuestionGroup = ({
|
|
|
3392
3407
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pts-root-question-group-div", children: groupQuestions });
|
|
3393
3408
|
case "none":
|
|
3394
3409
|
default:
|
|
3395
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: groupQuestions });
|
|
3396
3411
|
}
|
|
3397
3412
|
};
|
|
3398
3413
|
var QuestionGroup_default = QuestionGroup;
|
|
@@ -4014,10 +4029,10 @@ var Header = ({
|
|
|
4014
4029
|
var HeaderStandard_default = Header;
|
|
4015
4030
|
|
|
4016
4031
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
4017
|
-
var
|
|
4032
|
+
var import_react20 = require("react");
|
|
4018
4033
|
|
|
4019
4034
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
4020
|
-
var
|
|
4035
|
+
var import_react18 = require("react");
|
|
4021
4036
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4022
4037
|
var Navigation = ({
|
|
4023
4038
|
setIsMenyOpen,
|
|
@@ -4030,9 +4045,9 @@ var Navigation = ({
|
|
|
4030
4045
|
activePath = null
|
|
4031
4046
|
}) => {
|
|
4032
4047
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
4033
|
-
const navRef = (0,
|
|
4034
|
-
const firstVisitRef = (0,
|
|
4035
|
-
const [openSubMenu, setOpenSubMenu] = (0,
|
|
4048
|
+
const navRef = (0, import_react18.useRef)(null);
|
|
4049
|
+
const firstVisitRef = (0, import_react18.useRef)(true);
|
|
4050
|
+
const [openSubMenu, setOpenSubMenu] = (0, import_react18.useState)(null);
|
|
4036
4051
|
const handleSubMenu = (label) => {
|
|
4037
4052
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
4038
4053
|
};
|
|
@@ -4041,7 +4056,7 @@ var Navigation = ({
|
|
|
4041
4056
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4042
4057
|
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
4043
4058
|
};
|
|
4044
|
-
(0,
|
|
4059
|
+
(0, import_react18.useEffect)(() => {
|
|
4045
4060
|
var _a, _b;
|
|
4046
4061
|
if (!isOpen) {
|
|
4047
4062
|
setOpenSubMenu(null);
|
|
@@ -4053,7 +4068,7 @@ var Navigation = ({
|
|
|
4053
4068
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
4054
4069
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
4055
4070
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
4056
|
-
(0,
|
|
4071
|
+
(0, import_react18.useEffect)(() => {
|
|
4057
4072
|
if (!isOpen || !navRef.current) {
|
|
4058
4073
|
return;
|
|
4059
4074
|
}
|
|
@@ -4103,8 +4118,8 @@ var Navigation = ({
|
|
|
4103
4118
|
}
|
|
4104
4119
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4105
4120
|
};
|
|
4106
|
-
const [instruction, setInstruction] = (0,
|
|
4107
|
-
(0,
|
|
4121
|
+
const [instruction, setInstruction] = (0, import_react18.useState)("");
|
|
4122
|
+
(0, import_react18.useEffect)(() => {
|
|
4108
4123
|
if (firstVisitRef.current) {
|
|
4109
4124
|
firstVisitRef.current = false;
|
|
4110
4125
|
return;
|
|
@@ -4193,7 +4208,7 @@ var Navigation = ({
|
|
|
4193
4208
|
var NavigationStandard_default = Navigation;
|
|
4194
4209
|
|
|
4195
4210
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4196
|
-
var
|
|
4211
|
+
var import_react19 = require("react");
|
|
4197
4212
|
|
|
4198
4213
|
// src/components/layout/SearchBarStandard/Icons.tsx
|
|
4199
4214
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -4217,7 +4232,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
|
|
|
4217
4232
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4218
4233
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4219
4234
|
var SearchBar = ({ activatedLanguage = "sv" }) => {
|
|
4220
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
4235
|
+
const [searchTerm, setSearchTerm] = (0, import_react19.useState)("");
|
|
4221
4236
|
const handleSearch = () => {
|
|
4222
4237
|
console.log("S\xF6kt efter:", searchTerm);
|
|
4223
4238
|
};
|
|
@@ -4271,8 +4286,8 @@ var NavigationHeader = ({
|
|
|
4271
4286
|
if (activatedLanguage === "sv") return "English";
|
|
4272
4287
|
else return "Svenska";
|
|
4273
4288
|
};
|
|
4274
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
4275
|
-
const menuButtonFocusRef = (0,
|
|
4289
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react20.useState)(false);
|
|
4290
|
+
const menuButtonFocusRef = (0, import_react20.useRef)(null);
|
|
4276
4291
|
const handleMenuClick = () => {
|
|
4277
4292
|
setIsMenuOpen((prev) => !prev);
|
|
4278
4293
|
};
|
|
@@ -4286,7 +4301,7 @@ var NavigationHeader = ({
|
|
|
4286
4301
|
const getMenuIcon = () => {
|
|
4287
4302
|
return isMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MenuIcon, {});
|
|
4288
4303
|
};
|
|
4289
|
-
const [isSearchOpen, setIsSearchOpen] = (0,
|
|
4304
|
+
const [isSearchOpen, setIsSearchOpen] = (0, import_react20.useState)(false);
|
|
4290
4305
|
const handleSearchClick = () => {
|
|
4291
4306
|
if (!isSearchOpen) {
|
|
4292
4307
|
setIsSearchOpen(true);
|
|
@@ -4501,14 +4516,14 @@ var LinkStandard = ({
|
|
|
4501
4516
|
var LinkStandard_default = LinkStandard;
|
|
4502
4517
|
|
|
4503
4518
|
// src/components/layout/LinkListStandard/LinkListStandard.tsx
|
|
4504
|
-
var
|
|
4519
|
+
var import_react21 = require("react");
|
|
4505
4520
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4506
4521
|
var LinkList = ({
|
|
4507
4522
|
linkArray,
|
|
4508
4523
|
activatedLanguage,
|
|
4509
4524
|
linkComponent: LinkComponent = "a"
|
|
4510
4525
|
}) => {
|
|
4511
|
-
const uniqueId = (0,
|
|
4526
|
+
const uniqueId = (0, import_react21.useId)();
|
|
4512
4527
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "pts-linkList-container", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("ul", { children: linkArray && linkArray.map((link, index) => {
|
|
4513
4528
|
var _a, _b, _c;
|
|
4514
4529
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -4527,7 +4542,7 @@ var LinkList = ({
|
|
|
4527
4542
|
var LinkListStandard_default = LinkList;
|
|
4528
4543
|
|
|
4529
4544
|
// src/components/layout/CollapseStandard/CollapseStandard.tsx
|
|
4530
|
-
var
|
|
4545
|
+
var import_react22 = require("react");
|
|
4531
4546
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4532
4547
|
var Collapse = ({
|
|
4533
4548
|
title,
|
|
@@ -4537,8 +4552,8 @@ var Collapse = ({
|
|
|
4537
4552
|
activatedLanguage = "sv",
|
|
4538
4553
|
customClass = ""
|
|
4539
4554
|
}) => {
|
|
4540
|
-
const [isOpen, setIsOpen] = (0,
|
|
4541
|
-
const uniqueId = id != null ? id : (0,
|
|
4555
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(defaultOpen);
|
|
4556
|
+
const uniqueId = id != null ? id : (0, import_react22.useId)();
|
|
4542
4557
|
const contentId = `${uniqueId}-content`;
|
|
4543
4558
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
4544
4559
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj" : "Hide";
|
|
@@ -4652,14 +4667,14 @@ var StepperButtons = ({
|
|
|
4652
4667
|
var StepperButtonsStandard_default = StepperButtons;
|
|
4653
4668
|
|
|
4654
4669
|
// src/components/stepper/StepperStandard/StepperStandard.tsx
|
|
4655
|
-
var
|
|
4670
|
+
var import_react23 = __toESM(require("react"));
|
|
4656
4671
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4657
4672
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
4658
4673
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
4659
4674
|
const isActive = step.step === activeStep;
|
|
4660
4675
|
const lastElement = arraySteps.length;
|
|
4661
4676
|
const isDone = step.step < activeStep;
|
|
4662
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react23.default.Fragment, { children: [
|
|
4663
4678
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "pts-stepper-step", children: [
|
|
4664
4679
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4665
4680
|
"div",
|