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.mjs
CHANGED
|
@@ -289,7 +289,6 @@ var PreviewCheckboxGroup = ({
|
|
|
289
289
|
};
|
|
290
290
|
|
|
291
291
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
292
|
-
import { useState as useState3 } from "react";
|
|
293
292
|
import DOMPurify from "dompurify";
|
|
294
293
|
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
295
294
|
var InputTextarea = ({
|
|
@@ -303,7 +302,6 @@ var InputTextarea = ({
|
|
|
303
302
|
const inputId = `textarea-${question.id}`;
|
|
304
303
|
const aboutId = `about-${question.id}`;
|
|
305
304
|
const errorId = `error-${question.id}`;
|
|
306
|
-
const [localAnswer, setLocalAnswer] = useState3(question.answer);
|
|
307
305
|
const defaultMaxLength = 1e3;
|
|
308
306
|
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
309
307
|
const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
|
|
@@ -311,7 +309,6 @@ var InputTextarea = ({
|
|
|
311
309
|
const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
|
|
312
310
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
313
311
|
const onChange = (e) => {
|
|
314
|
-
setLocalAnswer(e.target.value);
|
|
315
312
|
handleQuestionInputChange(e, question);
|
|
316
313
|
};
|
|
317
314
|
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
@@ -341,7 +338,7 @@ var InputTextarea = ({
|
|
|
341
338
|
{
|
|
342
339
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
343
340
|
onChange: (e) => onChange(e),
|
|
344
|
-
value:
|
|
341
|
+
value: question.answer,
|
|
345
342
|
required: question.isQuestionMandatory,
|
|
346
343
|
"aria-required": question.isQuestionMandatory,
|
|
347
344
|
"aria-invalid": question.hasValidationError,
|
|
@@ -397,7 +394,6 @@ var PreviewTextarea = ({
|
|
|
397
394
|
};
|
|
398
395
|
|
|
399
396
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
400
|
-
import { useState as useState4, useRef, useEffect as useEffect3 } from "react";
|
|
401
397
|
import DOMPurify2 from "dompurify";
|
|
402
398
|
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
403
399
|
var TextFieldStandard = ({
|
|
@@ -411,22 +407,11 @@ var TextFieldStandard = ({
|
|
|
411
407
|
const inputId = `textField-${question.id}`;
|
|
412
408
|
const aboutId = `about-${question.id}`;
|
|
413
409
|
const errorId = `error-${question.id}`;
|
|
414
|
-
const
|
|
415
|
-
const lastSyncedAnswer = useRef(question.answer);
|
|
416
|
-
useEffect3(() => {
|
|
417
|
-
if (question.answer && question.answer !== lastSyncedAnswer.current) {
|
|
418
|
-
setLocalAnswer(question.answer);
|
|
419
|
-
lastSyncedAnswer.current = question.answer;
|
|
420
|
-
}
|
|
421
|
-
}, [question.answer]);
|
|
422
|
-
const answerLength = (_b = localAnswer == null ? void 0 : localAnswer.length) != null ? _b : 0;
|
|
410
|
+
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
423
411
|
const maxLength = 100;
|
|
424
412
|
const isTooLong = answerLength > maxLength;
|
|
425
413
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
426
414
|
const handleOnChange = (e) => {
|
|
427
|
-
const value = e.target.value;
|
|
428
|
-
setLocalAnswer(value);
|
|
429
|
-
lastSyncedAnswer.current = value;
|
|
430
415
|
handleQuestionInputChange(e, question);
|
|
431
416
|
};
|
|
432
417
|
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
@@ -460,7 +445,7 @@ var TextFieldStandard = ({
|
|
|
460
445
|
name: `question-name-${question.id}`,
|
|
461
446
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
462
447
|
onChange: handleOnChange,
|
|
463
|
-
value:
|
|
448
|
+
value: question.answer,
|
|
464
449
|
id: inputId,
|
|
465
450
|
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
466
451
|
required: question.isQuestionMandatory,
|
|
@@ -516,7 +501,7 @@ var PreviewTextField = ({
|
|
|
516
501
|
};
|
|
517
502
|
|
|
518
503
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
519
|
-
import { useCallback, useEffect as
|
|
504
|
+
import { useCallback, useEffect as useEffect5, useState as useState5 } from "react";
|
|
520
505
|
import clsx3 from "clsx";
|
|
521
506
|
|
|
522
507
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -568,19 +553,19 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
568
553
|
var DropFilesStandard_default = DropFiles;
|
|
569
554
|
|
|
570
555
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
571
|
-
import { useRef
|
|
556
|
+
import { useRef } from "react";
|
|
572
557
|
import clsx from "clsx";
|
|
573
558
|
|
|
574
559
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
575
|
-
import
|
|
560
|
+
import React from "react";
|
|
576
561
|
import { Fragment as Fragment7, jsx as jsx8 } from "react/jsx-runtime";
|
|
577
562
|
var ScreenReaderErrors = ({
|
|
578
563
|
errorMessageAddingFile,
|
|
579
564
|
activatedLanguage
|
|
580
565
|
}) => {
|
|
581
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
582
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
583
|
-
|
|
566
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React.useState(false);
|
|
567
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React.useState("");
|
|
568
|
+
React.useEffect(() => {
|
|
584
569
|
if (errorMessageAddingFile.length > 0) {
|
|
585
570
|
let errorMessages = "";
|
|
586
571
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -611,8 +596,8 @@ var ExploreFiles = ({
|
|
|
611
596
|
showErrors,
|
|
612
597
|
errorMessageAddingFile
|
|
613
598
|
}) => {
|
|
614
|
-
const fileInputRef =
|
|
615
|
-
const buttonInputRef =
|
|
599
|
+
const fileInputRef = useRef(null);
|
|
600
|
+
const buttonInputRef = useRef(null);
|
|
616
601
|
const handleFiles = (event) => {
|
|
617
602
|
const files = Array.from(event.target.files || []);
|
|
618
603
|
FilesSelected(files);
|
|
@@ -680,16 +665,16 @@ var ExploreFiles = ({
|
|
|
680
665
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
681
666
|
|
|
682
667
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
683
|
-
import
|
|
668
|
+
import React4, { useEffect as useEffect4, useState as useState4, useRef as useRef2 } from "react";
|
|
684
669
|
import { Col, Row } from "react-bootstrap";
|
|
685
670
|
|
|
686
671
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
687
|
-
import { useState as
|
|
672
|
+
import { useState as useState3 } from "react";
|
|
688
673
|
import clsx2 from "clsx";
|
|
689
674
|
import { Fragment as Fragment9, jsx as jsx10 } from "react/jsx-runtime";
|
|
690
675
|
var Indicator = (filename) => {
|
|
691
|
-
const [uploadPercentage, setUploadPercentage] =
|
|
692
|
-
const [uploadDone, setUploadDone] =
|
|
676
|
+
const [uploadPercentage, setUploadPercentage] = useState3(0);
|
|
677
|
+
const [uploadDone, setUploadDone] = useState3(false);
|
|
693
678
|
return /* @__PURE__ */ jsx10(Fragment9, { children: /* @__PURE__ */ jsx10("div", { className: clsx2("uploadIndicator", "uploadDone") }) });
|
|
694
679
|
};
|
|
695
680
|
var IndicatorStandard_default = Indicator;
|
|
@@ -708,7 +693,7 @@ var SelectedFiles = ({
|
|
|
708
693
|
setNumberOfFiles,
|
|
709
694
|
removeUploadErrors
|
|
710
695
|
}) => {
|
|
711
|
-
const theDiv =
|
|
696
|
+
const theDiv = useRef2(null);
|
|
712
697
|
const remove = (file) => {
|
|
713
698
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
714
699
|
const newCountOfFiles = newFiles.length;
|
|
@@ -720,8 +705,8 @@ var SelectedFiles = ({
|
|
|
720
705
|
removeFile(newCountOfFiles);
|
|
721
706
|
};
|
|
722
707
|
const useWindowWidth = () => {
|
|
723
|
-
const [windowWidth2, setWindowWidth] =
|
|
724
|
-
|
|
708
|
+
const [windowWidth2, setWindowWidth] = useState4(window.innerWidth);
|
|
709
|
+
useEffect4(() => {
|
|
725
710
|
const handleResize = () => {
|
|
726
711
|
setWindowWidth(window.innerWidth);
|
|
727
712
|
};
|
|
@@ -744,7 +729,7 @@ var SelectedFiles = ({
|
|
|
744
729
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
745
730
|
const fileType = errorObj.FileName.split(".").pop();
|
|
746
731
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
747
|
-
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
732
|
+
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React4.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
|
|
748
733
|
/* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsx11("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ jsx11("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
|
|
749
734
|
/* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(
|
|
750
735
|
Col,
|
|
@@ -797,7 +782,7 @@ var SelectedFiles = ({
|
|
|
797
782
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
798
783
|
const fileType = file.FileName.split(".").pop();
|
|
799
784
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
800
|
-
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
785
|
+
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React4.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
|
|
801
786
|
/* @__PURE__ */ jsxs9("div", { className: "fileItem", children: [
|
|
802
787
|
/* @__PURE__ */ jsx11(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx11(
|
|
803
788
|
"svg",
|
|
@@ -890,19 +875,19 @@ var AddFiles = ({
|
|
|
890
875
|
const errorId = `error-${questionObject.id}`;
|
|
891
876
|
const labelId = `label-${questionObject.id}`;
|
|
892
877
|
const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
|
|
893
|
-
const [numberOfFiles, setNumberOfFiles] =
|
|
894
|
-
const [totalFileSize, setTotalFileSize] =
|
|
895
|
-
const [errorMessageAddingFile, setErrorMessageAddingFile] =
|
|
896
|
-
const [newFiles, setNewFiles] =
|
|
897
|
-
const [dropFilesText, setDropFilesText] =
|
|
898
|
-
|
|
878
|
+
const [numberOfFiles, setNumberOfFiles] = useState5(0);
|
|
879
|
+
const [totalFileSize, setTotalFileSize] = useState5(0);
|
|
880
|
+
const [errorMessageAddingFile, setErrorMessageAddingFile] = useState5([]);
|
|
881
|
+
const [newFiles, setNewFiles] = useState5([]);
|
|
882
|
+
const [dropFilesText, setDropFilesText] = useState5("Dra och sl\xE4pp dina filer h\xE4r");
|
|
883
|
+
useEffect5(() => {
|
|
899
884
|
if (activatedLanguage === "sv") {
|
|
900
885
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
901
886
|
} else {
|
|
902
887
|
setDropFilesText("Drag and drop your files here");
|
|
903
888
|
}
|
|
904
889
|
}, [activatedLanguage]);
|
|
905
|
-
|
|
890
|
+
useEffect5(() => {
|
|
906
891
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
907
892
|
setNumberOfFiles(questionObject.files.length);
|
|
908
893
|
}
|
|
@@ -997,7 +982,7 @@ var AddFiles = ({
|
|
|
997
982
|
reader.readAsDataURL(file);
|
|
998
983
|
});
|
|
999
984
|
};
|
|
1000
|
-
|
|
985
|
+
useEffect5(() => {
|
|
1001
986
|
if (newFiles.length > 0) {
|
|
1002
987
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1003
988
|
const e = {
|
|
@@ -1117,7 +1102,7 @@ var PreviewAddFiles = ({
|
|
|
1117
1102
|
};
|
|
1118
1103
|
|
|
1119
1104
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1120
|
-
import { useEffect as
|
|
1105
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1121
1106
|
import DOMPurify3 from "dompurify";
|
|
1122
1107
|
import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1123
1108
|
var SingleCheckbox = ({
|
|
@@ -1131,8 +1116,8 @@ var SingleCheckbox = ({
|
|
|
1131
1116
|
const inputId = `checkbox-${question.id}`;
|
|
1132
1117
|
const aboutId = `about-${question.id}`;
|
|
1133
1118
|
const errorId = `error-${question.id}`;
|
|
1134
|
-
const [checked, setChecked] =
|
|
1135
|
-
|
|
1119
|
+
const [checked, setChecked] = useState6(false);
|
|
1120
|
+
useEffect6(() => {
|
|
1136
1121
|
if (question.answer && question.answer === "true") {
|
|
1137
1122
|
setChecked(true);
|
|
1138
1123
|
} else {
|
|
@@ -2060,10 +2045,10 @@ var InputInfoOnly = ({
|
|
|
2060
2045
|
var InfoOnlyStandard_default = InputInfoOnly;
|
|
2061
2046
|
|
|
2062
2047
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
|
|
2063
|
-
import
|
|
2048
|
+
import React7 from "react";
|
|
2064
2049
|
|
|
2065
2050
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2066
|
-
import { useEffect as
|
|
2051
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
2067
2052
|
import DOMPurify7 from "dompurify";
|
|
2068
2053
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2069
2054
|
var RadioCollapseItem = ({
|
|
@@ -2079,13 +2064,13 @@ var RadioCollapseItem = ({
|
|
|
2079
2064
|
activatedLanguage = "sv",
|
|
2080
2065
|
initialOpen = false
|
|
2081
2066
|
}) => {
|
|
2082
|
-
const [isOpen, setIsOpen] =
|
|
2067
|
+
const [isOpen, setIsOpen] = useState7(initialOpen);
|
|
2083
2068
|
const contentId = `${questionId}-content-${index}`;
|
|
2084
2069
|
const buttonId = `${questionId}-button-${index}`;
|
|
2085
2070
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2086
2071
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2087
2072
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2088
|
-
|
|
2073
|
+
useEffect7(() => {
|
|
2089
2074
|
if (questionAnswer === value) {
|
|
2090
2075
|
setIsOpen(true);
|
|
2091
2076
|
} else {
|
|
@@ -2195,7 +2180,7 @@ var RadioWithInfo = ({
|
|
|
2195
2180
|
groupedOptionArray.map((group, g_index) => {
|
|
2196
2181
|
var _a2;
|
|
2197
2182
|
let subId = "subheading-" + g_index;
|
|
2198
|
-
return /* @__PURE__ */ jsxs17(
|
|
2183
|
+
return /* @__PURE__ */ jsxs17(React7.Fragment, { children: [
|
|
2199
2184
|
/* @__PURE__ */ jsx21("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2200
2185
|
/* @__PURE__ */ jsx21("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
|
|
2201
2186
|
var _a3, _b2, _c2, _d, _e;
|
|
@@ -3021,9 +3006,9 @@ var getGroupCheckIds = (validationType) => {
|
|
|
3021
3006
|
var getGroupCheckIds_default = getGroupCheckIds;
|
|
3022
3007
|
|
|
3023
3008
|
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
3024
|
-
import * as
|
|
3009
|
+
import * as React8 from "react";
|
|
3025
3010
|
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
3026
|
-
|
|
3011
|
+
React8.useEffect(() => {
|
|
3027
3012
|
if (formStatus === "loading") {
|
|
3028
3013
|
handleModalOpen();
|
|
3029
3014
|
}
|
|
@@ -3038,7 +3023,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3038
3023
|
};
|
|
3039
3024
|
|
|
3040
3025
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3041
|
-
import { useMemo, useEffect as
|
|
3026
|
+
import { useMemo, useEffect as useEffect9 } from "react";
|
|
3042
3027
|
var usePTSPageTitle = ({
|
|
3043
3028
|
formStatus,
|
|
3044
3029
|
activeStep,
|
|
@@ -3056,19 +3041,19 @@ var usePTSPageTitle = ({
|
|
|
3056
3041
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3057
3042
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3058
3043
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3059
|
-
|
|
3044
|
+
useEffect9(() => {
|
|
3060
3045
|
document.title = computedTitle;
|
|
3061
3046
|
}, [computedTitle]);
|
|
3062
3047
|
return computedTitle;
|
|
3063
3048
|
};
|
|
3064
3049
|
|
|
3065
3050
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3066
|
-
import { useEffect as
|
|
3051
|
+
import { useEffect as useEffect10 } from "react";
|
|
3067
3052
|
var useInputMethodDetection = ({
|
|
3068
3053
|
mouseClassName = "using-mouse",
|
|
3069
3054
|
keyboardToggleKey = "Tab"
|
|
3070
3055
|
} = {}) => {
|
|
3071
|
-
|
|
3056
|
+
useEffect10(() => {
|
|
3072
3057
|
const handleMouseDown = () => {
|
|
3073
3058
|
document.body.classList.add(mouseClassName);
|
|
3074
3059
|
};
|
|
@@ -3087,7 +3072,7 @@ var useInputMethodDetection = ({
|
|
|
3087
3072
|
};
|
|
3088
3073
|
|
|
3089
3074
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3090
|
-
import { useCallback as useCallback2, useEffect as
|
|
3075
|
+
import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState8 } from "react";
|
|
3091
3076
|
var useCookieConsent = ({
|
|
3092
3077
|
cookieName,
|
|
3093
3078
|
choiceKey,
|
|
@@ -3108,7 +3093,7 @@ var useCookieConsent = ({
|
|
|
3108
3093
|
}),
|
|
3109
3094
|
[cookieName, choiceKey, expiryYears]
|
|
3110
3095
|
);
|
|
3111
|
-
const [showBanner, setShowBanner] =
|
|
3096
|
+
const [showBanner, setShowBanner] = useState8(false);
|
|
3112
3097
|
const handleCookieStateChange = useCallback2(() => {
|
|
3113
3098
|
const cookiesNowAccepted = areCookiesAccepted();
|
|
3114
3099
|
if (onConsentChange) {
|
|
@@ -3116,7 +3101,7 @@ var useCookieConsent = ({
|
|
|
3116
3101
|
}
|
|
3117
3102
|
setShowBanner(false);
|
|
3118
3103
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3119
|
-
|
|
3104
|
+
useEffect11(() => {
|
|
3120
3105
|
const cookiesAccepted = areCookiesAccepted();
|
|
3121
3106
|
const choiceMade = hasChoiceBeenMade();
|
|
3122
3107
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3245,7 +3230,7 @@ var QuestionRenderer = ({
|
|
|
3245
3230
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3246
3231
|
|
|
3247
3232
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3248
|
-
import { useEffect as
|
|
3233
|
+
import { useEffect as useEffect12, Fragment as Fragment18 } from "react";
|
|
3249
3234
|
import { Fragment as Fragment19, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3250
3235
|
var QuestionGroup = ({
|
|
3251
3236
|
questions,
|
|
@@ -3265,7 +3250,7 @@ var QuestionGroup = ({
|
|
|
3265
3250
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3266
3251
|
(e) => e.startsWith("groupCheck-")
|
|
3267
3252
|
);
|
|
3268
|
-
|
|
3253
|
+
useEffect12(() => {
|
|
3269
3254
|
questions.forEach((question) => {
|
|
3270
3255
|
if (question.visible && !question.isDisplayed) {
|
|
3271
3256
|
markQuestionAsDisplayed(question);
|
|
@@ -3945,10 +3930,10 @@ var Header = ({
|
|
|
3945
3930
|
var HeaderStandard_default = Header;
|
|
3946
3931
|
|
|
3947
3932
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
3948
|
-
import { useRef as
|
|
3933
|
+
import { useRef as useRef4, useState as useState11 } from "react";
|
|
3949
3934
|
|
|
3950
3935
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
3951
|
-
import { useEffect as
|
|
3936
|
+
import { useEffect as useEffect13, useState as useState9, useRef as useRef3 } from "react";
|
|
3952
3937
|
import { Fragment as Fragment20, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3953
3938
|
var Navigation = ({
|
|
3954
3939
|
setIsMenyOpen,
|
|
@@ -3961,9 +3946,9 @@ var Navigation = ({
|
|
|
3961
3946
|
activePath = null
|
|
3962
3947
|
}) => {
|
|
3963
3948
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3964
|
-
const navRef =
|
|
3965
|
-
const firstVisitRef =
|
|
3966
|
-
const [openSubMenu, setOpenSubMenu] =
|
|
3949
|
+
const navRef = useRef3(null);
|
|
3950
|
+
const firstVisitRef = useRef3(true);
|
|
3951
|
+
const [openSubMenu, setOpenSubMenu] = useState9(null);
|
|
3967
3952
|
const handleSubMenu = (label) => {
|
|
3968
3953
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
3969
3954
|
};
|
|
@@ -3972,7 +3957,7 @@ var Navigation = ({
|
|
|
3972
3957
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3973
3958
|
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
3974
3959
|
};
|
|
3975
|
-
|
|
3960
|
+
useEffect13(() => {
|
|
3976
3961
|
var _a, _b;
|
|
3977
3962
|
if (!isOpen) {
|
|
3978
3963
|
setOpenSubMenu(null);
|
|
@@ -3984,7 +3969,7 @@ var Navigation = ({
|
|
|
3984
3969
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
3985
3970
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
3986
3971
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
3987
|
-
|
|
3972
|
+
useEffect13(() => {
|
|
3988
3973
|
if (!isOpen || !navRef.current) {
|
|
3989
3974
|
return;
|
|
3990
3975
|
}
|
|
@@ -4034,8 +4019,8 @@ var Navigation = ({
|
|
|
4034
4019
|
}
|
|
4035
4020
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4036
4021
|
};
|
|
4037
|
-
const [instruction, setInstruction] =
|
|
4038
|
-
|
|
4022
|
+
const [instruction, setInstruction] = useState9("");
|
|
4023
|
+
useEffect13(() => {
|
|
4039
4024
|
if (firstVisitRef.current) {
|
|
4040
4025
|
firstVisitRef.current = false;
|
|
4041
4026
|
return;
|
|
@@ -4124,7 +4109,7 @@ var Navigation = ({
|
|
|
4124
4109
|
var NavigationStandard_default = Navigation;
|
|
4125
4110
|
|
|
4126
4111
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4127
|
-
import { useState as
|
|
4112
|
+
import { useState as useState10 } from "react";
|
|
4128
4113
|
|
|
4129
4114
|
// src/components/layout/SearchBarStandard/Icons.tsx
|
|
4130
4115
|
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -4148,7 +4133,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
|
|
|
4148
4133
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4149
4134
|
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4150
4135
|
var SearchBar = ({ activatedLanguage = "sv" }) => {
|
|
4151
|
-
const [searchTerm, setSearchTerm] =
|
|
4136
|
+
const [searchTerm, setSearchTerm] = useState10("");
|
|
4152
4137
|
const handleSearch = () => {
|
|
4153
4138
|
console.log("S\xF6kt efter:", searchTerm);
|
|
4154
4139
|
};
|
|
@@ -4202,8 +4187,8 @@ var NavigationHeader = ({
|
|
|
4202
4187
|
if (activatedLanguage === "sv") return "English";
|
|
4203
4188
|
else return "Svenska";
|
|
4204
4189
|
};
|
|
4205
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
4206
|
-
const menuButtonFocusRef =
|
|
4190
|
+
const [isMenuOpen, setIsMenuOpen] = useState11(false);
|
|
4191
|
+
const menuButtonFocusRef = useRef4(null);
|
|
4207
4192
|
const handleMenuClick = () => {
|
|
4208
4193
|
setIsMenuOpen((prev) => !prev);
|
|
4209
4194
|
};
|
|
@@ -4217,7 +4202,7 @@ var NavigationHeader = ({
|
|
|
4217
4202
|
const getMenuIcon = () => {
|
|
4218
4203
|
return isMenuOpen ? /* @__PURE__ */ jsx33(CloseIcon, {}) : /* @__PURE__ */ jsx33(MenuIcon, {});
|
|
4219
4204
|
};
|
|
4220
|
-
const [isSearchOpen, setIsSearchOpen] =
|
|
4205
|
+
const [isSearchOpen, setIsSearchOpen] = useState11(false);
|
|
4221
4206
|
const handleSearchClick = () => {
|
|
4222
4207
|
if (!isSearchOpen) {
|
|
4223
4208
|
setIsSearchOpen(true);
|
|
@@ -4458,7 +4443,7 @@ var LinkList = ({
|
|
|
4458
4443
|
var LinkListStandard_default = LinkList;
|
|
4459
4444
|
|
|
4460
4445
|
// src/components/layout/CollapseStandard/CollapseStandard.tsx
|
|
4461
|
-
import { useState as
|
|
4446
|
+
import { useState as useState12, useId as useId2 } from "react";
|
|
4462
4447
|
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4463
4448
|
var Collapse = ({
|
|
4464
4449
|
title,
|
|
@@ -4468,7 +4453,7 @@ var Collapse = ({
|
|
|
4468
4453
|
activatedLanguage = "sv",
|
|
4469
4454
|
customClass = ""
|
|
4470
4455
|
}) => {
|
|
4471
|
-
const [isOpen, setIsOpen] =
|
|
4456
|
+
const [isOpen, setIsOpen] = useState12(defaultOpen);
|
|
4472
4457
|
const uniqueId = id != null ? id : useId2();
|
|
4473
4458
|
const contentId = `${uniqueId}-content`;
|
|
4474
4459
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
@@ -4583,14 +4568,14 @@ var StepperButtons = ({
|
|
|
4583
4568
|
var StepperButtonsStandard_default = StepperButtons;
|
|
4584
4569
|
|
|
4585
4570
|
// src/components/stepper/StepperStandard/StepperStandard.tsx
|
|
4586
|
-
import
|
|
4571
|
+
import React11 from "react";
|
|
4587
4572
|
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4588
4573
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
4589
4574
|
return /* @__PURE__ */ jsx42("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
4590
4575
|
const isActive = step.step === activeStep;
|
|
4591
4576
|
const lastElement = arraySteps.length;
|
|
4592
4577
|
const isDone = step.step < activeStep;
|
|
4593
|
-
return /* @__PURE__ */ jsxs34(
|
|
4578
|
+
return /* @__PURE__ */ jsxs34(React11.Fragment, { children: [
|
|
4594
4579
|
/* @__PURE__ */ jsxs34("div", { className: "pts-stepper-step", children: [
|
|
4595
4580
|
/* @__PURE__ */ jsx42(
|
|
4596
4581
|
"div",
|