optimized-react-component-library-xyz123 3.0.0 → 3.0.2
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 +89 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -377,6 +377,7 @@ var PreviewCheckboxGroup = ({
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
380
|
+
var import_react3 = require("react");
|
|
380
381
|
var import_dompurify = __toESM(require("dompurify"));
|
|
381
382
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
382
383
|
var InputTextarea = ({
|
|
@@ -390,12 +391,17 @@ var InputTextarea = ({
|
|
|
390
391
|
const inputId = `textarea-${question.id}`;
|
|
391
392
|
const aboutId = `about-${question.id}`;
|
|
392
393
|
const errorId = `error-${question.id}`;
|
|
394
|
+
const [localAnswer, setLocalAnswer] = (0, import_react3.useState)(question.answer);
|
|
393
395
|
const defaultMaxLength = 1e3;
|
|
394
396
|
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
395
397
|
const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
|
|
396
398
|
const isTooLong = answerLength > maxLength;
|
|
397
399
|
const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
|
|
398
400
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
401
|
+
const onChange = (e) => {
|
|
402
|
+
setLocalAnswer(e.target.value);
|
|
403
|
+
handleQuestionInputChange(e, question);
|
|
404
|
+
};
|
|
399
405
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
400
406
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
401
407
|
"div",
|
|
@@ -422,8 +428,8 @@ var InputTextarea = ({
|
|
|
422
428
|
"textarea",
|
|
423
429
|
{
|
|
424
430
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
425
|
-
onChange: (e) =>
|
|
426
|
-
value:
|
|
431
|
+
onChange: (e) => onChange(e),
|
|
432
|
+
value: localAnswer,
|
|
427
433
|
required: question.isQuestionMandatory,
|
|
428
434
|
"aria-required": question.isQuestionMandatory,
|
|
429
435
|
"aria-invalid": question.hasValidationError,
|
|
@@ -479,6 +485,7 @@ var PreviewTextarea = ({
|
|
|
479
485
|
};
|
|
480
486
|
|
|
481
487
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
488
|
+
var import_react4 = require("react");
|
|
482
489
|
var import_dompurify2 = __toESM(require("dompurify"));
|
|
483
490
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
484
491
|
var TextFieldStandard = ({
|
|
@@ -492,10 +499,15 @@ var TextFieldStandard = ({
|
|
|
492
499
|
const inputId = `textField-${question.id}`;
|
|
493
500
|
const aboutId = `about-${question.id}`;
|
|
494
501
|
const errorId = `error-${question.id}`;
|
|
502
|
+
const [localAnswer, setLocalAnswer] = (0, import_react4.useState)(question.answer);
|
|
495
503
|
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
496
504
|
const maxLength = 100;
|
|
497
505
|
const isTooLong = answerLength > maxLength;
|
|
498
506
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
507
|
+
const onChange = (e) => {
|
|
508
|
+
setLocalAnswer(e.target.value);
|
|
509
|
+
handleQuestionInputChange(e, question);
|
|
510
|
+
};
|
|
499
511
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
500
512
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
501
513
|
"div",
|
|
@@ -526,8 +538,8 @@ var TextFieldStandard = ({
|
|
|
526
538
|
inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
|
|
527
539
|
name: `question-name-${question.id}`,
|
|
528
540
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
529
|
-
onChange: (e) =>
|
|
530
|
-
value:
|
|
541
|
+
onChange: (e) => onChange(e),
|
|
542
|
+
value: localAnswer,
|
|
531
543
|
id: inputId,
|
|
532
544
|
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
533
545
|
required: question.isQuestionMandatory,
|
|
@@ -583,7 +595,7 @@ var PreviewTextField = ({
|
|
|
583
595
|
};
|
|
584
596
|
|
|
585
597
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
586
|
-
var
|
|
598
|
+
var import_react9 = require("react");
|
|
587
599
|
var import_clsx3 = __toESM(require("clsx"));
|
|
588
600
|
|
|
589
601
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -635,19 +647,19 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
635
647
|
var DropFilesStandard_default = DropFiles;
|
|
636
648
|
|
|
637
649
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
638
|
-
var
|
|
650
|
+
var import_react6 = require("react");
|
|
639
651
|
var import_clsx = __toESM(require("clsx"));
|
|
640
652
|
|
|
641
653
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
642
|
-
var
|
|
654
|
+
var import_react5 = __toESM(require("react"));
|
|
643
655
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
644
656
|
var ScreenReaderErrors = ({
|
|
645
657
|
errorMessageAddingFile,
|
|
646
658
|
activatedLanguage
|
|
647
659
|
}) => {
|
|
648
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
649
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
650
|
-
|
|
660
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = import_react5.default.useState(false);
|
|
661
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react5.default.useState("");
|
|
662
|
+
import_react5.default.useEffect(() => {
|
|
651
663
|
if (errorMessageAddingFile.length > 0) {
|
|
652
664
|
let errorMessages = "";
|
|
653
665
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -678,8 +690,8 @@ var ExploreFiles = ({
|
|
|
678
690
|
showErrors,
|
|
679
691
|
errorMessageAddingFile
|
|
680
692
|
}) => {
|
|
681
|
-
const fileInputRef = (0,
|
|
682
|
-
const buttonInputRef = (0,
|
|
693
|
+
const fileInputRef = (0, import_react6.useRef)(null);
|
|
694
|
+
const buttonInputRef = (0, import_react6.useRef)(null);
|
|
683
695
|
const handleFiles = (event) => {
|
|
684
696
|
const files = Array.from(event.target.files || []);
|
|
685
697
|
FilesSelected(files);
|
|
@@ -747,16 +759,16 @@ var ExploreFiles = ({
|
|
|
747
759
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
748
760
|
|
|
749
761
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
750
|
-
var
|
|
762
|
+
var import_react8 = __toESM(require("react"));
|
|
751
763
|
var import_react_bootstrap = require("react-bootstrap");
|
|
752
764
|
|
|
753
765
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
754
|
-
var
|
|
766
|
+
var import_react7 = require("react");
|
|
755
767
|
var import_clsx2 = __toESM(require("clsx"));
|
|
756
768
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
757
769
|
var Indicator = (filename) => {
|
|
758
|
-
const [uploadPercentage, setUploadPercentage] = (0,
|
|
759
|
-
const [uploadDone, setUploadDone] = (0,
|
|
770
|
+
const [uploadPercentage, setUploadPercentage] = (0, import_react7.useState)(0);
|
|
771
|
+
const [uploadDone, setUploadDone] = (0, import_react7.useState)(false);
|
|
760
772
|
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") }) });
|
|
761
773
|
};
|
|
762
774
|
var IndicatorStandard_default = Indicator;
|
|
@@ -775,7 +787,7 @@ var SelectedFiles = ({
|
|
|
775
787
|
setNumberOfFiles,
|
|
776
788
|
removeUploadErrors
|
|
777
789
|
}) => {
|
|
778
|
-
const theDiv = (0,
|
|
790
|
+
const theDiv = (0, import_react8.useRef)(null);
|
|
779
791
|
const remove = (file) => {
|
|
780
792
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
781
793
|
const newCountOfFiles = newFiles.length;
|
|
@@ -787,8 +799,8 @@ var SelectedFiles = ({
|
|
|
787
799
|
removeFile(newCountOfFiles);
|
|
788
800
|
};
|
|
789
801
|
const useWindowWidth = () => {
|
|
790
|
-
const [windowWidth2, setWindowWidth] = (0,
|
|
791
|
-
(0,
|
|
802
|
+
const [windowWidth2, setWindowWidth] = (0, import_react8.useState)(window.innerWidth);
|
|
803
|
+
(0, import_react8.useEffect)(() => {
|
|
792
804
|
const handleResize = () => {
|
|
793
805
|
setWindowWidth(window.innerWidth);
|
|
794
806
|
};
|
|
@@ -811,7 +823,7 @@ var SelectedFiles = ({
|
|
|
811
823
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
812
824
|
const fileType = errorObj.FileName.split(".").pop();
|
|
813
825
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
814
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
826
|
+
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: [
|
|
815
827
|
/* @__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 }) }) }),
|
|
816
828
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
817
829
|
import_react_bootstrap.Col,
|
|
@@ -864,7 +876,7 @@ var SelectedFiles = ({
|
|
|
864
876
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
865
877
|
const fileType = file.FileName.split(".").pop();
|
|
866
878
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
879
|
+
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: [
|
|
868
880
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileItem", children: [
|
|
869
881
|
/* @__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)(
|
|
870
882
|
"svg",
|
|
@@ -957,24 +969,24 @@ var AddFiles = ({
|
|
|
957
969
|
const errorId = `error-${questionObject.id}`;
|
|
958
970
|
const labelId = `label-${questionObject.id}`;
|
|
959
971
|
const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
|
|
960
|
-
const [numberOfFiles, setNumberOfFiles] = (0,
|
|
961
|
-
const [totalFileSize, setTotalFileSize] = (0,
|
|
962
|
-
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0,
|
|
963
|
-
const [newFiles, setNewFiles] = (0,
|
|
964
|
-
const [dropFilesText, setDropFilesText] = (0,
|
|
965
|
-
(0,
|
|
972
|
+
const [numberOfFiles, setNumberOfFiles] = (0, import_react9.useState)(0);
|
|
973
|
+
const [totalFileSize, setTotalFileSize] = (0, import_react9.useState)(0);
|
|
974
|
+
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0, import_react9.useState)([]);
|
|
975
|
+
const [newFiles, setNewFiles] = (0, import_react9.useState)([]);
|
|
976
|
+
const [dropFilesText, setDropFilesText] = (0, import_react9.useState)("Dra och sl\xE4pp dina filer h\xE4r");
|
|
977
|
+
(0, import_react9.useEffect)(() => {
|
|
966
978
|
if (activatedLanguage === "sv") {
|
|
967
979
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
968
980
|
} else {
|
|
969
981
|
setDropFilesText("Drag and drop your files here");
|
|
970
982
|
}
|
|
971
983
|
}, [activatedLanguage]);
|
|
972
|
-
(0,
|
|
984
|
+
(0, import_react9.useEffect)(() => {
|
|
973
985
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
974
986
|
setNumberOfFiles(questionObject.files.length);
|
|
975
987
|
}
|
|
976
988
|
}, []);
|
|
977
|
-
const onDrop = (0,
|
|
989
|
+
const onDrop = (0, import_react9.useCallback)(
|
|
978
990
|
(acceptedFiles) => {
|
|
979
991
|
var _a2, _b2, _c;
|
|
980
992
|
const validationErrors = [];
|
|
@@ -1064,7 +1076,7 @@ var AddFiles = ({
|
|
|
1064
1076
|
reader.readAsDataURL(file);
|
|
1065
1077
|
});
|
|
1066
1078
|
};
|
|
1067
|
-
(0,
|
|
1079
|
+
(0, import_react9.useEffect)(() => {
|
|
1068
1080
|
if (newFiles.length > 0) {
|
|
1069
1081
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1070
1082
|
const e = {
|
|
@@ -1184,7 +1196,7 @@ var PreviewAddFiles = ({
|
|
|
1184
1196
|
};
|
|
1185
1197
|
|
|
1186
1198
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1187
|
-
var
|
|
1199
|
+
var import_react10 = require("react");
|
|
1188
1200
|
var import_dompurify3 = __toESM(require("dompurify"));
|
|
1189
1201
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1190
1202
|
var SingleCheckbox = ({
|
|
@@ -1198,8 +1210,8 @@ var SingleCheckbox = ({
|
|
|
1198
1210
|
const inputId = `checkbox-${question.id}`;
|
|
1199
1211
|
const aboutId = `about-${question.id}`;
|
|
1200
1212
|
const errorId = `error-${question.id}`;
|
|
1201
|
-
const [checked, setChecked] = (0,
|
|
1202
|
-
(0,
|
|
1213
|
+
const [checked, setChecked] = (0, import_react10.useState)(false);
|
|
1214
|
+
(0, import_react10.useEffect)(() => {
|
|
1203
1215
|
if (question.answer && question.answer === "true") {
|
|
1204
1216
|
setChecked(true);
|
|
1205
1217
|
} else {
|
|
@@ -1275,7 +1287,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1275
1287
|
};
|
|
1276
1288
|
|
|
1277
1289
|
// src/components/text-blocks/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1278
|
-
var
|
|
1290
|
+
var import_react11 = require("react");
|
|
1279
1291
|
var import_dompurify4 = __toESM(require("dompurify"));
|
|
1280
1292
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1281
1293
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
@@ -1284,7 +1296,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
|
1284
1296
|
{
|
|
1285
1297
|
className: "pts-textHeadlineAndBody-container",
|
|
1286
1298
|
children: [
|
|
1287
|
-
data.headline && (0,
|
|
1299
|
+
data.headline && (0, import_react11.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
|
|
1288
1300
|
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify4.default.sanitize(data.body) } }),
|
|
1289
1301
|
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)(
|
|
1290
1302
|
"a",
|
|
@@ -2127,10 +2139,10 @@ var InputInfoOnly = ({
|
|
|
2127
2139
|
var InfoOnlyStandard_default = InputInfoOnly;
|
|
2128
2140
|
|
|
2129
2141
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
|
|
2130
|
-
var
|
|
2142
|
+
var import_react13 = __toESM(require("react"));
|
|
2131
2143
|
|
|
2132
2144
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2133
|
-
var
|
|
2145
|
+
var import_react12 = require("react");
|
|
2134
2146
|
var import_dompurify7 = __toESM(require("dompurify"));
|
|
2135
2147
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2136
2148
|
var RadioCollapseItem = ({
|
|
@@ -2146,13 +2158,13 @@ var RadioCollapseItem = ({
|
|
|
2146
2158
|
activatedLanguage = "sv",
|
|
2147
2159
|
initialOpen = false
|
|
2148
2160
|
}) => {
|
|
2149
|
-
const [isOpen, setIsOpen] = (0,
|
|
2161
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(initialOpen);
|
|
2150
2162
|
const contentId = `${questionId}-content-${index}`;
|
|
2151
2163
|
const buttonId = `${questionId}-button-${index}`;
|
|
2152
2164
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2153
2165
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2154
2166
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2155
|
-
(0,
|
|
2167
|
+
(0, import_react12.useEffect)(() => {
|
|
2156
2168
|
if (questionAnswer === value) {
|
|
2157
2169
|
setIsOpen(true);
|
|
2158
2170
|
} else {
|
|
@@ -2262,7 +2274,7 @@ var RadioWithInfo = ({
|
|
|
2262
2274
|
groupedOptionArray.map((group, g_index) => {
|
|
2263
2275
|
var _a2;
|
|
2264
2276
|
let subId = "subheading-" + g_index;
|
|
2265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react13.default.Fragment, { children: [
|
|
2266
2278
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2267
2279
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
|
|
2268
2280
|
var _a3, _b2, _c2, _d, _e;
|
|
@@ -3085,9 +3097,9 @@ var getGroupCheckIds = (validationType) => {
|
|
|
3085
3097
|
var getGroupCheckIds_default = getGroupCheckIds;
|
|
3086
3098
|
|
|
3087
3099
|
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
3088
|
-
var
|
|
3100
|
+
var React10 = __toESM(require("react"));
|
|
3089
3101
|
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
3090
|
-
|
|
3102
|
+
React10.useEffect(() => {
|
|
3091
3103
|
if (formStatus === "loading") {
|
|
3092
3104
|
handleModalOpen();
|
|
3093
3105
|
}
|
|
@@ -3102,7 +3114,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3102
3114
|
};
|
|
3103
3115
|
|
|
3104
3116
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3105
|
-
var
|
|
3117
|
+
var import_react14 = require("react");
|
|
3106
3118
|
var usePTSPageTitle = ({
|
|
3107
3119
|
formStatus,
|
|
3108
3120
|
activeStep,
|
|
@@ -3111,7 +3123,7 @@ var usePTSPageTitle = ({
|
|
|
3111
3123
|
steps,
|
|
3112
3124
|
fallbackTitle = "PTS e-tj\xE4nst"
|
|
3113
3125
|
}) => {
|
|
3114
|
-
const computedTitle = (0,
|
|
3126
|
+
const computedTitle = (0, import_react14.useMemo)(() => {
|
|
3115
3127
|
var _a, _b, _c, _d;
|
|
3116
3128
|
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
3117
3129
|
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
@@ -3120,19 +3132,19 @@ var usePTSPageTitle = ({
|
|
|
3120
3132
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3121
3133
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3122
3134
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3123
|
-
(0,
|
|
3135
|
+
(0, import_react14.useEffect)(() => {
|
|
3124
3136
|
document.title = computedTitle;
|
|
3125
3137
|
}, [computedTitle]);
|
|
3126
3138
|
return computedTitle;
|
|
3127
3139
|
};
|
|
3128
3140
|
|
|
3129
3141
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3130
|
-
var
|
|
3142
|
+
var import_react15 = require("react");
|
|
3131
3143
|
var useInputMethodDetection = ({
|
|
3132
3144
|
mouseClassName = "using-mouse",
|
|
3133
3145
|
keyboardToggleKey = "Tab"
|
|
3134
3146
|
} = {}) => {
|
|
3135
|
-
(0,
|
|
3147
|
+
(0, import_react15.useEffect)(() => {
|
|
3136
3148
|
const handleMouseDown = () => {
|
|
3137
3149
|
document.body.classList.add(mouseClassName);
|
|
3138
3150
|
};
|
|
@@ -3151,7 +3163,7 @@ var useInputMethodDetection = ({
|
|
|
3151
3163
|
};
|
|
3152
3164
|
|
|
3153
3165
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3154
|
-
var
|
|
3166
|
+
var import_react16 = require("react");
|
|
3155
3167
|
var useCookieConsent = ({
|
|
3156
3168
|
cookieName,
|
|
3157
3169
|
choiceKey,
|
|
@@ -3164,7 +3176,7 @@ var useCookieConsent = ({
|
|
|
3164
3176
|
areCookiesAccepted,
|
|
3165
3177
|
hasChoiceBeenMade,
|
|
3166
3178
|
clearChoiceFromSession
|
|
3167
|
-
} = (0,
|
|
3179
|
+
} = (0, import_react16.useMemo)(
|
|
3168
3180
|
() => createCookieConsent({
|
|
3169
3181
|
cookieName,
|
|
3170
3182
|
choiceKey,
|
|
@@ -3172,15 +3184,15 @@ var useCookieConsent = ({
|
|
|
3172
3184
|
}),
|
|
3173
3185
|
[cookieName, choiceKey, expiryYears]
|
|
3174
3186
|
);
|
|
3175
|
-
const [showBanner, setShowBanner] = (0,
|
|
3176
|
-
const handleCookieStateChange = (0,
|
|
3187
|
+
const [showBanner, setShowBanner] = (0, import_react16.useState)(false);
|
|
3188
|
+
const handleCookieStateChange = (0, import_react16.useCallback)(() => {
|
|
3177
3189
|
const cookiesNowAccepted = areCookiesAccepted();
|
|
3178
3190
|
if (onConsentChange) {
|
|
3179
3191
|
onConsentChange(cookiesNowAccepted);
|
|
3180
3192
|
}
|
|
3181
3193
|
setShowBanner(false);
|
|
3182
3194
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3183
|
-
(0,
|
|
3195
|
+
(0, import_react16.useEffect)(() => {
|
|
3184
3196
|
const cookiesAccepted = areCookiesAccepted();
|
|
3185
3197
|
const choiceMade = hasChoiceBeenMade();
|
|
3186
3198
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3309,7 +3321,7 @@ var QuestionRenderer = ({
|
|
|
3309
3321
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3310
3322
|
|
|
3311
3323
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3312
|
-
var
|
|
3324
|
+
var import_react17 = require("react");
|
|
3313
3325
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3314
3326
|
var QuestionGroup = ({
|
|
3315
3327
|
questions,
|
|
@@ -3329,7 +3341,7 @@ var QuestionGroup = ({
|
|
|
3329
3341
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3330
3342
|
(e) => e.startsWith("groupCheck-")
|
|
3331
3343
|
);
|
|
3332
|
-
(0,
|
|
3344
|
+
(0, import_react17.useEffect)(() => {
|
|
3333
3345
|
questions.forEach((question) => {
|
|
3334
3346
|
if (question.visible && !question.isDisplayed) {
|
|
3335
3347
|
markQuestionAsDisplayed(question);
|
|
@@ -3337,7 +3349,7 @@ var QuestionGroup = ({
|
|
|
3337
3349
|
});
|
|
3338
3350
|
}, [questions]);
|
|
3339
3351
|
const groupQuestions = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: questions.map((question, index) => {
|
|
3340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3341
3353
|
QuestionRenderer_default,
|
|
3342
3354
|
{
|
|
3343
3355
|
question,
|
|
@@ -3386,7 +3398,7 @@ var QuestionGroup = ({
|
|
|
3386
3398
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pts-root-question-group-div", children: groupQuestions });
|
|
3387
3399
|
case "none":
|
|
3388
3400
|
default:
|
|
3389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: groupQuestions });
|
|
3390
3402
|
}
|
|
3391
3403
|
};
|
|
3392
3404
|
var QuestionGroup_default = QuestionGroup;
|
|
@@ -4008,10 +4020,10 @@ var Header = ({
|
|
|
4008
4020
|
var HeaderStandard_default = Header;
|
|
4009
4021
|
|
|
4010
4022
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
4011
|
-
var
|
|
4023
|
+
var import_react20 = require("react");
|
|
4012
4024
|
|
|
4013
4025
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
4014
|
-
var
|
|
4026
|
+
var import_react18 = require("react");
|
|
4015
4027
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4016
4028
|
var Navigation = ({
|
|
4017
4029
|
setIsMenyOpen,
|
|
@@ -4024,9 +4036,9 @@ var Navigation = ({
|
|
|
4024
4036
|
activePath = null
|
|
4025
4037
|
}) => {
|
|
4026
4038
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
4027
|
-
const navRef = (0,
|
|
4028
|
-
const firstVisitRef = (0,
|
|
4029
|
-
const [openSubMenu, setOpenSubMenu] = (0,
|
|
4039
|
+
const navRef = (0, import_react18.useRef)(null);
|
|
4040
|
+
const firstVisitRef = (0, import_react18.useRef)(true);
|
|
4041
|
+
const [openSubMenu, setOpenSubMenu] = (0, import_react18.useState)(null);
|
|
4030
4042
|
const handleSubMenu = (label) => {
|
|
4031
4043
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
4032
4044
|
};
|
|
@@ -4035,7 +4047,7 @@ var Navigation = ({
|
|
|
4035
4047
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4036
4048
|
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
4037
4049
|
};
|
|
4038
|
-
(0,
|
|
4050
|
+
(0, import_react18.useEffect)(() => {
|
|
4039
4051
|
var _a, _b;
|
|
4040
4052
|
if (!isOpen) {
|
|
4041
4053
|
setOpenSubMenu(null);
|
|
@@ -4047,7 +4059,7 @@ var Navigation = ({
|
|
|
4047
4059
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
4048
4060
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
4049
4061
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
4050
|
-
(0,
|
|
4062
|
+
(0, import_react18.useEffect)(() => {
|
|
4051
4063
|
if (!isOpen || !navRef.current) {
|
|
4052
4064
|
return;
|
|
4053
4065
|
}
|
|
@@ -4097,8 +4109,8 @@ var Navigation = ({
|
|
|
4097
4109
|
}
|
|
4098
4110
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4099
4111
|
};
|
|
4100
|
-
const [instruction, setInstruction] = (0,
|
|
4101
|
-
(0,
|
|
4112
|
+
const [instruction, setInstruction] = (0, import_react18.useState)("");
|
|
4113
|
+
(0, import_react18.useEffect)(() => {
|
|
4102
4114
|
if (firstVisitRef.current) {
|
|
4103
4115
|
firstVisitRef.current = false;
|
|
4104
4116
|
return;
|
|
@@ -4187,7 +4199,7 @@ var Navigation = ({
|
|
|
4187
4199
|
var NavigationStandard_default = Navigation;
|
|
4188
4200
|
|
|
4189
4201
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4190
|
-
var
|
|
4202
|
+
var import_react19 = require("react");
|
|
4191
4203
|
|
|
4192
4204
|
// src/components/layout/SearchBarStandard/Icons.tsx
|
|
4193
4205
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -4211,7 +4223,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
|
|
|
4211
4223
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4212
4224
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4213
4225
|
var SearchBar = ({ activatedLanguage = "sv" }) => {
|
|
4214
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
4226
|
+
const [searchTerm, setSearchTerm] = (0, import_react19.useState)("");
|
|
4215
4227
|
const handleSearch = () => {
|
|
4216
4228
|
console.log("S\xF6kt efter:", searchTerm);
|
|
4217
4229
|
};
|
|
@@ -4265,8 +4277,8 @@ var NavigationHeader = ({
|
|
|
4265
4277
|
if (activatedLanguage === "sv") return "English";
|
|
4266
4278
|
else return "Svenska";
|
|
4267
4279
|
};
|
|
4268
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
4269
|
-
const menuButtonFocusRef = (0,
|
|
4280
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react20.useState)(false);
|
|
4281
|
+
const menuButtonFocusRef = (0, import_react20.useRef)(null);
|
|
4270
4282
|
const handleMenuClick = () => {
|
|
4271
4283
|
setIsMenuOpen((prev) => !prev);
|
|
4272
4284
|
};
|
|
@@ -4280,7 +4292,7 @@ var NavigationHeader = ({
|
|
|
4280
4292
|
const getMenuIcon = () => {
|
|
4281
4293
|
return isMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MenuIcon, {});
|
|
4282
4294
|
};
|
|
4283
|
-
const [isSearchOpen, setIsSearchOpen] = (0,
|
|
4295
|
+
const [isSearchOpen, setIsSearchOpen] = (0, import_react20.useState)(false);
|
|
4284
4296
|
const handleSearchClick = () => {
|
|
4285
4297
|
if (!isSearchOpen) {
|
|
4286
4298
|
setIsSearchOpen(true);
|
|
@@ -4495,14 +4507,14 @@ var LinkStandard = ({
|
|
|
4495
4507
|
var LinkStandard_default = LinkStandard;
|
|
4496
4508
|
|
|
4497
4509
|
// src/components/layout/LinkListStandard/LinkListStandard.tsx
|
|
4498
|
-
var
|
|
4510
|
+
var import_react21 = require("react");
|
|
4499
4511
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4500
4512
|
var LinkList = ({
|
|
4501
4513
|
linkArray,
|
|
4502
4514
|
activatedLanguage,
|
|
4503
4515
|
linkComponent: LinkComponent = "a"
|
|
4504
4516
|
}) => {
|
|
4505
|
-
const uniqueId = (0,
|
|
4517
|
+
const uniqueId = (0, import_react21.useId)();
|
|
4506
4518
|
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) => {
|
|
4507
4519
|
var _a, _b, _c;
|
|
4508
4520
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -4521,7 +4533,7 @@ var LinkList = ({
|
|
|
4521
4533
|
var LinkListStandard_default = LinkList;
|
|
4522
4534
|
|
|
4523
4535
|
// src/components/layout/CollapseStandard/CollapseStandard.tsx
|
|
4524
|
-
var
|
|
4536
|
+
var import_react22 = require("react");
|
|
4525
4537
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4526
4538
|
var Collapse = ({
|
|
4527
4539
|
title,
|
|
@@ -4531,8 +4543,8 @@ var Collapse = ({
|
|
|
4531
4543
|
activatedLanguage = "sv",
|
|
4532
4544
|
customClass = ""
|
|
4533
4545
|
}) => {
|
|
4534
|
-
const [isOpen, setIsOpen] = (0,
|
|
4535
|
-
const uniqueId = id != null ? id : (0,
|
|
4546
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(defaultOpen);
|
|
4547
|
+
const uniqueId = id != null ? id : (0, import_react22.useId)();
|
|
4536
4548
|
const contentId = `${uniqueId}-content`;
|
|
4537
4549
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
4538
4550
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj" : "Hide";
|
|
@@ -4646,14 +4658,14 @@ var StepperButtons = ({
|
|
|
4646
4658
|
var StepperButtonsStandard_default = StepperButtons;
|
|
4647
4659
|
|
|
4648
4660
|
// src/components/stepper/StepperStandard/StepperStandard.tsx
|
|
4649
|
-
var
|
|
4661
|
+
var import_react23 = __toESM(require("react"));
|
|
4650
4662
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4651
4663
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
4652
4664
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
4653
4665
|
const isActive = step.step === activeStep;
|
|
4654
4666
|
const lastElement = arraySteps.length;
|
|
4655
4667
|
const isDone = step.step < activeStep;
|
|
4656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react23.default.Fragment, { children: [
|
|
4657
4669
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "pts-stepper-step", children: [
|
|
4658
4670
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4659
4671
|
"div",
|