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