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