optimized-react-component-library-xyz123 3.3.0 → 3.3.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 +36 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -289,7 +289,7 @@ var PreviewCheckboxGroup = ({
|
|
|
289
289
|
};
|
|
290
290
|
|
|
291
291
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
292
|
-
import { useState as useState3 } from "react";
|
|
292
|
+
import { useEffect as useEffect3, useRef, useState as useState3 } from "react";
|
|
293
293
|
import DOMPurify from "dompurify";
|
|
294
294
|
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
295
295
|
var InputTextarea = ({
|
|
@@ -298,20 +298,31 @@ var InputTextarea = ({
|
|
|
298
298
|
showPreview = false,
|
|
299
299
|
activatedLanguage
|
|
300
300
|
}) => {
|
|
301
|
-
var _a, _b, _c, _d, _e, _f;
|
|
301
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
302
302
|
const questionId = `question-${question.id}`;
|
|
303
303
|
const inputId = `textarea-${question.id}`;
|
|
304
304
|
const aboutId = `about-${question.id}`;
|
|
305
305
|
const errorId = `error-${question.id}`;
|
|
306
|
-
const [localAnswer, setLocalAnswer] = useState3(question.answer);
|
|
306
|
+
const [localAnswer, setLocalAnswer] = useState3((_a = question.answer) != null ? _a : "");
|
|
307
|
+
const lastSyncedAnswer = useRef((_b = question.answer) != null ? _b : "");
|
|
308
|
+
useEffect3(() => {
|
|
309
|
+
var _a2;
|
|
310
|
+
const incomingFromRedux = (_a2 = question.answer) != null ? _a2 : "";
|
|
311
|
+
if (incomingFromRedux !== lastSyncedAnswer.current) {
|
|
312
|
+
setLocalAnswer(incomingFromRedux);
|
|
313
|
+
lastSyncedAnswer.current = incomingFromRedux;
|
|
314
|
+
}
|
|
315
|
+
}, [question.answer]);
|
|
307
316
|
const defaultMaxLength = 1e3;
|
|
308
|
-
const answerLength = (
|
|
309
|
-
const maxLength = (
|
|
317
|
+
const answerLength = (_d = (_c = question.answer) == null ? void 0 : _c.length) != null ? _d : 0;
|
|
318
|
+
const maxLength = (_f = (_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) != null ? _f : defaultMaxLength;
|
|
310
319
|
const isTooLong = answerLength > maxLength;
|
|
311
320
|
const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
|
|
312
321
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
313
|
-
const
|
|
314
|
-
|
|
322
|
+
const handleOnChange = (e) => {
|
|
323
|
+
const value = e.target.value;
|
|
324
|
+
setLocalAnswer(value);
|
|
325
|
+
lastSyncedAnswer.current = value;
|
|
315
326
|
handleQuestionInputChange(e, question);
|
|
316
327
|
};
|
|
317
328
|
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
@@ -340,7 +351,7 @@ var InputTextarea = ({
|
|
|
340
351
|
"textarea",
|
|
341
352
|
{
|
|
342
353
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
343
|
-
onChange:
|
|
354
|
+
onChange: handleOnChange,
|
|
344
355
|
value: localAnswer,
|
|
345
356
|
required: question.isQuestionMandatory,
|
|
346
357
|
"aria-required": question.isQuestionMandatory,
|
|
@@ -350,13 +361,13 @@ var InputTextarea = ({
|
|
|
350
361
|
}
|
|
351
362
|
),
|
|
352
363
|
/* @__PURE__ */ jsxs5("div", { className: "pts-textarea-counter-error-container", children: [
|
|
353
|
-
!((
|
|
364
|
+
!((_g = question.questionExtraAttribute) == null ? void 0 : _g.hideTextCounter) && /* @__PURE__ */ jsx5("div", { "aria-live": "polite", className: `pts-character-counter`, children: counterText }),
|
|
354
365
|
!isTooLong && question.hasValidationError && /* @__PURE__ */ jsx5(
|
|
355
366
|
ValidationMessage_default,
|
|
356
367
|
{
|
|
357
368
|
showValidationMessage: true,
|
|
358
369
|
validationId: errorId,
|
|
359
|
-
validationMessesege: (
|
|
370
|
+
validationMessesege: (_h = question.validationDefaultMessesege) != null ? _h : "",
|
|
360
371
|
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
361
372
|
}
|
|
362
373
|
),
|
|
@@ -397,7 +408,7 @@ var PreviewTextarea = ({
|
|
|
397
408
|
};
|
|
398
409
|
|
|
399
410
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
400
|
-
import { useState as useState4, useRef, useEffect as
|
|
411
|
+
import { useState as useState4, useRef as useRef2, useEffect as useEffect4 } from "react";
|
|
401
412
|
import DOMPurify2 from "dompurify";
|
|
402
413
|
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
403
414
|
var TextFieldStandard = ({
|
|
@@ -406,20 +417,22 @@ var TextFieldStandard = ({
|
|
|
406
417
|
showPreview = false,
|
|
407
418
|
activatedLanguage
|
|
408
419
|
}) => {
|
|
409
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
420
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
410
421
|
const questionId = `question-${question.id}`;
|
|
411
422
|
const inputId = `textField-${question.id}`;
|
|
412
423
|
const aboutId = `about-${question.id}`;
|
|
413
424
|
const errorId = `error-${question.id}`;
|
|
414
425
|
const [localAnswer, setLocalAnswer] = useState4((_a = question.answer) != null ? _a : "");
|
|
415
|
-
const lastSyncedAnswer =
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
426
|
+
const lastSyncedAnswer = useRef2((_b = question.answer) != null ? _b : "");
|
|
427
|
+
useEffect4(() => {
|
|
428
|
+
var _a2;
|
|
429
|
+
const incomingFromRedux = (_a2 = question.answer) != null ? _a2 : "";
|
|
430
|
+
if (incomingFromRedux !== lastSyncedAnswer.current) {
|
|
431
|
+
setLocalAnswer(incomingFromRedux);
|
|
432
|
+
lastSyncedAnswer.current = incomingFromRedux;
|
|
420
433
|
}
|
|
421
434
|
}, [question.answer]);
|
|
422
|
-
const answerLength = (
|
|
435
|
+
const answerLength = (_c = localAnswer == null ? void 0 : localAnswer.length) != null ? _c : 0;
|
|
423
436
|
const maxLength = 100;
|
|
424
437
|
const isTooLong = answerLength > maxLength;
|
|
425
438
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
@@ -434,7 +447,7 @@ var TextFieldStandard = ({
|
|
|
434
447
|
"div",
|
|
435
448
|
{
|
|
436
449
|
id: questionId,
|
|
437
|
-
className: `pts-root-question pts-textField-container ${((
|
|
450
|
+
className: `pts-root-question pts-textField-container ${((_d = question.questionExtraAttribute) == null ? void 0 : _d.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
|
|
438
451
|
children: [
|
|
439
452
|
/* @__PURE__ */ jsxs6("label", { htmlFor: inputId, children: [
|
|
440
453
|
question.questionLabel,
|
|
@@ -454,21 +467,21 @@ var TextFieldStandard = ({
|
|
|
454
467
|
/* @__PURE__ */ jsx6(
|
|
455
468
|
"input",
|
|
456
469
|
{
|
|
457
|
-
type: (
|
|
458
|
-
autoComplete: (
|
|
459
|
-
inputMode: (
|
|
470
|
+
type: (_f = (_e = question.questionExtraAttribute) == null ? void 0 : _e.inputType) != null ? _f : "text",
|
|
471
|
+
autoComplete: (_h = (_g = question.questionExtraAttribute) == null ? void 0 : _g.autoComplete) != null ? _h : void 0,
|
|
472
|
+
inputMode: (_j = (_i = question.questionExtraAttribute) == null ? void 0 : _i.inputMode) != null ? _j : void 0,
|
|
460
473
|
name: `question-name-${question.id}`,
|
|
461
474
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
462
475
|
onChange: handleOnChange,
|
|
463
476
|
value: localAnswer,
|
|
464
477
|
id: inputId,
|
|
465
|
-
disabled: (
|
|
478
|
+
disabled: (_k = question.questionExtraAttribute) == null ? void 0 : _k.disabled,
|
|
466
479
|
required: question.isQuestionMandatory,
|
|
467
480
|
"aria-required": question.isQuestionMandatory,
|
|
468
481
|
"aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
|
|
469
482
|
"aria-invalid": question.hasValidationError,
|
|
470
|
-
spellCheck: (
|
|
471
|
-
autoCapitalize: (
|
|
483
|
+
spellCheck: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.spellCheck) != null ? _m : void 0,
|
|
484
|
+
autoCapitalize: (_o = (_n = question.questionExtraAttribute) == null ? void 0 : _n.autoCapitalize) != null ? _o : void 0
|
|
472
485
|
}
|
|
473
486
|
),
|
|
474
487
|
!isTooLong && question.hasValidationError && /* @__PURE__ */ jsx6(
|
|
@@ -476,7 +489,7 @@ var TextFieldStandard = ({
|
|
|
476
489
|
{
|
|
477
490
|
showValidationMessage: true,
|
|
478
491
|
validationId: errorId,
|
|
479
|
-
validationMessesege: (
|
|
492
|
+
validationMessesege: (_p = question.validationDefaultMessesege) != null ? _p : "",
|
|
480
493
|
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
481
494
|
}
|
|
482
495
|
),
|
|
@@ -516,7 +529,7 @@ var PreviewTextField = ({
|
|
|
516
529
|
};
|
|
517
530
|
|
|
518
531
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
519
|
-
import { useCallback, useEffect as
|
|
532
|
+
import { useCallback, useEffect as useEffect7, useState as useState7 } from "react";
|
|
520
533
|
import clsx3 from "clsx";
|
|
521
534
|
|
|
522
535
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -568,7 +581,7 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
568
581
|
var DropFilesStandard_default = DropFiles;
|
|
569
582
|
|
|
570
583
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
571
|
-
import { useRef as
|
|
584
|
+
import { useRef as useRef3 } from "react";
|
|
572
585
|
import clsx from "clsx";
|
|
573
586
|
|
|
574
587
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
@@ -611,8 +624,8 @@ var ExploreFiles = ({
|
|
|
611
624
|
showErrors,
|
|
612
625
|
errorMessageAddingFile
|
|
613
626
|
}) => {
|
|
614
|
-
const fileInputRef =
|
|
615
|
-
const buttonInputRef =
|
|
627
|
+
const fileInputRef = useRef3(null);
|
|
628
|
+
const buttonInputRef = useRef3(null);
|
|
616
629
|
const handleFiles = (event) => {
|
|
617
630
|
const files = Array.from(event.target.files || []);
|
|
618
631
|
FilesSelected(files);
|
|
@@ -680,7 +693,7 @@ var ExploreFiles = ({
|
|
|
680
693
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
681
694
|
|
|
682
695
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
683
|
-
import React6, { useEffect as
|
|
696
|
+
import React6, { useEffect as useEffect6, useState as useState6, useRef as useRef4 } from "react";
|
|
684
697
|
import { Col, Row } from "react-bootstrap";
|
|
685
698
|
|
|
686
699
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
@@ -708,7 +721,7 @@ var SelectedFiles = ({
|
|
|
708
721
|
setNumberOfFiles,
|
|
709
722
|
removeUploadErrors
|
|
710
723
|
}) => {
|
|
711
|
-
const theDiv =
|
|
724
|
+
const theDiv = useRef4(null);
|
|
712
725
|
const remove = (file) => {
|
|
713
726
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
714
727
|
const newCountOfFiles = newFiles.length;
|
|
@@ -721,7 +734,7 @@ var SelectedFiles = ({
|
|
|
721
734
|
};
|
|
722
735
|
const useWindowWidth = () => {
|
|
723
736
|
const [windowWidth2, setWindowWidth] = useState6(window.innerWidth);
|
|
724
|
-
|
|
737
|
+
useEffect6(() => {
|
|
725
738
|
const handleResize = () => {
|
|
726
739
|
setWindowWidth(window.innerWidth);
|
|
727
740
|
};
|
|
@@ -895,14 +908,14 @@ var AddFiles = ({
|
|
|
895
908
|
const [errorMessageAddingFile, setErrorMessageAddingFile] = useState7([]);
|
|
896
909
|
const [newFiles, setNewFiles] = useState7([]);
|
|
897
910
|
const [dropFilesText, setDropFilesText] = useState7("Dra och sl\xE4pp dina filer h\xE4r");
|
|
898
|
-
|
|
911
|
+
useEffect7(() => {
|
|
899
912
|
if (activatedLanguage === "sv") {
|
|
900
913
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
901
914
|
} else {
|
|
902
915
|
setDropFilesText("Drag and drop your files here");
|
|
903
916
|
}
|
|
904
917
|
}, [activatedLanguage]);
|
|
905
|
-
|
|
918
|
+
useEffect7(() => {
|
|
906
919
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
907
920
|
setNumberOfFiles(questionObject.files.length);
|
|
908
921
|
}
|
|
@@ -997,7 +1010,7 @@ var AddFiles = ({
|
|
|
997
1010
|
reader.readAsDataURL(file);
|
|
998
1011
|
});
|
|
999
1012
|
};
|
|
1000
|
-
|
|
1013
|
+
useEffect7(() => {
|
|
1001
1014
|
if (newFiles.length > 0) {
|
|
1002
1015
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1003
1016
|
const e = {
|
|
@@ -1117,7 +1130,7 @@ var PreviewAddFiles = ({
|
|
|
1117
1130
|
};
|
|
1118
1131
|
|
|
1119
1132
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1120
|
-
import { useEffect as
|
|
1133
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
1121
1134
|
import DOMPurify3 from "dompurify";
|
|
1122
1135
|
import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1123
1136
|
var SingleCheckbox = ({
|
|
@@ -1132,7 +1145,7 @@ var SingleCheckbox = ({
|
|
|
1132
1145
|
const aboutId = `about-${question.id}`;
|
|
1133
1146
|
const errorId = `error-${question.id}`;
|
|
1134
1147
|
const [checked, setChecked] = useState8(false);
|
|
1135
|
-
|
|
1148
|
+
useEffect8(() => {
|
|
1136
1149
|
if (question.answer && question.answer === "true") {
|
|
1137
1150
|
setChecked(true);
|
|
1138
1151
|
} else {
|
|
@@ -2063,7 +2076,7 @@ var InfoOnlyStandard_default = InputInfoOnly;
|
|
|
2063
2076
|
import React9 from "react";
|
|
2064
2077
|
|
|
2065
2078
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2066
|
-
import { useEffect as
|
|
2079
|
+
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
2067
2080
|
import DOMPurify7 from "dompurify";
|
|
2068
2081
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2069
2082
|
var RadioCollapseItem = ({
|
|
@@ -2085,7 +2098,7 @@ var RadioCollapseItem = ({
|
|
|
2085
2098
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2086
2099
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2087
2100
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2088
|
-
|
|
2101
|
+
useEffect9(() => {
|
|
2089
2102
|
if (questionAnswer === value) {
|
|
2090
2103
|
setIsOpen(true);
|
|
2091
2104
|
} else {
|
|
@@ -3038,7 +3051,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3038
3051
|
};
|
|
3039
3052
|
|
|
3040
3053
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3041
|
-
import { useMemo, useEffect as
|
|
3054
|
+
import { useMemo, useEffect as useEffect11 } from "react";
|
|
3042
3055
|
var usePTSPageTitle = ({
|
|
3043
3056
|
formStatus,
|
|
3044
3057
|
activeStep,
|
|
@@ -3056,19 +3069,19 @@ var usePTSPageTitle = ({
|
|
|
3056
3069
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3057
3070
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3058
3071
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3059
|
-
|
|
3072
|
+
useEffect11(() => {
|
|
3060
3073
|
document.title = computedTitle;
|
|
3061
3074
|
}, [computedTitle]);
|
|
3062
3075
|
return computedTitle;
|
|
3063
3076
|
};
|
|
3064
3077
|
|
|
3065
3078
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3066
|
-
import { useEffect as
|
|
3079
|
+
import { useEffect as useEffect12 } from "react";
|
|
3067
3080
|
var useInputMethodDetection = ({
|
|
3068
3081
|
mouseClassName = "using-mouse",
|
|
3069
3082
|
keyboardToggleKey = "Tab"
|
|
3070
3083
|
} = {}) => {
|
|
3071
|
-
|
|
3084
|
+
useEffect12(() => {
|
|
3072
3085
|
const handleMouseDown = () => {
|
|
3073
3086
|
document.body.classList.add(mouseClassName);
|
|
3074
3087
|
};
|
|
@@ -3087,7 +3100,7 @@ var useInputMethodDetection = ({
|
|
|
3087
3100
|
};
|
|
3088
3101
|
|
|
3089
3102
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3090
|
-
import { useCallback as useCallback2, useEffect as
|
|
3103
|
+
import { useCallback as useCallback2, useEffect as useEffect13, useMemo as useMemo2, useState as useState10 } from "react";
|
|
3091
3104
|
var useCookieConsent = ({
|
|
3092
3105
|
cookieName,
|
|
3093
3106
|
choiceKey,
|
|
@@ -3116,7 +3129,7 @@ var useCookieConsent = ({
|
|
|
3116
3129
|
}
|
|
3117
3130
|
setShowBanner(false);
|
|
3118
3131
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3119
|
-
|
|
3132
|
+
useEffect13(() => {
|
|
3120
3133
|
const cookiesAccepted = areCookiesAccepted();
|
|
3121
3134
|
const choiceMade = hasChoiceBeenMade();
|
|
3122
3135
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3245,7 +3258,7 @@ var QuestionRenderer = ({
|
|
|
3245
3258
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3246
3259
|
|
|
3247
3260
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3248
|
-
import { useEffect as
|
|
3261
|
+
import { useEffect as useEffect14, Fragment as Fragment18 } from "react";
|
|
3249
3262
|
import { Fragment as Fragment19, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3250
3263
|
var QuestionGroup = ({
|
|
3251
3264
|
questions,
|
|
@@ -3265,7 +3278,7 @@ var QuestionGroup = ({
|
|
|
3265
3278
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3266
3279
|
(e) => e.startsWith("groupCheck-")
|
|
3267
3280
|
);
|
|
3268
|
-
|
|
3281
|
+
useEffect14(() => {
|
|
3269
3282
|
questions.forEach((question) => {
|
|
3270
3283
|
if (question.visible && !question.isDisplayed) {
|
|
3271
3284
|
markQuestionAsDisplayed(question);
|
|
@@ -3945,10 +3958,10 @@ var Header = ({
|
|
|
3945
3958
|
var HeaderStandard_default = Header;
|
|
3946
3959
|
|
|
3947
3960
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
3948
|
-
import { useRef as
|
|
3961
|
+
import { useRef as useRef6, useState as useState13 } from "react";
|
|
3949
3962
|
|
|
3950
3963
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
3951
|
-
import { useEffect as
|
|
3964
|
+
import { useEffect as useEffect15, useState as useState11, useRef as useRef5 } from "react";
|
|
3952
3965
|
import { Fragment as Fragment20, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3953
3966
|
var Navigation = ({
|
|
3954
3967
|
setIsMenyOpen,
|
|
@@ -3961,8 +3974,8 @@ var Navigation = ({
|
|
|
3961
3974
|
activePath = null
|
|
3962
3975
|
}) => {
|
|
3963
3976
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3964
|
-
const navRef =
|
|
3965
|
-
const firstVisitRef =
|
|
3977
|
+
const navRef = useRef5(null);
|
|
3978
|
+
const firstVisitRef = useRef5(true);
|
|
3966
3979
|
const [openSubMenu, setOpenSubMenu] = useState11(null);
|
|
3967
3980
|
const handleSubMenu = (label) => {
|
|
3968
3981
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
@@ -3972,7 +3985,7 @@ var Navigation = ({
|
|
|
3972
3985
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3973
3986
|
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
3987
|
};
|
|
3975
|
-
|
|
3988
|
+
useEffect15(() => {
|
|
3976
3989
|
var _a, _b;
|
|
3977
3990
|
if (!isOpen) {
|
|
3978
3991
|
setOpenSubMenu(null);
|
|
@@ -3984,7 +3997,7 @@ var Navigation = ({
|
|
|
3984
3997
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
3985
3998
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
3986
3999
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
3987
|
-
|
|
4000
|
+
useEffect15(() => {
|
|
3988
4001
|
if (!isOpen || !navRef.current) {
|
|
3989
4002
|
return;
|
|
3990
4003
|
}
|
|
@@ -4035,7 +4048,7 @@ var Navigation = ({
|
|
|
4035
4048
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4036
4049
|
};
|
|
4037
4050
|
const [instruction, setInstruction] = useState11("");
|
|
4038
|
-
|
|
4051
|
+
useEffect15(() => {
|
|
4039
4052
|
if (firstVisitRef.current) {
|
|
4040
4053
|
firstVisitRef.current = false;
|
|
4041
4054
|
return;
|
|
@@ -4203,7 +4216,7 @@ var NavigationHeader = ({
|
|
|
4203
4216
|
else return "Svenska";
|
|
4204
4217
|
};
|
|
4205
4218
|
const [isMenuOpen, setIsMenuOpen] = useState13(false);
|
|
4206
|
-
const menuButtonFocusRef =
|
|
4219
|
+
const menuButtonFocusRef = useRef6(null);
|
|
4207
4220
|
const handleMenuClick = () => {
|
|
4208
4221
|
setIsMenuOpen((prev) => !prev);
|
|
4209
4222
|
};
|