optimized-react-component-library-xyz123 3.0.0 → 3.0.1
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 +81 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -41
- 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,
|
|
@@ -583,7 +589,7 @@ var PreviewTextField = ({
|
|
|
583
589
|
};
|
|
584
590
|
|
|
585
591
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
586
|
-
var
|
|
592
|
+
var import_react8 = require("react");
|
|
587
593
|
var import_clsx3 = __toESM(require("clsx"));
|
|
588
594
|
|
|
589
595
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -635,19 +641,19 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
635
641
|
var DropFilesStandard_default = DropFiles;
|
|
636
642
|
|
|
637
643
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
638
|
-
var
|
|
644
|
+
var import_react5 = require("react");
|
|
639
645
|
var import_clsx = __toESM(require("clsx"));
|
|
640
646
|
|
|
641
647
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
642
|
-
var
|
|
648
|
+
var import_react4 = __toESM(require("react"));
|
|
643
649
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
644
650
|
var ScreenReaderErrors = ({
|
|
645
651
|
errorMessageAddingFile,
|
|
646
652
|
activatedLanguage
|
|
647
653
|
}) => {
|
|
648
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
649
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
650
|
-
|
|
654
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = import_react4.default.useState(false);
|
|
655
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react4.default.useState("");
|
|
656
|
+
import_react4.default.useEffect(() => {
|
|
651
657
|
if (errorMessageAddingFile.length > 0) {
|
|
652
658
|
let errorMessages = "";
|
|
653
659
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -678,8 +684,8 @@ var ExploreFiles = ({
|
|
|
678
684
|
showErrors,
|
|
679
685
|
errorMessageAddingFile
|
|
680
686
|
}) => {
|
|
681
|
-
const fileInputRef = (0,
|
|
682
|
-
const buttonInputRef = (0,
|
|
687
|
+
const fileInputRef = (0, import_react5.useRef)(null);
|
|
688
|
+
const buttonInputRef = (0, import_react5.useRef)(null);
|
|
683
689
|
const handleFiles = (event) => {
|
|
684
690
|
const files = Array.from(event.target.files || []);
|
|
685
691
|
FilesSelected(files);
|
|
@@ -747,16 +753,16 @@ var ExploreFiles = ({
|
|
|
747
753
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
748
754
|
|
|
749
755
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
750
|
-
var
|
|
756
|
+
var import_react7 = __toESM(require("react"));
|
|
751
757
|
var import_react_bootstrap = require("react-bootstrap");
|
|
752
758
|
|
|
753
759
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
754
|
-
var
|
|
760
|
+
var import_react6 = require("react");
|
|
755
761
|
var import_clsx2 = __toESM(require("clsx"));
|
|
756
762
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
757
763
|
var Indicator = (filename) => {
|
|
758
|
-
const [uploadPercentage, setUploadPercentage] = (0,
|
|
759
|
-
const [uploadDone, setUploadDone] = (0,
|
|
764
|
+
const [uploadPercentage, setUploadPercentage] = (0, import_react6.useState)(0);
|
|
765
|
+
const [uploadDone, setUploadDone] = (0, import_react6.useState)(false);
|
|
760
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") }) });
|
|
761
767
|
};
|
|
762
768
|
var IndicatorStandard_default = Indicator;
|
|
@@ -775,7 +781,7 @@ var SelectedFiles = ({
|
|
|
775
781
|
setNumberOfFiles,
|
|
776
782
|
removeUploadErrors
|
|
777
783
|
}) => {
|
|
778
|
-
const theDiv = (0,
|
|
784
|
+
const theDiv = (0, import_react7.useRef)(null);
|
|
779
785
|
const remove = (file) => {
|
|
780
786
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
781
787
|
const newCountOfFiles = newFiles.length;
|
|
@@ -787,8 +793,8 @@ var SelectedFiles = ({
|
|
|
787
793
|
removeFile(newCountOfFiles);
|
|
788
794
|
};
|
|
789
795
|
const useWindowWidth = () => {
|
|
790
|
-
const [windowWidth2, setWindowWidth] = (0,
|
|
791
|
-
(0,
|
|
796
|
+
const [windowWidth2, setWindowWidth] = (0, import_react7.useState)(window.innerWidth);
|
|
797
|
+
(0, import_react7.useEffect)(() => {
|
|
792
798
|
const handleResize = () => {
|
|
793
799
|
setWindowWidth(window.innerWidth);
|
|
794
800
|
};
|
|
@@ -811,7 +817,7 @@ var SelectedFiles = ({
|
|
|
811
817
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
812
818
|
const fileType = errorObj.FileName.split(".").pop();
|
|
813
819
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
814
|
-
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_react7.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
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 }) }) }),
|
|
816
822
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
817
823
|
import_react_bootstrap.Col,
|
|
@@ -864,7 +870,7 @@ var SelectedFiles = ({
|
|
|
864
870
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
865
871
|
const fileType = file.FileName.split(".").pop();
|
|
866
872
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
867
|
-
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_react7.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
874
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileItem", children: [
|
|
869
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)(
|
|
870
876
|
"svg",
|
|
@@ -957,24 +963,24 @@ var AddFiles = ({
|
|
|
957
963
|
const errorId = `error-${questionObject.id}`;
|
|
958
964
|
const labelId = `label-${questionObject.id}`;
|
|
959
965
|
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,
|
|
966
|
+
const [numberOfFiles, setNumberOfFiles] = (0, import_react8.useState)(0);
|
|
967
|
+
const [totalFileSize, setTotalFileSize] = (0, import_react8.useState)(0);
|
|
968
|
+
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0, import_react8.useState)([]);
|
|
969
|
+
const [newFiles, setNewFiles] = (0, import_react8.useState)([]);
|
|
970
|
+
const [dropFilesText, setDropFilesText] = (0, import_react8.useState)("Dra och sl\xE4pp dina filer h\xE4r");
|
|
971
|
+
(0, import_react8.useEffect)(() => {
|
|
966
972
|
if (activatedLanguage === "sv") {
|
|
967
973
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
968
974
|
} else {
|
|
969
975
|
setDropFilesText("Drag and drop your files here");
|
|
970
976
|
}
|
|
971
977
|
}, [activatedLanguage]);
|
|
972
|
-
(0,
|
|
978
|
+
(0, import_react8.useEffect)(() => {
|
|
973
979
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
974
980
|
setNumberOfFiles(questionObject.files.length);
|
|
975
981
|
}
|
|
976
982
|
}, []);
|
|
977
|
-
const onDrop = (0,
|
|
983
|
+
const onDrop = (0, import_react8.useCallback)(
|
|
978
984
|
(acceptedFiles) => {
|
|
979
985
|
var _a2, _b2, _c;
|
|
980
986
|
const validationErrors = [];
|
|
@@ -1064,7 +1070,7 @@ var AddFiles = ({
|
|
|
1064
1070
|
reader.readAsDataURL(file);
|
|
1065
1071
|
});
|
|
1066
1072
|
};
|
|
1067
|
-
(0,
|
|
1073
|
+
(0, import_react8.useEffect)(() => {
|
|
1068
1074
|
if (newFiles.length > 0) {
|
|
1069
1075
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1070
1076
|
const e = {
|
|
@@ -1184,7 +1190,7 @@ var PreviewAddFiles = ({
|
|
|
1184
1190
|
};
|
|
1185
1191
|
|
|
1186
1192
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1187
|
-
var
|
|
1193
|
+
var import_react9 = require("react");
|
|
1188
1194
|
var import_dompurify3 = __toESM(require("dompurify"));
|
|
1189
1195
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1190
1196
|
var SingleCheckbox = ({
|
|
@@ -1198,8 +1204,8 @@ var SingleCheckbox = ({
|
|
|
1198
1204
|
const inputId = `checkbox-${question.id}`;
|
|
1199
1205
|
const aboutId = `about-${question.id}`;
|
|
1200
1206
|
const errorId = `error-${question.id}`;
|
|
1201
|
-
const [checked, setChecked] = (0,
|
|
1202
|
-
(0,
|
|
1207
|
+
const [checked, setChecked] = (0, import_react9.useState)(false);
|
|
1208
|
+
(0, import_react9.useEffect)(() => {
|
|
1203
1209
|
if (question.answer && question.answer === "true") {
|
|
1204
1210
|
setChecked(true);
|
|
1205
1211
|
} else {
|
|
@@ -1275,7 +1281,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1275
1281
|
};
|
|
1276
1282
|
|
|
1277
1283
|
// src/components/text-blocks/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1278
|
-
var
|
|
1284
|
+
var import_react10 = require("react");
|
|
1279
1285
|
var import_dompurify4 = __toESM(require("dompurify"));
|
|
1280
1286
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1281
1287
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
@@ -1284,7 +1290,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
|
1284
1290
|
{
|
|
1285
1291
|
className: "pts-textHeadlineAndBody-container",
|
|
1286
1292
|
children: [
|
|
1287
|
-
data.headline && (0,
|
|
1293
|
+
data.headline && (0, import_react10.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
|
|
1288
1294
|
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify4.default.sanitize(data.body) } }),
|
|
1289
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)(
|
|
1290
1296
|
"a",
|
|
@@ -2127,10 +2133,10 @@ var InputInfoOnly = ({
|
|
|
2127
2133
|
var InfoOnlyStandard_default = InputInfoOnly;
|
|
2128
2134
|
|
|
2129
2135
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
|
|
2130
|
-
var
|
|
2136
|
+
var import_react12 = __toESM(require("react"));
|
|
2131
2137
|
|
|
2132
2138
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2133
|
-
var
|
|
2139
|
+
var import_react11 = require("react");
|
|
2134
2140
|
var import_dompurify7 = __toESM(require("dompurify"));
|
|
2135
2141
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2136
2142
|
var RadioCollapseItem = ({
|
|
@@ -2146,13 +2152,13 @@ var RadioCollapseItem = ({
|
|
|
2146
2152
|
activatedLanguage = "sv",
|
|
2147
2153
|
initialOpen = false
|
|
2148
2154
|
}) => {
|
|
2149
|
-
const [isOpen, setIsOpen] = (0,
|
|
2155
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(initialOpen);
|
|
2150
2156
|
const contentId = `${questionId}-content-${index}`;
|
|
2151
2157
|
const buttonId = `${questionId}-button-${index}`;
|
|
2152
2158
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2153
2159
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2154
2160
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2155
|
-
(0,
|
|
2161
|
+
(0, import_react11.useEffect)(() => {
|
|
2156
2162
|
if (questionAnswer === value) {
|
|
2157
2163
|
setIsOpen(true);
|
|
2158
2164
|
} else {
|
|
@@ -2262,7 +2268,7 @@ var RadioWithInfo = ({
|
|
|
2262
2268
|
groupedOptionArray.map((group, g_index) => {
|
|
2263
2269
|
var _a2;
|
|
2264
2270
|
let subId = "subheading-" + g_index;
|
|
2265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react12.default.Fragment, { children: [
|
|
2266
2272
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2267
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) => {
|
|
2268
2274
|
var _a3, _b2, _c2, _d, _e;
|
|
@@ -3085,9 +3091,9 @@ var getGroupCheckIds = (validationType) => {
|
|
|
3085
3091
|
var getGroupCheckIds_default = getGroupCheckIds;
|
|
3086
3092
|
|
|
3087
3093
|
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
3088
|
-
var
|
|
3094
|
+
var React9 = __toESM(require("react"));
|
|
3089
3095
|
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
3090
|
-
|
|
3096
|
+
React9.useEffect(() => {
|
|
3091
3097
|
if (formStatus === "loading") {
|
|
3092
3098
|
handleModalOpen();
|
|
3093
3099
|
}
|
|
@@ -3102,7 +3108,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3102
3108
|
};
|
|
3103
3109
|
|
|
3104
3110
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3105
|
-
var
|
|
3111
|
+
var import_react13 = require("react");
|
|
3106
3112
|
var usePTSPageTitle = ({
|
|
3107
3113
|
formStatus,
|
|
3108
3114
|
activeStep,
|
|
@@ -3111,7 +3117,7 @@ var usePTSPageTitle = ({
|
|
|
3111
3117
|
steps,
|
|
3112
3118
|
fallbackTitle = "PTS e-tj\xE4nst"
|
|
3113
3119
|
}) => {
|
|
3114
|
-
const computedTitle = (0,
|
|
3120
|
+
const computedTitle = (0, import_react13.useMemo)(() => {
|
|
3115
3121
|
var _a, _b, _c, _d;
|
|
3116
3122
|
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
3117
3123
|
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
@@ -3120,19 +3126,19 @@ var usePTSPageTitle = ({
|
|
|
3120
3126
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3121
3127
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3122
3128
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3123
|
-
(0,
|
|
3129
|
+
(0, import_react13.useEffect)(() => {
|
|
3124
3130
|
document.title = computedTitle;
|
|
3125
3131
|
}, [computedTitle]);
|
|
3126
3132
|
return computedTitle;
|
|
3127
3133
|
};
|
|
3128
3134
|
|
|
3129
3135
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3130
|
-
var
|
|
3136
|
+
var import_react14 = require("react");
|
|
3131
3137
|
var useInputMethodDetection = ({
|
|
3132
3138
|
mouseClassName = "using-mouse",
|
|
3133
3139
|
keyboardToggleKey = "Tab"
|
|
3134
3140
|
} = {}) => {
|
|
3135
|
-
(0,
|
|
3141
|
+
(0, import_react14.useEffect)(() => {
|
|
3136
3142
|
const handleMouseDown = () => {
|
|
3137
3143
|
document.body.classList.add(mouseClassName);
|
|
3138
3144
|
};
|
|
@@ -3151,7 +3157,7 @@ var useInputMethodDetection = ({
|
|
|
3151
3157
|
};
|
|
3152
3158
|
|
|
3153
3159
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3154
|
-
var
|
|
3160
|
+
var import_react15 = require("react");
|
|
3155
3161
|
var useCookieConsent = ({
|
|
3156
3162
|
cookieName,
|
|
3157
3163
|
choiceKey,
|
|
@@ -3164,7 +3170,7 @@ var useCookieConsent = ({
|
|
|
3164
3170
|
areCookiesAccepted,
|
|
3165
3171
|
hasChoiceBeenMade,
|
|
3166
3172
|
clearChoiceFromSession
|
|
3167
|
-
} = (0,
|
|
3173
|
+
} = (0, import_react15.useMemo)(
|
|
3168
3174
|
() => createCookieConsent({
|
|
3169
3175
|
cookieName,
|
|
3170
3176
|
choiceKey,
|
|
@@ -3172,15 +3178,15 @@ var useCookieConsent = ({
|
|
|
3172
3178
|
}),
|
|
3173
3179
|
[cookieName, choiceKey, expiryYears]
|
|
3174
3180
|
);
|
|
3175
|
-
const [showBanner, setShowBanner] = (0,
|
|
3176
|
-
const handleCookieStateChange = (0,
|
|
3181
|
+
const [showBanner, setShowBanner] = (0, import_react15.useState)(false);
|
|
3182
|
+
const handleCookieStateChange = (0, import_react15.useCallback)(() => {
|
|
3177
3183
|
const cookiesNowAccepted = areCookiesAccepted();
|
|
3178
3184
|
if (onConsentChange) {
|
|
3179
3185
|
onConsentChange(cookiesNowAccepted);
|
|
3180
3186
|
}
|
|
3181
3187
|
setShowBanner(false);
|
|
3182
3188
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3183
|
-
(0,
|
|
3189
|
+
(0, import_react15.useEffect)(() => {
|
|
3184
3190
|
const cookiesAccepted = areCookiesAccepted();
|
|
3185
3191
|
const choiceMade = hasChoiceBeenMade();
|
|
3186
3192
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3309,7 +3315,7 @@ var QuestionRenderer = ({
|
|
|
3309
3315
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3310
3316
|
|
|
3311
3317
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3312
|
-
var
|
|
3318
|
+
var import_react16 = require("react");
|
|
3313
3319
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3314
3320
|
var QuestionGroup = ({
|
|
3315
3321
|
questions,
|
|
@@ -3329,7 +3335,7 @@ var QuestionGroup = ({
|
|
|
3329
3335
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3330
3336
|
(e) => e.startsWith("groupCheck-")
|
|
3331
3337
|
);
|
|
3332
|
-
(0,
|
|
3338
|
+
(0, import_react16.useEffect)(() => {
|
|
3333
3339
|
questions.forEach((question) => {
|
|
3334
3340
|
if (question.visible && !question.isDisplayed) {
|
|
3335
3341
|
markQuestionAsDisplayed(question);
|
|
@@ -3337,7 +3343,7 @@ var QuestionGroup = ({
|
|
|
3337
3343
|
});
|
|
3338
3344
|
}, [questions]);
|
|
3339
3345
|
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)(
|
|
3346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3341
3347
|
QuestionRenderer_default,
|
|
3342
3348
|
{
|
|
3343
3349
|
question,
|
|
@@ -3386,7 +3392,7 @@ var QuestionGroup = ({
|
|
|
3386
3392
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pts-root-question-group-div", children: groupQuestions });
|
|
3387
3393
|
case "none":
|
|
3388
3394
|
default:
|
|
3389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react16.Fragment, { children: groupQuestions });
|
|
3390
3396
|
}
|
|
3391
3397
|
};
|
|
3392
3398
|
var QuestionGroup_default = QuestionGroup;
|
|
@@ -4008,10 +4014,10 @@ var Header = ({
|
|
|
4008
4014
|
var HeaderStandard_default = Header;
|
|
4009
4015
|
|
|
4010
4016
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
4011
|
-
var
|
|
4017
|
+
var import_react19 = require("react");
|
|
4012
4018
|
|
|
4013
4019
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
4014
|
-
var
|
|
4020
|
+
var import_react17 = require("react");
|
|
4015
4021
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4016
4022
|
var Navigation = ({
|
|
4017
4023
|
setIsMenyOpen,
|
|
@@ -4024,9 +4030,9 @@ var Navigation = ({
|
|
|
4024
4030
|
activePath = null
|
|
4025
4031
|
}) => {
|
|
4026
4032
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
4027
|
-
const navRef = (0,
|
|
4028
|
-
const firstVisitRef = (0,
|
|
4029
|
-
const [openSubMenu, setOpenSubMenu] = (0,
|
|
4033
|
+
const navRef = (0, import_react17.useRef)(null);
|
|
4034
|
+
const firstVisitRef = (0, import_react17.useRef)(true);
|
|
4035
|
+
const [openSubMenu, setOpenSubMenu] = (0, import_react17.useState)(null);
|
|
4030
4036
|
const handleSubMenu = (label) => {
|
|
4031
4037
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
4032
4038
|
};
|
|
@@ -4035,7 +4041,7 @@ var Navigation = ({
|
|
|
4035
4041
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4036
4042
|
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
4043
|
};
|
|
4038
|
-
(0,
|
|
4044
|
+
(0, import_react17.useEffect)(() => {
|
|
4039
4045
|
var _a, _b;
|
|
4040
4046
|
if (!isOpen) {
|
|
4041
4047
|
setOpenSubMenu(null);
|
|
@@ -4047,7 +4053,7 @@ var Navigation = ({
|
|
|
4047
4053
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
4048
4054
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
4049
4055
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
4050
|
-
(0,
|
|
4056
|
+
(0, import_react17.useEffect)(() => {
|
|
4051
4057
|
if (!isOpen || !navRef.current) {
|
|
4052
4058
|
return;
|
|
4053
4059
|
}
|
|
@@ -4097,8 +4103,8 @@ var Navigation = ({
|
|
|
4097
4103
|
}
|
|
4098
4104
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4099
4105
|
};
|
|
4100
|
-
const [instruction, setInstruction] = (0,
|
|
4101
|
-
(0,
|
|
4106
|
+
const [instruction, setInstruction] = (0, import_react17.useState)("");
|
|
4107
|
+
(0, import_react17.useEffect)(() => {
|
|
4102
4108
|
if (firstVisitRef.current) {
|
|
4103
4109
|
firstVisitRef.current = false;
|
|
4104
4110
|
return;
|
|
@@ -4187,7 +4193,7 @@ var Navigation = ({
|
|
|
4187
4193
|
var NavigationStandard_default = Navigation;
|
|
4188
4194
|
|
|
4189
4195
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4190
|
-
var
|
|
4196
|
+
var import_react18 = require("react");
|
|
4191
4197
|
|
|
4192
4198
|
// src/components/layout/SearchBarStandard/Icons.tsx
|
|
4193
4199
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -4211,7 +4217,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
|
|
|
4211
4217
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4212
4218
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4213
4219
|
var SearchBar = ({ activatedLanguage = "sv" }) => {
|
|
4214
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
4220
|
+
const [searchTerm, setSearchTerm] = (0, import_react18.useState)("");
|
|
4215
4221
|
const handleSearch = () => {
|
|
4216
4222
|
console.log("S\xF6kt efter:", searchTerm);
|
|
4217
4223
|
};
|
|
@@ -4265,8 +4271,8 @@ var NavigationHeader = ({
|
|
|
4265
4271
|
if (activatedLanguage === "sv") return "English";
|
|
4266
4272
|
else return "Svenska";
|
|
4267
4273
|
};
|
|
4268
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
4269
|
-
const menuButtonFocusRef = (0,
|
|
4274
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react19.useState)(false);
|
|
4275
|
+
const menuButtonFocusRef = (0, import_react19.useRef)(null);
|
|
4270
4276
|
const handleMenuClick = () => {
|
|
4271
4277
|
setIsMenuOpen((prev) => !prev);
|
|
4272
4278
|
};
|
|
@@ -4280,7 +4286,7 @@ var NavigationHeader = ({
|
|
|
4280
4286
|
const getMenuIcon = () => {
|
|
4281
4287
|
return isMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MenuIcon, {});
|
|
4282
4288
|
};
|
|
4283
|
-
const [isSearchOpen, setIsSearchOpen] = (0,
|
|
4289
|
+
const [isSearchOpen, setIsSearchOpen] = (0, import_react19.useState)(false);
|
|
4284
4290
|
const handleSearchClick = () => {
|
|
4285
4291
|
if (!isSearchOpen) {
|
|
4286
4292
|
setIsSearchOpen(true);
|
|
@@ -4495,14 +4501,14 @@ var LinkStandard = ({
|
|
|
4495
4501
|
var LinkStandard_default = LinkStandard;
|
|
4496
4502
|
|
|
4497
4503
|
// src/components/layout/LinkListStandard/LinkListStandard.tsx
|
|
4498
|
-
var
|
|
4504
|
+
var import_react20 = require("react");
|
|
4499
4505
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4500
4506
|
var LinkList = ({
|
|
4501
4507
|
linkArray,
|
|
4502
4508
|
activatedLanguage,
|
|
4503
4509
|
linkComponent: LinkComponent = "a"
|
|
4504
4510
|
}) => {
|
|
4505
|
-
const uniqueId = (0,
|
|
4511
|
+
const uniqueId = (0, import_react20.useId)();
|
|
4506
4512
|
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
4513
|
var _a, _b, _c;
|
|
4508
4514
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -4521,7 +4527,7 @@ var LinkList = ({
|
|
|
4521
4527
|
var LinkListStandard_default = LinkList;
|
|
4522
4528
|
|
|
4523
4529
|
// src/components/layout/CollapseStandard/CollapseStandard.tsx
|
|
4524
|
-
var
|
|
4530
|
+
var import_react21 = require("react");
|
|
4525
4531
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4526
4532
|
var Collapse = ({
|
|
4527
4533
|
title,
|
|
@@ -4531,8 +4537,8 @@ var Collapse = ({
|
|
|
4531
4537
|
activatedLanguage = "sv",
|
|
4532
4538
|
customClass = ""
|
|
4533
4539
|
}) => {
|
|
4534
|
-
const [isOpen, setIsOpen] = (0,
|
|
4535
|
-
const uniqueId = id != null ? id : (0,
|
|
4540
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(defaultOpen);
|
|
4541
|
+
const uniqueId = id != null ? id : (0, import_react21.useId)();
|
|
4536
4542
|
const contentId = `${uniqueId}-content`;
|
|
4537
4543
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
4538
4544
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj" : "Hide";
|
|
@@ -4646,14 +4652,14 @@ var StepperButtons = ({
|
|
|
4646
4652
|
var StepperButtonsStandard_default = StepperButtons;
|
|
4647
4653
|
|
|
4648
4654
|
// src/components/stepper/StepperStandard/StepperStandard.tsx
|
|
4649
|
-
var
|
|
4655
|
+
var import_react22 = __toESM(require("react"));
|
|
4650
4656
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4651
4657
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
4652
4658
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
4653
4659
|
const isActive = step.step === activeStep;
|
|
4654
4660
|
const lastElement = arraySteps.length;
|
|
4655
4661
|
const isDone = step.step < activeStep;
|
|
4656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react22.default.Fragment, { children: [
|
|
4657
4663
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "pts-stepper-step", children: [
|
|
4658
4664
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4659
4665
|
"div",
|