optimized-react-component-library-xyz123 3.0.1 → 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 +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
|
@@ -485,6 +485,7 @@ var PreviewTextarea = ({
|
|
|
485
485
|
};
|
|
486
486
|
|
|
487
487
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
488
|
+
var import_react4 = require("react");
|
|
488
489
|
var import_dompurify2 = __toESM(require("dompurify"));
|
|
489
490
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
490
491
|
var TextFieldStandard = ({
|
|
@@ -498,10 +499,15 @@ var TextFieldStandard = ({
|
|
|
498
499
|
const inputId = `textField-${question.id}`;
|
|
499
500
|
const aboutId = `about-${question.id}`;
|
|
500
501
|
const errorId = `error-${question.id}`;
|
|
502
|
+
const [localAnswer, setLocalAnswer] = (0, import_react4.useState)(question.answer);
|
|
501
503
|
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
502
504
|
const maxLength = 100;
|
|
503
505
|
const isTooLong = answerLength > maxLength;
|
|
504
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
|
+
};
|
|
505
511
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
506
512
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
507
513
|
"div",
|
|
@@ -532,8 +538,8 @@ var TextFieldStandard = ({
|
|
|
532
538
|
inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
|
|
533
539
|
name: `question-name-${question.id}`,
|
|
534
540
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
535
|
-
onChange: (e) =>
|
|
536
|
-
value:
|
|
541
|
+
onChange: (e) => onChange(e),
|
|
542
|
+
value: localAnswer,
|
|
537
543
|
id: inputId,
|
|
538
544
|
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
539
545
|
required: question.isQuestionMandatory,
|
|
@@ -589,7 +595,7 @@ var PreviewTextField = ({
|
|
|
589
595
|
};
|
|
590
596
|
|
|
591
597
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
592
|
-
var
|
|
598
|
+
var import_react9 = require("react");
|
|
593
599
|
var import_clsx3 = __toESM(require("clsx"));
|
|
594
600
|
|
|
595
601
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -641,19 +647,19 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
641
647
|
var DropFilesStandard_default = DropFiles;
|
|
642
648
|
|
|
643
649
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
644
|
-
var
|
|
650
|
+
var import_react6 = require("react");
|
|
645
651
|
var import_clsx = __toESM(require("clsx"));
|
|
646
652
|
|
|
647
653
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
648
|
-
var
|
|
654
|
+
var import_react5 = __toESM(require("react"));
|
|
649
655
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
650
656
|
var ScreenReaderErrors = ({
|
|
651
657
|
errorMessageAddingFile,
|
|
652
658
|
activatedLanguage
|
|
653
659
|
}) => {
|
|
654
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
655
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
656
|
-
|
|
660
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = import_react5.default.useState(false);
|
|
661
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react5.default.useState("");
|
|
662
|
+
import_react5.default.useEffect(() => {
|
|
657
663
|
if (errorMessageAddingFile.length > 0) {
|
|
658
664
|
let errorMessages = "";
|
|
659
665
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -684,8 +690,8 @@ var ExploreFiles = ({
|
|
|
684
690
|
showErrors,
|
|
685
691
|
errorMessageAddingFile
|
|
686
692
|
}) => {
|
|
687
|
-
const fileInputRef = (0,
|
|
688
|
-
const buttonInputRef = (0,
|
|
693
|
+
const fileInputRef = (0, import_react6.useRef)(null);
|
|
694
|
+
const buttonInputRef = (0, import_react6.useRef)(null);
|
|
689
695
|
const handleFiles = (event) => {
|
|
690
696
|
const files = Array.from(event.target.files || []);
|
|
691
697
|
FilesSelected(files);
|
|
@@ -753,16 +759,16 @@ var ExploreFiles = ({
|
|
|
753
759
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
754
760
|
|
|
755
761
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
756
|
-
var
|
|
762
|
+
var import_react8 = __toESM(require("react"));
|
|
757
763
|
var import_react_bootstrap = require("react-bootstrap");
|
|
758
764
|
|
|
759
765
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
760
|
-
var
|
|
766
|
+
var import_react7 = require("react");
|
|
761
767
|
var import_clsx2 = __toESM(require("clsx"));
|
|
762
768
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
763
769
|
var Indicator = (filename) => {
|
|
764
|
-
const [uploadPercentage, setUploadPercentage] = (0,
|
|
765
|
-
const [uploadDone, setUploadDone] = (0,
|
|
770
|
+
const [uploadPercentage, setUploadPercentage] = (0, import_react7.useState)(0);
|
|
771
|
+
const [uploadDone, setUploadDone] = (0, import_react7.useState)(false);
|
|
766
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") }) });
|
|
767
773
|
};
|
|
768
774
|
var IndicatorStandard_default = Indicator;
|
|
@@ -781,7 +787,7 @@ var SelectedFiles = ({
|
|
|
781
787
|
setNumberOfFiles,
|
|
782
788
|
removeUploadErrors
|
|
783
789
|
}) => {
|
|
784
|
-
const theDiv = (0,
|
|
790
|
+
const theDiv = (0, import_react8.useRef)(null);
|
|
785
791
|
const remove = (file) => {
|
|
786
792
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
787
793
|
const newCountOfFiles = newFiles.length;
|
|
@@ -793,8 +799,8 @@ var SelectedFiles = ({
|
|
|
793
799
|
removeFile(newCountOfFiles);
|
|
794
800
|
};
|
|
795
801
|
const useWindowWidth = () => {
|
|
796
|
-
const [windowWidth2, setWindowWidth] = (0,
|
|
797
|
-
(0,
|
|
802
|
+
const [windowWidth2, setWindowWidth] = (0, import_react8.useState)(window.innerWidth);
|
|
803
|
+
(0, import_react8.useEffect)(() => {
|
|
798
804
|
const handleResize = () => {
|
|
799
805
|
setWindowWidth(window.innerWidth);
|
|
800
806
|
};
|
|
@@ -817,7 +823,7 @@ var SelectedFiles = ({
|
|
|
817
823
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
818
824
|
const fileType = errorObj.FileName.split(".").pop();
|
|
819
825
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
820
|
-
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: [
|
|
821
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 }) }) }),
|
|
822
828
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
823
829
|
import_react_bootstrap.Col,
|
|
@@ -870,7 +876,7 @@ var SelectedFiles = ({
|
|
|
870
876
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
871
877
|
const fileType = file.FileName.split(".").pop();
|
|
872
878
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
873
|
-
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: [
|
|
874
880
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileItem", children: [
|
|
875
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)(
|
|
876
882
|
"svg",
|
|
@@ -963,24 +969,24 @@ var AddFiles = ({
|
|
|
963
969
|
const errorId = `error-${questionObject.id}`;
|
|
964
970
|
const labelId = `label-${questionObject.id}`;
|
|
965
971
|
const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
|
|
966
|
-
const [numberOfFiles, setNumberOfFiles] = (0,
|
|
967
|
-
const [totalFileSize, setTotalFileSize] = (0,
|
|
968
|
-
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0,
|
|
969
|
-
const [newFiles, setNewFiles] = (0,
|
|
970
|
-
const [dropFilesText, setDropFilesText] = (0,
|
|
971
|
-
(0,
|
|
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)(() => {
|
|
972
978
|
if (activatedLanguage === "sv") {
|
|
973
979
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
974
980
|
} else {
|
|
975
981
|
setDropFilesText("Drag and drop your files here");
|
|
976
982
|
}
|
|
977
983
|
}, [activatedLanguage]);
|
|
978
|
-
(0,
|
|
984
|
+
(0, import_react9.useEffect)(() => {
|
|
979
985
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
980
986
|
setNumberOfFiles(questionObject.files.length);
|
|
981
987
|
}
|
|
982
988
|
}, []);
|
|
983
|
-
const onDrop = (0,
|
|
989
|
+
const onDrop = (0, import_react9.useCallback)(
|
|
984
990
|
(acceptedFiles) => {
|
|
985
991
|
var _a2, _b2, _c;
|
|
986
992
|
const validationErrors = [];
|
|
@@ -1070,7 +1076,7 @@ var AddFiles = ({
|
|
|
1070
1076
|
reader.readAsDataURL(file);
|
|
1071
1077
|
});
|
|
1072
1078
|
};
|
|
1073
|
-
(0,
|
|
1079
|
+
(0, import_react9.useEffect)(() => {
|
|
1074
1080
|
if (newFiles.length > 0) {
|
|
1075
1081
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1076
1082
|
const e = {
|
|
@@ -1190,7 +1196,7 @@ var PreviewAddFiles = ({
|
|
|
1190
1196
|
};
|
|
1191
1197
|
|
|
1192
1198
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1193
|
-
var
|
|
1199
|
+
var import_react10 = require("react");
|
|
1194
1200
|
var import_dompurify3 = __toESM(require("dompurify"));
|
|
1195
1201
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1196
1202
|
var SingleCheckbox = ({
|
|
@@ -1204,8 +1210,8 @@ var SingleCheckbox = ({
|
|
|
1204
1210
|
const inputId = `checkbox-${question.id}`;
|
|
1205
1211
|
const aboutId = `about-${question.id}`;
|
|
1206
1212
|
const errorId = `error-${question.id}`;
|
|
1207
|
-
const [checked, setChecked] = (0,
|
|
1208
|
-
(0,
|
|
1213
|
+
const [checked, setChecked] = (0, import_react10.useState)(false);
|
|
1214
|
+
(0, import_react10.useEffect)(() => {
|
|
1209
1215
|
if (question.answer && question.answer === "true") {
|
|
1210
1216
|
setChecked(true);
|
|
1211
1217
|
} else {
|
|
@@ -1281,7 +1287,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1281
1287
|
};
|
|
1282
1288
|
|
|
1283
1289
|
// src/components/text-blocks/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1284
|
-
var
|
|
1290
|
+
var import_react11 = require("react");
|
|
1285
1291
|
var import_dompurify4 = __toESM(require("dompurify"));
|
|
1286
1292
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1287
1293
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
@@ -1290,7 +1296,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
|
1290
1296
|
{
|
|
1291
1297
|
className: "pts-textHeadlineAndBody-container",
|
|
1292
1298
|
children: [
|
|
1293
|
-
data.headline && (0,
|
|
1299
|
+
data.headline && (0, import_react11.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
|
|
1294
1300
|
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify4.default.sanitize(data.body) } }),
|
|
1295
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)(
|
|
1296
1302
|
"a",
|
|
@@ -2133,10 +2139,10 @@ var InputInfoOnly = ({
|
|
|
2133
2139
|
var InfoOnlyStandard_default = InputInfoOnly;
|
|
2134
2140
|
|
|
2135
2141
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
|
|
2136
|
-
var
|
|
2142
|
+
var import_react13 = __toESM(require("react"));
|
|
2137
2143
|
|
|
2138
2144
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2139
|
-
var
|
|
2145
|
+
var import_react12 = require("react");
|
|
2140
2146
|
var import_dompurify7 = __toESM(require("dompurify"));
|
|
2141
2147
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2142
2148
|
var RadioCollapseItem = ({
|
|
@@ -2152,13 +2158,13 @@ var RadioCollapseItem = ({
|
|
|
2152
2158
|
activatedLanguage = "sv",
|
|
2153
2159
|
initialOpen = false
|
|
2154
2160
|
}) => {
|
|
2155
|
-
const [isOpen, setIsOpen] = (0,
|
|
2161
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(initialOpen);
|
|
2156
2162
|
const contentId = `${questionId}-content-${index}`;
|
|
2157
2163
|
const buttonId = `${questionId}-button-${index}`;
|
|
2158
2164
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2159
2165
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2160
2166
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2161
|
-
(0,
|
|
2167
|
+
(0, import_react12.useEffect)(() => {
|
|
2162
2168
|
if (questionAnswer === value) {
|
|
2163
2169
|
setIsOpen(true);
|
|
2164
2170
|
} else {
|
|
@@ -2268,7 +2274,7 @@ var RadioWithInfo = ({
|
|
|
2268
2274
|
groupedOptionArray.map((group, g_index) => {
|
|
2269
2275
|
var _a2;
|
|
2270
2276
|
let subId = "subheading-" + g_index;
|
|
2271
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react13.default.Fragment, { children: [
|
|
2272
2278
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2273
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) => {
|
|
2274
2280
|
var _a3, _b2, _c2, _d, _e;
|
|
@@ -3091,9 +3097,9 @@ var getGroupCheckIds = (validationType) => {
|
|
|
3091
3097
|
var getGroupCheckIds_default = getGroupCheckIds;
|
|
3092
3098
|
|
|
3093
3099
|
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
3094
|
-
var
|
|
3100
|
+
var React10 = __toESM(require("react"));
|
|
3095
3101
|
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
3096
|
-
|
|
3102
|
+
React10.useEffect(() => {
|
|
3097
3103
|
if (formStatus === "loading") {
|
|
3098
3104
|
handleModalOpen();
|
|
3099
3105
|
}
|
|
@@ -3108,7 +3114,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3108
3114
|
};
|
|
3109
3115
|
|
|
3110
3116
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3111
|
-
var
|
|
3117
|
+
var import_react14 = require("react");
|
|
3112
3118
|
var usePTSPageTitle = ({
|
|
3113
3119
|
formStatus,
|
|
3114
3120
|
activeStep,
|
|
@@ -3117,7 +3123,7 @@ var usePTSPageTitle = ({
|
|
|
3117
3123
|
steps,
|
|
3118
3124
|
fallbackTitle = "PTS e-tj\xE4nst"
|
|
3119
3125
|
}) => {
|
|
3120
|
-
const computedTitle = (0,
|
|
3126
|
+
const computedTitle = (0, import_react14.useMemo)(() => {
|
|
3121
3127
|
var _a, _b, _c, _d;
|
|
3122
3128
|
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
3123
3129
|
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
@@ -3126,19 +3132,19 @@ var usePTSPageTitle = ({
|
|
|
3126
3132
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3127
3133
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3128
3134
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3129
|
-
(0,
|
|
3135
|
+
(0, import_react14.useEffect)(() => {
|
|
3130
3136
|
document.title = computedTitle;
|
|
3131
3137
|
}, [computedTitle]);
|
|
3132
3138
|
return computedTitle;
|
|
3133
3139
|
};
|
|
3134
3140
|
|
|
3135
3141
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3136
|
-
var
|
|
3142
|
+
var import_react15 = require("react");
|
|
3137
3143
|
var useInputMethodDetection = ({
|
|
3138
3144
|
mouseClassName = "using-mouse",
|
|
3139
3145
|
keyboardToggleKey = "Tab"
|
|
3140
3146
|
} = {}) => {
|
|
3141
|
-
(0,
|
|
3147
|
+
(0, import_react15.useEffect)(() => {
|
|
3142
3148
|
const handleMouseDown = () => {
|
|
3143
3149
|
document.body.classList.add(mouseClassName);
|
|
3144
3150
|
};
|
|
@@ -3157,7 +3163,7 @@ var useInputMethodDetection = ({
|
|
|
3157
3163
|
};
|
|
3158
3164
|
|
|
3159
3165
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3160
|
-
var
|
|
3166
|
+
var import_react16 = require("react");
|
|
3161
3167
|
var useCookieConsent = ({
|
|
3162
3168
|
cookieName,
|
|
3163
3169
|
choiceKey,
|
|
@@ -3170,7 +3176,7 @@ var useCookieConsent = ({
|
|
|
3170
3176
|
areCookiesAccepted,
|
|
3171
3177
|
hasChoiceBeenMade,
|
|
3172
3178
|
clearChoiceFromSession
|
|
3173
|
-
} = (0,
|
|
3179
|
+
} = (0, import_react16.useMemo)(
|
|
3174
3180
|
() => createCookieConsent({
|
|
3175
3181
|
cookieName,
|
|
3176
3182
|
choiceKey,
|
|
@@ -3178,15 +3184,15 @@ var useCookieConsent = ({
|
|
|
3178
3184
|
}),
|
|
3179
3185
|
[cookieName, choiceKey, expiryYears]
|
|
3180
3186
|
);
|
|
3181
|
-
const [showBanner, setShowBanner] = (0,
|
|
3182
|
-
const handleCookieStateChange = (0,
|
|
3187
|
+
const [showBanner, setShowBanner] = (0, import_react16.useState)(false);
|
|
3188
|
+
const handleCookieStateChange = (0, import_react16.useCallback)(() => {
|
|
3183
3189
|
const cookiesNowAccepted = areCookiesAccepted();
|
|
3184
3190
|
if (onConsentChange) {
|
|
3185
3191
|
onConsentChange(cookiesNowAccepted);
|
|
3186
3192
|
}
|
|
3187
3193
|
setShowBanner(false);
|
|
3188
3194
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3189
|
-
(0,
|
|
3195
|
+
(0, import_react16.useEffect)(() => {
|
|
3190
3196
|
const cookiesAccepted = areCookiesAccepted();
|
|
3191
3197
|
const choiceMade = hasChoiceBeenMade();
|
|
3192
3198
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3315,7 +3321,7 @@ var QuestionRenderer = ({
|
|
|
3315
3321
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3316
3322
|
|
|
3317
3323
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3318
|
-
var
|
|
3324
|
+
var import_react17 = require("react");
|
|
3319
3325
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3320
3326
|
var QuestionGroup = ({
|
|
3321
3327
|
questions,
|
|
@@ -3335,7 +3341,7 @@ var QuestionGroup = ({
|
|
|
3335
3341
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3336
3342
|
(e) => e.startsWith("groupCheck-")
|
|
3337
3343
|
);
|
|
3338
|
-
(0,
|
|
3344
|
+
(0, import_react17.useEffect)(() => {
|
|
3339
3345
|
questions.forEach((question) => {
|
|
3340
3346
|
if (question.visible && !question.isDisplayed) {
|
|
3341
3347
|
markQuestionAsDisplayed(question);
|
|
@@ -3343,7 +3349,7 @@ var QuestionGroup = ({
|
|
|
3343
3349
|
});
|
|
3344
3350
|
}, [questions]);
|
|
3345
3351
|
const groupQuestions = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: questions.map((question, index) => {
|
|
3346
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3347
3353
|
QuestionRenderer_default,
|
|
3348
3354
|
{
|
|
3349
3355
|
question,
|
|
@@ -3392,7 +3398,7 @@ var QuestionGroup = ({
|
|
|
3392
3398
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pts-root-question-group-div", children: groupQuestions });
|
|
3393
3399
|
case "none":
|
|
3394
3400
|
default:
|
|
3395
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: groupQuestions });
|
|
3396
3402
|
}
|
|
3397
3403
|
};
|
|
3398
3404
|
var QuestionGroup_default = QuestionGroup;
|
|
@@ -4014,10 +4020,10 @@ var Header = ({
|
|
|
4014
4020
|
var HeaderStandard_default = Header;
|
|
4015
4021
|
|
|
4016
4022
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
4017
|
-
var
|
|
4023
|
+
var import_react20 = require("react");
|
|
4018
4024
|
|
|
4019
4025
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
4020
|
-
var
|
|
4026
|
+
var import_react18 = require("react");
|
|
4021
4027
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4022
4028
|
var Navigation = ({
|
|
4023
4029
|
setIsMenyOpen,
|
|
@@ -4030,9 +4036,9 @@ var Navigation = ({
|
|
|
4030
4036
|
activePath = null
|
|
4031
4037
|
}) => {
|
|
4032
4038
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
4033
|
-
const navRef = (0,
|
|
4034
|
-
const firstVisitRef = (0,
|
|
4035
|
-
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);
|
|
4036
4042
|
const handleSubMenu = (label) => {
|
|
4037
4043
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
4038
4044
|
};
|
|
@@ -4041,7 +4047,7 @@ var Navigation = ({
|
|
|
4041
4047
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4042
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());
|
|
4043
4049
|
};
|
|
4044
|
-
(0,
|
|
4050
|
+
(0, import_react18.useEffect)(() => {
|
|
4045
4051
|
var _a, _b;
|
|
4046
4052
|
if (!isOpen) {
|
|
4047
4053
|
setOpenSubMenu(null);
|
|
@@ -4053,7 +4059,7 @@ var Navigation = ({
|
|
|
4053
4059
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
4054
4060
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
4055
4061
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
4056
|
-
(0,
|
|
4062
|
+
(0, import_react18.useEffect)(() => {
|
|
4057
4063
|
if (!isOpen || !navRef.current) {
|
|
4058
4064
|
return;
|
|
4059
4065
|
}
|
|
@@ -4103,8 +4109,8 @@ var Navigation = ({
|
|
|
4103
4109
|
}
|
|
4104
4110
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4105
4111
|
};
|
|
4106
|
-
const [instruction, setInstruction] = (0,
|
|
4107
|
-
(0,
|
|
4112
|
+
const [instruction, setInstruction] = (0, import_react18.useState)("");
|
|
4113
|
+
(0, import_react18.useEffect)(() => {
|
|
4108
4114
|
if (firstVisitRef.current) {
|
|
4109
4115
|
firstVisitRef.current = false;
|
|
4110
4116
|
return;
|
|
@@ -4193,7 +4199,7 @@ var Navigation = ({
|
|
|
4193
4199
|
var NavigationStandard_default = Navigation;
|
|
4194
4200
|
|
|
4195
4201
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4196
|
-
var
|
|
4202
|
+
var import_react19 = require("react");
|
|
4197
4203
|
|
|
4198
4204
|
// src/components/layout/SearchBarStandard/Icons.tsx
|
|
4199
4205
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -4217,7 +4223,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
|
|
|
4217
4223
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4218
4224
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4219
4225
|
var SearchBar = ({ activatedLanguage = "sv" }) => {
|
|
4220
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
4226
|
+
const [searchTerm, setSearchTerm] = (0, import_react19.useState)("");
|
|
4221
4227
|
const handleSearch = () => {
|
|
4222
4228
|
console.log("S\xF6kt efter:", searchTerm);
|
|
4223
4229
|
};
|
|
@@ -4271,8 +4277,8 @@ var NavigationHeader = ({
|
|
|
4271
4277
|
if (activatedLanguage === "sv") return "English";
|
|
4272
4278
|
else return "Svenska";
|
|
4273
4279
|
};
|
|
4274
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
4275
|
-
const menuButtonFocusRef = (0,
|
|
4280
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react20.useState)(false);
|
|
4281
|
+
const menuButtonFocusRef = (0, import_react20.useRef)(null);
|
|
4276
4282
|
const handleMenuClick = () => {
|
|
4277
4283
|
setIsMenuOpen((prev) => !prev);
|
|
4278
4284
|
};
|
|
@@ -4286,7 +4292,7 @@ var NavigationHeader = ({
|
|
|
4286
4292
|
const getMenuIcon = () => {
|
|
4287
4293
|
return isMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MenuIcon, {});
|
|
4288
4294
|
};
|
|
4289
|
-
const [isSearchOpen, setIsSearchOpen] = (0,
|
|
4295
|
+
const [isSearchOpen, setIsSearchOpen] = (0, import_react20.useState)(false);
|
|
4290
4296
|
const handleSearchClick = () => {
|
|
4291
4297
|
if (!isSearchOpen) {
|
|
4292
4298
|
setIsSearchOpen(true);
|
|
@@ -4501,14 +4507,14 @@ var LinkStandard = ({
|
|
|
4501
4507
|
var LinkStandard_default = LinkStandard;
|
|
4502
4508
|
|
|
4503
4509
|
// src/components/layout/LinkListStandard/LinkListStandard.tsx
|
|
4504
|
-
var
|
|
4510
|
+
var import_react21 = require("react");
|
|
4505
4511
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4506
4512
|
var LinkList = ({
|
|
4507
4513
|
linkArray,
|
|
4508
4514
|
activatedLanguage,
|
|
4509
4515
|
linkComponent: LinkComponent = "a"
|
|
4510
4516
|
}) => {
|
|
4511
|
-
const uniqueId = (0,
|
|
4517
|
+
const uniqueId = (0, import_react21.useId)();
|
|
4512
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) => {
|
|
4513
4519
|
var _a, _b, _c;
|
|
4514
4520
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -4527,7 +4533,7 @@ var LinkList = ({
|
|
|
4527
4533
|
var LinkListStandard_default = LinkList;
|
|
4528
4534
|
|
|
4529
4535
|
// src/components/layout/CollapseStandard/CollapseStandard.tsx
|
|
4530
|
-
var
|
|
4536
|
+
var import_react22 = require("react");
|
|
4531
4537
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4532
4538
|
var Collapse = ({
|
|
4533
4539
|
title,
|
|
@@ -4537,8 +4543,8 @@ var Collapse = ({
|
|
|
4537
4543
|
activatedLanguage = "sv",
|
|
4538
4544
|
customClass = ""
|
|
4539
4545
|
}) => {
|
|
4540
|
-
const [isOpen, setIsOpen] = (0,
|
|
4541
|
-
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)();
|
|
4542
4548
|
const contentId = `${uniqueId}-content`;
|
|
4543
4549
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
4544
4550
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj" : "Hide";
|
|
@@ -4652,14 +4658,14 @@ var StepperButtons = ({
|
|
|
4652
4658
|
var StepperButtonsStandard_default = StepperButtons;
|
|
4653
4659
|
|
|
4654
4660
|
// src/components/stepper/StepperStandard/StepperStandard.tsx
|
|
4655
|
-
var
|
|
4661
|
+
var import_react23 = __toESM(require("react"));
|
|
4656
4662
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4657
4663
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
4658
4664
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
4659
4665
|
const isActive = step.step === activeStep;
|
|
4660
4666
|
const lastElement = arraySteps.length;
|
|
4661
4667
|
const isDone = step.step < activeStep;
|
|
4662
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react23.default.Fragment, { children: [
|
|
4663
4669
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "pts-stepper-step", children: [
|
|
4664
4670
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4665
4671
|
"div",
|