optimized-react-component-library-xyz123 3.4.0 → 3.4.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 +261 -231
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +247 -217
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -376,6 +376,188 @@ var PreviewCheckboxGroup = ({
|
|
|
376
376
|
] });
|
|
377
377
|
};
|
|
378
378
|
|
|
379
|
+
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
380
|
+
var import_react7 = require("react");
|
|
381
|
+
|
|
382
|
+
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
383
|
+
var import_react3 = require("react");
|
|
384
|
+
|
|
385
|
+
// src/helpers/cookieHandler/cookieHandler.ts
|
|
386
|
+
var getCookie = (name) => {
|
|
387
|
+
const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
|
|
388
|
+
return match ? match[2] : null;
|
|
389
|
+
};
|
|
390
|
+
var setCookie = (name, value, expirationDate) => {
|
|
391
|
+
let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
|
|
392
|
+
if (expirationDate) {
|
|
393
|
+
cookieString += `; expires=${expirationDate.toUTCString()}`;
|
|
394
|
+
}
|
|
395
|
+
if (window.location.protocol === "https:") {
|
|
396
|
+
cookieString += "; Secure";
|
|
397
|
+
}
|
|
398
|
+
document.cookie = cookieString;
|
|
399
|
+
};
|
|
400
|
+
var removeCookie = (name) => {
|
|
401
|
+
const pastDate = /* @__PURE__ */ new Date(0);
|
|
402
|
+
setCookie(name, "", pastDate);
|
|
403
|
+
};
|
|
404
|
+
var createCookieConsent = (config) => {
|
|
405
|
+
const { cookieName, choiceKey, expiryYears = 1 } = config;
|
|
406
|
+
const acceptCookies = () => {
|
|
407
|
+
const expires = /* @__PURE__ */ new Date();
|
|
408
|
+
expires.setFullYear(expires.getFullYear() + expiryYears);
|
|
409
|
+
setCookie(cookieName, "true", expires);
|
|
410
|
+
localStorage.setItem(cookieName, "true");
|
|
411
|
+
};
|
|
412
|
+
const rejectCookies = () => {
|
|
413
|
+
removeCookie(cookieName);
|
|
414
|
+
localStorage.removeItem(cookieName);
|
|
415
|
+
sessionStorage.setItem(choiceKey, "true");
|
|
416
|
+
};
|
|
417
|
+
const areCookiesAccepted = () => getCookie(cookieName) === "true";
|
|
418
|
+
const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === "true";
|
|
419
|
+
const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
|
|
420
|
+
return {
|
|
421
|
+
acceptCookies,
|
|
422
|
+
rejectCookies,
|
|
423
|
+
areCookiesAccepted,
|
|
424
|
+
hasChoiceBeenMade,
|
|
425
|
+
clearChoiceFromSession
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
430
|
+
var useCookieConsent = ({
|
|
431
|
+
cookieName,
|
|
432
|
+
choiceKey,
|
|
433
|
+
expiryYears = 1,
|
|
434
|
+
onConsentChange
|
|
435
|
+
}) => {
|
|
436
|
+
const {
|
|
437
|
+
acceptCookies,
|
|
438
|
+
rejectCookies,
|
|
439
|
+
areCookiesAccepted,
|
|
440
|
+
hasChoiceBeenMade,
|
|
441
|
+
clearChoiceFromSession
|
|
442
|
+
} = (0, import_react3.useMemo)(
|
|
443
|
+
() => createCookieConsent({
|
|
444
|
+
cookieName,
|
|
445
|
+
choiceKey,
|
|
446
|
+
expiryYears
|
|
447
|
+
}),
|
|
448
|
+
[cookieName, choiceKey, expiryYears]
|
|
449
|
+
);
|
|
450
|
+
const [showBanner, setShowBanner] = (0, import_react3.useState)(false);
|
|
451
|
+
const handleCookieStateChange = (0, import_react3.useCallback)(() => {
|
|
452
|
+
const cookiesNowAccepted = areCookiesAccepted();
|
|
453
|
+
if (onConsentChange) {
|
|
454
|
+
onConsentChange(cookiesNowAccepted);
|
|
455
|
+
}
|
|
456
|
+
setShowBanner(false);
|
|
457
|
+
}, [areCookiesAccepted, onConsentChange]);
|
|
458
|
+
(0, import_react3.useEffect)(() => {
|
|
459
|
+
const cookiesAccepted = areCookiesAccepted();
|
|
460
|
+
const choiceMade = hasChoiceBeenMade();
|
|
461
|
+
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
462
|
+
if (cookiesAccepted && onConsentChange) {
|
|
463
|
+
onConsentChange(true);
|
|
464
|
+
}
|
|
465
|
+
const handleShowBannerEvent = () => {
|
|
466
|
+
clearChoiceFromSession();
|
|
467
|
+
setShowBanner(true);
|
|
468
|
+
};
|
|
469
|
+
window.addEventListener("showCookieBanner", handleShowBannerEvent);
|
|
470
|
+
return () => {
|
|
471
|
+
window.removeEventListener("showCookieBanner", handleShowBannerEvent);
|
|
472
|
+
};
|
|
473
|
+
}, [areCookiesAccepted, hasChoiceBeenMade, clearChoiceFromSession, onConsentChange]);
|
|
474
|
+
return {
|
|
475
|
+
showBanner,
|
|
476
|
+
handleCookieStateChange,
|
|
477
|
+
acceptCookies,
|
|
478
|
+
rejectCookies
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// src/hooks/useDebouncedValue/useDebouncedValue.ts
|
|
483
|
+
var import_react4 = require("react");
|
|
484
|
+
var useDebouncedValue = (value, delay) => {
|
|
485
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react4.useState)(value);
|
|
486
|
+
(0, import_react4.useEffect)(() => {
|
|
487
|
+
const timeoutId = window.setTimeout(() => {
|
|
488
|
+
setDebouncedValue(value);
|
|
489
|
+
}, delay);
|
|
490
|
+
return () => window.clearTimeout(timeoutId);
|
|
491
|
+
}, [value, delay]);
|
|
492
|
+
return debouncedValue;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
496
|
+
var React = __toESM(require("react"));
|
|
497
|
+
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
498
|
+
React.useEffect(() => {
|
|
499
|
+
if (formStatus === "loading") {
|
|
500
|
+
handleModalOpen();
|
|
501
|
+
}
|
|
502
|
+
if (formStatus === "success" || formStatus === "failed") {
|
|
503
|
+
setTimeout(() => {
|
|
504
|
+
handleModalClose();
|
|
505
|
+
}, 1050);
|
|
506
|
+
const main = document.querySelector(mainSelector);
|
|
507
|
+
if (main) main.focus();
|
|
508
|
+
}
|
|
509
|
+
}, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
513
|
+
var import_react5 = require("react");
|
|
514
|
+
var useInputMethodDetection = ({
|
|
515
|
+
mouseClassName = "using-mouse",
|
|
516
|
+
keyboardToggleKey = "Tab"
|
|
517
|
+
} = {}) => {
|
|
518
|
+
(0, import_react5.useEffect)(() => {
|
|
519
|
+
const handleMouseDown = () => {
|
|
520
|
+
document.body.classList.add(mouseClassName);
|
|
521
|
+
};
|
|
522
|
+
const handleKeyDown = (event) => {
|
|
523
|
+
if (event.key === keyboardToggleKey) {
|
|
524
|
+
document.body.classList.remove(mouseClassName);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
528
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
529
|
+
return () => {
|
|
530
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
531
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
532
|
+
};
|
|
533
|
+
}, [mouseClassName, keyboardToggleKey]);
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
537
|
+
var import_react6 = require("react");
|
|
538
|
+
var usePTSPageTitle = ({
|
|
539
|
+
formStatus,
|
|
540
|
+
activeStep,
|
|
541
|
+
applicationContent,
|
|
542
|
+
thankYouBlock,
|
|
543
|
+
steps,
|
|
544
|
+
fallbackTitle = "PTS e-tj\xE4nst"
|
|
545
|
+
}) => {
|
|
546
|
+
const computedTitle = (0, import_react6.useMemo)(() => {
|
|
547
|
+
var _a, _b, _c, _d;
|
|
548
|
+
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
549
|
+
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
550
|
+
const stepTitle = (_d = (_c = steps == null ? void 0 : steps[Math.max(0, activeStep - 1)]) == null ? void 0 : _c.pageTitle) != null ? _d : "";
|
|
551
|
+
if (formStatus === "success" && thankYouPageTitle) return thankYouPageTitle;
|
|
552
|
+
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
553
|
+
return stepTitle || baseTitle || fallbackTitle;
|
|
554
|
+
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
555
|
+
(0, import_react6.useEffect)(() => {
|
|
556
|
+
document.title = computedTitle;
|
|
557
|
+
}, [computedTitle]);
|
|
558
|
+
return computedTitle;
|
|
559
|
+
};
|
|
560
|
+
|
|
379
561
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
380
562
|
var import_dompurify = __toESM(require("dompurify"));
|
|
381
563
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -385,16 +567,25 @@ var InputTextarea = ({
|
|
|
385
567
|
showPreview = false,
|
|
386
568
|
activatedLanguage
|
|
387
569
|
}) => {
|
|
388
|
-
var _a, _b, _c, _d, _e
|
|
570
|
+
var _a, _b, _c, _d, _e;
|
|
389
571
|
const questionId = `question-${question.id}`;
|
|
390
572
|
const inputId = `textarea-${question.id}`;
|
|
391
573
|
const aboutId = `about-${question.id}`;
|
|
392
574
|
const errorId = `error-${question.id}`;
|
|
575
|
+
const counterLiveRegionId = `counter-live-${question.id}`;
|
|
576
|
+
const [localAnswer, setLocalAnswer] = (0, import_react7.useState)((_a = question.answer) != null ? _a : "");
|
|
577
|
+
(0, import_react7.useEffect)(() => {
|
|
578
|
+
var _a2;
|
|
579
|
+
setLocalAnswer((_a2 = question.answer) != null ? _a2 : "");
|
|
580
|
+
}, [question.answer]);
|
|
581
|
+
const debouncedAnswer = useDebouncedValue(localAnswer, 1e3);
|
|
393
582
|
const defaultMaxLength = 1e3;
|
|
394
|
-
const answerLength =
|
|
395
|
-
const
|
|
583
|
+
const answerLength = localAnswer.length;
|
|
584
|
+
const debouncedAnswerLength = debouncedAnswer.length;
|
|
585
|
+
const maxLength = (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.answerMaxLength) != null ? _c : defaultMaxLength;
|
|
396
586
|
const isTooLong = answerLength > maxLength;
|
|
397
|
-
const
|
|
587
|
+
const visibleCounterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
|
|
588
|
+
const screenReaderCounterText = activatedLanguage === "en" ? `${debouncedAnswerLength} of ${maxLength} characters` : `${debouncedAnswerLength} av ${maxLength} tecken`;
|
|
398
589
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
399
590
|
const onChange = (e) => {
|
|
400
591
|
handleQuestionInputChange(e, question);
|
|
@@ -435,13 +626,16 @@ var InputTextarea = ({
|
|
|
435
626
|
}
|
|
436
627
|
),
|
|
437
628
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-textarea-counter-error-container", children: [
|
|
438
|
-
!((
|
|
629
|
+
!((_d = question.questionExtraAttribute) == null ? void 0 : _d.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "aria-hidden": "true", className: `pts-character-counter`, children: visibleCounterText }),
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { id: counterLiveRegionId, "aria-live": "polite", className: "sr-only", children: screenReaderCounterText })
|
|
632
|
+
] }),
|
|
439
633
|
!isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
440
634
|
ValidationMessage_default,
|
|
441
635
|
{
|
|
442
636
|
showValidationMessage: true,
|
|
443
637
|
validationId: errorId,
|
|
444
|
-
validationMessesege: (
|
|
638
|
+
validationMessesege: (_e = question.validationDefaultMessesege) != null ? _e : "",
|
|
445
639
|
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
446
640
|
}
|
|
447
641
|
),
|
|
@@ -589,7 +783,7 @@ var PreviewTextField = ({
|
|
|
589
783
|
};
|
|
590
784
|
|
|
591
785
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
592
|
-
var
|
|
786
|
+
var import_react12 = require("react");
|
|
593
787
|
var import_clsx3 = __toESM(require("clsx"));
|
|
594
788
|
|
|
595
789
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -641,19 +835,19 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
641
835
|
var DropFilesStandard_default = DropFiles;
|
|
642
836
|
|
|
643
837
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
644
|
-
var
|
|
838
|
+
var import_react9 = require("react");
|
|
645
839
|
var import_clsx = __toESM(require("clsx"));
|
|
646
840
|
|
|
647
841
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
648
|
-
var
|
|
842
|
+
var import_react8 = __toESM(require("react"));
|
|
649
843
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
650
844
|
var ScreenReaderErrors = ({
|
|
651
845
|
errorMessageAddingFile,
|
|
652
846
|
activatedLanguage
|
|
653
847
|
}) => {
|
|
654
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
655
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
656
|
-
|
|
848
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = import_react8.default.useState(false);
|
|
849
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react8.default.useState("");
|
|
850
|
+
import_react8.default.useEffect(() => {
|
|
657
851
|
if (errorMessageAddingFile.length > 0) {
|
|
658
852
|
let errorMessages = "";
|
|
659
853
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -684,8 +878,8 @@ var ExploreFiles = ({
|
|
|
684
878
|
showErrors,
|
|
685
879
|
errorMessageAddingFile
|
|
686
880
|
}) => {
|
|
687
|
-
const fileInputRef = (0,
|
|
688
|
-
const buttonInputRef = (0,
|
|
881
|
+
const fileInputRef = (0, import_react9.useRef)(null);
|
|
882
|
+
const buttonInputRef = (0, import_react9.useRef)(null);
|
|
689
883
|
const handleFiles = (event) => {
|
|
690
884
|
const files = Array.from(event.target.files || []);
|
|
691
885
|
FilesSelected(files);
|
|
@@ -753,16 +947,16 @@ var ExploreFiles = ({
|
|
|
753
947
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
754
948
|
|
|
755
949
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
756
|
-
var
|
|
950
|
+
var import_react11 = __toESM(require("react"));
|
|
757
951
|
var import_react_bootstrap = require("react-bootstrap");
|
|
758
952
|
|
|
759
953
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
760
|
-
var
|
|
954
|
+
var import_react10 = require("react");
|
|
761
955
|
var import_clsx2 = __toESM(require("clsx"));
|
|
762
956
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
763
957
|
var Indicator = (filename) => {
|
|
764
|
-
const [uploadPercentage, setUploadPercentage] = (0,
|
|
765
|
-
const [uploadDone, setUploadDone] = (0,
|
|
958
|
+
const [uploadPercentage, setUploadPercentage] = (0, import_react10.useState)(0);
|
|
959
|
+
const [uploadDone, setUploadDone] = (0, import_react10.useState)(false);
|
|
766
960
|
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
961
|
};
|
|
768
962
|
var IndicatorStandard_default = Indicator;
|
|
@@ -781,7 +975,7 @@ var SelectedFiles = ({
|
|
|
781
975
|
setNumberOfFiles,
|
|
782
976
|
removeUploadErrors
|
|
783
977
|
}) => {
|
|
784
|
-
const theDiv = (0,
|
|
978
|
+
const theDiv = (0, import_react11.useRef)(null);
|
|
785
979
|
const remove = (file) => {
|
|
786
980
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
787
981
|
const newCountOfFiles = newFiles.length;
|
|
@@ -793,8 +987,8 @@ var SelectedFiles = ({
|
|
|
793
987
|
removeFile(newCountOfFiles);
|
|
794
988
|
};
|
|
795
989
|
const useWindowWidth = () => {
|
|
796
|
-
const [windowWidth2, setWindowWidth] = (0,
|
|
797
|
-
(0,
|
|
990
|
+
const [windowWidth2, setWindowWidth] = (0, import_react11.useState)(window.innerWidth);
|
|
991
|
+
(0, import_react11.useEffect)(() => {
|
|
798
992
|
const handleResize = () => {
|
|
799
993
|
setWindowWidth(window.innerWidth);
|
|
800
994
|
};
|
|
@@ -817,7 +1011,7 @@ var SelectedFiles = ({
|
|
|
817
1011
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
818
1012
|
const fileType = errorObj.FileName.split(".").pop();
|
|
819
1013
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
820
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react11.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
1015
|
/* @__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
1016
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
823
1017
|
import_react_bootstrap.Col,
|
|
@@ -870,7 +1064,7 @@ var SelectedFiles = ({
|
|
|
870
1064
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
871
1065
|
const fileType = file.FileName.split(".").pop();
|
|
872
1066
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
873
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react11.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
1068
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileItem", children: [
|
|
875
1069
|
/* @__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
1070
|
"svg",
|
|
@@ -963,24 +1157,24 @@ var AddFiles = ({
|
|
|
963
1157
|
const errorId = `error-${questionObject.id}`;
|
|
964
1158
|
const labelId = `label-${questionObject.id}`;
|
|
965
1159
|
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,
|
|
1160
|
+
const [numberOfFiles, setNumberOfFiles] = (0, import_react12.useState)(0);
|
|
1161
|
+
const [totalFileSize, setTotalFileSize] = (0, import_react12.useState)(0);
|
|
1162
|
+
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0, import_react12.useState)([]);
|
|
1163
|
+
const [newFiles, setNewFiles] = (0, import_react12.useState)([]);
|
|
1164
|
+
const [dropFilesText, setDropFilesText] = (0, import_react12.useState)("Dra och sl\xE4pp dina filer h\xE4r");
|
|
1165
|
+
(0, import_react12.useEffect)(() => {
|
|
972
1166
|
if (activatedLanguage === "sv") {
|
|
973
1167
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
974
1168
|
} else {
|
|
975
1169
|
setDropFilesText("Drag and drop your files here");
|
|
976
1170
|
}
|
|
977
1171
|
}, [activatedLanguage]);
|
|
978
|
-
(0,
|
|
1172
|
+
(0, import_react12.useEffect)(() => {
|
|
979
1173
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
980
1174
|
setNumberOfFiles(questionObject.files.length);
|
|
981
1175
|
}
|
|
982
1176
|
}, []);
|
|
983
|
-
const onDrop = (0,
|
|
1177
|
+
const onDrop = (0, import_react12.useCallback)(
|
|
984
1178
|
(acceptedFiles) => {
|
|
985
1179
|
var _a2, _b2, _c;
|
|
986
1180
|
const validationErrors = [];
|
|
@@ -1070,7 +1264,7 @@ var AddFiles = ({
|
|
|
1070
1264
|
reader.readAsDataURL(file);
|
|
1071
1265
|
});
|
|
1072
1266
|
};
|
|
1073
|
-
(0,
|
|
1267
|
+
(0, import_react12.useEffect)(() => {
|
|
1074
1268
|
if (newFiles.length > 0) {
|
|
1075
1269
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1076
1270
|
const e = {
|
|
@@ -1190,7 +1384,7 @@ var PreviewAddFiles = ({
|
|
|
1190
1384
|
};
|
|
1191
1385
|
|
|
1192
1386
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1193
|
-
var
|
|
1387
|
+
var import_react13 = require("react");
|
|
1194
1388
|
var import_dompurify3 = __toESM(require("dompurify"));
|
|
1195
1389
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1196
1390
|
var SingleCheckbox = ({
|
|
@@ -1204,8 +1398,8 @@ var SingleCheckbox = ({
|
|
|
1204
1398
|
const inputId = `checkbox-${question.id}`;
|
|
1205
1399
|
const aboutId = `about-${question.id}`;
|
|
1206
1400
|
const errorId = `error-${question.id}`;
|
|
1207
|
-
const [checked, setChecked] = (0,
|
|
1208
|
-
(0,
|
|
1401
|
+
const [checked, setChecked] = (0, import_react13.useState)(false);
|
|
1402
|
+
(0, import_react13.useEffect)(() => {
|
|
1209
1403
|
if (question.answer && question.answer === "true") {
|
|
1210
1404
|
setChecked(true);
|
|
1211
1405
|
} else {
|
|
@@ -1281,7 +1475,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1281
1475
|
};
|
|
1282
1476
|
|
|
1283
1477
|
// src/components/text-blocks/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1284
|
-
var
|
|
1478
|
+
var import_react14 = require("react");
|
|
1285
1479
|
var import_dompurify4 = __toESM(require("dompurify"));
|
|
1286
1480
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1287
1481
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
@@ -1290,7 +1484,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
|
1290
1484
|
{
|
|
1291
1485
|
className: "pts-textHeadlineAndBody-container",
|
|
1292
1486
|
children: [
|
|
1293
|
-
data.headline && (0,
|
|
1487
|
+
data.headline && (0, import_react14.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
|
|
1294
1488
|
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify4.default.sanitize(data.body) } }),
|
|
1295
1489
|
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
1490
|
"a",
|
|
@@ -2133,10 +2327,10 @@ var InputInfoOnly = ({
|
|
|
2133
2327
|
var InfoOnlyStandard_default = InputInfoOnly;
|
|
2134
2328
|
|
|
2135
2329
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
|
|
2136
|
-
var
|
|
2330
|
+
var import_react16 = __toESM(require("react"));
|
|
2137
2331
|
|
|
2138
2332
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2139
|
-
var
|
|
2333
|
+
var import_react15 = require("react");
|
|
2140
2334
|
var import_dompurify7 = __toESM(require("dompurify"));
|
|
2141
2335
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2142
2336
|
var RadioCollapseItem = ({
|
|
@@ -2152,13 +2346,13 @@ var RadioCollapseItem = ({
|
|
|
2152
2346
|
activatedLanguage = "sv",
|
|
2153
2347
|
initialOpen = false
|
|
2154
2348
|
}) => {
|
|
2155
|
-
const [isOpen, setIsOpen] = (0,
|
|
2349
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(initialOpen);
|
|
2156
2350
|
const contentId = `${questionId}-content-${index}`;
|
|
2157
2351
|
const buttonId = `${questionId}-button-${index}`;
|
|
2158
2352
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2159
2353
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2160
2354
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2161
|
-
(0,
|
|
2355
|
+
(0, import_react15.useEffect)(() => {
|
|
2162
2356
|
if (questionAnswer === value) {
|
|
2163
2357
|
setIsOpen(true);
|
|
2164
2358
|
} else {
|
|
@@ -2268,7 +2462,7 @@ var RadioWithInfo = ({
|
|
|
2268
2462
|
groupedOptionArray.map((group, g_index) => {
|
|
2269
2463
|
var _a2;
|
|
2270
2464
|
let subId = "subheading-" + g_index;
|
|
2271
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react16.default.Fragment, { children: [
|
|
2272
2466
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2273
2467
|
/* @__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
2468
|
var _a3, _b2, _c2, _d, _e;
|
|
@@ -2994,50 +3188,6 @@ var makeFormSelectors = (selectSlice) => {
|
|
|
2994
3188
|
};
|
|
2995
3189
|
};
|
|
2996
3190
|
|
|
2997
|
-
// src/helpers/cookieHandler/cookieHandler.ts
|
|
2998
|
-
var getCookie = (name) => {
|
|
2999
|
-
const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
|
|
3000
|
-
return match ? match[2] : null;
|
|
3001
|
-
};
|
|
3002
|
-
var setCookie = (name, value, expirationDate) => {
|
|
3003
|
-
let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
|
|
3004
|
-
if (expirationDate) {
|
|
3005
|
-
cookieString += `; expires=${expirationDate.toUTCString()}`;
|
|
3006
|
-
}
|
|
3007
|
-
if (window.location.protocol === "https:") {
|
|
3008
|
-
cookieString += "; Secure";
|
|
3009
|
-
}
|
|
3010
|
-
document.cookie = cookieString;
|
|
3011
|
-
};
|
|
3012
|
-
var removeCookie = (name) => {
|
|
3013
|
-
const pastDate = /* @__PURE__ */ new Date(0);
|
|
3014
|
-
setCookie(name, "", pastDate);
|
|
3015
|
-
};
|
|
3016
|
-
var createCookieConsent = (config) => {
|
|
3017
|
-
const { cookieName, choiceKey, expiryYears = 1 } = config;
|
|
3018
|
-
const acceptCookies = () => {
|
|
3019
|
-
const expires = /* @__PURE__ */ new Date();
|
|
3020
|
-
expires.setFullYear(expires.getFullYear() + expiryYears);
|
|
3021
|
-
setCookie(cookieName, "true", expires);
|
|
3022
|
-
localStorage.setItem(cookieName, "true");
|
|
3023
|
-
};
|
|
3024
|
-
const rejectCookies = () => {
|
|
3025
|
-
removeCookie(cookieName);
|
|
3026
|
-
localStorage.removeItem(cookieName);
|
|
3027
|
-
sessionStorage.setItem(choiceKey, "true");
|
|
3028
|
-
};
|
|
3029
|
-
const areCookiesAccepted = () => getCookie(cookieName) === "true";
|
|
3030
|
-
const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === "true";
|
|
3031
|
-
const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
|
|
3032
|
-
return {
|
|
3033
|
-
acceptCookies,
|
|
3034
|
-
rejectCookies,
|
|
3035
|
-
areCookiesAccepted,
|
|
3036
|
-
hasChoiceBeenMade,
|
|
3037
|
-
clearChoiceFromSession
|
|
3038
|
-
};
|
|
3039
|
-
};
|
|
3040
|
-
|
|
3041
3191
|
// src/helpers/scriptHandler/scriptHandler.ts
|
|
3042
3192
|
var toggleScriptByConsent = (consent, options) => {
|
|
3043
3193
|
if (typeof document === "undefined") return;
|
|
@@ -3090,126 +3240,6 @@ var getGroupCheckIds = (validationType) => {
|
|
|
3090
3240
|
};
|
|
3091
3241
|
var getGroupCheckIds_default = getGroupCheckIds;
|
|
3092
3242
|
|
|
3093
|
-
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
3094
|
-
var React8 = __toESM(require("react"));
|
|
3095
|
-
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
3096
|
-
React8.useEffect(() => {
|
|
3097
|
-
if (formStatus === "loading") {
|
|
3098
|
-
handleModalOpen();
|
|
3099
|
-
}
|
|
3100
|
-
if (formStatus === "success" || formStatus === "failed") {
|
|
3101
|
-
setTimeout(() => {
|
|
3102
|
-
handleModalClose();
|
|
3103
|
-
}, 1050);
|
|
3104
|
-
const main = document.querySelector(mainSelector);
|
|
3105
|
-
if (main) main.focus();
|
|
3106
|
-
}
|
|
3107
|
-
}, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
|
|
3108
|
-
};
|
|
3109
|
-
|
|
3110
|
-
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3111
|
-
var import_react12 = require("react");
|
|
3112
|
-
var usePTSPageTitle = ({
|
|
3113
|
-
formStatus,
|
|
3114
|
-
activeStep,
|
|
3115
|
-
applicationContent,
|
|
3116
|
-
thankYouBlock,
|
|
3117
|
-
steps,
|
|
3118
|
-
fallbackTitle = "PTS e-tj\xE4nst"
|
|
3119
|
-
}) => {
|
|
3120
|
-
const computedTitle = (0, import_react12.useMemo)(() => {
|
|
3121
|
-
var _a, _b, _c, _d;
|
|
3122
|
-
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
3123
|
-
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
3124
|
-
const stepTitle = (_d = (_c = steps == null ? void 0 : steps[Math.max(0, activeStep - 1)]) == null ? void 0 : _c.pageTitle) != null ? _d : "";
|
|
3125
|
-
if (formStatus === "success" && thankYouPageTitle) return thankYouPageTitle;
|
|
3126
|
-
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3127
|
-
return stepTitle || baseTitle || fallbackTitle;
|
|
3128
|
-
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3129
|
-
(0, import_react12.useEffect)(() => {
|
|
3130
|
-
document.title = computedTitle;
|
|
3131
|
-
}, [computedTitle]);
|
|
3132
|
-
return computedTitle;
|
|
3133
|
-
};
|
|
3134
|
-
|
|
3135
|
-
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3136
|
-
var import_react13 = require("react");
|
|
3137
|
-
var useInputMethodDetection = ({
|
|
3138
|
-
mouseClassName = "using-mouse",
|
|
3139
|
-
keyboardToggleKey = "Tab"
|
|
3140
|
-
} = {}) => {
|
|
3141
|
-
(0, import_react13.useEffect)(() => {
|
|
3142
|
-
const handleMouseDown = () => {
|
|
3143
|
-
document.body.classList.add(mouseClassName);
|
|
3144
|
-
};
|
|
3145
|
-
const handleKeyDown = (event) => {
|
|
3146
|
-
if (event.key === keyboardToggleKey) {
|
|
3147
|
-
document.body.classList.remove(mouseClassName);
|
|
3148
|
-
}
|
|
3149
|
-
};
|
|
3150
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
3151
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
3152
|
-
return () => {
|
|
3153
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
3154
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
3155
|
-
};
|
|
3156
|
-
}, [mouseClassName, keyboardToggleKey]);
|
|
3157
|
-
};
|
|
3158
|
-
|
|
3159
|
-
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3160
|
-
var import_react14 = require("react");
|
|
3161
|
-
var useCookieConsent = ({
|
|
3162
|
-
cookieName,
|
|
3163
|
-
choiceKey,
|
|
3164
|
-
expiryYears = 1,
|
|
3165
|
-
onConsentChange
|
|
3166
|
-
}) => {
|
|
3167
|
-
const {
|
|
3168
|
-
acceptCookies,
|
|
3169
|
-
rejectCookies,
|
|
3170
|
-
areCookiesAccepted,
|
|
3171
|
-
hasChoiceBeenMade,
|
|
3172
|
-
clearChoiceFromSession
|
|
3173
|
-
} = (0, import_react14.useMemo)(
|
|
3174
|
-
() => createCookieConsent({
|
|
3175
|
-
cookieName,
|
|
3176
|
-
choiceKey,
|
|
3177
|
-
expiryYears
|
|
3178
|
-
}),
|
|
3179
|
-
[cookieName, choiceKey, expiryYears]
|
|
3180
|
-
);
|
|
3181
|
-
const [showBanner, setShowBanner] = (0, import_react14.useState)(false);
|
|
3182
|
-
const handleCookieStateChange = (0, import_react14.useCallback)(() => {
|
|
3183
|
-
const cookiesNowAccepted = areCookiesAccepted();
|
|
3184
|
-
if (onConsentChange) {
|
|
3185
|
-
onConsentChange(cookiesNowAccepted);
|
|
3186
|
-
}
|
|
3187
|
-
setShowBanner(false);
|
|
3188
|
-
}, [areCookiesAccepted, onConsentChange]);
|
|
3189
|
-
(0, import_react14.useEffect)(() => {
|
|
3190
|
-
const cookiesAccepted = areCookiesAccepted();
|
|
3191
|
-
const choiceMade = hasChoiceBeenMade();
|
|
3192
|
-
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
3193
|
-
if (cookiesAccepted && onConsentChange) {
|
|
3194
|
-
onConsentChange(true);
|
|
3195
|
-
}
|
|
3196
|
-
const handleShowBannerEvent = () => {
|
|
3197
|
-
clearChoiceFromSession();
|
|
3198
|
-
setShowBanner(true);
|
|
3199
|
-
};
|
|
3200
|
-
window.addEventListener("showCookieBanner", handleShowBannerEvent);
|
|
3201
|
-
return () => {
|
|
3202
|
-
window.removeEventListener("showCookieBanner", handleShowBannerEvent);
|
|
3203
|
-
};
|
|
3204
|
-
}, [areCookiesAccepted, hasChoiceBeenMade, clearChoiceFromSession, onConsentChange]);
|
|
3205
|
-
return {
|
|
3206
|
-
showBanner,
|
|
3207
|
-
handleCookieStateChange,
|
|
3208
|
-
acceptCookies,
|
|
3209
|
-
rejectCookies
|
|
3210
|
-
};
|
|
3211
|
-
};
|
|
3212
|
-
|
|
3213
3243
|
// src/components/question-rendering/QuestionRenderer/QuestionRenderer.tsx
|
|
3214
3244
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3215
3245
|
var QuestionRenderer = ({
|
|
@@ -3315,7 +3345,7 @@ var QuestionRenderer = ({
|
|
|
3315
3345
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3316
3346
|
|
|
3317
3347
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3318
|
-
var
|
|
3348
|
+
var import_react17 = require("react");
|
|
3319
3349
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3320
3350
|
var QuestionGroup = ({
|
|
3321
3351
|
questions,
|
|
@@ -3335,7 +3365,7 @@ var QuestionGroup = ({
|
|
|
3335
3365
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3336
3366
|
(e) => e.startsWith("groupCheck-")
|
|
3337
3367
|
);
|
|
3338
|
-
(0,
|
|
3368
|
+
(0, import_react17.useEffect)(() => {
|
|
3339
3369
|
questions.forEach((question) => {
|
|
3340
3370
|
if (question.visible && !question.isDisplayed) {
|
|
3341
3371
|
markQuestionAsDisplayed(question);
|
|
@@ -3344,7 +3374,7 @@ var QuestionGroup = ({
|
|
|
3344
3374
|
}, [questions]);
|
|
3345
3375
|
const groupQuestions = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: questions.map((question, index) => {
|
|
3346
3376
|
var _a2;
|
|
3347
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3348
3378
|
QuestionRenderer_default,
|
|
3349
3379
|
{
|
|
3350
3380
|
question,
|
|
@@ -3393,7 +3423,7 @@ var QuestionGroup = ({
|
|
|
3393
3423
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pts-root-question-group-div", children: groupQuestions });
|
|
3394
3424
|
case "none":
|
|
3395
3425
|
default:
|
|
3396
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: groupQuestions });
|
|
3397
3427
|
}
|
|
3398
3428
|
};
|
|
3399
3429
|
var QuestionGroup_default = QuestionGroup;
|
|
@@ -4015,10 +4045,10 @@ var Header = ({
|
|
|
4015
4045
|
var HeaderStandard_default = Header;
|
|
4016
4046
|
|
|
4017
4047
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
4018
|
-
var
|
|
4048
|
+
var import_react20 = require("react");
|
|
4019
4049
|
|
|
4020
4050
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
4021
|
-
var
|
|
4051
|
+
var import_react18 = require("react");
|
|
4022
4052
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4023
4053
|
var Navigation = ({
|
|
4024
4054
|
setIsMenyOpen,
|
|
@@ -4031,9 +4061,9 @@ var Navigation = ({
|
|
|
4031
4061
|
activePath = null
|
|
4032
4062
|
}) => {
|
|
4033
4063
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
4034
|
-
const navRef = (0,
|
|
4035
|
-
const firstVisitRef = (0,
|
|
4036
|
-
const [openSubMenu, setOpenSubMenu] = (0,
|
|
4064
|
+
const navRef = (0, import_react18.useRef)(null);
|
|
4065
|
+
const firstVisitRef = (0, import_react18.useRef)(true);
|
|
4066
|
+
const [openSubMenu, setOpenSubMenu] = (0, import_react18.useState)(null);
|
|
4037
4067
|
const handleSubMenu = (label) => {
|
|
4038
4068
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
4039
4069
|
};
|
|
@@ -4042,7 +4072,7 @@ var Navigation = ({
|
|
|
4042
4072
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4043
4073
|
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
4044
4074
|
};
|
|
4045
|
-
(0,
|
|
4075
|
+
(0, import_react18.useEffect)(() => {
|
|
4046
4076
|
var _a, _b;
|
|
4047
4077
|
if (!isOpen) {
|
|
4048
4078
|
setOpenSubMenu(null);
|
|
@@ -4054,7 +4084,7 @@ var Navigation = ({
|
|
|
4054
4084
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
4055
4085
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
4056
4086
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
4057
|
-
(0,
|
|
4087
|
+
(0, import_react18.useEffect)(() => {
|
|
4058
4088
|
if (!isOpen || !navRef.current) {
|
|
4059
4089
|
return;
|
|
4060
4090
|
}
|
|
@@ -4104,8 +4134,8 @@ var Navigation = ({
|
|
|
4104
4134
|
}
|
|
4105
4135
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4106
4136
|
};
|
|
4107
|
-
const [instruction, setInstruction] = (0,
|
|
4108
|
-
(0,
|
|
4137
|
+
const [instruction, setInstruction] = (0, import_react18.useState)("");
|
|
4138
|
+
(0, import_react18.useEffect)(() => {
|
|
4109
4139
|
if (firstVisitRef.current) {
|
|
4110
4140
|
firstVisitRef.current = false;
|
|
4111
4141
|
return;
|
|
@@ -4194,7 +4224,7 @@ var Navigation = ({
|
|
|
4194
4224
|
var NavigationStandard_default = Navigation;
|
|
4195
4225
|
|
|
4196
4226
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4197
|
-
var
|
|
4227
|
+
var import_react19 = require("react");
|
|
4198
4228
|
|
|
4199
4229
|
// src/components/layout/SearchBarStandard/Icons.tsx
|
|
4200
4230
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -4218,7 +4248,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
|
|
|
4218
4248
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4219
4249
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4220
4250
|
var SearchBar = ({ activatedLanguage = "sv" }) => {
|
|
4221
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
4251
|
+
const [searchTerm, setSearchTerm] = (0, import_react19.useState)("");
|
|
4222
4252
|
const handleSearch = () => {
|
|
4223
4253
|
console.log("S\xF6kt efter:", searchTerm);
|
|
4224
4254
|
};
|
|
@@ -4272,8 +4302,8 @@ var NavigationHeader = ({
|
|
|
4272
4302
|
if (activatedLanguage === "sv") return "English";
|
|
4273
4303
|
else return "Svenska";
|
|
4274
4304
|
};
|
|
4275
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
4276
|
-
const menuButtonFocusRef = (0,
|
|
4305
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react20.useState)(false);
|
|
4306
|
+
const menuButtonFocusRef = (0, import_react20.useRef)(null);
|
|
4277
4307
|
const handleMenuClick = () => {
|
|
4278
4308
|
setIsMenuOpen((prev) => !prev);
|
|
4279
4309
|
};
|
|
@@ -4287,7 +4317,7 @@ var NavigationHeader = ({
|
|
|
4287
4317
|
const getMenuIcon = () => {
|
|
4288
4318
|
return isMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MenuIcon, {});
|
|
4289
4319
|
};
|
|
4290
|
-
const [isSearchOpen, setIsSearchOpen] = (0,
|
|
4320
|
+
const [isSearchOpen, setIsSearchOpen] = (0, import_react20.useState)(false);
|
|
4291
4321
|
const handleSearchClick = () => {
|
|
4292
4322
|
if (!isSearchOpen) {
|
|
4293
4323
|
setIsSearchOpen(true);
|
|
@@ -4502,14 +4532,14 @@ var LinkStandard = ({
|
|
|
4502
4532
|
var LinkStandard_default = LinkStandard;
|
|
4503
4533
|
|
|
4504
4534
|
// src/components/layout/LinkListStandard/LinkListStandard.tsx
|
|
4505
|
-
var
|
|
4535
|
+
var import_react21 = require("react");
|
|
4506
4536
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4507
4537
|
var LinkList = ({
|
|
4508
4538
|
linkArray,
|
|
4509
4539
|
activatedLanguage,
|
|
4510
4540
|
linkComponent: LinkComponent = "a"
|
|
4511
4541
|
}) => {
|
|
4512
|
-
const uniqueId = (0,
|
|
4542
|
+
const uniqueId = (0, import_react21.useId)();
|
|
4513
4543
|
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) => {
|
|
4514
4544
|
var _a, _b, _c;
|
|
4515
4545
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -4528,7 +4558,7 @@ var LinkList = ({
|
|
|
4528
4558
|
var LinkListStandard_default = LinkList;
|
|
4529
4559
|
|
|
4530
4560
|
// src/components/layout/CollapseStandard/CollapseStandard.tsx
|
|
4531
|
-
var
|
|
4561
|
+
var import_react22 = require("react");
|
|
4532
4562
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4533
4563
|
var Collapse = ({
|
|
4534
4564
|
title,
|
|
@@ -4538,8 +4568,8 @@ var Collapse = ({
|
|
|
4538
4568
|
activatedLanguage = "sv",
|
|
4539
4569
|
customClass = ""
|
|
4540
4570
|
}) => {
|
|
4541
|
-
const [isOpen, setIsOpen] = (0,
|
|
4542
|
-
const uniqueId = id != null ? id : (0,
|
|
4571
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(defaultOpen);
|
|
4572
|
+
const uniqueId = id != null ? id : (0, import_react22.useId)();
|
|
4543
4573
|
const contentId = `${uniqueId}-content`;
|
|
4544
4574
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
4545
4575
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj" : "Hide";
|
|
@@ -4653,14 +4683,14 @@ var StepperButtons = ({
|
|
|
4653
4683
|
var StepperButtonsStandard_default = StepperButtons;
|
|
4654
4684
|
|
|
4655
4685
|
// src/components/stepper/StepperStandard/StepperStandard.tsx
|
|
4656
|
-
var
|
|
4686
|
+
var import_react23 = __toESM(require("react"));
|
|
4657
4687
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4658
4688
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
4659
4689
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
4660
4690
|
const isActive = step.step === activeStep;
|
|
4661
4691
|
const lastElement = arraySteps.length;
|
|
4662
4692
|
const isDone = step.step < activeStep;
|
|
4663
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react23.default.Fragment, { children: [
|
|
4664
4694
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "pts-stepper-step", children: [
|
|
4665
4695
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4666
4696
|
"div",
|